From gerrit-no-reply at lists.osmocom.org Wed Mar 1 01:27:24 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Wed, 1 Mar 2017 01:27:24 +0000 Subject: libosmocore[master]: Add osmo_rand() function In-Reply-To: References: Message-ID: Patch Set 2: > I think it would be best to map this to the linux getrandom(2) > syscall by default. It is in mainline linux kernel since 2014, and > we should use it by default to avoid any external crypto library > dependency. If this syscall exists at compile time (we can check > with autoconf if the function getrandom() is defined in > linux/random.h), then we should use it. Not sure. There are subtle differences. OpenSSL/GNUTLS get random from the kernel to initialize their internal state (and only re-initialize at some point). If we always use getrandom we will take more bits from the kernel than before (e.g. blocking the app) -- To view, visit https://gerrit.osmocom.org/1526 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0241b814ea4c4ce1458f7ad76e31d390383c2048 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 01:31:56 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Wed, 1 Mar 2017 01:31:56 +0000 Subject: libosmocore[master]: Export comp128 v2 and v3 routines as well In-Reply-To: References: Message-ID: Patch Set 1: > What's wrong with the abstraction? Is there way we can make generic > API better? it is not about a better interface but if you do foreign function interface (FFI) calls, the runtime will have support to map strings/bytearrays to char* but if you need to fill a struct you have more work (and questions of alignment). So it is more nice to call the raw function. -- To view, visit https://gerrit.osmocom.org/1929 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0128d529c52ec030cfb87b0aff3c69cadf2c59d2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 02:49:54 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Wed, 1 Mar 2017 02:49:54 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: Isn't that a standard feature of the unit testing code Class.name? -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 09:03:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 09:03:00 +0000 Subject: [PATCH] libosmocore[master]: Fix client-side ctrl interface helpers In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1897 to look at the new patch set (#2). Fix client-side ctrl interface helpers * remove unused ctrl_interface_connect() which is not part of public API * add default read callback to osmo_ctrl_conn_alloc() Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4 Related: OS#1615 --- M src/ctrl/control_if.c 1 file changed, 1 insertion(+), 40 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/1897/2 diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index d78b513..de49d16 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -388,6 +388,7 @@ ccon->write_queue.bfd.data = data; ccon->write_queue.write_cb = control_write_cb; + ccon->write_queue.read_cb = handle_control_read; return ccon; } @@ -431,7 +432,6 @@ ccon->write_queue.bfd.fd = fd; ccon->write_queue.bfd.when = BSC_FD_READ; - ccon->write_queue.read_cb = handle_control_read; ret = osmo_fd_register(&ccon->write_queue.bfd); if (ret < 0) { @@ -653,45 +653,6 @@ static int verify_counter(struct ctrl_cmd *cmd, const char *value, void *data) { return 0; -} - -/*! \brief Setup CTRL interface connection to a given address - * \param[in] data Pointer which will be made available to each - set_..() get_..() verify_..() control command function - * \param[in] addr Address to which we shall connect - * \param[in] port Port to which we shall connect - * \param[in] lookup Lookup function pointer, can be NULL - * \returns ctrl_handle pointer or NULL in case of errors - */ -struct ctrl_handle *ctrl_interface_connect(void *data, const char *addr, - uint16_t port, - ctrl_cmd_lookup lookup) -{ - int ret; - struct ctrl_handle *ctrl; - - ctrl = talloc_zero(data, struct ctrl_handle); - if (!ctrl) - return NULL; - - INIT_LLIST_HEAD(&ctrl->ccon_list); - - ctrl->data = data; - ctrl->lookup = lookup; - - ctrl->listen_fd.cb = NULL; - ctrl->listen_fd.data = ctrl; - ret = osmo_sock_init_ofd(&ctrl->listen_fd, AF_INET, SOCK_STREAM, - IPPROTO_TCP, addr, port, OSMO_SOCK_F_CONNECT); - if (ret < 0) { - LOGP(DLCTRL, LOGL_ERROR, "Cannot connect to CTRL at %s:%u\n", - addr, port); - talloc_free(ctrl); - return NULL; - } - LOGP(DLCTRL, LOGL_NOTICE, "CTRL connected to %s:%u\n", addr, port); - - return ctrl; } struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port, -- To view, visit https://gerrit.osmocom.org/1897 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:10:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:10:58 +0000 Subject: [PATCH] osmo-hlr[master]: Add global HLR struct In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1856 to look at the new patch set (#4). Add global HLR struct Introduce g_hlr of type 'struct hlr' which holds pointers to all globally accessible variables. Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Related: OS#1645 --- M src/db_test.c M src/hlr.c M src/hlr.h 3 files changed, 37 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/56/1856/4 diff --git a/src/db_test.c b/src/db_test.c index 75fcb62..998a37a 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -4,12 +4,13 @@ #include #include "db.h" +#include "hlr.h" #include "rand.h" #include "logging.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; -static int test(const char *imsi) +static int test(const char *imsi, struct db_context *dbc) { struct osmo_auth_vector vec[3]; int rc, i; @@ -19,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(g_dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; @@ -46,6 +47,8 @@ { int rc; + g_hlr = talloc_zero(NULL, struct hlr); + rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { fprintf(stderr, "Error initializing logging\n"); @@ -59,24 +62,24 @@ exit(1); } - g_dbc = db_open(NULL, "hlr.db"); - if (!g_dbc) { + g_hlr->dbc = db_open(NULL, "hlr.db"); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_ERROR, "Error opening database\n"); exit(1); } /* non-existing subscriber */ - rc = test("901990123456789"); + rc = test("901990123456789", g_hlr->dbc); /* 2G only AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000001"); + rc = test("901990000000001", g_hlr->dbc); /* 2G + 3G AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000002"); + rc = test("901990000000002", g_hlr->dbc); /* 3G AUC data (MILENAGE) */ - rc = test("901990000000003"); + rc = test("901990000000003", g_hlr->dbc); LOGP(DMAIN, LOGL_NOTICE, "Exiting\n"); - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.c b/src/hlr.c index 5c59b88..2bc3125 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -42,7 +42,7 @@ #include "luop.h" #include "hlr_vty.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; /*********************************************************************** * Send Auth Info handling @@ -50,7 +50,8 @@ /* process an incoming SAI request */ static int rx_send_auth_info(struct osmo_gsup_conn *conn, - const struct osmo_gsup_message *gsup) + const struct osmo_gsup_message *gsup, + struct db_context *dbc) { struct osmo_gsup_message gsup_out; struct msgb *msg_out; @@ -60,7 +61,7 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(g_dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { @@ -158,7 +159,7 @@ /* Roughly follwing "Process Update_Location_HLR" of TS 09.02 */ /* check if subscriber is known at all */ - if (!lu_op_fill_subscr(luop, g_dbc, gsup->imsi)) { + if (!lu_op_fill_subscr(luop, g_hlr->dbc, gsup->imsi)) { /* Send Error back: Subscriber Unknown in HLR */ strcpy(luop->subscr.imsi, gsup->imsi); lu_op_tx_error(luop, GMM_CAUSE_IMSI_UNKNOWN); @@ -217,7 +218,7 @@ * we have on record. Only update if yes */ /* Perform the actual update of the DB */ - rc = db_subscr_purge(g_dbc, gsup->imsi, is_ps); + rc = db_subscr_purge(g_hlr->dbc, gsup->imsi, is_ps); if (rc == 1) gsup_reply.message_type = OSMO_GSUP_MSGT_PURGE_MS_RESULT; @@ -248,7 +249,7 @@ switch (gsup.message_type) { /* requests sent to us */ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST: - rx_send_auth_info(conn, &gsup); + rx_send_auth_info(conn, &gsup, g_hlr->dbc); break; case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST: rx_upd_loc_req(conn, &gsup); @@ -363,15 +364,14 @@ } static void *hlr_ctx = NULL; -static struct osmo_gsup_server *gs; static void signal_hdlr(int signal) { switch (signal) { case SIGINT: LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n"); - osmo_gsup_server_destroy(gs); - db_close(g_dbc); + osmo_gsup_server_destroy(g_hlr->gs); + db_close(g_hlr->dbc); log_fini(); talloc_report_full(hlr_ctx, stderr); exit(0); @@ -397,6 +397,7 @@ hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); + g_hlr = talloc_zero(hlr_ctx, struct hlr); c_opts = talloc_zero(hlr_ctx, struct cmdline_opts); c_opts->config_file = "osmo-hlr.cfg"; @@ -434,14 +435,14 @@ exit(1); } - g_dbc = db_open(hlr_ctx, c_opts->db_file); - if (!g_dbc) { + g_hlr->dbc = db_open(hlr_ctx, c_opts->db_file); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_FATAL, "Error opening database\n"); exit(1); } - gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); - if (!gs) { + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); } @@ -462,7 +463,7 @@ osmo_select_main(0); } - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.h b/src/hlr.h index 23e7188..6d7a436 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -1,6 +1,7 @@ /* OsmoHLR generic header */ /* (C) 2016 by Harald Welte + * (C) 2017 sysmocom s.f.m.c. GmbH * All Rights Reserved * * Author: Max Suraev @@ -29,3 +30,11 @@ const char *db_file; bool daemonize; }; + +struct hlr { + /* GSUP server pointer */ + struct osmo_gsup_server *gs; + + /* DB context */ + struct db_context *dbc; +}; -- To view, visit https://gerrit.osmocom.org/1856 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Gerrit-PatchSet: 4 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:10:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:10:58 +0000 Subject: [PATCH] osmo-hlr[master]: CTRL: add enable/disable packet service cmds In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1841 to look at the new patch set (#10). CTRL: add enable/disable packet service cmds Add commands to enable/disable Packet Service for a given IMSI. Changes are synced to DB and propagated at runtime to SGSN (in case of disable command). Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Related: OS#1645 --- M src/ctrl.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M src/luop.c M src/luop.h 6 files changed, 78 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/41/1841/10 diff --git a/src/ctrl.c b/src/ctrl.c index a167171..ec1a85d 100644 --- a/src/ctrl.c +++ b/src/ctrl.c @@ -33,6 +33,46 @@ #include "luop.h" #include "ctrl.h" +static int handle_cmd_ps(struct hlr *ctx, struct ctrl_cmd *cmd, bool enable) +{ + struct lu_operation *luop = NULL; + struct osmo_gsup_conn *co; + + if (db_subscr_get(ctx->dbc, cmd->value, NULL) < 0) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + if (db_subscr_ps(ctx->dbc, cmd->value, enable) < 0) { + cmd->reply = "Error updating DB"; + return CTRL_CMD_ERROR; + } + + if (!enable){ /* FIXME: only send to single SGSN where latest update for IMSI came from */ + llist_for_each_entry(co, &ctx->gs->clients, list) { + luop = lu_op_alloc_conn(co); + lu_op_fill_subscr(luop, ctx->dbc, cmd->value); + lu_op_tx_del_subscr_data(luop); + } + } + + cmd->reply = "OK"; + + return CTRL_CMD_REPLY; +} + +CTRL_CMD_DEFINE_WO_NOVRF(enable_ps, "enable-ps"); +static int set_enable_ps(struct ctrl_cmd *cmd, void *data) +{ + return handle_cmd_ps(data, cmd, true); +} + +CTRL_CMD_DEFINE_WO_NOVRF(disable_ps, "disable-ps"); +static int set_disable_ps(struct ctrl_cmd *cmd, void *data) +{ + return handle_cmd_ps(data, cmd, false); +} + CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); static int set_status_ps(struct ctrl_cmd *cmd, void *data) { @@ -57,6 +97,8 @@ { int rc = 0; + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_enable_ps); + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_disable_ps); rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index ea51f7d..d431637 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -245,9 +245,9 @@ } struct osmo_gsup_server * -osmo_gsup_server_create(void *ctx, const char *ip_addr, - uint16_t tcp_port, - osmo_gsup_read_cb_t read_cb) +osmo_gsup_server_create(void *ctx, const char *ip_addr, uint16_t tcp_port, + osmo_gsup_read_cb_t read_cb, + struct llist_head *lu_op_lst) { struct osmo_gsup_server *gsups; int rc; @@ -272,6 +272,8 @@ if (rc < 0) goto failed; + gsups->luop = lu_op_lst; + return gsups; failed: diff --git a/src/gsup_server.h b/src/gsup_server.h index 484a0d7..885fe52 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -14,6 +14,9 @@ /* list of osmo_gsup_conn */ struct llist_head clients; + /* lu_operations list */ + struct llist_head *luop; + struct ipa_server_link *link; osmo_gsup_read_cb_t read_cb; struct llist_head routes; @@ -36,9 +39,10 @@ uint8_t tag); struct osmo_gsup_server *osmo_gsup_server_create(void *ctx, - const char *ip_addr, - uint16_t tcp_port, - osmo_gsup_read_cb_t read_cb); + const char *ip_addr, + uint16_t tcp_port, + osmo_gsup_read_cb_t read_cb, + struct llist_head *lu_op_lst); void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups); diff --git a/src/hlr.c b/src/hlr.c index 216f2a5..3a15042 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -259,6 +259,14 @@ rx_purge_ms_req(conn, &gsup); break; /* responses to requests sent by us */ + case OSMO_GSUP_MSGT_DELETE_DATA_ERROR: + LOGP(DMAIN, LOGL_ERROR, "Error while deleting subscriber data " + "for IMSI %s\n", gsup.imsi); + break; + case OSMO_GSUP_MSGT_DELETE_DATA_RESULT: + LOGP(DMAIN, LOGL_ERROR, "Deleting subscriber data for IMSI %s\n", + gsup.imsi); + break; case OSMO_GSUP_MSGT_INSERT_DATA_ERROR: case OSMO_GSUP_MSGT_INSERT_DATA_RESULT: case OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR: @@ -448,7 +456,8 @@ exit(1); } - g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb, + &g_lu_ops); if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); diff --git a/src/luop.c b/src/luop.c index ecf31b4..937c02c 100644 --- a/src/luop.c +++ b/src/luop.c @@ -266,3 +266,16 @@ lu_op_statechg(luop, LU_S_ISD_SENT); osmo_timer_schedule(&luop->timer, ISD_TIMEOUT_SECS, 0); } + +/*! Transmit Delete Subscriber Data to new VLR/SGSN */ +void lu_op_tx_del_subscr_data(struct lu_operation *luop) +{ + struct osmo_gsup_message gsup; + + fill_gsup_msg(&gsup, luop, OSMO_GSUP_MSGT_DELETE_DATA_REQUEST); + + gsup.cn_domain = OSMO_GSUP_CN_DOMAIN_PS; + + /* Send ISD to new VLR/SGSN */ + _luop_tx_gsup(luop, &gsup); +} diff --git a/src/luop.h b/src/luop.h index 7e2fbb0..ab1bc24 100644 --- a/src/luop.h +++ b/src/luop.h @@ -78,3 +78,4 @@ void lu_op_tx_ack(struct lu_operation *luop); void lu_op_tx_cancel_old(struct lu_operation *luop); void lu_op_tx_insert_subscr_data(struct lu_operation *luop); +void lu_op_tx_del_subscr_data(struct lu_operation *luop); -- To view, visit https://gerrit.osmocom.org/1841 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Gerrit-PatchSet: 10 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:10:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:10:58 +0000 Subject: [PATCH] osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1827 to look at the new patch set (#12). Add CTRL interface Add command to query Packet Services (GPRS etc.) for particular IMSI. Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Related: OS#1645 --- M configure.ac M src/Makefile.am A src/ctrl.c A src/ctrl.h M src/hlr.c M src/hlr.h 6 files changed, 135 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/27/1827/12 diff --git a/configure.ac b/configure.ac index bfda9c5..a04185f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) PKG_CHECK_MODULES(SQLITE3, sqlite3) diff --git a/src/Makefile.am b/src/Makefile.am index 6e7fcdc..9ba3217 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(NULL) @@ -20,6 +21,7 @@ gsup_server.h \ logging.h \ rand.h \ + ctrl.h \ hlr_vty.h \ $(NULL) @@ -33,6 +35,7 @@ osmo_hlr_SOURCES = \ auc.c \ + ctrl.c \ db.c \ luop.c \ db_auc.c \ @@ -49,6 +52,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(SQLITE3_LIBS) \ $(NULL) diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..a167171 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,81 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#include + +#include +#include +#include + +#include "gsup_server.h" +#include "logging.h" +#include "db.h" +#include "hlr.h" +#include "luop.h" +#include "ctrl.h" + +CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); +static int set_status_ps(struct ctrl_cmd *cmd, void *data) +{ + struct hlr *ctx = data; + struct lu_operation *luop = lu_op_alloc(ctx->gs); + if (!luop) { + cmd->reply = "Internal HLR error"; + return CTRL_CMD_ERROR; + } + + if (!lu_op_fill_subscr(luop, ctx->dbc, cmd->value)) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + cmd->reply = luop->subscr.nam_ps ? "1" : "0"; + + return CTRL_CMD_REPLY; +} + +int hlr_ctrl_cmds_install() +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); + + return rc; +} + +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs) +{ + int rc; + struct ctrl_handle *hdl = ctrl_interface_setup_dynip(ctx, + ctx->ctrl_bind_addr, + OSMO_CTRL_PORT_HLR, + NULL); + if (!hdl) + return NULL; + + rc = hlr_ctrl_cmds_install(); + if (rc) /* FIXME: close control interface? */ + return NULL; + + return hdl; +} diff --git a/src/ctrl.h b/src/ctrl.h new file mode 100644 index 0000000..663de30 --- /dev/null +++ b/src/ctrl.h @@ -0,0 +1,31 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +#include "gsup_server.h" + +int hlr_ctrl_cmds_install(); +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs); diff --git a/src/hlr.c b/src/hlr.c index 2bc3125..216f2a5 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -35,6 +35,7 @@ #include "hlr.h" #include "db.h" +#include "ctrl.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -299,6 +300,8 @@ printf(" -s --disable-color Do not print ANSI colors in the log\n"); printf(" -T --timestamp Prefix every log line with a timestamp.\n"); printf(" -e --log-level number Set a global loglevel.\n"); + printf(" -R --ctrl address Set address to which Control " + "Interface should be bound, defaults to 127.0.0.1.\n"); printf(" -V --version Print the version of OsmoHLR.\n"); } @@ -314,12 +317,13 @@ {"daemonize", 0, 0, 'D'}, {"disable-color", 0, 0, 's'}, {"log-level", 1, 0, 'e'}, + {"ctrl", 1, 0, 'R'}, {"timestamp", 0, 0, 'T'}, {"version", 0, 0, 'V' }, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "hc:l:d:Dse:TV", + c = getopt_long(argc, argv, "hc:l:d:Dse:R:TV", long_options, &option_index); if (c == -1) break; @@ -334,6 +338,9 @@ break; case 'l': cfg->db_file = optarg; + break; + case 'R': + g_hlr->ctrl_bind_addr = optarg; break; case 'd': log_parse_category_mask(osmo_stderr_target, optarg); @@ -447,6 +454,12 @@ exit(1); } + if (g_hlr->ctrl_bind_addr) + g_hlr->ctrl = hlr_controlif_setup(g_hlr, g_hlr->gs); + else + LOGP(DLGSUP, LOGL_NOTICE, "Control Interface is NOT created: " + "bind address missing\n"); + osmo_init_ignore_signals(); signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); diff --git a/src/hlr.h b/src/hlr.h index 6d7a436..5ce3f63 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -37,4 +37,8 @@ /* DB context */ struct db_context *dbc; + + /* Control Interface */ + struct ctrl_handle *ctrl; + const char *ctrl_bind_addr; }; -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 12 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:10:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:10:58 +0000 Subject: [PATCH] osmo-hlr[master]: Get rid of global config options struct In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1899 to look at the new patch set (#2). Get rid of global config options struct Make it obvious that the command-line options are only used within main() by removing global static struct and explicitly passing passing it to handle_options() instead. Move struct definition to separate file which'll be further expanded with global struct in follow-up commits. Change-Id: I83f0a352327e6ea659b789c37deacf2f86eb3dde --- M src/Makefile.am M src/hlr.c A src/hlr.h 3 files changed, 48 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/99/1899/2 diff --git a/src/Makefile.am b/src/Makefile.am index 56a5670..6e7fcdc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,6 +13,7 @@ noinst_HEADERS = \ auc.h \ + hlr.h \ db.h \ luop.h \ gsup_router.h \ diff --git a/src/hlr.c b/src/hlr.c index d74d9fb..5c59b88 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -33,6 +33,7 @@ #include #include +#include "hlr.h" #include "db.h" #include "logging.h" #include "gsup_server.h" @@ -300,17 +301,7 @@ printf(" -V --version Print the version of OsmoHLR.\n"); } -static struct { - const char *config_file; - const char *db_file; - bool daemonize; -} cmdline_opts = { - .config_file = "osmo-hlr.cfg", - .db_file = "hlr.db", - .daemonize = false, -}; - -static void handle_options(int argc, char **argv) +static void handle_options(struct cmdline_opts *cfg, int argc, char **argv) { while (1) { int option_index = 0, c; @@ -338,16 +329,16 @@ print_help(); exit(0); case 'c': - cmdline_opts.config_file = optarg; + cfg->config_file = optarg; break; case 'l': - cmdline_opts.db_file = optarg; + cfg->db_file = optarg; break; case 'd': log_parse_category_mask(osmo_stderr_target, optarg); break; case 'D': - cmdline_opts.daemonize = 1; + cfg->daemonize = true; break; case 's': log_set_use_color(osmo_stderr_target, 0); @@ -401,9 +392,15 @@ int main(int argc, char **argv) { int rc; + struct cmdline_opts *c_opts; hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); + + c_opts = talloc_zero(hlr_ctx, struct cmdline_opts); + + c_opts->config_file = "osmo-hlr.cfg"; + c_opts->db_file = "hlr.db"; rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { @@ -412,14 +409,14 @@ } vty_init(&vty_info); - handle_options(argc, argv); + handle_options(c_opts, argc, argv); hlr_vty_init(&hlr_log_info); - rc = vty_read_config_file(cmdline_opts.config_file, NULL); + rc = vty_read_config_file(c_opts->config_file, NULL); if (rc < 0) { LOGP(DMAIN, LOGL_FATAL, "Failed to parse the config file: '%s'\n", - cmdline_opts.config_file); + c_opts->config_file); return rc; } @@ -437,7 +434,7 @@ exit(1); } - g_dbc = db_open(hlr_ctx, cmdline_opts.db_file); + g_dbc = db_open(hlr_ctx, c_opts->db_file); if (!g_dbc) { LOGP(DMAIN, LOGL_FATAL, "Error opening database\n"); exit(1); @@ -453,7 +450,7 @@ signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); - if (cmdline_opts.daemonize) { + if (c_opts->daemonize) { rc = osmo_daemonize(); if (rc < 0) { perror("Error during daemonize"); diff --git a/src/hlr.h b/src/hlr.h new file mode 100644 index 0000000..23e7188 --- /dev/null +++ b/src/hlr.h @@ -0,0 +1,31 @@ +/* OsmoHLR generic header */ + +/* (C) 2016 by Harald Welte + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +struct cmdline_opts { + const char *config_file; + const char *db_file; + bool daemonize; +}; -- To view, visit https://gerrit.osmocom.org/1899 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I83f0a352327e6ea659b789c37deacf2f86eb3dde Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:10:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:10:58 +0000 Subject: [PATCH] osmo-hlr[master]: Make subscr parameter to db_subscr_get() optional In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1853 to look at the new patch set (#7). Make subscr parameter to db_subscr_get() optional This allows to check for subscriber's presence in DB without the need to bother with unused structure allocation. While at it also call to db_remove_reset() and return explicitly instead of using goto to make it a bit easier to follow the code. Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e --- M src/db_hlr.c 1 file changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/53/1853/7 diff --git a/src/db_hlr.c b/src/db_hlr.c index 2c6b243..340e7ce 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -41,7 +41,7 @@ struct hlr_subscriber *subscr) { sqlite3_stmt *stmt = dbc->stmt[SEL_BY_IMSI]; - int rc, ret = 0; + int rc; if (!db_bind_imsi(stmt, imsi)) return -EINVAL; @@ -50,8 +50,13 @@ rc = sqlite3_step(stmt); if (rc != SQLITE_ROW) { LOGHLR(imsi, LOGL_ERROR, "Error executing SQL: %d\n", rc); - ret = -ENOEXEC; - goto out; + db_remove_reset(stmt); + return -ENOEXEC; + } + + if (!subscr) { + db_remove_reset(stmt); + return 0; } /* obtain the various columns */ @@ -70,10 +75,9 @@ subscr->ms_purged_cs = sqlite3_column_int(stmt, 11); subscr->ms_purged_ps = sqlite3_column_int(stmt, 12); -out: db_remove_reset(stmt); - return ret; + return 0; } int db_subscr_ps(struct db_context *dbc, const char *imsi, bool enable) -- To view, visit https://gerrit.osmocom.org/1853 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e Gerrit-PatchSet: 7 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:34:39 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:34:39 +0000 Subject: [PATCH] openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1875 to look at the new patch set (#5). Add simple CTRL2SOAP proxy Add python client which converts TRAP messages into SOAP requests and perform corresponding actions. It can be used as follows ./soap.py -d -w http://example.com/soapservice/htdocs/wsdl/test.wsdl See ./soap.py -h for additional options. Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Related: SYS#3028 --- A openbsc/contrib/soap.py 1 file changed, 172 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/75/1875/5 diff --git a/openbsc/contrib/soap.py b/openbsc/contrib/soap.py new file mode 100755 index 0000000..e9107a7 --- /dev/null +++ b/openbsc/contrib/soap.py @@ -0,0 +1,172 @@ +#!/usr/bin/python3 +# -*- mode: python-mode; py-indent-tabs-mode: nil -*- +""" +/* + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +""" + +from twisted.internet import reactor +from twisted_ipa import CTRL, IPAFactory +from ipa import Ctrl +from treq import post, collect +from suds.client import Client +from functools import partial +import argparse, datetime, signal, sys, os + + +version = "v0.4" # bump this on every non-trivial change + +# keys from OpenBSC openbsc/src/libbsc/bsc_rf_ctrl.c, values SOAP-specific +oper = { 'inoperational' : 0, 'operational' : 1 } +admin = { 'locked' : 0, 'unlocked' : 1 } +policy = { 'off' : 0, 'on' : 1, 'grace' : 2, 'unknown' : 3 } + +# keys from OpenBSC openbsc/src/libbsc/bsc_vty.c +fix = { 'invalid' : 0, 'fix2d' : 1, 'fix3d' : 1 } # SOAP server treats it as boolean but expects int + + +class Trap(CTRL): + """ + TRAP handler (agnostic to factory's client object) + """ + def ctrl_TRAP(self, data, op_id, v): + """ + Parse CTRL TRAP and dispatch to appropriate handler after normalization + """ + (l, r) = v.split() + loc = l.split('.') + t_type = loc[-1] + p = partial(lambda a, i: a[i] if len(a) > i else None, loc) # parse helper + method = getattr(self, 'handle_' + t_type.replace('-', ''), lambda: "Unhandled %s trap" % t_type) + method(p(1), p(3), p(5), p(7), r) # we expect net.0.bsc.666.bts.2.trx.1 format for trap prefix + + def ctrl_SET_REPLY(self, data, _, v): + """ + Debug log for replies to our commands + """ + if self.factory.debug: + print('SET REPLY %s' % v) + + def ctrl_ERROR(self, data, op_id, v): + """ + We want to know if smth went wrong + """ + if self.factory.debug: + print('CTRL ERROR [%s] %s' % (op_id, v)) + + def dbg(*_): + """ + Turn off debug print from lower layers as it's too verbose + """ + pass + + def connectionMade(self): + """ + Logging wrapper, calling super() is necessary not to break reconnection logic + """ + print("Connected to CTRL@%s:%d" % (self.factory.host, self.factory.port)) + super(CTRL, self).connectionMade() + + def handle_locationstate(self, net, bsc, bts, trx, data): + """ + Handle location-state TRAP: parse trap content, build SOAP context and use treq's routines to post it while setting up async handlers + """ + def cback(c, r): + """ + Callback function: takes c (SOAP client's RequestContext) and server's reply, sends set of parsed ctrl commands (in a 'fire and forget' way) + """ + repl = c.process_reply(r) + bsc_id = repl.commands[0].split()[0].split('.')[3] # we expect 1st command to have net.0.bsc.666.bts.2.trx.1 location prefix format + print("Received SOAP response for BSC %s, error status: %s" % (bsc_id, repl.error)) + if self.factory.debug: + print("BSC %s commands: %s" % (bsc_id, repl.commands)) + for t in repl.commands: # Process OpenBscCommands format from .wsdl + (_, m) = Ctrl().cmd(*t.split()) + self.transport.write(m) + (ts, fx, lat, lon, height, opr, adm, pol, mcc, mnc) = data.split(',') + tstamp = datetime.datetime.fromtimestamp(float(ts)).isoformat() + if self.factory.debug: + print('location-state@%s.%s.%s.%s (%s) [%s/%s] => %s' % (net, bsc, bts, trx, tstamp, mcc, mnc, data)) + ctx = self.factory.client.registerSiteLocation(bsc, float(lon), float(lat), fix.get(fx, 0), tstamp, oper.get(opr, 2), admin.get(adm, 2), policy.get(pol, 3)) + post(self.factory.location, ctx.envelope).addCallback(collect, partial(cback, ctx)) # treq's collect helper is handy to get all reply content at once using closure on ctx + + def handle_notificationrejectionv1(self, net, bsc, bts, trx, data): + """ + Handle notification-rejection-v1 TRAP: just an example to show how more message types can be handled + """ + if self.factory.debug: + print('notification-rejection-v1 at bsc-id %s => %s' % (bsc, data)) + + +class TrapFactory(IPAFactory): + """ + Store SOAP client object so TRAP handler can use it for requests + """ + location = None + client = None + host = None + port = None + debug = None + def __init__(self, host, port, proto=None, debug=False, wsdl=None, location=None): + self.host = host # for logging only, + self.port = port # seems to be no way to get it from ReconnectingClientFactory + self.debug = debug + soap = Client(wsdl, location=location, nosend=True) # make async SOAP client + self.location = location.encode() if location else soap.wsdl.services[0].ports[0].location # necessary for dispatching HTTP POST via treq + self.client = soap.service + if debug: + print("Using IPA %s, SUDS client: %s" % (Ctrl.version, soap)) + super(TrapFactory, self).__init__(proto, debug) + + +def reloader(path, script, dbg, signum, _): + """ + Signal handler: we have to use execl() because twisted's reactor is not restartable due to some bug in twisted implementation + """ + print("Received Signal %s - restarting..." % signal.Signals(signum).name) + if signum == signal.SIGUSR1 and dbg not in sys.argv: + sys.argv.append(dbg) # enforce debug + if signum == signal.SIGUSR2 and dbg in sys.argv: + sys.argv.remove(dbg) # disable debug + os.execl(path, script, *sys.argv[1:]) + + +if __name__ == '__main__': + p = argparse.ArgumentParser() + p.add_argument('-v', '--version', action='version', version=("%(prog)s " + version)) + p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface, defaults to 4250") + p.add_argument('-c', '--ctrl', default='localhost', help="Adress to use for CTRL interface, defaults to localhost") + p.add_argument('-w', '--wsdl', required=True, help="WSDL URL for SOAP") + p.add_argument('-s', '--size', type=int, default=5, help="Size of thread pool") + p.add_argument('-d', '--debug', action='store_true', help="Enable debug log") + p.add_argument('-l', '--location', help="Override location found in WSDL file (don't use unless you know what you're doing)") + args = p.parse_args() + fl = os.path.basename(__file__) + + reboot = partial(reloader, os.getcwd() + '/' + fl, fl, '-d') + signal.signal(signal.SIGHUP, reboot) + signal.signal(signal.SIGQUIT, reboot) + signal.signal(signal.SIGUSR1, reboot) # restart and enabled debug output + signal.signal(signal.SIGUSR2, reboot) # restart and disable debug output + + print("SOAP proxy %s starting with PID %d ..." % (version, os.getpid())) + reactor.suggestThreadPoolSize(args.size) + reactor.connectTCP(args.ctrl, args.port, TrapFactory(args.ctrl, args.port, Trap, args.debug, args.wsdl, args.location)) + reactor.run() -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 1 10:43:20 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 10:43:20 +0000 Subject: openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Patch Set 5: Verified-1 Will wait for ok from customer's testing. -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 11:48:10 2017 From: gerrit-no-reply at lists.osmocom.org (Keith Whyte) Date: Wed, 1 Mar 2017 11:48:10 +0000 Subject: [MERGED] openbsc[master]: meas_json: fix NEIGH: missing array braces In-Reply-To: References: Message-ID: Keith Whyte has submitted this change and it was merged. Change subject: meas_json: fix NEIGH: missing array braces ...................................................................... meas_json: fix NEIGH: missing array braces Make NEIGH an array of Javascript objects, otherwise the JSON is not parseable when neighbours exist Change-Id: I42029f40bf357adbb2f3c71cdcbafbc21090e348 --- M openbsc/src/utils/meas_json.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/utils/meas_json.c b/openbsc/src/utils/meas_json.c index 93203bc..51eb6c7 100644 --- a/openbsc/src/utils/meas_json.c +++ b/openbsc/src/utils/meas_json.c @@ -89,7 +89,7 @@ for (i = 0; i < mr->num_cell; i++) { struct gsm_meas_rep_cell *mrc = &mr->cell[i]; if (i!=0) printf(", "); - printf("\"IDX\":%u, \"ARFCN\":%u, \"BSIC\":%u, \"POWER\":%d", + printf("{\"IDX\":%u, \"ARFCN\":%u, \"BSIC\":%u, \"POWER\":%d}", mrc->neigh_idx, mrc->arfcn, mrc->bsic, rxlev2dbm(mrc->rxlev)); } printf("]"); @@ -151,6 +151,7 @@ default: break; } + return 0; } static int udp_fd_cb(struct osmo_fd *ofd, unsigned int what) -- To view, visit https://gerrit.osmocom.org/1916 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I42029f40bf357adbb2f3c71cdcbafbc21090e348 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Keith Whyte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Keith Whyte Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:03:13 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:03:13 +0000 Subject: osmo-hlr[master]: Get rid of global config options struct In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 my firm opinion is to keep it exactly the way it was before this patch: keep the cmdline options struct static (non-global) and close to the main() just above the parse_options() (, and separate from the hlr struct). It's a bit bikeshed, so I wasn't pressing this strongly. Anyway, I think this is the wrong direction. -- To view, visit https://gerrit.osmocom.org/1899 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83f0a352327e6ea659b789c37deacf2f86eb3dde Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:14:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:14:07 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: couldn't find "Class.name" in the python unittest doc, do you have a specific pointer? There seems to be a test name selection with the unittest.main(), but we're not using main(). What we do is suite = unittest.TestSuite() suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMGCP)) suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB)) add_bsc_test(suite, workdir) add_nat_test(suite, workdir) add_gbproxy_test(suite, workdir) add_sgsn_test(suite, workdir) res = unittest.TextTestRunner(verbosity=verbose_level, stream=sys.stdout).run(suite) and after we have this suite there is no way to tell run() to just go for one of those. My quickest way to get to run only testBSCreload was to ipython on it to find the private members and drop those names I don't want from the suite object. It's not very nice, but it works, and saves me effort to grind that bloaty API. -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:17:25 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:17:25 +0000 Subject: [PATCH] libosmocore[master]: fsm: convenience: add inline osmo_fsm_inst_state_name() In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1937 to look at the new patch set (#2). fsm: convenience: add inline osmo_fsm_inst_state_name() Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b --- M include/osmocom/core/fsm.h 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/37/1937/2 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 952f82f..3a1f233 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -152,6 +152,10 @@ const char *osmo_fsm_inst_name(struct osmo_fsm_inst *fi); const char *osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state); +/*! \brief return the name of the state the FSM instance is currently in. */ +static inline const char *osmo_fsm_inst_state_name(struct osmo_fsm_inst *fi) +{ return osmo_fsm_state_name(fi->fsm, fi->state); } + /*! \brief perform a state change of the given FSM instance * * This is a macro that calls _osmo_fsm_inst_state_chg() with the given -- To view, visit https://gerrit.osmocom.org/1937 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:21:16 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:21:16 +0000 Subject: [MERGED] osmo-hlr[master]: cosmetic: refactor auc_compute_vectors(), add debug log In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: refactor auc_compute_vectors(), add debug log ...................................................................... cosmetic: refactor auc_compute_vectors(), add debug log Make the generation logic easier to understand (hopefully). Massively extend debug logging, which serves to illustrate the current AUTS failure shown by auc_3g_test. Since DAUC now logs the vectors, there is no need to print the vectors in VEC_IS() in auc_3g_test and auc_ts_55_205_test_sets anymore. Adjust testlog expectations accordingly. Change-Id: Ifb36d010a4ac64c765517e15b9074424ec19cc60 --- M src/auc.c M tests/auc/auc_3g_test.c M tests/auc/auc_3g_test.err M tests/auc/auc_ts_55_205_test_sets.err M tests/auc/gen_ts_55_205_test_sets/main_template.c 5 files changed, 522 insertions(+), 393 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/auc.c b/src/auc.c index a307931..f4d19a0 100644 --- a/src/auc.c +++ b/src/auc.c @@ -18,12 +18,16 @@ */ #include +#include #include #include #include "logging.h" #include "rand.h" + +#define hexb(buf) osmo_hexdump_nospc((void*)buf, sizeof(buf)) +#define hex(buf,sz) osmo_hexdump_nospc((void*)buf, sz) /* compute given number of vectors using either aud2g or aud2g or a combination * of both. Handles re-synchronization if rand_auts and auts are set */ @@ -34,7 +38,16 @@ { unsigned int i; uint8_t rand[16]; + struct osmo_auth_vector vtmp; int rc; + + /* no need to iterate the log categories all the time */ + int dbg = log_check_level(DAUC, LOGL_DEBUG); +#define DBGP(args ...) if (dbg) DEBUGP(DAUC, ##args) +#define DBGVB(member) DBGP("vector [%u]: " #member " = %s\n", \ + i, hexb(vec[i].member)) +#define DBGVV(fmt, member) DBGP("vector [%u]: " #member " = " fmt "\n", \ + i, vec[i].member) if (aud2g && (aud2g->algo == OSMO_AUTH_ALG_NONE || aud2g->type == OSMO_AUTH_TYPE_NONE)) @@ -73,59 +86,100 @@ return -1; } - /* compute quintuples */ + DBGP("Computing %d auth vector%s: %s%s\n", + num_vec, num_vec == 1 ? "" : "s", + aud3g? (aud2g? "3G + separate 2G" + : "3G only (2G derived from 3G keys)") + : "2G only", + auts? ", with AUTS resync" : ""); + if (aud3g) { + DBGP("3G: k = %s\n", hexb(aud3g->u.umts.k)); + DBGP("3G: %s = %s\n", + aud3g->u.umts.opc_is_op? "OP" : "opc", + hexb(aud3g->u.umts.opc)); + } + if (aud2g) + DBGP("2G: ki = %s\n", hexb(aud2g->u.gsm.ki)); + for (i = 0; i < num_vec; i++) { rc = rand_get(rand, sizeof(rand)); - DEBUGP(DAUC, "rand %s\n", osmo_hexdump_nospc(rand, sizeof(rand))); if (rc != sizeof(rand)) { LOGP(DAUC, LOGL_ERROR, "Unable to read %zu random " "bytes: rc=%d\n", sizeof(rand), rc); goto out; } + DBGP("vector [%u]: rand = %s\n", i, hexb(rand)); - if (aud2g && !aud3g) { - /* 2G only case: output directly to vec */ - DEBUGP(DAUC, "compute vector [%u]/%u: 2G only\n", - i, num_vec); - rc = osmo_auth_gen_vec(vec+i, aud2g, rand); - if (rc < 0) { - LOGP(DAUC, LOGL_ERROR, "Error in 2G vector " - "generation: %d\n", rc); - goto out; - } - } else if (aud3g) { + if (aud3g) { /* 3G or 3G + 2G case */ - if (!aud2g) - DEBUGP(DAUC, "compute vector [%u]/%u: 3G only\n", - i, num_vec); - if (rand_auts && auts) - rc = osmo_auth_gen_vec_auts(vec+i, aud3g, - auts, rand_auts, - rand); - else + + if (auts) { + DBGP("vector [%u]: resync: auts = %s\n", + i, hex(auts, 14)); + DBGP("vector [%u]: resync: rand_auts = %s\n", + i, hex(rand_auts, 16)); + + rc = osmo_auth_gen_vec_auts(vec+i, aud3g, auts, + rand_auts, rand); + /* The sqn used for the key is sqn - 1 because + * vector generation has already inc'd it. The + * USIM's sqn sent in AUTS is sqn - 2. */ + DBGP("vector [%u]: resync: sqn = %"PRIu64 "\n", + i, aud3g->u.umts.sqn - 1); + } else { + DBGP("vector [%u]: sqn = %" PRIu64 "\n", + i, aud3g->u.umts.sqn); rc = osmo_auth_gen_vec(vec+i, aud3g, rand); + } if (rc < 0) { LOGP(DAUC, LOGL_ERROR, "Error in 3G vector " - "generation: %d\n", rc); + "generation: [%u]: rc = %d\n", i, rc); goto out; } - } - if (aud2g && aud3g) { - /* separate 2G + 3G case: patch 2G into 3G */ - struct osmo_auth_vector vtmp; - DEBUGP(DAUC, "compute vector [%u]/%u:" - " separate 2G + 3G\n", i, num_vec); + + DBGVB(autn); + DBGVB(ck); + DBGVB(ik); + DBGVB(res); + DBGVV("%u", res_len); + + if (!aud2g) { + /* use the 2G tokens from 3G keys */ + DBGVB(kc); + DBGVB(sres); + DBGVV("0x%x", auth_types); + continue; + } + /* calculate 2G separately */ + + DBGP("vector [%u]: deriving 2G from 3G\n", i); + rc = osmo_auth_gen_vec(&vtmp, aud2g, rand); if (rc < 0) { - LOGP(DAUC, LOGL_ERROR, "Error in 2G vector " - "generation: %d\n", rc); + LOGP(DAUC, LOGL_ERROR, "Error in 2G vector" + "generation: [%u]: rc = %d\n", i, rc); goto out; } memcpy(&vec[i].kc, vtmp.kc, sizeof(vec[i].kc)); memcpy(&vec[i].sres, vtmp.sres, sizeof(vec[i].sres)); vec[i].auth_types |= OSMO_AUTH_TYPE_GSM; + } else { + /* 2G only case */ + rc = osmo_auth_gen_vec(vec+i, aud2g, rand); + if (rc < 0) { + LOGP(DAUC, LOGL_ERROR, "Error in 2G vector " + "generation: [%u]: rc = %d\n", i, rc); + goto out; + } } + + DBGVB(kc); + DBGVB(sres); + DBGVV("0x%x", auth_types); } out: return i; +#undef DBGVV +#undef DBGVB +#undef DBGP } diff --git a/tests/auc/auc_3g_test.c b/tests/auc/auc_3g_test.c index f8ff67a..51184c5 100644 --- a/tests/auc/auc_3g_test.c +++ b/tests/auc/auc_3g_test.c @@ -69,7 +69,6 @@ #define VEC_IS(vec, expect) do { \ char *_is = vec_str(vec); \ - fprintf(stderr, "auth vector ==\n%s\n", _is); \ if (strcmp(_is, expect)) { \ fprintf(stderr, "MISMATCH! expected ==\n%s\n", \ expect); \ @@ -84,7 +83,8 @@ } \ } \ OSMO_ASSERT(false); \ - } \ + } else \ + fprintf(stderr, "vector matches expectations\n"); \ } while (0) uint8_t fake_rand[16] = { 0 }; diff --git a/tests/auc/auc_3g_test.err b/tests/auc/auc_3g_test.err index db076d7..e8e6f03 100644 --- a/tests/auc/auc_3g_test.err +++ b/tests/auc/auc_3g_test.err @@ -1,210 +1,209 @@ ===== test_gen_vectors_2g_only aud3g.u.umts.sqn == 0 -DAUC rand 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC compute vector [0]/1: 2G only +DAUC Computing 1 auth vector: 2G only +DAUC 2G: ki = eb215756028d60e3275e613320aec880 +DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: kc = 241a5b16aeb8e400 +DAUC vector [0]: sres = 429d5b27 +DAUC vector [0]: auth_types = 0x1 rc == 1 -auth vector == - rand: 39fa2f4e3d523d8619a73b4f65c3e14d - autn: 00000000000000000000000000000000 - ck: 00000000000000000000000000000000 - ik: 00000000000000000000000000000000 - res: 00000000000000000000000000000000 - res_len: 00 - kc: 241a5b16aeb8e400 - sres: 429d5b27 - auth_types: 01000000 - +vector matches expectations aud3g.u.umts.sqn == 0 -DAUC rand 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC compute vector [0]/1: 2G only +DAUC Computing 1 auth vector: 2G only +DAUC 2G: ki = eb215756028d60e3275e613320aec880 +DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: kc = 241a5b16aeb8e400 +DAUC vector [0]: sres = 429d5b27 +DAUC vector [0]: auth_types = 0x1 rc == 1 -auth vector == - rand: 39fa2f4e3d523d8619a73b4f65c3e14d - autn: 00000000000000000000000000000000 - ck: 00000000000000000000000000000000 - ik: 00000000000000000000000000000000 - res: 00000000000000000000000000000000 - res_len: 00 - kc: 241a5b16aeb8e400 - sres: 429d5b27 - auth_types: 01000000 - +vector matches expectations ===== test_gen_vectors_2g_only: SUCCESS ===== test_gen_vectors_2g_plus_3g aud3g.u.umts.sqn == 0 -DAUC rand 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC compute vector [0]/1: separate 2G + 3G +DAUC Computing 1 auth vector: 3G + separate 2G +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 2G: ki = eb215756028d60e3275e613320aec880 +DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 +DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef +DAUC vector [0]: res = e229c19e791f2e410000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: deriving 2G from 3G +DAUC vector [0]: kc = 241a5b16aeb8e400 +DAUC vector [0]: sres = 429d5b27 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 39fa2f4e3d523d8619a73b4f65c3e14d - autn: 8704f5ba55f30000d2ee44b22c8ea919 - ck: f64735036e5871319c679f4742a75ea1 - ik: 27497388b6cb044648f396aa155b95ef - res: e229c19e791f2e410000000000000000 - res_len: 08 - kc: 241a5b16aeb8e400 - sres: 429d5b27 - auth_types: 03000000 - +vector matches expectations aud3g.u.umts.sqn == 1 aud3g.u.umts.sqn == 0 -DAUC rand 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC compute vector [0]/1: separate 2G + 3G +DAUC Computing 1 auth vector: 3G + separate 2G +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 2G: ki = eb215756028d60e3275e613320aec880 +DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 +DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef +DAUC vector [0]: res = e229c19e791f2e410000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: deriving 2G from 3G +DAUC vector [0]: kc = 241a5b16aeb8e400 +DAUC vector [0]: sres = 429d5b27 +DAUC vector [0]: auth_types = 0x3 rc == 1 aud3g.u.umts.sqn == 1 -auth vector == - rand: 39fa2f4e3d523d8619a73b4f65c3e14d - autn: 8704f5ba55f30000d2ee44b22c8ea919 - ck: f64735036e5871319c679f4742a75ea1 - ik: 27497388b6cb044648f396aa155b95ef - res: e229c19e791f2e410000000000000000 - res_len: 08 - kc: 241a5b16aeb8e400 - sres: 429d5b27 - auth_types: 03000000 - +vector matches expectations ===== test_gen_vectors_2g_plus_3g: SUCCESS ===== test_gen_vectors_3g_only aud3g.u.umts.sqn == 0 -DAUC rand 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 +DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef +DAUC vector [0]: res = e229c19e791f2e410000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 059a4f668f6fbe39 +DAUC vector [0]: sres = 9b36efdf +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 39fa2f4e3d523d8619a73b4f65c3e14d - autn: 8704f5ba55f30000d2ee44b22c8ea919 - ck: f64735036e5871319c679f4742a75ea1 - ik: 27497388b6cb044648f396aa155b95ef - res: e229c19e791f2e410000000000000000 - res_len: 08 - kc: 059a4f668f6fbe39 - sres: 9b36efdf - auth_types: 03000000 - +vector matches expectations aud3g.u.umts.sqn == 1 aud3g.u.umts.sqn == 0 -DAUC rand 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 +DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef +DAUC vector [0]: res = e229c19e791f2e410000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 059a4f668f6fbe39 +DAUC vector [0]: sres = 9b36efdf +DAUC vector [0]: auth_types = 0x3 rc == 1 aud3g.u.umts.sqn == 1 -auth vector == - rand: 39fa2f4e3d523d8619a73b4f65c3e14d - autn: 8704f5ba55f30000d2ee44b22c8ea919 - ck: f64735036e5871319c679f4742a75ea1 - ik: 27497388b6cb044648f396aa155b95ef - res: e229c19e791f2e410000000000000000 - res_len: 08 - kc: 059a4f668f6fbe39 - sres: 9b36efdf - auth_types: 03000000 - +vector matches expectations - test AUTS resync aud3g.u.umts.sqn == 0 -DAUC rand 897210a0f7de278f0b8213098e098a3f -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f +DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c +DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: resync: sqn = 24 +DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 +DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 +DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 +DAUC vector [0]: res = 9af5a557902d2db80000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 7526fc13c5976685 +DAUC vector [0]: sres = 0ad888ef +DAUC vector [0]: auth_types = 0x3 rc == 1 aud3g.u.umts.sqn == 25 -auth vector == - rand: 897210a0f7de278f0b8213098e098a3f - autn: c6b9790dad4b00000cf322869ea6a481 - ck: e9922bd036718ed9e40bd1d02c3b81a5 - ik: f19c20ca863137f8892326d959ec5e01 - res: 9af5a557902d2db80000000000000000 - res_len: 08 - kc: 7526fc13c5976685 - sres: 0ad888ef - auth_types: 03000000 - +vector matches expectations - verify N vectors with AUTS resync == N vectors without AUTS First just set rand and sqn = 24, and compute 3 vectors aud3g.u.umts.sqn == 24 -DAUC rand 897210a0f7de278f0b8213098e098a3f -DAUC compute vector [0]/3: 3G only -DAUC rand 9a8321b108ef38a01c93241a9f1a9b50 -DAUC compute vector [1]/3: 3G only -DAUC rand ab9432c2190049b12da4352bb02bac61 -DAUC compute vector [2]/3: 3G only +DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys) +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f +DAUC vector [0]: sqn = 24 +DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 +DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 +DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 +DAUC vector [0]: res = 9af5a557902d2db80000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 7526fc13c5976685 +DAUC vector [0]: sres = 0ad888ef +DAUC vector [0]: auth_types = 0x3 +DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 +DAUC vector [1]: sqn = 25 +DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 +DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 +DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 +DAUC vector [1]: res = 43023475cb29292c0000000000000000 +DAUC vector [1]: res_len = 8 +DAUC vector [1]: kc = aef73dd515e86c15 +DAUC vector [1]: sres = 882b1d59 +DAUC vector [1]: auth_types = 0x3 +DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 +DAUC vector [2]: sqn = 26 +DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b +DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 +DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 +DAUC vector [2]: res = 010cab11cc63a6e40000000000000000 +DAUC vector [2]: res_len = 8 +DAUC vector [2]: kc = f0eaf8cb19e0758d +DAUC vector [2]: sres = cd6f0df5 +DAUC vector [2]: auth_types = 0x3 rc == 3 aud3g.u.umts.sqn == 27 -[0]: auth vector == - rand: 897210a0f7de278f0b8213098e098a3f - autn: c6b9790dad4b00000cf322869ea6a481 - ck: e9922bd036718ed9e40bd1d02c3b81a5 - ik: f19c20ca863137f8892326d959ec5e01 - res: 9af5a557902d2db80000000000000000 - res_len: 08 - kc: 7526fc13c5976685 - sres: 0ad888ef - auth_types: 03000000 - -[1]: auth vector == - rand: 9a8321b108ef38a01c93241a9f1a9b50 - autn: 79a5113eb0910000be6020540503ffc5 - ck: 3686f05df057d1899c66ae4eb18cf941 - ik: 79f21ed53bcb47787de57d136ff803a5 - res: 43023475cb29292c0000000000000000 - res_len: 08 - kc: aef73dd515e86c15 - sres: 882b1d59 - auth_types: 03000000 - -[2]: auth vector == - rand: ab9432c2190049b12da4352bb02bac61 - autn: 24b018d46c3b00009c7e1b47f3a19b2b - ck: d86c3191a36fc0602e48202ef2080964 - ik: 648dab72016181406243420649e63dc9 - res: 010cab11cc63a6e40000000000000000 - res_len: 08 - kc: f0eaf8cb19e0758d - sres: cd6f0df5 - auth_types: 03000000 - +[0]: vector matches expectations +[1]: vector matches expectations +[2]: vector matches expectations Now reach sqn = 24 with AUTS and expect the same -DAUC rand 897210a0f7de278f0b8213098e098a3f -DAUC compute vector [0]/3: 3G only -DAUC rand 9a8321b108ef38a01c93241a9f1a9b50 -DAUC compute vector [1]/3: 3G only -DAUC rand ab9432c2190049b12da4352bb02bac61 -DAUC compute vector [2]/3: 3G only +DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys), with AUTS resync +DAUC 3G: k = eb215756028d60e3275e613320aec880 +DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f +DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c +DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [0]: resync: sqn = 24 +DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 +DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 +DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 +DAUC vector [0]: res = 9af5a557902d2db80000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 7526fc13c5976685 +DAUC vector [0]: sres = 0ad888ef +DAUC vector [0]: auth_types = 0x3 +DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 +DAUC vector [1]: resync: auts = 979498b1f72d3e28c59fa2e72f9c +DAUC vector [1]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [1]: resync: sqn = 24 +DAUC vector [1]: autn = 79a5113eb0900000f7e138537aa0962b +DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 +DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 +DAUC vector [1]: res = 43023475cb29292c0000000000000000 +DAUC vector [1]: res_len = 8 +DAUC vector [1]: kc = aef73dd515e86c15 +DAUC vector [1]: sres = 882b1d59 +DAUC vector [1]: auth_types = 0x3 +DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 +DAUC vector [2]: resync: auts = 979498b1f72d3e28c59fa2e72f9c +DAUC vector [2]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d +DAUC vector [2]: resync: sqn = 24 +DAUC vector [2]: autn = 24b018d46c390000d88e11730d0367ac +DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 +DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 +DAUC vector [2]: res = 010cab11cc63a6e40000000000000000 +DAUC vector [2]: res_len = 8 +DAUC vector [2]: kc = f0eaf8cb19e0758d +DAUC vector [2]: sres = cd6f0df5 +DAUC vector [2]: auth_types = 0x3 THERE IS A BUG AND THE TEST PASSES THE WRONG VECTORS UNTIL THAT IS FIXED The SQN should increment with each new vector. -[0]: auth vector == - rand: 897210a0f7de278f0b8213098e098a3f - autn: c6b9790dad4b00000cf322869ea6a481 - ck: e9922bd036718ed9e40bd1d02c3b81a5 - ik: f19c20ca863137f8892326d959ec5e01 - res: 9af5a557902d2db80000000000000000 - res_len: 08 - kc: 7526fc13c5976685 - sres: 0ad888ef - auth_types: 03000000 - -[1]: auth vector == - rand: 9a8321b108ef38a01c93241a9f1a9b50 - autn: 79a5113eb0900000f7e138537aa0962b - ck: 3686f05df057d1899c66ae4eb18cf941 - ik: 79f21ed53bcb47787de57d136ff803a5 - res: 43023475cb29292c0000000000000000 - res_len: 08 - kc: aef73dd515e86c15 - sres: 882b1d59 - auth_types: 03000000 - -[2]: auth vector == - rand: ab9432c2190049b12da4352bb02bac61 - autn: 24b018d46c390000d88e11730d0367ac - ck: d86c3191a36fc0602e48202ef2080964 - ik: 648dab72016181406243420649e63dc9 - res: 010cab11cc63a6e40000000000000000 - res_len: 08 - kc: f0eaf8cb19e0758d - sres: cd6f0df5 - auth_types: 03000000 - +[0]: vector matches expectations +[1]: vector matches expectations +[2]: vector matches expectations ===== test_gen_vectors_3g_only: SUCCESS diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 9a26922..8bedf46 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -1,304 +1,380 @@ ===== test_set_1 aud3g.u.umts.sqn == 0 -DAUC rand 23553cbe9637a89d218ae64dae47bf35 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc +DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf +DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = aa689c64837000000eed35e2ae9e21c0 +DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb +DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 +DAUC vector [0]: res = a54211d5e3ba50bf0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = eae4be823af9a08b +DAUC vector [0]: sres = 46f8416a +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 23553cbe9637a89d218ae64dae47bf35 - ck: b40ba9a3c58b2a05bbf0d987b21bf8cb - ik: f769bcd751044604127672711c6d3441 - res: a54211d5e3ba50bf0000000000000000 - kc: eae4be823af9a08b - sres: 46f8416a - +vector matches expectations ===== test_set_1: SUCCESS ===== test_set_2 aud3g.u.umts.sqn == 0 -DAUC rand 9f7c8d021accf4db213ccff0c7f71a6a -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f +DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 +DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 33484dc2136b00009abcd7740cfa799c +DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 +DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b +DAUC vector [0]: res = 8011c48c0c214ed20000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = aa01739b8caa976d +DAUC vector [0]: sres = 8c308a5e +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 9f7c8d021accf4db213ccff0c7f71a6a - ck: 5dbdbb2954e8f3cde665b046179a5098 - ik: 59a92d3b476a0443487055cf88b2307b - res: 8011c48c0c214ed20000000000000000 - kc: aa01739b8caa976d - sres: 8c308a5e - +vector matches expectations ===== test_set_2: SUCCESS ===== test_set_3 aud3g.u.umts.sqn == 0 -DAUC rand ce83dbc54ac0274a157c17f80d017bd6 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 +DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 +DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = f0b9c08ad02e00001b5ca3e1240212be +DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d +DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b +DAUC vector [0]: res = f365cd683cd92e960000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 9a8ec95f408cc507 +DAUC vector [0]: sres = cfbce3fe +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: ce83dbc54ac0274a157c17f80d017bd6 - ck: e203edb3971574f5a94b0d61b816345d - ik: 0c4524adeac041c4dd830d20854fc46b - res: f365cd683cd92e960000000000000000 - kc: 9a8ec95f408cc507 - sres: cfbce3fe - +vector matches expectations ===== test_set_3: SUCCESS ===== test_set_4 aud3g.u.umts.sqn == 0 -DAUC rand 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 +DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e +DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 31e11a6091180000f55f5c8adb793014 +DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 +DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 +DAUC vector [0]: res = 5860fc1bce351e7e0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = cdc1dc0841b81a22 +DAUC vector [0]: sres = 9655e265 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 74b0cd6031a1c8339b2b6ce2b8c4a186 - ck: 7657766b373d1c2138f307e3de9242f9 - ik: 1c42e960d89b8fa99f2744e0708ccb53 - res: 5860fc1bce351e7e0000000000000000 - kc: cdc1dc0841b81a22 - sres: 9655e265 - +vector matches expectations ===== test_set_4: SUCCESS ===== test_set_5 aud3g.u.umts.sqn == 0 -DAUC rand ee6466bc96202c5a557abbeff8babf63 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f +DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 +DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 45b0f69ab06c0000a161b2de788f3b3f +DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b +DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 +DAUC vector [0]: res = 16c8233f05a0ac280000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = df75bc5ea899879f +DAUC vector [0]: sres = 13688f17 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: ee6466bc96202c5a557abbeff8babf63 - ck: 3f8c7587fe8e4b233af676aede30ba3b - ik: a7466cc1e6b2a1337d49d3b66e95d7b4 - res: 16c8233f05a0ac280000000000000000 - kc: df75bc5ea899879f - sres: 13688f17 - +vector matches expectations ===== test_set_5: SUCCESS ===== test_set_6 aud3g.u.umts.sqn == 0 -DAUC rand 194aa756013896b74b4a2a3b0af4539e -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d +DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 +DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 7e6455f34cf3000040dc9568192ab1c0 +DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 +DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 +DAUC vector [0]: res = 8c25a16cd918a1df0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 84b417ae3aeab4f3 +DAUC vector [0]: sres = 553d00b3 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 194aa756013896b74b4a2a3b0af4539e - ck: 4cd0846020f8fa0731dd47cbdc6be411 - ik: 88ab80a415f15c73711254a1d388f696 - res: 8c25a16cd918a1df0000000000000000 - kc: 84b417ae3aeab4f3 - sres: 553d00b3 - +vector matches expectations ===== test_set_6: SUCCESS ===== test_set_7 aud3g.u.umts.sqn == 0 -DAUC rand 3a4c2b3245c50eb5c71d08639395764d -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 +DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 +DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 88196c47986f000075c2ba7455852c2a +DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b +DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 +DAUC vector [0]: res = a63241e1ffc3e5ab0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 3b4e244cdc60ce03 +DAUC vector [0]: sres = 59f1a44a +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 3a4c2b3245c50eb5c71d08639395764d - ck: 10f05bab75a99a5fbb98a9c287679c3b - ik: f9ec0865eb32f22369cade40c59c3a44 - res: a63241e1ffc3e5ab0000000000000000 - kc: 3b4e244cdc60ce03 - sres: 59f1a44a - +vector matches expectations ===== test_set_7: SUCCESS ===== test_set_8 aud3g.u.umts.sqn == 0 -DAUC rand f761e5e93d603feb730e27556cb8a2ca -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 +DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 +DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 82a0f5287a71000023563512500d75d9 +DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 +DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e +DAUC vector [0]: res = 4a90b2171ac83a760000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 8d4ec01de597acfe +DAUC vector [0]: sres = 50588861 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: f761e5e93d603feb730e27556cb8a2ca - ck: 71236b7129f9b22ab77ea7a54c96da22 - ik: 90527ebaa5588968db41727325a04d9e - res: 4a90b2171ac83a760000000000000000 - kc: 8d4ec01de597acfe - sres: 50588861 - +vector matches expectations ===== test_set_8: SUCCESS ===== test_set_9 aud3g.u.umts.sqn == 0 -DAUC rand 08eff828b13fdb562722c65c7f30a9b2 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb +DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 +DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = a2f858aa9e5d0000bdd79d9f7c269d1c +DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa +DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 +DAUC vector [0]: res = 4bc2212d8624910a0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = d8debc4ffbcd60aa +DAUC vector [0]: sres = cde6b027 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 08eff828b13fdb562722c65c7f30a9b2 - ck: 08cef6d004ec61471a3c3cda048137fa - ik: ed0318ca5deb9206272f6e8fa64ba411 - res: 4bc2212d8624910a0000000000000000 - kc: d8debc4ffbcd60aa - sres: cde6b027 - +vector matches expectations ===== test_set_9: SUCCESS ===== test_set_10 aud3g.u.umts.sqn == 0 -DAUC rand 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d +DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 +DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 4c539a26e1fa000059e7ec99b51f33f3 +DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c +DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd +DAUC vector [0]: res = 6fc30fee6d1235230000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = f0eaa50a1edcebb7 +DAUC vector [0]: sres = 02d13acd +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 679ac4dbacd7d233ff9d6806f4149ce3 - ck: 69b1cae7c7429d975e245cacb05a517c - ik: 74f24e8c26df58e1b38d7dcd4f1b7fbd - res: 6fc30fee6d1235230000000000000000 - kc: f0eaa50a1edcebb7 - sres: 02d13acd - +vector matches expectations ===== test_set_10: SUCCESS ===== test_set_11 aud3g.u.umts.sqn == 0 -DAUC rand 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 77b45843c88e58c10d202684515ed430 +DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 +DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 30ff25cdadf600003991f8e7e72a5948 +DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f +DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 +DAUC vector [0]: res = aefa357beac2a87a0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 82dbab7f83f063da +DAUC vector [0]: sres = 44389d01 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 4c47eb3076dc55fe5106cb2034b8cd78 - ck: 908c43f0569cb8f74bc971e706c36c5f - ik: c251df0d888dd9329bcf46655b226e40 - res: aefa357beac2a87a0000000000000000 - kc: 82dbab7f83f063da - sres: 44389d01 - +vector matches expectations ===== test_set_11: SUCCESS ===== test_set_12 aud3g.u.umts.sqn == 0 -DAUC rand 311c4c929744d675b720f3b7e9b1cbd0 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb +DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 +DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 5380d158cfe30000fd10b1f261e825c3 +DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 +DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 +DAUC vector [0]: res = 98dbbd099b3b408d0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 3c66cb98cab2d33d +DAUC vector [0]: sres = 03e0fd84 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 311c4c929744d675b720f3b7e9b1cbd0 - ck: 44c0f23c5493cfd241e48f197e1d1012 - ik: 0c9fb81613884c2535dd0eabf3b440d8 - res: 98dbbd099b3b408d0000000000000000 - kc: 3c66cb98cab2d33d - sres: 03e0fd84 - +vector matches expectations ===== test_set_12: SUCCESS ===== test_set_13 aud3g.u.umts.sqn == 0 -DAUC rand cf7d0ab1d94306950bf12018fbd46887 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa +DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 +DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 217af49272ad0000cc1d4642c4476641 +DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c +DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a +DAUC vector [0]: res = af4a411e1139f2c20000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 9612b5d88a4130bb +DAUC vector [0]: sres = be73b3dc +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: cf7d0ab1d94306950bf12018fbd46887 - ck: 5af86b80edb70df5292cc1121cbad50c - ik: 7f4d6ae7440e18789a8b75ad3f42f03a - res: af4a411e1139f2c20000000000000000 - kc: 9612b5d88a4130bb - sres: be73b3dc - +vector matches expectations ===== test_set_13: SUCCESS ===== test_set_14 aud3g.u.umts.sqn == 0 -DAUC rand 1f0f8578464fd59b64bed2d09436b57a -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = af7c65e1927221de591187a2c5987a53 +DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 +DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 837fd7b744190000e4ae3648e1c7770b +DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 +DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 +DAUC vector [0]: res = 7bffa5c2f41fbc050000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 75a150df3c6aed08 +DAUC vector [0]: sres = 8fe019c7 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 1f0f8578464fd59b64bed2d09436b57a - ck: 3f8c3f3ccf7625bf77fc94bcfd22fd26 - ik: abcbae8fd46115e9961a55d0da5f2078 - res: 7bffa5c2f41fbc050000000000000000 - kc: 75a150df3c6aed08 - sres: 8fe019c7 - +vector matches expectations ===== test_set_14: SUCCESS ===== test_set_15 aud3g.u.umts.sqn == 0 -DAUC rand 59b75f14251c75031d0bcbac1c2c04c7 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 +DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 +DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 5be11495525d00008538a96619c04b01 +DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 +DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 +DAUC vector [0]: res = 7e3f44c7591f6f450000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = b7f92e426a36fec5 +DAUC vector [0]: sres = 27202b82 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 59b75f14251c75031d0bcbac1c2c04c7 - ck: d42b2d615e49a03ac275a5aef97af892 - ik: 0b3f8d024fe6bfafaa982b8f82e319c2 - res: 7e3f44c7591f6f450000000000000000 - kc: b7f92e426a36fec5 - sres: 27202b82 - +vector matches expectations ===== test_set_15: SUCCESS ===== test_set_16 aud3g.u.umts.sqn == 0 -DAUC rand f69b78f300a0568bce9f0cb93c4be4c9 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d +DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 +DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 1c408a858b3e0000956596c6cd632f0f +DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b +DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 +DAUC vector [0]: res = 70f6bdb9ad21525f0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 88d9de10a22004c5 +DAUC vector [0]: sres = ddd7efe6 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: f69b78f300a0568bce9f0cb93c4be4c9 - ck: 6edaf99e5bd9f85d5f36d91c1272fb4b - ik: d61c853c280dd9c46f297baec386de17 - res: 70f6bdb9ad21525f0000000000000000 - kc: 88d9de10a22004c5 - sres: ddd7efe6 - +vector matches expectations ===== test_set_16: SUCCESS ===== test_set_17 aud3g.u.umts.sqn == 0 -DAUC rand b120f1c1a0102a2f507dd543de68281f -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df +DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 +DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = aefdaa5ddd9900003bf0fbdbbc9d8ecc +DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e +DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 +DAUC vector [0]: res = 479dd25c20792d630000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = a819e577a8d6175b +DAUC vector [0]: sres = 67e4ff3f +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: b120f1c1a0102a2f507dd543de68281f - ck: 66195dbed0313274c5ca7766615fa25e - ik: 66bec707eb2afc476d7408a8f2927b36 - res: 479dd25c20792d630000000000000000 - kc: a819e577a8d6175b - sres: 67e4ff3f - +vector matches expectations ===== test_set_17: SUCCESS ===== test_set_18 aud3g.u.umts.sqn == 0 -DAUC rand 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 +DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf +DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = ada15aeb7bb80000f141568691cccaec +DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f +DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a +DAUC vector [0]: res = 28d7b0f2a2ec3de50000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = 9a8d0e883ff0887a +DAUC vector [0]: sres = 8a3b8d17 +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 81e92b6c0ee0e12ebceba8d92a99dfa5 - ck: 5349fbe098649f948f5d2e973a81c00f - ik: 9744871ad32bf9bbd1dd5ce54e3e2e5a - res: 28d7b0f2a2ec3de50000000000000000 - kc: 9a8d0e883ff0887a - sres: 8a3b8d17 - +vector matches expectations ===== test_set_18: SUCCESS ===== test_set_19 aud3g.u.umts.sqn == 0 -DAUC rand 9fddc72092c6ad036b6e464789315b78 -DAUC compute vector [0]/1: 3G only +DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) +DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 +DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 +DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 +DAUC vector [0]: sqn = 0 +DAUC vector [0]: autn = 83cfd54db9130000eb5e0ab0a7c030e6 +DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 +DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef +DAUC vector [0]: res = a95100e2760952cd0000000000000000 +DAUC vector [0]: res_len = 8 +DAUC vector [0]: kc = ed29b2f1c27f9f34 +DAUC vector [0]: sres = df58522f +DAUC vector [0]: auth_types = 0x3 rc == 1 -auth vector == - rand: 9fddc72092c6ad036b6e464789315b78 - ck: b5f2da03883b69f96bf52e029ed9ac45 - ik: b4721368bc16ea67875c5598688bb0ef - res: a95100e2760952cd0000000000000000 - kc: ed29b2f1c27f9f34 - sres: df58522f - +vector matches expectations ===== test_set_19: SUCCESS diff --git a/tests/auc/gen_ts_55_205_test_sets/main_template.c b/tests/auc/gen_ts_55_205_test_sets/main_template.c index c03b820..e917e71 100644 --- a/tests/auc/gen_ts_55_205_test_sets/main_template.c +++ b/tests/auc/gen_ts_55_205_test_sets/main_template.c @@ -70,7 +70,6 @@ #define VEC_IS(vec, expect) do { \ char *_is = vec_str(vec); \ - fprintf(stderr, "auth vector ==\n%s\n", _is); \ if (strcmp(_is, expect)) { \ fprintf(stderr, "MISMATCH! expected ==\n%s\n", \ expect); \ @@ -85,7 +84,8 @@ } \ } \ OSMO_ASSERT(false); \ - } \ + } else \ + fprintf(stderr, "vector matches expectations\n"); \ } while (0) uint8_t fake_rand[16] = { 0 }; -- To view, visit https://gerrit.osmocom.org/1869 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifb36d010a4ac64c765517e15b9074424ec19cc60 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:21:16 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:21:16 +0000 Subject: [MERGED] osmo-hlr[master]: cosmetic: rename auc_3g_test.c to auc_test.c In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: rename auc_3g_test.c to auc_test.c ...................................................................... cosmetic: rename auc_3g_test.c to auc_test.c The test includes 2G-only tests so the name is misleading. Splitting up makes no sense. Change-Id: I1a5a40413bf6636ead9370fb827aa0338c049e7f --- M tests/auc/Makefile.am R tests/auc/auc_test.c R tests/auc/auc_test.err R tests/auc/auc_test.ok M tests/testsuite.at 5 files changed, 9 insertions(+), 9 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auc/Makefile.am b/tests/auc/Makefile.am index 761396b..b3c20f2 100644 --- a/tests/auc/Makefile.am +++ b/tests/auc/Makefile.am @@ -16,23 +16,23 @@ $(NULL) EXTRA_DIST = \ - auc_3g_test.ok \ - auc_3g_test.err \ + auc_test.ok \ + auc_test.err \ auc_ts_55_205_test_sets.ok \ auc_ts_55_205_test_sets.err \ $(NULL) noinst_PROGRAMS = \ - auc_3g_test \ + auc_test \ auc_ts_55_205_test_sets \ $(NULL) -auc_3g_test_SOURCES = \ - auc_3g_test.c \ +auc_test_SOURCES = \ + auc_test.c \ $(NULL) -auc_3g_test_LDADD = \ +auc_test_LDADD = \ $(top_srcdir)/src/auc.c \ $(top_srcdir)/src/logging.c \ $(LIBOSMOCORE_LIBS) \ diff --git a/tests/auc/auc_3g_test.c b/tests/auc/auc_test.c similarity index 100% rename from tests/auc/auc_3g_test.c rename to tests/auc/auc_test.c diff --git a/tests/auc/auc_3g_test.err b/tests/auc/auc_test.err similarity index 100% rename from tests/auc/auc_3g_test.err rename to tests/auc/auc_test.err diff --git a/tests/auc/auc_3g_test.ok b/tests/auc/auc_test.ok similarity index 100% rename from tests/auc/auc_3g_test.ok rename to tests/auc/auc_test.ok diff --git a/tests/testsuite.at b/tests/testsuite.at index dc1de33..46d1456 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -3,9 +3,9 @@ AT_SETUP([auc]) AT_KEYWORDS([auc]) -cat $abs_srcdir/auc/auc_3g_test.ok > expout -cat $abs_srcdir/auc/auc_3g_test.err > experr -AT_CHECK([$abs_top_builddir/tests/auc/auc_3g_test], [], [expout], [experr]) +cat $abs_srcdir/auc/auc_test.ok > expout +cat $abs_srcdir/auc/auc_test.err > experr +AT_CHECK([$abs_top_builddir/tests/auc/auc_test], [], [expout], [experr]) AT_CLEANUP AT_SETUP([auc_ts_55_205_test_sets]) -- To view, visit https://gerrit.osmocom.org/1872 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1a5a40413bf6636ead9370fb827aa0338c049e7f Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:21:17 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:21:17 +0000 Subject: [MERGED] osmo-hlr[master]: cosmetic: auc_3g_test: improve test debugging tools In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: auc_3g_test: improve test debugging tools ...................................................................... cosmetic: auc_3g_test: improve test debugging tools In the test failure mismatch printf, better indicate the place of first mismatch. Helpful if some byte within a hexdump differs, the case when debugging AUTS. Copy some optarg code from openbsc's msc_vlr tests to provide verbose mode that prints log statements' source file and line. Change-Id: I1b23da055b5edacba09310411caf43c4cd1c29bc --- M tests/auc/auc_3g_test.c 1 file changed, 66 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auc/auc_3g_test.c b/tests/auc/auc_3g_test.c index 7b12358..16c87f7 100644 --- a/tests/auc/auc_3g_test.c +++ b/tests/auc/auc_3g_test.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -76,9 +77,13 @@ char *b = expect; \ for (; *a && *b; a++, b++) { \ if (*a != *b) { \ - while (a > _is && *(a-1) != '\n') a--; \ - fprintf(stderr, "mismatch at %d:\n" \ - "%s", (int)(a - _is), a); \ + fprintf(stderr, "mismatch at %d:\n", \ + (int)(a - _is)); \ + while (a > _is && *(a-1) != '\n') { \ + fprintf(stderr, " "); \ + a--; \ + } \ + fprintf(stderr, "v\n%s", a); \ break; \ } \ } \ @@ -547,11 +552,67 @@ comment_end(); } -int main() +static struct { + bool verbose; +} cmdline_opts = { + .verbose = false, +}; + +static void print_help(const char *program) +{ + printf("Usage:\n" + " %s [-v] [N [N...]]\n" + "Options:\n" + " -h --help show this text.\n" + " -v --verbose print source file and line numbers\n", + program + ); +} + +static void handle_options(int argc, char **argv) +{ + while (1) { + int option_index = 0, c; + static struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"verbose", 1, 0, 'v'}, + {0, 0, 0, 0} + }; + + c = getopt_long(argc, argv, "hv", + long_options, &option_index); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(argv[0]); + exit(0); + case 'v': + cmdline_opts.verbose = true; + break; + default: + /* catch unknown options *as well as* missing arguments. */ + fprintf(stderr, "Error in command line options. Exiting.\n"); + exit(-1); + break; + } + } + + if (optind < argc) { + fprintf(stderr, "too many args\n"); + exit(-1); + } +} + +int main(int argc, char **argv) { printf("auc_3g_test.c\n"); + + handle_options(argc, argv); + osmo_init_logging(&hlr_log_info); - log_set_print_filename(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, cmdline_opts.verbose); log_set_print_timestamp(osmo_stderr_target, 0); log_set_use_color(osmo_stderr_target, 0); log_set_print_category(osmo_stderr_target, 1); -- To view, visit https://gerrit.osmocom.org/1871 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1b23da055b5edacba09310411caf43c4cd1c29bc Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:21:18 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:21:18 +0000 Subject: [MERGED] osmo-hlr[master]: auc_compute_vectors(): fix AUTS resync for multiple vectors In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: auc_compute_vectors(): fix AUTS resync for multiple vectors ...................................................................... auc_compute_vectors(): fix AUTS resync for multiple vectors Fix bug where AUTS was fed to each vector generation and thus each vector was generated with the same SQN. In auc_3g_test, adjust the bug indicating test expectations to now expect the proper results. Depends: libosmocore change-id If943731a78089f0aac3d55245de80596d01314a4 Change-Id: I425a1d92c85896227341f565f5361c0d830ce866 --- M src/auc.c M tests/auc/auc_3g_test.c M tests/auc/auc_3g_test.err 3 files changed, 8 insertions(+), 56 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/auc.c b/src/auc.c index f4d19a0..9c20db2 100644 --- a/src/auc.c +++ b/src/auc.c @@ -113,7 +113,9 @@ if (aud3g) { /* 3G or 3G + 2G case */ - if (auts) { + /* Do AUTS only for the first vector or we would use + * the same SQN for each following key. */ + if ((i == 0) && auts) { DBGP("vector [%u]: resync: auts = %s\n", i, hex(auts, 14)); DBGP("vector [%u]: resync: rand_auts = %s\n", diff --git a/tests/auc/auc_3g_test.c b/tests/auc/auc_3g_test.c index 51184c5..7b12358 100644 --- a/tests/auc/auc_3g_test.c +++ b/tests/auc/auc_3g_test.c @@ -239,48 +239,6 @@ comment_end(); } -void _test_gen_vectors_3g_only__expect_vecs__WRONG(struct osmo_auth_vector vecs[3]) -{ - fprintf(stderr, "THERE IS A BUG AND THE TEST PASSES THE WRONG VECTORS UNTIL THAT IS FIXED\n"); - fprintf(stderr, "The SQN should increment with each new vector.\n"); - fprintf(stderr, "[0]: "); - VEC_IS(&vecs[0], - " rand: 897210a0f7de278f0b8213098e098a3f\n" - " autn: c6b9790dad4b00000cf322869ea6a481\n" - " ck: e9922bd036718ed9e40bd1d02c3b81a5\n" - " ik: f19c20ca863137f8892326d959ec5e01\n" - " res: 9af5a557902d2db80000000000000000\n" - " res_len: 08\n" - " kc: 7526fc13c5976685\n" - " sres: 0ad888ef\n" - " auth_types: 03000000\n" - ); - fprintf(stderr, "[1]: "); - VEC_IS(&vecs[1], - " rand: 9a8321b108ef38a01c93241a9f1a9b50\n" - " autn: 79a5113eb0900000f7e138537aa0962b\n" - " ck: 3686f05df057d1899c66ae4eb18cf941\n" - " ik: 79f21ed53bcb47787de57d136ff803a5\n" - " res: 43023475cb29292c0000000000000000\n" - " res_len: 08\n" - " kc: aef73dd515e86c15\n" - " sres: 882b1d59\n" - " auth_types: 03000000\n" - ); - fprintf(stderr, "[2]: "); - VEC_IS(&vecs[2], - " rand: ab9432c2190049b12da4352bb02bac61\n" - " autn: 24b018d46c390000d88e11730d0367ac\n" - " ck: d86c3191a36fc0602e48202ef2080964\n" - " ik: 648dab72016181406243420649e63dc9\n" - " res: 010cab11cc63a6e40000000000000000\n" - " res_len: 08\n" - " kc: f0eaf8cb19e0758d\n" - " sres: cd6f0df5\n" - " auth_types: 03000000\n" - ); -} - void _test_gen_vectors_3g_only__expect_vecs(struct osmo_auth_vector vecs[3]) { fprintf(stderr, "[0]: "); @@ -487,9 +445,7 @@ next_rand("897210a0f7de278f0b8213098e098a3f", false); rc = auc_compute_vectors(vecs, 3, &aud2g, &aud3g, rand_auts, auts); - /* THIS IS WRONG AND WILL BE FIXED IN A SUBSEQUENT COMMIT: - should be _test_gen_vectors_3g_only__expect_vecs() instead */ - _test_gen_vectors_3g_only__expect_vecs__WRONG(vecs); + _test_gen_vectors_3g_only__expect_vecs(vecs); comment_end(); } diff --git a/tests/auc/auc_3g_test.err b/tests/auc/auc_3g_test.err index e8e6f03..aff96c9 100644 --- a/tests/auc/auc_3g_test.err +++ b/tests/auc/auc_3g_test.err @@ -176,10 +176,8 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: resync: auts = 979498b1f72d3e28c59fa2e72f9c -DAUC vector [1]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [1]: resync: sqn = 24 -DAUC vector [1]: autn = 79a5113eb0900000f7e138537aa0962b +DAUC vector [1]: sqn = 25 +DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 DAUC vector [1]: res = 43023475cb29292c0000000000000000 @@ -188,10 +186,8 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: resync: auts = 979498b1f72d3e28c59fa2e72f9c -DAUC vector [2]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [2]: resync: sqn = 24 -DAUC vector [2]: autn = 24b018d46c390000d88e11730d0367ac +DAUC vector [2]: sqn = 26 +DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 DAUC vector [2]: res = 010cab11cc63a6e40000000000000000 @@ -199,8 +195,6 @@ DAUC vector [2]: kc = f0eaf8cb19e0758d DAUC vector [2]: sres = cd6f0df5 DAUC vector [2]: auth_types = 0x3 -THERE IS A BUG AND THE TEST PASSES THE WRONG VECTORS UNTIL THAT IS FIXED -The SQN should increment with each new vector. [0]: vector matches expectations [1]: vector matches expectations [2]: vector matches expectations -- To view, visit https://gerrit.osmocom.org/1870 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I425a1d92c85896227341f565f5361c0d830ce866 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:39:32 2017 From: gerrit-no-reply at lists.osmocom.org (Keith Whyte) Date: Wed, 1 Mar 2017 12:39:32 +0000 Subject: openbsc[master]: meas_json: fix NEIGH: missing array braces In-Reply-To: References: Message-ID: Patch Set 4: > would be great to get Alexanders' input, but he cannot be added, > i.e. it seems he has no gerrit account? He's in the known users list. account was added July 2016. -- To view, visit https://gerrit.osmocom.org/1916 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I42029f40bf357adbb2f3c71cdcbafbc21090e348 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Keith Whyte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Keith Whyte Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:40:21 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:40:21 +0000 Subject: [PATCH] openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1858 to look at the new patch set (#2). subscriber conn: add indicator for originating RAN Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but also for libvlr to decide between GSM or UMTS Auth. Until actual Iu support is merged to master, this indicator will aid VLR unit testing. Change-Id: I93b870522f725170e4265a5543f6b680383d7465 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_api.c 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/58/1858/2 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a14e59f..50bb556 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -106,6 +106,12 @@ uint8_t last_seen_nr; }; +enum ran_type { + RAN_UNKNOWN, + RAN_GERAN, /* 2G / A-interface */ + RAN_UTRAN /* 3G / Iu-interface (IuCS or IuPS) */ +}; + /* active radio connection of a mobile subscriber */ struct gsm_subscriber_connection { struct llist_head entry; @@ -148,6 +154,8 @@ struct osmo_timer_list T10; /* BSC */ struct gsm_lchan *secondary_lchan; /* BSC */ + /* connected via 2G or 3G? */ + enum ran_type via_ran; }; diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 7a48296..5b01d69 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -251,6 +251,7 @@ conn->network = net; conn->lchan = lchan; conn->bts = lchan->ts->trx->bts; + conn->via_ran = RAN_GERAN; lchan->conn = conn; llist_add_tail(&conn->entry, &net->subscr_conns); return conn; -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 1 12:49:49 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 12:49:49 +0000 Subject: libosmocore[master]: Use value_string for ctrl_type In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1895/2/src/ctrl/control_cmd.c File src/ctrl/control_cmd.c: Line 49: { CTRL_TYPE_UNKNOWN, NULL } 2 things: have you tested that having NULL in here works? AFAIK this would be the first time that we store NULL as value in a value string. Should probably be verified in a unit test... missing termination with {0, NULL}: get_value_string() and get_string_value() don't know where the array ends. -- To view, visit https://gerrit.osmocom.org/1895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:00:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:00:11 +0000 Subject: [PATCH] libosmocore[master]: contrib: add script to find unterminated value_string arrays Message-ID: Review at https://gerrit.osmocom.org/1940 contrib: add script to find unterminated value_string arrays Unterminated value_string arrays are dangerous since get_value_string() and get_string_value() need to know where the struct ends. If the terminator is missing, they might run through and return arbitrary memory locations. Employ some regexes to find such unterminated value string arrays and return nonzero if any are found. This can be used in our jenkins build jobs to avoid committing unterminated value_string arrays. In fact I've found one in current libosmocore: gsm0808_bssap_names in gsm/gsm0808.c, fixed in a separate patch. Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- A contrib/verify_value_string_arrays_are_terminated.py 1 file changed, 34 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/1940/1 diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..51c0bd4 --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(open(f).read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:00:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:00:11 +0000 Subject: [PATCH] libosmocore[master]: fix: gsm0808.c: unterminated value_string array gsm0808_bssa... Message-ID: Review at https://gerrit.osmocom.org/1941 fix: gsm0808.c: unterminated value_string array gsm0808_bssap_names Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8 --- M src/gsm/gsm0808.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/1941/1 diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..de80006 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -540,6 +540,7 @@ static const struct value_string gsm0808_bssap_names[] = { { BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" }, { BSSAP_MSG_DTAP, "DTAP" }, + { 0, NULL } }; const char *gsm0808_bssap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1941 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:01:45 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:01:45 +0000 Subject: [PATCH] openbsc[master]: fix: gprs_gmm, gprs_llc_vty: two unterminated value_string a... Message-ID: Review at https://gerrit.osmocom.org/1942 fix: gprs_gmm, gprs_llc_vty: two unterminated value_string arrays Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84 --- M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc_vty.c 2 files changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/42/1942/1 diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 3f59a2b..ce9faae 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -115,6 +115,7 @@ { MM_IDLE, "MM IDLE" }, { MM_READY, "MM READY" }, { MM_STANDBY, "MM STANDBY" }, + { 0, NULL } }; static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx); diff --git a/openbsc/src/gprs/gprs_llc_vty.c b/openbsc/src/gprs/gprs_llc_vty.c index e97416b..bf34e97 100644 --- a/openbsc/src/gprs/gprs_llc_vty.c +++ b/openbsc/src/gprs/gprs_llc_vty.c @@ -48,6 +48,7 @@ { GPRS_LLES_ABM, "Asynchronous Balanced Mode" }, { GPRS_LLES_LOCAL_REL, "Local Release" }, { GPRS_LLES_TIMER_REC, "Timer Recovery" }, + { 0, NULL } }; static void vty_dump_lle(struct vty *vty, struct gprs_llc_lle *lle) -- To view, visit https://gerrit.osmocom.org/1942 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:09:58 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:09:58 +0000 Subject: [PATCH] libosmocore[master]: NOT FOR MERGE: check whether new jenkins value_string check ... Message-ID: Review at https://gerrit.osmocom.org/1943 NOT FOR MERGE: check whether new jenkins value_string check works Change-Id: I3c84c17b9e4dc89f8ee0837c93dbb66a85e89f58 --- M contrib/jenkins.sh A contrib/verify_value_string_arrays_are_terminated.py 2 files changed, 36 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/43/1943/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..51c0bd4 --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(open(f).read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) -- To view, visit https://gerrit.osmocom.org/1943 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3c84c17b9e4dc89f8ee0837c93dbb66a85e89f58 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:11:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:11:48 +0000 Subject: [PATCH] libosmocore[master]: NOT FOR MERGE: jenkins: check whether value_string check works Message-ID: Review at https://gerrit.osmocom.org/1944 NOT FOR MERGE: jenkins: check whether value_string check works this one should pass, it includes the array's missing terminator Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 --- M contrib/jenkins.sh A contrib/verify_value_string_arrays_are_terminated.py M src/gsm/gsm0808.c 3 files changed, 37 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/1944/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..51c0bd4 --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(open(f).read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..de80006 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -540,6 +540,7 @@ static const struct value_string gsm0808_bssap_names[] = { { BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" }, { BSSAP_MSG_DTAP, "DTAP" }, + { 0, NULL } }; const char *gsm0808_bssap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1944 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:12:58 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:12:58 +0000 Subject: [ABANDON] libosmocore[master]: NOT FOR MERGE: check whether new jenkins value_string check ... In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: NOT FOR MERGE: check whether new jenkins value_string check works ...................................................................... Abandoned test was successful, don't need this anymore -- To view, visit https://gerrit.osmocom.org/1943 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I3c84c17b9e4dc89f8ee0837c93dbb66a85e89f58 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:16:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:16:26 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 needs explicit python2 or python3 for our freebsd build slave -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:16:55 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:16:55 +0000 Subject: [PATCH] libosmocore[master]: NOT FOR MERGE: jenkins: check whether value_string check works In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1944 to look at the new patch set (#2). NOT FOR MERGE: jenkins: check whether value_string check works this one should pass, it includes the array's missing terminator Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 --- M contrib/jenkins.sh A contrib/verify_value_string_arrays_are_terminated.py M src/gsm/gsm0808.c 3 files changed, 37 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/1944/2 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..1d36c4e --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(open(f).read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..de80006 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -540,6 +540,7 @@ static const struct value_string gsm0808_bssap_names[] = { { BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" }, { BSSAP_MSG_DTAP, "DTAP" }, + { 0, NULL } }; const char *gsm0808_bssap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1944 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:20:50 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:20:50 +0000 Subject: [PATCH] libosmocore[master]: NOT FOR MERGE: jenkins: check whether value_string check works In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1944 to look at the new patch set (#3). NOT FOR MERGE: jenkins: check whether value_string check works this one should pass, it includes the array's missing terminator Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 --- M contrib/jenkins.sh A contrib/verify_value_string_arrays_are_terminated.py M src/gsm/gsm0808.c 3 files changed, 39 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/1944/3 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..790e71f --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys + +sys.setdefaultencoding('utf-8') + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(open(f).read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..de80006 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -540,6 +540,7 @@ static const struct value_string gsm0808_bssap_names[] = { { BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" }, { BSSAP_MSG_DTAP, "DTAP" }, + { 0, NULL } }; const char *gsm0808_bssap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1944 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:24:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:24:52 +0000 Subject: [PATCH] libosmocore[master]: NOT FOR MERGE: jenkins: check whether value_string check works In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1944 to look at the new patch set (#4). NOT FOR MERGE: jenkins: check whether value_string check works this one should pass, it includes the array's missing terminator Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 --- M contrib/jenkins.sh A contrib/verify_value_string_arrays_are_terminated.py M src/gsm/gsm0808.c 3 files changed, 38 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/1944/4 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..13c609e --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys +import codecs + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..de80006 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -540,6 +540,7 @@ static const struct value_string gsm0808_bssap_names[] = { { BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" }, { BSSAP_MSG_DTAP, "DTAP" }, + { 0, NULL } }; const char *gsm0808_bssap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1944 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:26:45 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:26:45 +0000 Subject: [PATCH] libosmocore[master]: NOT FOR MERGE: jenkins: check whether value_string check works In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1944 to look at the new patch set (#5). NOT FOR MERGE: jenkins: check whether value_string check works this one should FAIL, two terminators were removed Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 --- M contrib/jenkins.sh A contrib/verify_value_string_arrays_are_terminated.py M src/gsm/gsm0808.c 3 files changed, 37 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/1944/5 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..13c609e --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys +import codecs + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..b7c4895 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -529,7 +529,6 @@ { BSS_MAP_MSG_LCLS_CONNECT_CTRL_ACK, "CLS-CONNECT-CONTROL-ACK" }, { BSS_MAP_MSG_LCLS_NOTIFICATION, "LCLS-NOTIFICATION" }, - { 0, NULL } }; const char *gsm0808_bssmap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1944 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:27:36 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:27:36 +0000 Subject: [ABANDON] libosmocore[master]: NOT FOR MERGE: jenkins: check whether value_string check works In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: NOT FOR MERGE: jenkins: check whether value_string check works ...................................................................... Abandoned all tests succeeded now, not needed anymore -- To view, visit https://gerrit.osmocom.org/1944 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:28:32 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:28:32 +0000 Subject: [PATCH] libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1940 to look at the new patch set (#2). contrib: add script to find unterminated value_string arrays Unterminated value_string arrays are dangerous since get_value_string() and get_string_value() need to know where the struct ends. If the terminator is missing, they might run through and return arbitrary memory locations. Employ some regexes to find such unterminated value string arrays and return nonzero if any are found. This can be used in our jenkins build jobs to avoid committing unterminated value_string arrays. In fact I've found one in current libosmocore: gsm0808_bssap_names in gsm/gsm0808.c, fixed in a separate patch. Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- A contrib/verify_value_string_arrays_are_terminated.py 1 file changed, 35 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/1940/2 diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..13c609e --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys +import codecs + +ws = r'\s*' + '\n' + r'*\s*' + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)' + ws + '=' + ws + ')?' +terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ',' + + ws + members + '(0|NULL)' + ws + '}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:28:33 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:28:33 +0000 Subject: [PATCH] libosmocore[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1945 jenkins: add value_string termination check Change-Id: I7fe3678b524d602fc6aa14bc0ed06308df809a3e --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/1945/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ -- To view, visit https://gerrit.osmocom.org/1945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7fe3678b524d602fc6aa14bc0ed06308df809a3e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:29:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:29:37 +0000 Subject: [PATCH] openbsc[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1946 jenkins: add value_string termination check Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 Change-Id: I4183415cd1ead9d46ae3a556e94243325ef5a844 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/46/1946/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 7ad4ee6..08e16b9 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1946 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4183415cd1ead9d46ae3a556e94243325ef5a844 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:36:56 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:36:56 +0000 Subject: [PATCH] libosmo-abis[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1947 jenkins: add value_string termination check Change-Id: I37c14c1a18207f64aa5e15ec0d2503bc834b2627 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/47/1947/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 2ca3f46..f1019e4 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1947 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I37c14c1a18207f64aa5e15ec0d2503bc834b2627 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:38:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:38:59 +0000 Subject: [PATCH] libosmo-netif[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1948 jenkins: add value_string termination check Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/48/1948/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 9a37ca5..2fce993 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1948 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:39:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:39:48 +0000 Subject: [PATCH] libosmo-sccp[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1949 jenkins: add value_string termination check Change-Id: Ic06cb58061ba2d5698dd80df9777b9d3a825d5f7 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/49/1949/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 33045d8..668a58b 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1949 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic06cb58061ba2d5698dd80df9777b9d3a825d5f7 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:40:23 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:40:23 +0000 Subject: [PATCH] openggsn[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1950 jenkins: add value_string termination check Change-Id: I7c676debcdfef2471004deb9ef5a63e8f4e97e15 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/50/1950/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index b8d4373..30416b2 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,9 @@ $MAKE $PARALLEL_MAKE install cd ../../ + +deps/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig:$PKG_CONFIG_PATH ./configure PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig:$PKG_CONFIG_PATH $MAKE $PARALLEL_MAKE -- To view, visit https://gerrit.osmocom.org/1950 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c676debcdfef2471004deb9ef5a63e8f4e97e15 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:41:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:41:11 +0000 Subject: [PATCH] osmo-bts[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1951 jenkins: add value_string termination check Change-Id: Id4eb92924c03748563921e3f56cc0e5e0ffff502 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins_bts_trx.sh M contrib/jenkins_oct.sh M contrib/jenkins_oct_and_bts_trx.sh M contrib/jenkins_sysmobts.sh 4 files changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/51/1951/1 diff --git a/contrib/jenkins_bts_trx.sh b/contrib/jenkins_bts_trx.sh index c4f05a9..dbd41ca 100755 --- a/contrib/jenkins_bts_trx.sh +++ b/contrib/jenkins_bts_trx.sh @@ -14,6 +14,9 @@ export LD_LIBRARY_PATH="$inst/lib" osmo-build-dep.sh libosmocore + +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + osmo-build-dep.sh libosmo-abis cd "$deps" diff --git a/contrib/jenkins_oct.sh b/contrib/jenkins_oct.sh index 4fecd0a..9f06888 100755 --- a/contrib/jenkins_oct.sh +++ b/contrib/jenkins_oct.sh @@ -19,6 +19,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" diff --git a/contrib/jenkins_oct_and_bts_trx.sh b/contrib/jenkins_oct_and_bts_trx.sh index 0740bd0..93aa47a 100755 --- a/contrib/jenkins_oct_and_bts_trx.sh +++ b/contrib/jenkins_oct_and_bts_trx.sh @@ -14,6 +14,9 @@ export LD_LIBRARY_PATH="$inst/lib" osmo-build-dep.sh libosmocore + +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + osmo-build-dep.sh libosmo-abis cd "$deps" diff --git a/contrib/jenkins_sysmobts.sh b/contrib/jenkins_sysmobts.sh index be544a7..c6f109d 100755 --- a/contrib/jenkins_sysmobts.sh +++ b/contrib/jenkins_sysmobts.sh @@ -19,6 +19,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1951 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id4eb92924c03748563921e3f56cc0e5e0ffff502 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:41:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:41:34 +0000 Subject: [PATCH] osmo-hlr[master]: fix: properly handle error rc by osmo_gsup_conn_ccm_get() Message-ID: Review at https://gerrit.osmocom.org/1952 fix: properly handle error rc by osmo_gsup_conn_ccm_get() Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26 --- M src/gsup_server.c 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/52/1952/1 diff --git a/src/gsup_server.c b/src/gsup_server.c index ea51f7d..1a1cd6c 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -185,9 +185,14 @@ osmo_tlvp_dump(tlvp, DLGSUP, LOGL_INFO); addr_len = osmo_gsup_conn_ccm_get(clnt, &addr, IPAC_IDTAG_SERNR); - if (addr_len) - gsup_route_add(clnt, addr, addr_len); + if (addr_len <= 0) { + LOGP(DLGSUP, LOGL_ERROR, "GSUP client %s:%u has no" + " IDTAG_SERNR IE and cannot be routed\n", + conn->addr, conn->port); + return -EINVAL; + } + gsup_route_add(clnt, addr, addr_len); return 0; } -- To view, visit https://gerrit.osmocom.org/1952 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:41:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:41:34 +0000 Subject: [PATCH] osmo-hlr[master]: RFC: add the osmo_gsup_conn directly to the lu_operation if ... Message-ID: Review at https://gerrit.osmocom.org/1953 RFC: add the osmo_gsup_conn directly to the lu_operation if known Change-Id: I427b8e5ed2a6ce82231fe7e05d1b47e9f057d9cc --- M src/luop.c M src/luop.h 2 files changed, 26 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/53/1953/1 diff --git a/src/luop.c b/src/luop.c index ecf31b4..b0028da 100644 --- a/src/luop.c +++ b/src/luop.c @@ -54,9 +54,14 @@ msg_out = msgb_alloc_headroom(1024+16, 16, "GSUP LUOP"); osmo_gsup_encode(msg_out, gsup); - osmo_gsup_addr_send(luop->gsup_server, luop->peer, - talloc_total_size(luop->peer), - msg_out); + if (luop->conn) + osmo_gsup_addr_send_direct(luop->gsup_server, + luop->conn, + msg_out); + else + osmo_gsup_addr_send(luop->gsup_server, luop->peer, + talloc_total_size(luop->peer), + msg_out); } static inline void fill_gsup_msg(struct osmo_gsup_message *out, @@ -123,6 +128,7 @@ return NULL; luop->peer = talloc_memdup(luop, peer_addr, rc); + luop->conn = conn; return luop; } @@ -166,6 +172,17 @@ return -ENODEV; } + return osmo_gsup_addr_send_direct(gs, conn, msg); +} + +int osmo_gsup_addr_send_direct(struct osmo_gsup_server *gs, + struct osmo_gsup_conn *conn, struct msgb *msg) +{ + OSMO_ASSERT(conn); + DEBUGP(DMAIN, "Tx to peer %s:%u msg %s\n", + conn->conn->addr, conn->conn->port, + osmo_hexdump_nospc(msg->data, msg->len)); + return osmo_gsup_conn_send(conn, msg); } diff --git a/src/luop.h b/src/luop.h index 7e2fbb0..659a09d 100644 --- a/src/luop.h +++ b/src/luop.h @@ -60,12 +60,18 @@ struct hlr_subscriber subscr; /*! peer VLR/SGSN starting the request */ uint8_t *peer; + + /*! peer, if we already know it */ + struct osmo_gsup_conn *conn; }; int osmo_gsup_addr_send(struct osmo_gsup_server *gs, const uint8_t *addr, size_t addrlen, struct msgb *msg); +int osmo_gsup_addr_send_direct(struct osmo_gsup_server *gs, + struct osmo_gsup_conn *conn, struct msgb *msg); + struct lu_operation *lu_op_alloc(struct osmo_gsup_server *srv); struct lu_operation *lu_op_alloc_conn(struct osmo_gsup_conn *conn); void lu_op_statechg(struct lu_operation *luop, enum lu_state new_state); -- To view, visit https://gerrit.osmocom.org/1953 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I427b8e5ed2a6ce82231fe7e05d1b47e9f057d9cc Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:41:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:41:34 +0000 Subject: [PATCH] osmo-hlr[master]: logging Message-ID: Review at https://gerrit.osmocom.org/1954 logging Change-Id: I0ffbfa8d32dce19133c71389b78833713c60b923 --- M src/gsup_router.c M src/hlr.c M src/luop.c 3 files changed, 20 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/54/1954/1 diff --git a/src/gsup_router.c b/src/gsup_router.c index e9aed78..fbc22fc 100644 --- a/src/gsup_router.c +++ b/src/gsup_router.c @@ -22,8 +22,10 @@ #include #include +#include #include "gsup_server.h" +#include "logging.h" struct gsup_route { struct llist_head list; @@ -40,8 +42,11 @@ llist_for_each_entry(gr, &gs->routes, list) { if (talloc_total_size(gr->addr) == addrlen && - !memcmp(gr->addr, addr, addrlen)) + !memcmp(gr->addr, addr, addrlen)) { + DEBUGP(DMAIN, "Found route to addr %s: %s:%u\n", + addr, gr->conn->conn->addr, gr->conn->conn->port); return gr->conn; + } } return NULL; } @@ -64,6 +69,9 @@ gr->conn = conn; llist_add_tail(&gr->list, &conn->server->routes); + DEBUGP(DMAIN, "New GSUP route: addr %s to %s:%u\n", + gr->addr, gr->conn->conn->addr, gr->conn->conn->port); + return 0; } @@ -80,6 +88,8 @@ num_deleted++; } } + DEBUGP(DMAIN, "Deleted all %u GSUP routes to %s:%u\n", + num_deleted, conn->conn->addr, conn->conn->port); return num_deleted; } diff --git a/src/hlr.c b/src/hlr.c index d74d9fb..98baf7e 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -143,6 +143,7 @@ const struct osmo_gsup_message *gsup) { struct lu_operation *luop = lu_op_alloc_conn(conn); + DEBUGP(DMAIN, "%s: Rx Update Location Request\n", gsup->imsi); if (!luop) { LOGP(DMAIN, LOGL_ERROR, "LU REQ from conn without addr?\n"); return -EINVAL; @@ -244,6 +245,10 @@ return rc; } + DEBUGP(DMAIN, "Rx from %s:%u msg %s\n", + conn->conn->addr, conn->conn->port, + osmo_hexdump_nospc(msg->data, msg->len)); + switch (gsup.message_type) { /* requests sent to us */ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST: diff --git a/src/luop.c b/src/luop.c index b0028da..e3126cd 100644 --- a/src/luop.c +++ b/src/luop.c @@ -54,6 +54,8 @@ msg_out = msgb_alloc_headroom(1024+16, 16, "GSUP LUOP"); osmo_gsup_encode(msg_out, gsup); + DEBUGP(DMAIN, "%s: Tx %s\n", + gsup->imsi, osmo_gsup_message_type_name(gsup->message_type)); if (luop->conn) osmo_gsup_addr_send_direct(luop->gsup_server, luop->conn, @@ -167,7 +169,8 @@ conn = gsup_route_find(gs, addr, addrlen); if (!conn) { - DEBUGP(DMAIN, "Cannot find route for addr %s\n", addr); + LOGP(DMAIN, LOGL_INFO, "Cannot find route for addr %s\n", + addr); msgb_free(msg); return -ENODEV; } -- To view, visit https://gerrit.osmocom.org/1954 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0ffbfa8d32dce19133c71389b78833713c60b923 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:41:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:41:34 +0000 Subject: [PATCH] osmo-hlr[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1955 jenkins: add value_string termination check Change-Id: I8cf15d898ef274c505cda0a6b8ddcbf01ba190d9 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/55/1955/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index c9cab3b..f2c9cbb 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -14,6 +14,9 @@ export LD_LIBRARY_PATH="$inst/lib" osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false + +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + osmo-build-dep.sh libosmo-abis set +x -- To view, visit https://gerrit.osmocom.org/1955 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cf15d898ef274c505cda0a6b8ddcbf01ba190d9 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:43:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:43:30 +0000 Subject: [ABANDON] osmo-hlr[master]: RFC: add the osmo_gsup_conn directly to the lu_operation if ... In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: RFC: add the osmo_gsup_conn directly to the lu_operation if known ...................................................................... Abandoned pushed by accident -- To view, visit https://gerrit.osmocom.org/1953 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I427b8e5ed2a6ce82231fe7e05d1b47e9f057d9cc Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:43:38 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:43:38 +0000 Subject: [ABANDON] osmo-hlr[master]: logging In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: logging ...................................................................... Abandoned pushed by accident -- To view, visit https://gerrit.osmocom.org/1954 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I0ffbfa8d32dce19133c71389b78833713c60b923 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:45:10 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:45:10 +0000 Subject: [PATCH] osmo-iuh[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1956 jenkins: add value_string termination check Change-Id: I54ede7b120953c233c0e10cc88e9fd448c961308 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/56/1956/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 770575e..06f170b 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1956 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I54ede7b120953c233c0e10cc88e9fd448c961308 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:45:36 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:45:36 +0000 Subject: [PATCH] osmo-sip-connector[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1957 jenkins: add value_string termination check Change-Id: Ic247005aeeabdf349caf48657af0249da8c8d9ea Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/57/1957/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 588634e..1e028f1 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1957 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic247005aeeabdf349caf48657af0249da8c8d9ea Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 14:48:47 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 14:48:47 +0000 Subject: [PATCH] osmo-pcu[master]: jenkins: add value_string termination check Message-ID: Review at https://gerrit.osmocom.org/1958 jenkins: add value_string termination check Change-Id: I27217c9162efd800eebcb403eab770f4528d21ac Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/58/1958/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index fb0fb2f..8a96380 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -52,6 +52,8 @@ # Build deps osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1958 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I27217c9162efd800eebcb403eab770f4528d21ac Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 15:12:27 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 15:12:27 +0000 Subject: [PATCH] libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1940 to look at the new patch set (#3). contrib: add script to find unterminated value_string arrays Unterminated value_string arrays are dangerous since get_value_string() and get_string_value() need to know where the struct ends. If the terminator is missing, they might run through and return arbitrary memory locations. Employ some regexes to find such unterminated value string arrays and return nonzero if any are found. This can be used in our jenkins build jobs to avoid committing unterminated value_string arrays. In fact I've found one in current libosmocore: gsm0808_bssap_names in gsm/gsm0808.c, fixed in a separate patch. Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- A contrib/verify_value_string_arrays_are_terminated.py 1 file changed, 33 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/1940/3 diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..020bb4d --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys +import codecs + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)\s*=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)\s*=\s*)?' +terminator_re = re.compile('{\s*' + members + '(0|NULL)\s*,' + '\s*' + members + '(0|NULL)\s*}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 15:37:13 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 15:37:13 +0000 Subject: [PATCH] openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1875 to look at the new patch set (#6). Add simple CTRL2SOAP proxy Add python client which converts TRAP messages into SOAP requests and perform corresponding actions. It can be used as follows ./soap.py -d -w http://example.com/soapservice/htdocs/wsdl/test.wsdl See ./soap.py -h for additional options. Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Related: SYS#3028 --- A openbsc/contrib/soap.py 1 file changed, 182 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/75/1875/6 diff --git a/openbsc/contrib/soap.py b/openbsc/contrib/soap.py new file mode 100755 index 0000000..8d3e131 --- /dev/null +++ b/openbsc/contrib/soap.py @@ -0,0 +1,182 @@ +#!/usr/bin/python3 +# -*- mode: python-mode; py-indent-tabs-mode: nil -*- +""" +/* + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +""" + +from twisted.internet import defer, reactor +from twisted_ipa import CTRL, IPAFactory +from ipa import Ctrl +from treq import post, collect +from suds.client import Client +from functools import partial +import argparse, datetime, signal, sys, os + + +version = "v0.5" # bump this on every non-trivial change + +# keys from OpenBSC openbsc/src/libbsc/bsc_rf_ctrl.c, values SOAP-specific +oper = { 'inoperational' : 0, 'operational' : 1 } +admin = { 'locked' : 0, 'unlocked' : 1 } +policy = { 'off' : 0, 'on' : 1, 'grace' : 2, 'unknown' : 3 } + +# keys from OpenBSC openbsc/src/libbsc/bsc_vty.c +fix = { 'invalid' : 0, 'fix2d' : 1, 'fix3d' : 1 } # SOAP server treats it as boolean but expects int + + +def handle_reply(p, f, v, r): + """ + Reply handler: takes function p to process raw SOAP server reply r, function f to run for each command and verbosity flag v + """ + repl = p(r) # result is expected to have both commands[] array and error string (could be None) + bsc_id = repl.commands[0].split()[0].split('.')[3] # we expect 1st command to have net.0.bsc.666.bts.2.trx.1 location prefix format + print("Received SOAP response for BSC %s with %d commands, error status: %s" % (bsc_id, len(repl.commands), repl.error)) + if v: + print("BSC %s commands: %s" % (bsc_id, repl.commands)) + for t in repl.commands: # Process OpenBscCommands format from .wsdl + (_, m) = Ctrl().cmd(*t.split()) + f(m) + + +class Trap(CTRL): + """ + TRAP handler (agnostic to factory's client object) + """ + def ctrl_TRAP(self, data, op_id, v): + """ + Parse CTRL TRAP and dispatch to appropriate handler after normalization + """ + (l, r) = v.split() + loc = l.split('.') + t_type = loc[-1] + p = partial(lambda a, i: a[i] if len(a) > i else None, loc) # parse helper + method = getattr(self, 'handle_' + t_type.replace('-', ''), lambda: "Unhandled %s trap" % t_type) + method(p(1), p(3), p(5), p(7), r) # we expect net.0.bsc.666.bts.2.trx.1 format for trap prefix + + def ctrl_SET_REPLY(self, data, _, v): + """ + Debug log for replies to our commands + """ + if self.factory.debug: + print('SET REPLY %s' % v) + + def ctrl_ERROR(self, data, op_id, v): + """ + We want to know if smth went wrong + """ + if self.factory.debug: + print('CTRL ERROR [%s] %s' % (op_id, v)) + + def dbg(*_): + """ + Turn off debug print from lower layers as it's too verbose + """ + pass + + def connectionMade(self): + """ + Logging wrapper, calling super() is necessary not to break reconnection logic + """ + print("Connected to CTRL@%s:%d" % (self.factory.host, self.factory.port)) + super(CTRL, self).connectionMade() + + @defer.inlineCallbacks + def handle_locationstate(self, net, bsc, bts, trx, data): + """ + Handle location-state TRAP: parse trap content, build SOAP context and use treq's routines to post it while setting up async handlers + """ + (ts, fx, lat, lon, height, opr, adm, pol, mcc, mnc) = data.split(',') + tstamp = datetime.datetime.fromtimestamp(float(ts)).isoformat() + if self.factory.debug: + print('location-state@%s.%s.%s.%s (%s) [%s/%s] => %s' % (net, bsc, bts, trx, tstamp, mcc, mnc, data)) + ctx = self.factory.client.registerSiteLocation(bsc, float(lon), float(lat), fix.get(fx, 0), tstamp, oper.get(opr, 2), admin.get(adm, 2), policy.get(pol, 3)) + d = post(self.factory.location, ctx.envelope) + d.addCallback(collect, partial(handle_reply, ctx.process_reply, self.transport.write, self.factory.debug)) # treq's collect helper is handy to get all reply content at once using closure on ctx + d.addErrback(lambda e, bsc: print("HTTP POST error %s while trying to register BSC %s" % (e, bsc)), bsc) # handle HTTP errors + # Ensure that we run only limited number of requests in parallel: + yield self.factory.semaphore.acquire() + yield d # we end up here only if semaphore is available which means it's ok to fire the request without exceeding the limit + self.factory.semaphore.release() + + def handle_notificationrejectionv1(self, net, bsc, bts, trx, data): + """ + Handle notification-rejection-v1 TRAP: just an example to show how more message types can be handled + """ + if self.factory.debug: + print('notification-rejection-v1 at bsc-id %s => %s' % (bsc, data)) + + +class TrapFactory(IPAFactory): + """ + Store SOAP client object so TRAP handler can use it for requests + """ + location = None + semaphore = None + client = None + host = None + port = None + debug = None + def __init__(self, host, port, proto, semaphore, debug=False, wsdl=None, location=None): + self.host = host # for logging only, + self.port = port # seems to be no way to get it from ReconnectingClientFactory + self.debug = debug + self.semaphore = semaphore + soap = Client(wsdl, location=location, nosend=True) # make async SOAP client + self.location = location.encode() if location else soap.wsdl.services[0].ports[0].location # necessary for dispatching HTTP POST via treq + self.client = soap.service + if debug: + print("Using IPA %s, SUDS client: %s" % (Ctrl.version, soap)) + super(TrapFactory, self).__init__(proto, debug) + + +def reloader(path, script, dbg, signum, _): + """ + Signal handler: we have to use execl() because twisted's reactor is not restartable due to some bug in twisted implementation + """ + print("Received Signal %s - restarting..." % signal.Signals(signum).name) + if signum == signal.SIGUSR1 and dbg not in sys.argv: + sys.argv.append(dbg) # enforce debug + if signum == signal.SIGUSR2 and dbg in sys.argv: + sys.argv.remove(dbg) # disable debug + os.execl(path, script, *sys.argv[1:]) + + +if __name__ == '__main__': + p = argparse.ArgumentParser() + p.add_argument('-v', '--version', action='version', version=("%(prog)s " + version)) + p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface, defaults to 4250") + p.add_argument('-c', '--ctrl', default='localhost', help="Adress to use for CTRL interface, defaults to localhost") + p.add_argument('-w', '--wsdl', required=True, help="WSDL URL for SOAP") + p.add_argument('-n', '--num', type=int, default=5, help="Max number of concurrent HTTP requests to SOAP server") + p.add_argument('-d', '--debug', action='store_true', help="Enable debug log") + p.add_argument('-l', '--location', help="Override location found in WSDL file (don't use unless you know what you're doing)") + args = p.parse_args() + fl = os.path.basename(__file__) + + reboot = partial(reloader, os.getcwd() + '/' + fl, fl, '-d') + signal.signal(signal.SIGHUP, reboot) + signal.signal(signal.SIGQUIT, reboot) + signal.signal(signal.SIGUSR1, reboot) # restart and enabled debug output + signal.signal(signal.SIGUSR2, reboot) # restart and disable debug output + + print("SOAP proxy %s starting with PID %d ..." % (version, os.getpid())) + reactor.connectTCP(args.ctrl, args.port, TrapFactory(args.ctrl, args.port, Trap, defer.DeferredSemaphore(args.num), args.debug, args.wsdl, args.location)) + reactor.run() -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:19:15 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:19:15 +0000 Subject: [PATCH] libosmocore[master]: Use value_string for ctrl_type In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1895 to look at the new patch set (#3). Use value_string for ctrl_type Use value_string for enum ctrl_type instead of custom code. Add corresponding unit tests. Related: OS#1615 Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 --- M .gitignore M include/osmocom/ctrl/control_cmd.h M src/ctrl/control_cmd.c M tests/Makefile.am A tests/ctrl/ctrl_test.c A tests/ctrl/ctrl_test.ok M tests/testsuite.at 7 files changed, 74 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/1895/3 diff --git a/.gitignore b/.gitignore index ad8354e..48642ca 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ tests/testsuite tests/testsuite.dir/ tests/testsuite.log - +tests/ctrl/ctrl_test tests/utils/utils_test tests/stats/stats_test tests/kasumi/kasumi_test diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index a63557d..d82c9af 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -4,7 +4,7 @@ #include #include #include - +#include #include #define CTRL_CMD_ERROR -1 @@ -22,7 +22,7 @@ }; enum ctrl_type { - CTRL_TYPE_UNKNOWN, + CTRL_TYPE_UNKNOWN = 0, CTRL_TYPE_GET, CTRL_TYPE_SET, CTRL_TYPE_GET_REPLY, @@ -31,6 +31,8 @@ CTRL_TYPE_ERROR }; +extern const struct value_string ctrl_type_vals[]; + struct ctrl_connection { struct llist_head list_entry; diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 2cf66cf..1cc8247 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -33,41 +33,21 @@ #include #include - +#include #include #include extern vector ctrl_node_vec; -static struct ctrl_cmd_map ccm[] = { - {"GET", CTRL_TYPE_GET}, - {"SET", CTRL_TYPE_SET}, - {"GET_REPLY", CTRL_TYPE_GET_REPLY}, - {"SET_REPLY", CTRL_TYPE_SET_REPLY}, - {"TRAP", CTRL_TYPE_TRAP}, - {"ERROR", CTRL_TYPE_ERROR}, - {NULL} +const struct value_string ctrl_type_vals[] = { + { CTRL_TYPE_GET, "GET" }, + { CTRL_TYPE_SET, "SET" }, + { CTRL_TYPE_GET_REPLY, "GET_REPLY" }, + { CTRL_TYPE_SET_REPLY, "SET_REPLY" }, + { CTRL_TYPE_TRAP, "TRAP" }, + { CTRL_TYPE_ERROR, "ERROR" }, + { CTRL_TYPE_UNKNOWN, NULL } }; - -static int ctrl_cmd_str2type(char *s) -{ - int i; - for (i=0; ccm[i].cmd != NULL; i++) { - if (strcasecmp(s, ccm[i].cmd) == 0) - return ccm[i].type; - } - return CTRL_TYPE_UNKNOWN; -} - -static char *ctrl_cmd_type2str(int type) -{ - int i; - for (i=0; ccm[i].cmd != NULL; i++) { - if (ccm[i].type == type) - return ccm[i].cmd; - } - return NULL; -} /* Functions from libosmocom */ extern vector cmd_make_descvec(const char *string, const char *descstr); @@ -308,7 +288,7 @@ goto err; } - cmd->type = ctrl_cmd_str2type(tmp); + cmd->type = get_string_value(ctrl_type_vals, tmp); if (cmd->type == CTRL_TYPE_UNKNOWN) { cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; @@ -403,7 +383,8 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd) { struct msgb *msg; - char *type, *tmp; + const char *type; + char *tmp; if (!cmd->id) return NULL; @@ -412,7 +393,7 @@ if (!msg) return NULL; - type = ctrl_cmd_type2str(cmd->type); + type = get_value_string(ctrl_type_vals, cmd->type); switch (cmd->type) { case CTRL_TYPE_GET: diff --git a/tests/Makefile.am b/tests/Makefile.am index f6d4db3..35b9150 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -11,7 +11,7 @@ logging/logging_test fr/fr_test codec/codec_test \ loggingrb/loggingrb_test strrb/strrb_test \ vty/vty_test comp128/comp128_test utils/utils_test \ - smscb/gsm0341_test stats/stats_test \ + smscb/gsm0341_test stats/stats_test ctrl/ctrl_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test socket/socket_test @@ -41,6 +41,9 @@ auth_milenage_test_SOURCES = auth/milenage_test.c auth_milenage_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la + +ctrl_ctrl_test_SOURCES = ctrl/ctrl_test.c +ctrl_ctrl_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/ctrl/libosmoctrl.la gea_gea_test_SOURCES = gea/gea_test.c gea_gea_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la @@ -164,7 +167,7 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ timer/timer_test.ok sms/sms_test.ok ussd/ussd_test.ok \ smscb/smscb_test.ok bits/bitrev_test.ok a5/a5_test.ok \ - conv/conv_test.ok auth/milenage_test.ok \ + conv/conv_test.ok auth/milenage_test.ok ctrl/ctrl_test.ok \ lapd/lapd_test.ok gsm0408/gsm0408_test.ok \ gsm0808/gsm0808_test.ok gb/bssgp_fc_tests.err \ gb/bssgp_fc_tests.ok gb/bssgp_fc_tests.sh \ diff --git a/tests/ctrl/ctrl_test.c b/tests/ctrl/ctrl_test.c new file mode 100644 index 0000000..3bbab76 --- /dev/null +++ b/tests/ctrl/ctrl_test.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include + +#include +#include + +inline void check_type(enum ctrl_type c) +{ + const char *t = get_value_string(ctrl_type_vals, c); + int v = get_string_value(ctrl_type_vals, t); + + printf("ctrl type %d is %s ", c, t); + if (v < 0) + printf("[PARSE FAILED]\n"); + else + printf("-> %d %s\n", v, c != v ? "FAIL" : "OK"); +} + +int main(int argc, char **argv) +{ + printf("Checking ctrl types...\n"); + + check_type(CTRL_TYPE_UNKNOWN); + check_type(CTRL_TYPE_GET); + check_type(CTRL_TYPE_SET); + check_type(CTRL_TYPE_GET_REPLY); + check_type(CTRL_TYPE_SET_REPLY); + check_type(CTRL_TYPE_TRAP); + check_type(CTRL_TYPE_ERROR); + check_type(64); + + return 0; +} diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok new file mode 100644 index 0000000..c4b05e9 --- /dev/null +++ b/tests/ctrl/ctrl_test.ok @@ -0,0 +1,9 @@ +Checking ctrl types... +ctrl type 0 is unknown 0x0 [PARSE FAILED] +ctrl type 1 is GET -> 1 OK +ctrl type 2 is SET -> 2 OK +ctrl type 3 is GET_REPLY -> 3 OK +ctrl type 4 is SET_REPLY -> 4 OK +ctrl type 5 is TRAP -> 5 OK +ctrl type 6 is ERROR -> 6 OK +ctrl type 64 is unknown 0x40 [PARSE FAILED] diff --git a/tests/testsuite.at b/tests/testsuite.at index a3be0e7..6d8c5d3 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -9,6 +9,12 @@ AT_CHECK([$abs_top_builddir/tests/a5/a5_test], [0], [expout]) AT_CLEANUP +AT_SETUP([ctrl]) +AT_KEYWORDS([ctrl]) +cat $abs_srcdir/ctrl/ctrl_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/ctrl/ctrl_test], [0], [expout]) +AT_CLEANUP + AT_SETUP([kasumi]) AT_KEYWORDS([kasumi]) cat $abs_srcdir/kasumi/kasumi_test.ok > expout -- To view, visit https://gerrit.osmocom.org/1895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:20:23 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:20:23 +0000 Subject: libosmocore[master]: Use value_string for ctrl_type In-Reply-To: References: Message-ID: Patch Set 3: Added unit test, also explicitly assigned 0 to CTRL_TYPE_UNKNOWN. -- To view, visit https://gerrit.osmocom.org/1895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:28:24 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:28:24 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: Code-Review-1 That's too simplistic: it'll give false-positive if value_string is terminated with {IAMZERO, NULL} with "#define IAMZERO 0" in header. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:29:44 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:29:44 +0000 Subject: openbsc[master]: fix: gprs_gmm, gprs_llc_vty: two unterminated value_string a... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1942 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:31:17 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 1 Mar 2017 16:31:17 +0000 Subject: openbsc[master]: sgsn: Fix broken ACL based authentication In-Reply-To: References: Message-ID: Patch Set 2: I thought that this would be similar to the "closed" from osmo-nitb where each subscriber needs authorized=1 in the hlr in order to be authenticated. I thought that the ACL would be like the authorized flag. closed: MCC/MNC of the IMSI matches home-network ==> Authenticated! IMSI in ACL ==> Authenticated! acl-only: IMSI in ACL ==> Authenticated, otherwise, REJECTED The SGSN manual seems not to document how the ACL exactly works. Anyway, I think I got it now. I will abandon the patch. -- To view, visit https://gerrit.osmocom.org/1939 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I463afa5cc407f5c56d29fb5a501185cd3e7ea5be Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:31:55 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 1 Mar 2017 16:31:55 +0000 Subject: [ABANDON] openbsc[master]: sgsn: Fix broken ACL based authentication In-Reply-To: References: Message-ID: dexter has abandoned this change. Change subject: sgsn: Fix broken ACL based authentication ...................................................................... Abandoned Wrong change. -- To view, visit https://gerrit.osmocom.org/1939 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I463afa5cc407f5c56d29fb5a501185cd3e7ea5be Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:32:32 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:32:32 +0000 Subject: osmo-hlr[master]: fix: properly handle error rc by osmo_gsup_conn_ccm_get() In-Reply-To: References: Message-ID: Patch Set 1: Why not use ipa_ccm_idtag_name() instead of typing it manually? -- To view, visit https://gerrit.osmocom.org/1952 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:35:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 1 Mar 2017 16:35:34 +0000 Subject: libosmocore[master]: Fix client-side ctrl interface helpers In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1897 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:36:07 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 1 Mar 2017 16:36:07 +0000 Subject: [PATCH] openbsc[master]: sgsn: fix problem with leading-zero-IMSIs In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1938 to look at the new patch set (#2). sgsn: fix problem with leading-zero-IMSIs When the IMSI ACL is maintained via the VTY, users may enter IMSIs without leading zeros. Especially in test environments, where MCC=001 and MNC=01 is common, it is likely that someone enters the corresponding IMSI (001010000000001) without the two zeros at the beginning. This patch fixes the problem by sanitizing the IMSI, eventually missing zeros in the beginning will be automatically added. Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 --- M openbsc/src/gprs/sgsn_vty.c 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/38/1938/2 diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 6c8b640..8df75a4 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -586,9 +586,19 @@ "Remove IMSI from ACL\n" "IMSI of subscriber\n") { + char imsi_sanitized[16]; const char *op = argv[0]; - const char *imsi = argv[1]; + const char *imsi = imsi_sanitized; int rc; + + /* Sanitize IMSI */ + if (strlen(argv[1]) > 15) { + vty_out(vty, "%% IMSI (%s) too long -- ignored!%s", + argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + memset(imsi_sanitized, '0', sizeof(imsi_sanitized)); + strcpy(imsi_sanitized+15-strlen(argv[1]),argv[1]); if (!strcmp(op, "add")) rc = sgsn_acl_add(imsi, g_cfg); @@ -597,7 +607,6 @@ if (rc < 0) { vty_out(vty, "%% unable to %s ACL%s", op, VTY_NEWLINE); - return CMD_WARNING; } -- To view, visit https://gerrit.osmocom.org/1938 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:36:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 1 Mar 2017 16:36:20 +0000 Subject: libosmocore[master]: Use value_string for ctrl_type In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:37:59 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:37:59 +0000 Subject: [MERGED] libosmocore[master]: Use value_string for ctrl_type In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Use value_string for ctrl_type ...................................................................... Use value_string for ctrl_type Use value_string for enum ctrl_type instead of custom code. Add corresponding unit tests. Related: OS#1615 Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 --- M .gitignore M include/osmocom/ctrl/control_cmd.h M src/ctrl/control_cmd.c M tests/Makefile.am A tests/ctrl/ctrl_test.c A tests/ctrl/ctrl_test.ok M tests/testsuite.at 7 files changed, 74 insertions(+), 37 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitignore b/.gitignore index ad8354e..48642ca 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ tests/testsuite tests/testsuite.dir/ tests/testsuite.log - +tests/ctrl/ctrl_test tests/utils/utils_test tests/stats/stats_test tests/kasumi/kasumi_test diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index a63557d..d82c9af 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -4,7 +4,7 @@ #include #include #include - +#include #include #define CTRL_CMD_ERROR -1 @@ -22,7 +22,7 @@ }; enum ctrl_type { - CTRL_TYPE_UNKNOWN, + CTRL_TYPE_UNKNOWN = 0, CTRL_TYPE_GET, CTRL_TYPE_SET, CTRL_TYPE_GET_REPLY, @@ -31,6 +31,8 @@ CTRL_TYPE_ERROR }; +extern const struct value_string ctrl_type_vals[]; + struct ctrl_connection { struct llist_head list_entry; diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 2cf66cf..1cc8247 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -33,41 +33,21 @@ #include #include - +#include #include #include extern vector ctrl_node_vec; -static struct ctrl_cmd_map ccm[] = { - {"GET", CTRL_TYPE_GET}, - {"SET", CTRL_TYPE_SET}, - {"GET_REPLY", CTRL_TYPE_GET_REPLY}, - {"SET_REPLY", CTRL_TYPE_SET_REPLY}, - {"TRAP", CTRL_TYPE_TRAP}, - {"ERROR", CTRL_TYPE_ERROR}, - {NULL} +const struct value_string ctrl_type_vals[] = { + { CTRL_TYPE_GET, "GET" }, + { CTRL_TYPE_SET, "SET" }, + { CTRL_TYPE_GET_REPLY, "GET_REPLY" }, + { CTRL_TYPE_SET_REPLY, "SET_REPLY" }, + { CTRL_TYPE_TRAP, "TRAP" }, + { CTRL_TYPE_ERROR, "ERROR" }, + { CTRL_TYPE_UNKNOWN, NULL } }; - -static int ctrl_cmd_str2type(char *s) -{ - int i; - for (i=0; ccm[i].cmd != NULL; i++) { - if (strcasecmp(s, ccm[i].cmd) == 0) - return ccm[i].type; - } - return CTRL_TYPE_UNKNOWN; -} - -static char *ctrl_cmd_type2str(int type) -{ - int i; - for (i=0; ccm[i].cmd != NULL; i++) { - if (ccm[i].type == type) - return ccm[i].cmd; - } - return NULL; -} /* Functions from libosmocom */ extern vector cmd_make_descvec(const char *string, const char *descstr); @@ -308,7 +288,7 @@ goto err; } - cmd->type = ctrl_cmd_str2type(tmp); + cmd->type = get_string_value(ctrl_type_vals, tmp); if (cmd->type == CTRL_TYPE_UNKNOWN) { cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; @@ -403,7 +383,8 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd) { struct msgb *msg; - char *type, *tmp; + const char *type; + char *tmp; if (!cmd->id) return NULL; @@ -412,7 +393,7 @@ if (!msg) return NULL; - type = ctrl_cmd_type2str(cmd->type); + type = get_value_string(ctrl_type_vals, cmd->type); switch (cmd->type) { case CTRL_TYPE_GET: diff --git a/tests/Makefile.am b/tests/Makefile.am index f6d4db3..35b9150 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -11,7 +11,7 @@ logging/logging_test fr/fr_test codec/codec_test \ loggingrb/loggingrb_test strrb/strrb_test \ vty/vty_test comp128/comp128_test utils/utils_test \ - smscb/gsm0341_test stats/stats_test \ + smscb/gsm0341_test stats/stats_test ctrl/ctrl_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test socket/socket_test @@ -41,6 +41,9 @@ auth_milenage_test_SOURCES = auth/milenage_test.c auth_milenage_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la + +ctrl_ctrl_test_SOURCES = ctrl/ctrl_test.c +ctrl_ctrl_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/ctrl/libosmoctrl.la gea_gea_test_SOURCES = gea/gea_test.c gea_gea_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la @@ -164,7 +167,7 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ timer/timer_test.ok sms/sms_test.ok ussd/ussd_test.ok \ smscb/smscb_test.ok bits/bitrev_test.ok a5/a5_test.ok \ - conv/conv_test.ok auth/milenage_test.ok \ + conv/conv_test.ok auth/milenage_test.ok ctrl/ctrl_test.ok \ lapd/lapd_test.ok gsm0408/gsm0408_test.ok \ gsm0808/gsm0808_test.ok gb/bssgp_fc_tests.err \ gb/bssgp_fc_tests.ok gb/bssgp_fc_tests.sh \ diff --git a/tests/ctrl/ctrl_test.c b/tests/ctrl/ctrl_test.c new file mode 100644 index 0000000..3bbab76 --- /dev/null +++ b/tests/ctrl/ctrl_test.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include + +#include +#include + +inline void check_type(enum ctrl_type c) +{ + const char *t = get_value_string(ctrl_type_vals, c); + int v = get_string_value(ctrl_type_vals, t); + + printf("ctrl type %d is %s ", c, t); + if (v < 0) + printf("[PARSE FAILED]\n"); + else + printf("-> %d %s\n", v, c != v ? "FAIL" : "OK"); +} + +int main(int argc, char **argv) +{ + printf("Checking ctrl types...\n"); + + check_type(CTRL_TYPE_UNKNOWN); + check_type(CTRL_TYPE_GET); + check_type(CTRL_TYPE_SET); + check_type(CTRL_TYPE_GET_REPLY); + check_type(CTRL_TYPE_SET_REPLY); + check_type(CTRL_TYPE_TRAP); + check_type(CTRL_TYPE_ERROR); + check_type(64); + + return 0; +} diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok new file mode 100644 index 0000000..c4b05e9 --- /dev/null +++ b/tests/ctrl/ctrl_test.ok @@ -0,0 +1,9 @@ +Checking ctrl types... +ctrl type 0 is unknown 0x0 [PARSE FAILED] +ctrl type 1 is GET -> 1 OK +ctrl type 2 is SET -> 2 OK +ctrl type 3 is GET_REPLY -> 3 OK +ctrl type 4 is SET_REPLY -> 4 OK +ctrl type 5 is TRAP -> 5 OK +ctrl type 6 is ERROR -> 6 OK +ctrl type 64 is unknown 0x40 [PARSE FAILED] diff --git a/tests/testsuite.at b/tests/testsuite.at index a3be0e7..6d8c5d3 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -9,6 +9,12 @@ AT_CHECK([$abs_top_builddir/tests/a5/a5_test], [0], [expout]) AT_CLEANUP +AT_SETUP([ctrl]) +AT_KEYWORDS([ctrl]) +cat $abs_srcdir/ctrl/ctrl_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/ctrl/ctrl_test], [0], [expout]) +AT_CLEANUP + AT_SETUP([kasumi]) AT_KEYWORDS([kasumi]) cat $abs_srcdir/kasumi/kasumi_test.ok > expout -- To view, visit https://gerrit.osmocom.org/1895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:38:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:38:00 +0000 Subject: [MERGED] libosmocore[master]: Fix client-side ctrl interface helpers In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Fix client-side ctrl interface helpers ...................................................................... Fix client-side ctrl interface helpers * remove unused ctrl_interface_connect() which is not part of public API * add default read callback to osmo_ctrl_conn_alloc() Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4 Related: OS#1615 --- M src/ctrl/control_if.c 1 file changed, 1 insertion(+), 40 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index d78b513..de49d16 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -388,6 +388,7 @@ ccon->write_queue.bfd.data = data; ccon->write_queue.write_cb = control_write_cb; + ccon->write_queue.read_cb = handle_control_read; return ccon; } @@ -431,7 +432,6 @@ ccon->write_queue.bfd.fd = fd; ccon->write_queue.bfd.when = BSC_FD_READ; - ccon->write_queue.read_cb = handle_control_read; ret = osmo_fd_register(&ccon->write_queue.bfd); if (ret < 0) { @@ -653,45 +653,6 @@ static int verify_counter(struct ctrl_cmd *cmd, const char *value, void *data) { return 0; -} - -/*! \brief Setup CTRL interface connection to a given address - * \param[in] data Pointer which will be made available to each - set_..() get_..() verify_..() control command function - * \param[in] addr Address to which we shall connect - * \param[in] port Port to which we shall connect - * \param[in] lookup Lookup function pointer, can be NULL - * \returns ctrl_handle pointer or NULL in case of errors - */ -struct ctrl_handle *ctrl_interface_connect(void *data, const char *addr, - uint16_t port, - ctrl_cmd_lookup lookup) -{ - int ret; - struct ctrl_handle *ctrl; - - ctrl = talloc_zero(data, struct ctrl_handle); - if (!ctrl) - return NULL; - - INIT_LLIST_HEAD(&ctrl->ccon_list); - - ctrl->data = data; - ctrl->lookup = lookup; - - ctrl->listen_fd.cb = NULL; - ctrl->listen_fd.data = ctrl; - ret = osmo_sock_init_ofd(&ctrl->listen_fd, AF_INET, SOCK_STREAM, - IPPROTO_TCP, addr, port, OSMO_SOCK_F_CONNECT); - if (ret < 0) { - LOGP(DLCTRL, LOGL_ERROR, "Cannot connect to CTRL at %s:%u\n", - addr, port); - talloc_free(ctrl); - return NULL; - } - LOGP(DLCTRL, LOGL_NOTICE, "CTRL connected to %s:%u\n", addr, port); - - return ctrl; } struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port, -- To view, visit https://gerrit.osmocom.org/1897 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:38:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:38:00 +0000 Subject: [MERGED] libosmocore[master]: Handle replies in ctrl_cmd_handle() In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Handle replies in ctrl_cmd_handle() ...................................................................... Handle replies in ctrl_cmd_handle() Previously *_REPLY and ERROR messages were not explicitly handled which would lead to sending error in response to them which in turn would prompt other party to send error as well which would result in infinite cycle. Handle it explicitly by logging message id and other relevant data. Change-Id: Id96f3a2fc81fa4549f49556d83f062c6b2f59e28 Related: OS#1615 --- M src/ctrl/control_if.c 1 file changed, 17 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index de49d16..f49d639 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -186,6 +186,23 @@ vector vline, cmdvec, cmds_vec; + if (cmd->type == CTRL_TYPE_SET_REPLY || + cmd->type == CTRL_TYPE_GET_REPLY) { + if (strncmp(cmd->reply, "OK", 2) == 0) { + LOGP(DLCTRL, LOGL_DEBUG, "%s <%s> for %s is OK\n", + get_value_string(ctrl_type_vals, cmd->type), + cmd->id, cmd->variable); + return CTRL_CMD_HANDLED; + } + } + + if (cmd->type == CTRL_TYPE_ERROR) { + LOGP(DLCTRL, LOGL_ERROR, "%s <%s> for %s is %s\n", + get_value_string(ctrl_type_vals, cmd->type), + cmd->id, cmd->variable, cmd->reply); + return CTRL_CMD_HANDLED; + } + ret = CTRL_CMD_ERROR; cmd->reply = NULL; node = CTRL_NODE_ROOT; -- To view, visit https://gerrit.osmocom.org/1896 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id96f3a2fc81fa4549f49556d83f062c6b2f59e28 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:38:35 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 16:38:35 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:38:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 1 Mar 2017 16:38:59 +0000 Subject: openbsc[master]: sgsn: fix problem with leading-zero-IMSIs In-Reply-To: References: Message-ID: Patch Set 2: -Code-Review (1 comment) https://gerrit.osmocom.org/#/c/1938/2/openbsc/src/gprs/sgsn_vty.c File openbsc/src/gprs/sgsn_vty.c: Line 595: if (strlen(argv[1]) > 15) { please avoid magic numbers. We almost always have #defines for such general GSM constants in libosmocore, such as GSM23003_IMSI_MAX_DIGITS in this case. -- To view, visit https://gerrit.osmocom.org/1938 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:39:15 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 1 Mar 2017 16:39:15 +0000 Subject: openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:39:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 1 Mar 2017 16:39:22 +0000 Subject: libosmocore[master]: fsm: convenience: add inline osmo_fsm_inst_state_name() In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1937 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:42:55 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Wed, 1 Mar 2017 16:42:55 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: with open('foo.xml', 'wb') as output: unittest.main( testRunner=xmlrunner.XMLTestRunner(output=output), failfast=False, buffer=False, catchbreak=False) so maybe a specific feature for unittest.main. Let me sleeo over the change :) -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 16:59:19 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 1 Mar 2017 16:59:19 +0000 Subject: [PATCH] openbsc[master]: sgsn: fix problem with leading-zero-IMSIs In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1938 to look at the new patch set (#3). sgsn: fix problem with leading-zero-IMSIs When the IMSI ACL is maintained via the VTY, users may enter IMSIs without leading zeros. Especially in test environments, where MCC=001 and MNC=01 is common, it is likely that someone enters the corresponding IMSI (001010000000001) without the two zeros at the beginning. This patch fixes the problem by sanitizing the IMSI, eventually missing zeros in the beginning will be automatically added. Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 --- M openbsc/src/gprs/sgsn_vty.c 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/38/1938/3 diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 6c8b640..d42a165 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -586,9 +586,19 @@ "Remove IMSI from ACL\n" "IMSI of subscriber\n") { + char imsi_sanitized[GSM23003_IMSI_MAX_DIGITS+1]; const char *op = argv[0]; - const char *imsi = argv[1]; + const char *imsi = imsi_sanitized; int rc; + + /* Sanitize IMSI */ + if (strlen(argv[1]) > GSM23003_IMSI_MAX_DIGITS) { + vty_out(vty, "%% IMSI (%s) too long -- ignored!%s", + argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + memset(imsi_sanitized, '0', sizeof(imsi_sanitized)); + strcpy(imsi_sanitized+GSM23003_IMSI_MAX_DIGITS-strlen(argv[1]),argv[1]); if (!strcmp(op, "add")) rc = sgsn_acl_add(imsi, g_cfg); @@ -597,7 +607,6 @@ if (rc < 0) { vty_out(vty, "%% unable to %s ACL%s", op, VTY_NEWLINE); - return CMD_WARNING; } -- To view, visit https://gerrit.osmocom.org/1938 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 17:07:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 17:07:22 +0000 Subject: openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Patch Set 2: hmm but what about: enum sgsn_ran_type { /* GPRS/EDGE via Gb */ MM_CTX_T_GERAN_Gb, /* UMTS via Iu */ MM_CTX_T_UTRAN_Iu, /* GPRS/EDGE via Iu */ MM_CTX_T_GERAN_Iu, }; that implies that GERAN can come over Iu? That's a misnomer, right? -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 17:14:28 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 1 Mar 2017 17:14:28 +0000 Subject: [PATCH] osmo-pcu[master]: BTS: Convert relative frame numbers to absolute frame numbers In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1861 to look at the new patch set (#5). BTS: Convert relative frame numbers to absolute frame numbers The implementation of the method rcv_rach() in class BTS, restores the absolute frame number of the incoming RACH-Request by using the relative frame number (RFn = Fn mod 42432) from the rach request and the already known internal absolute frame number m_cur_fn, which is continusly updated by the CCU interface. In some rare cases, a RACH request might be received by the BTS, a very short time before the frame number wraps in its 42432. Depending on the PCU location, RACH request might be received by the BSC, which forwards it to the PCU. It is then likely that, while the RACH request is being forwarded to the PCU, the PCU internal absolute frame number wraps before the RACH can be processed. The relative frame number from the rach request would then be interpreted as if it were received after the wrapping of the internal frame number modulos. This commit adds logic to detect and resolve this race condition. Also a unit test is added to check some cornercases. Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759 --- M src/bts.cpp M src/bts.h M tests/Makefile.am A tests/fn/FnTest.cpp A tests/fn/FnTest.ok M tests/testsuite.at 6 files changed, 301 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/61/1861/5 diff --git a/src/bts.cpp b/src/bts.cpp index 21e9d96..548d000 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -34,12 +34,16 @@ #include #include #include + #include } #include #include #include + +#define RFN_MODULUS 42432 +#define RFN_THRESHOLD RFN_MODULUS / 2 extern void *tall_pcu_ctx; @@ -516,6 +520,57 @@ return 0; } +/* Determine the full frame number from a relative frame number */ +uint32_t BTS::rfn_to_fn(uint32_t rfn) +{ + uint32_t m_cur_rfn; + uint32_t fn; + uint32_t fn_rounded; + + /* Note: If a BTS is sending in a rach request it will be fully aware + * of the frame number. If the PCU is used in a BSC-co-located setup. + * The BSC will forward the incoming RACH request. The RACH request + * only contains the relative frame number (Fn % 42432) in its request + * reference. This PCU implementation has to fit both scenarios, so + * we need to assume that Fn is a relative frame number. */ + + /* Ensure that all following calculations are performed with the + * relative frame number */ + rfn = rfn % 42432; + + /* Compute an internal relative frame number from the full internal + frame number */ + m_cur_rfn = m_cur_fn % RFN_MODULUS; + + /* Compute a "rounded" version of the internal frame number, which + * exactly fits in the RFN_MODULUS raster */ + fn_rounded = m_cur_fn - m_cur_rfn; + + /* If the delta between the internal and the external relative frame + * number exceeds a certain limit, we need to assume that the incoming + * rach request belongs to a the previous rfn period. To correct this, + * we roll back the rounded frame number by one RFN_MODULUS */ + if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { + LOGP(DRLCMAC, LOGL_DEBUG, + "Race condition between rfn (%u) and m_cur_fn (%u) detected: rfn belongs to the previos modulus %u cycle, wrappng...\n", + rfn, m_cur_fn, RFN_MODULUS); + if (fn_rounded < RFN_MODULUS) { + LOGP(DRLCMAC, LOGL_DEBUG, + "Cornercase detected: wrapping crosses %u border\n", + GSM_MAX_FN); + fn_rounded = GSM_MAX_FN - (RFN_MODULUS - fn_rounded); + } + else + fn_rounded -= RFN_MODULUS; + } + + /* The real frame number is the sum of the rounded frame number and the + * relative framenumber computed via RACH */ + fn = fn_rounded + rfn; + + return fn; +} + int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type) { @@ -536,20 +591,8 @@ if (is_11bit) rach_frame_11bit(); - /* Note: If a BTS is sending in a rach request it will be fully aware - * of the frame number. If the PCU is used in a BSC-co-located setup. - * The BSC will forward the incoming RACH request. The RACH request - * only contains the relative frame number (Fn % 42432) in its request - * reference. This PCU implementation has to fit both secenarious, so - * we need to assume that Fn is a relative frame number. */ - - /* Ensure that all following calculations are performed with the - * relative frame number */ - Fn = Fn % 42432; - - /* Restore the full frame number - * (See also 3GPP TS 44.018, section 10.5.2.38) */ - Fn = Fn + m_cur_fn - m_cur_fn % 42432; + /* Determine full frame number */ + Fn = rfn_to_fn(Fn); LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF on RACH, " "so we provide one: ra=0x%02x Fn=%u qta=%d is_11bit=%d:\n", diff --git a/src/bts.h b/src/bts.h index 2932154..5d8dc59 100644 --- a/src/bts.h +++ b/src/bts.h @@ -349,6 +349,8 @@ int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn); uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); + + uint32_t rfn_to_fn(uint32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); diff --git a/tests/Makefile.am b/tests/Makefile.am index a24f4ea..a03528c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ AM_LDFLAGS = -lrt -check_PROGRAMS = rlcmac/RLCMACTest alloc/AllocTest tbf/TbfTest types/TypesTest ms/MsTest llist/LListTest llc/LlcTest codel/codel_test edge/EdgeTest bitcomp/BitcompTest +check_PROGRAMS = rlcmac/RLCMACTest alloc/AllocTest tbf/TbfTest types/TypesTest ms/MsTest llist/LListTest llc/LlcTest codel/codel_test edge/EdgeTest bitcomp/BitcompTest fn/FnTest noinst_PROGRAMS = emu/pcu_emu rlcmac_RLCMACTest_SOURCES = rlcmac/RLCMACTest.cpp @@ -90,6 +90,14 @@ $(LIBOSMOCORE_LIBS) \ $(COMMON_LA) +fn_FnTest_SOURCES = fn/FnTest.cpp +fn_FnTest_LDADD = \ + $(top_builddir)/src/libgprs.la \ + $(LIBOSMOGB_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOCORE_LIBS) \ + $(COMMON_LA) + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -119,7 +127,8 @@ llc/LlcTest.ok llc/LlcTest.err \ llist/LListTest.ok llist/LListTest.err \ codel/codel_test.ok \ - edge/EdgeTest.ok + edge/EdgeTest.ok \ + fn/FnTest.ok DISTCLEANFILES = atconfig diff --git a/tests/fn/FnTest.cpp b/tests/fn/FnTest.cpp new file mode 100644 index 0000000..279903c --- /dev/null +++ b/tests/fn/FnTest.cpp @@ -0,0 +1,175 @@ +/* Frame number calculation test */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * 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 . + */ + +#include "bts.h" +#include +#include + +extern "C" { +#include +#include +#include +#include +} + +#define RFN_MODULUS 42432 + +/* globals used by the code */ void *tall_pcu_ctx; +int16_t spoof_mnc = 0, spoof_mcc = 0; + +static uint32_t calc_fn(BTS * bts, uint32_t rfn) +{ + uint32_t fn; + fn = bts->rfn_to_fn(rfn); + printf("rfn=%i ==> fn=%i\n", rfn, fn); + return fn; +} + +static void set_fn(BTS * bts, uint32_t fn) +{ + printf("\n"); + bts->set_current_frame_number(fn); + printf("bts: fn=%i\n", fn); +} + +static void run_test() +{ + BTS bts; + uint32_t fn; + + printf("RFN_MODULUS=%i\n",RFN_MODULUS); + printf("GSM_MAX_FN=%i\n",GSM_MAX_FN); + + + /* Test with a collection of real world examples, + * all all of them are not critical and do not + * assume the occurence of any race contions */ + set_fn(&bts, 1320462); + fn = calc_fn(&bts, 5066); + OSMO_ASSERT(fn == 1320458); + + set_fn(&bts, 8246); + fn = calc_fn(&bts, 8244); + OSMO_ASSERT(fn == 8244); + + set_fn(&bts, 10270); + fn = calc_fn(&bts, 10269); + OSMO_ASSERT(fn == 10269); + + set_fn(&bts, 311276); + fn = calc_fn(&bts, 14250); + OSMO_ASSERT(fn == 311274); + + + /* Now lets assume a case where the frame number + * just wrapped over a little bit above the + * modulo 42432 raster, but the rach request + * occurred before the wrapping */ + set_fn(&bts, RFN_MODULUS + 30); + fn = calc_fn(&bts, RFN_MODULUS - 10); + OSMO_ASSERT(fn == 42422); + + set_fn(&bts, RFN_MODULUS + 1); + fn = calc_fn(&bts, RFN_MODULUS - 1); + OSMO_ASSERT(fn == 42431); + + set_fn(&bts, RFN_MODULUS * 123 + 16); + fn = calc_fn(&bts, RFN_MODULUS - 4); + OSMO_ASSERT(fn == 5219132); + + set_fn(&bts, RFN_MODULUS * 123 + 451); + fn = calc_fn(&bts, RFN_MODULUS - 175); + OSMO_ASSERT(fn == 5218961); + + + /* Lets check a special cornercase. We assume that + * the BTS just wrapped its internal frame number + * but we still get rach requests with high relative + * frame numbers. */ + set_fn(&bts, 0); + fn = calc_fn(&bts, RFN_MODULUS - 13); + OSMO_ASSERT(fn == 2715635); + + set_fn(&bts, 453); + fn = calc_fn(&bts, RFN_MODULUS - 102); + OSMO_ASSERT(fn == 2715546); + + set_fn(&bts, 10); + fn = calc_fn(&bts, RFN_MODULUS - 10); + OSMO_ASSERT(fn == 2715638); + + set_fn(&bts, 23); + fn = calc_fn(&bts, RFN_MODULUS - 42); + OSMO_ASSERT(fn == 2715606); + + + /* Also check with some corner case + * values where Fn and RFn reach its + * maximum/minimum valid range */ + set_fn(&bts, GSM_MAX_FN); + fn = calc_fn(&bts, RFN_MODULUS-1); + OSMO_ASSERT(fn == GSM_MAX_FN-1); + + set_fn(&bts, 0); + fn = calc_fn(&bts, RFN_MODULUS-1); + OSMO_ASSERT(fn == GSM_MAX_FN-1); + + set_fn(&bts, GSM_MAX_FN); + fn = calc_fn(&bts, 0); + OSMO_ASSERT(fn == GSM_MAX_FN); + + set_fn(&bts, 0); + fn = calc_fn(&bts, 0); + OSMO_ASSERT(fn == 0); +} + +int main(int argc, char **argv) +{ + tall_pcu_ctx = talloc_named_const(NULL, 1, "fn test context"); + if (!tall_pcu_ctx) + abort(); + + msgb_talloc_ctx_init(tall_pcu_ctx, 0); + osmo_init_logging(&gprs_log_info); + log_set_use_color(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, 0); + log_set_log_level(osmo_stderr_target, LOGL_DEBUG); + + run_test(); + return EXIT_SUCCESS; +} + +/* + * stubs that should not be reached + */ +extern "C" { + void l1if_pdch_req() { + abort(); + } void l1if_connect_pdch() { + abort(); + } + void l1if_close_pdch() { + abort(); + } + void l1if_open_pdch() { + abort(); + } +} diff --git a/tests/fn/FnTest.ok b/tests/fn/FnTest.ok new file mode 100644 index 0000000..be6400f --- /dev/null +++ b/tests/fn/FnTest.ok @@ -0,0 +1,50 @@ +RFN_MODULUS=42432 +GSM_MAX_FN=2715648 + +bts: fn=1320462 +rfn=5066 ==> fn=1320458 + +bts: fn=8246 +rfn=8244 ==> fn=8244 + +bts: fn=10270 +rfn=10269 ==> fn=10269 + +bts: fn=311276 +rfn=14250 ==> fn=311274 + +bts: fn=42462 +rfn=42422 ==> fn=42422 + +bts: fn=42433 +rfn=42431 ==> fn=42431 + +bts: fn=5219152 +rfn=42428 ==> fn=5219132 + +bts: fn=5219587 +rfn=42257 ==> fn=5218961 + +bts: fn=0 +rfn=42419 ==> fn=2715635 + +bts: fn=453 +rfn=42330 ==> fn=2715546 + +bts: fn=10 +rfn=42422 ==> fn=2715638 + +bts: fn=23 +rfn=42390 ==> fn=2715606 + +bts: fn=2715648 +rfn=42431 ==> fn=2715647 + +bts: fn=0 +rfn=42431 ==> fn=2715647 + +bts: fn=2715648 +rfn=0 ==> fn=2715648 + +bts: fn=0 +rfn=0 ==> fn=0 diff --git a/tests/testsuite.at b/tests/testsuite.at index e42a0fd..d8f8f9a 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -70,3 +70,9 @@ cat $abs_srcdir/codel/codel_test.ok > expout AT_CHECK([$OSMO_QEMU $abs_top_builddir/tests/codel/codel_test], [0], [expout], [ignore]) AT_CLEANUP + +AT_SETUP([fn]) +AT_KEYWORDS([fn]) +cat $abs_srcdir/fn/FnTest.ok > expout +AT_CHECK([$OSMO_QEMU $abs_top_builddir/tests/fn/FnTest], [0], [expout], [ignore]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1861 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759 Gerrit-PatchSet: 5 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 1 17:20:08 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 1 Mar 2017 17:20:08 +0000 Subject: [PATCH] libosmocore[master]: Check for proper lapdm_datalink entity Message-ID: Review at https://gerrit.osmocom.org/1959 Check for proper lapdm_datalink entity Previously lapdm_datalink->entity->mode was dereferenced without checking if correct entity is present. This might lead to segfault. Check it explicitly before dereferencing, log error and gracefully return if necessary. Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Related: OS#1898 --- M src/gsm/lapdm.c 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/1959/1 diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index fa7769b..30a3f70 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -852,10 +852,16 @@ struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); uint8_t chan_nr = rllh->chan_nr; uint8_t link_id = rllh->link_id; - int ui_bts = (le->mode == LAPDM_MODE_BTS && (link_id & 0x40)); uint8_t sapi = link_id & 7; struct tlv_parsed tv; - int length; + int length, ui_bts; + + if (!le) { + LOGP(DLLAPD, LOGL_ERROR, "lapdm_datalink without entity error\n"); + msgb_free(msg); + return -EBADR; + } + ui_bts = (le->mode == LAPDM_MODE_BTS && (link_id & 0x40)); /* check if the layer3 message length exceeds N201 */ -- To view, visit https://gerrit.osmocom.org/1959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 1 17:29:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 17:29:22 +0000 Subject: openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 I first want to clarify IFACE_IU vs RAN_UTRAN, because on the 3G branch we need to know whether to talk to the Iu or the A interface; If GERAN can also be talked over Iu, the GERAN vs UTRAN classification needs to be separate from this. The msc_vlr tests then want to use the GERAN vs UTRAN, while the Iu code wants to use IFACE_IU vs IFACE_A. -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 1 23:52:55 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 1 Mar 2017 23:52:55 +0000 Subject: [MERGED] libosmocore[master]: fsm: convenience: add inline osmo_fsm_inst_state_name() In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fsm: convenience: add inline osmo_fsm_inst_state_name() ...................................................................... fsm: convenience: add inline osmo_fsm_inst_state_name() Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b --- M include/osmocom/core/fsm.h 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 952f82f..3a1f233 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -152,6 +152,10 @@ const char *osmo_fsm_inst_name(struct osmo_fsm_inst *fi); const char *osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state); +/*! \brief return the name of the state the FSM instance is currently in. */ +static inline const char *osmo_fsm_inst_state_name(struct osmo_fsm_inst *fi) +{ return osmo_fsm_state_name(fi->fsm, fi->state); } + /*! \brief perform a state change of the given FSM instance * * This is a macro that calls _osmo_fsm_inst_state_chg() with the given -- To view, visit https://gerrit.osmocom.org/1937 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 00:03:23 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 00:03:23 +0000 Subject: [PATCH] openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Hello Max, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1858 to look at the new patch set (#3). subscriber conn: add indicator for originating RAN Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but also for libvlr to decide between GSM or UMTS Auth. Until actual Iu support is merged to master, this indicator will aid VLR unit testing. At some point we may also add RAN_GERAN_IU; it's not on the agenda yet, but to clearly distinguish the names if we want to add it, explicitly name the ones we have RAN_GERAN_A and RAN_UTRAN_IU. Change-Id: I93b870522f725170e4265a5543f6b680383d7465 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_api.c 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/58/1858/3 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a14e59f..620b6e4 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -106,6 +106,12 @@ uint8_t last_seen_nr; }; +enum ran_type { + RAN_UNKNOWN, + RAN_GERAN_A, /* 2G / A-interface */ + RAN_UTRAN_IU, /* 3G / Iu-interface (IuCS or IuPS) */ +}; + /* active radio connection of a mobile subscriber */ struct gsm_subscriber_connection { struct llist_head entry; @@ -148,6 +154,8 @@ struct osmo_timer_list T10; /* BSC */ struct gsm_lchan *secondary_lchan; /* BSC */ + /* connected via 2G or 3G? */ + enum ran_type via_ran; }; diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 7a48296..5b01d69 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -251,6 +251,7 @@ conn->network = net; conn->lchan = lchan; conn->bts = lchan->ts->trx->bts; + conn->via_ran = RAN_GERAN; lchan->conn = conn; llist_add_tail(&conn->entry, &net->subscr_conns); return conn; -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 00:24:16 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 00:24:16 +0000 Subject: [PATCH] openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Hello Max, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1858 to look at the new patch set (#4). subscriber conn: add indicator for originating RAN Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but also for libvlr to decide between GSM or UMTS Auth. Until actual Iu support is merged to master, this indicator will aid VLR unit testing. At some point we may also add RAN_GERAN_IU; it's not on the agenda yet, but to clearly distinguish the names if we want to add it, explicitly name the ones we have RAN_GERAN_A and RAN_UTRAN_IU. Change-Id: I93b870522f725170e4265a5543f6b680383d7465 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_api.c M openbsc/src/libmsc/gsm_04_08.c 3 files changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/58/1858/4 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a14e59f..620b6e4 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -106,6 +106,12 @@ uint8_t last_seen_nr; }; +enum ran_type { + RAN_UNKNOWN, + RAN_GERAN_A, /* 2G / A-interface */ + RAN_UTRAN_IU, /* 3G / Iu-interface (IuCS or IuPS) */ +}; + /* active radio connection of a mobile subscriber */ struct gsm_subscriber_connection { struct llist_head entry; @@ -148,6 +154,8 @@ struct osmo_timer_list T10; /* BSC */ struct gsm_lchan *secondary_lchan; /* BSC */ + /* connected via 2G or 3G? */ + enum ran_type via_ran; }; diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 7a48296..54978e5 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -251,6 +251,7 @@ conn->network = net; conn->lchan = lchan; conn->bts = lchan->ts->trx->bts; + conn->via_ran = RAN_GERAN_A; lchan->conn = conn; llist_add_tail(&conn->entry, &net->subscr_conns); return conn; diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 3cc86ba..fff902d 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -1235,7 +1235,7 @@ osmo_hexdump_nospc(res, res_len)); /* Future: vlr_sub_rx_auth_resp(conn->vsub, is_r99, - * conn->via_iface == IFACE_IU, + * conn->via_ran == RAN_UTRAN_IU, * res, res_len); */ -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 01:46:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 01:46:30 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: They all should terminate with { 0, NULL }, maybe { 0, 0 } if needs be or { .value = 0, .str = NULL }, but nothing else ever needs to be allowed. Sorry, I don't see your point. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 01:48:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 01:48:08 +0000 Subject: libosmocore[master]: fix: gsm0808.c: unterminated value_string array gsm0808_bssa... In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1941 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 01:48:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 01:48:11 +0000 Subject: [MERGED] libosmocore[master]: fix: gsm0808.c: unterminated value_string array gsm0808_bssa... In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix: gsm0808.c: unterminated value_string array gsm0808_bssap_names ...................................................................... fix: gsm0808.c: unterminated value_string array gsm0808_bssap_names Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8 --- M src/gsm/gsm0808.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 4035f46..de80006 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -540,6 +540,7 @@ static const struct value_string gsm0808_bssap_names[] = { { BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" }, { BSSAP_MSG_DTAP, "DTAP" }, + { 0, NULL } }; const char *gsm0808_bssap_name(uint8_t msg_type) -- To view, visit https://gerrit.osmocom.org/1941 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 01:48:29 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 01:48:29 +0000 Subject: openbsc[master]: fix: gprs_gmm, gprs_llc_vty: two unterminated value_string a... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1942 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 01:48:31 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 01:48:31 +0000 Subject: [MERGED] openbsc[master]: fix: gprs_gmm, gprs_llc_vty: two unterminated value_string a... In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix: gprs_gmm, gprs_llc_vty: two unterminated value_string arrays ...................................................................... fix: gprs_gmm, gprs_llc_vty: two unterminated value_string arrays Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84 --- M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc_vty.c 2 files changed, 2 insertions(+), 0 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index da243a4..aa03891 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -116,6 +116,7 @@ { MM_IDLE, "MM IDLE" }, { MM_READY, "MM READY" }, { MM_STANDBY, "MM STANDBY" }, + { 0, NULL } }; static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx); diff --git a/openbsc/src/gprs/gprs_llc_vty.c b/openbsc/src/gprs/gprs_llc_vty.c index e97416b..bf34e97 100644 --- a/openbsc/src/gprs/gprs_llc_vty.c +++ b/openbsc/src/gprs/gprs_llc_vty.c @@ -48,6 +48,7 @@ { GPRS_LLES_ABM, "Asynchronous Balanced Mode" }, { GPRS_LLES_LOCAL_REL, "Local Release" }, { GPRS_LLES_TIMER_REC, "Timer Recovery" }, + { 0, NULL } }; static void vty_dump_lle(struct vty *vty, struct gprs_llc_lle *lle) -- To view, visit https://gerrit.osmocom.org/1942 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 02:06:21 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 02:06:21 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: We could define an OSMO_VALUE_STRING_END (as {0, NULL}) and change this script to srictly require all arrays to end with literally OSMO_VALUE_STRING_END, without alternative ... but I prefer to expect what the code currently uses, avoiding to edit all arrays. I would agree to add an OSMO_VALUE_STRING_END to the script if we want to introduce it, but until then { 0, NULL } is what everyone should use. The point is that we can and should be strict on how to terminate value_string[]s, no need to be general about it (i.e. not beyond the variants we find in today's code). -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 02:11:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 02:11:44 +0000 Subject: openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 02:13:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 02:13:11 +0000 Subject: [MERGED] openbsc[master]: subscriber conn: add indicator for originating RAN In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: subscriber conn: add indicator for originating RAN ...................................................................... subscriber conn: add indicator for originating RAN Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but also for libvlr to decide between GSM or UMTS Auth. Until actual Iu support is merged to master, this indicator will aid VLR unit testing. At some point we may also add RAN_GERAN_IU; it's not on the agenda yet, but to clearly distinguish the names if we want to add it, explicitly name the ones we have RAN_GERAN_A and RAN_UTRAN_IU. Change-Id: I93b870522f725170e4265a5543f6b680383d7465 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_api.c M openbsc/src/libmsc/gsm_04_08.c 3 files changed, 10 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a14e59f..620b6e4 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -106,6 +106,12 @@ uint8_t last_seen_nr; }; +enum ran_type { + RAN_UNKNOWN, + RAN_GERAN_A, /* 2G / A-interface */ + RAN_UTRAN_IU, /* 3G / Iu-interface (IuCS or IuPS) */ +}; + /* active radio connection of a mobile subscriber */ struct gsm_subscriber_connection { struct llist_head entry; @@ -148,6 +154,8 @@ struct osmo_timer_list T10; /* BSC */ struct gsm_lchan *secondary_lchan; /* BSC */ + /* connected via 2G or 3G? */ + enum ran_type via_ran; }; diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 7a48296..54978e5 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -251,6 +251,7 @@ conn->network = net; conn->lchan = lchan; conn->bts = lchan->ts->trx->bts; + conn->via_ran = RAN_GERAN_A; lchan->conn = conn; llist_add_tail(&conn->entry, &net->subscr_conns); return conn; diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 3cc86ba..fff902d 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -1235,7 +1235,7 @@ osmo_hexdump_nospc(res, res_len)); /* Future: vlr_sub_rx_auth_resp(conn->vsub, is_r99, - * conn->via_iface == IFACE_IU, + * conn->via_ran == RAN_UTRAN_IU, * res, res_len); */ -- To view, visit https://gerrit.osmocom.org/1858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I93b870522f725170e4265a5543f6b680383d7465 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 02:38:15 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 02:38:15 +0000 Subject: [PATCH] python/osmo-python-tests[master]: cosmetic: early exit instead of if-cascade In-Reply-To: References: Message-ID: cosmetic: early exit instead of if-cascade Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 --- M osmopy/obscvty.py 1 file changed, 10 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/20/1920/2 diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index b09d108..420db7d 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -70,14 +70,16 @@ def _close_socket(self): global debug_tcp_sockets - if self.socket: - if debug_tcp_sockets: - VTYInteract.all_sockets.remove(self.socket) - print "Socket: closing %s:%d %r (%d sockets open)" % ( - self.host, self.port, self.socket, - len(VTYInteract.all_sockets)) - self.socket.close() - self.socket = None + if self.socket is None: + return + + if debug_tcp_sockets: + VTYInteract.all_sockets.remove(self.socket) + print "Socket: closing %s:%d %r (%d sockets open)" % ( + self.host, self.port, self.socket, + len(VTYInteract.all_sockets)) + self.socket.close() + self.socket = None def _is_end(self, text, ends): """ -- To view, visit https://gerrit.osmocom.org/1920 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 09:25:43 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 09:25:43 +0000 Subject: [PATCH] libosmocore[master]: Check for proper lapdm_datalink entity In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1959 to look at the new patch set (#2). Check for proper lapdm_datalink entity Previously lapdm_datalink->entity->mode was dereferenced without checking if correct entity is present. This might lead to segfault. Check it explicitly before dereferencing, log error and gracefully return if necessary. Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Related: OS#1898 --- M src/gsm/lapdm.c 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/1959/2 diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index fa7769b..1fdf311 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -852,10 +852,16 @@ struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); uint8_t chan_nr = rllh->chan_nr; uint8_t link_id = rllh->link_id; - int ui_bts = (le->mode == LAPDM_MODE_BTS && (link_id & 0x40)); uint8_t sapi = link_id & 7; struct tlv_parsed tv; - int length; + int length, ui_bts; + + if (!le) { + LOGP(DLLAPD, LOGL_ERROR, "lapdm_datalink without entity error\n"); + msgb_free(msg); + return -EMLINK; + } + ui_bts = (le->mode == LAPDM_MODE_BTS && (link_id & 0x40)); /* check if the layer3 message length exceeds N201 */ -- To view, visit https://gerrit.osmocom.org/1959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 2 09:28:19 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 09:28:19 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: -Code-Review -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 09:33:11 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 09:33:11 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: ctrl_type_vals in libosmocore is terminated with { CTRL_TYPE_UNKNOWN, NULL } where CTRL_TYPE_UNKNOWN is first element of enum explicitly defined as 0. Will your regexp treat it as error? I agree that it would be nice to check for null-termination automatically, I just don't think current version of the check is robust enough not to become obstacle. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 10:30:44 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 10:30:44 +0000 Subject: [PATCH] osmo-bts[master]: Check for suitable lchan type when detecting HO Message-ID: Review at https://gerrit.osmocom.org/1960 Check for suitable lchan type when detecting HO Log error when handover RACH is detected on wrong channel: according to 3GPP TS 44.018 it can only be seen on SACCH and DCCH. Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Related: OS#1898 --- M src/common/handover.c 1 file changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/60/1960/1 diff --git a/src/common/handover.c b/src/common/handover.c index 03433ea..45ed040 100644 --- a/src/common/handover.c +++ b/src/common/handover.c @@ -106,9 +106,17 @@ return; } + /* Ignore handover on channels other than DCCH and SACCH */ + if (lchan->type != GSM_LCHAN_SDCCH && lchan->type != GSM_LCHAN_TCH_H && + lchan->type != GSM_LCHAN_TCH_F) { + LOGP(DHO, LOGL_ERROR, "%s handover RACH received on %s?!\n", + gsm_lchan_name(lchan), gsm_lchant_name(lchan->type)); + return; + } + LOGP(DHO, LOGL_NOTICE, - "%s RACH on dedicated channel received with TA=%u\n", - gsm_lchan_name(lchan), acc_delay); + "%s RACH on dedicated channel type %s received with TA=%u, ref=%u\n", + gsm_lchan_name(lchan), gsm_lchant_name(lchan->type), acc_delay, ra); /* Set timing advance */ lchan->rqd_ta = acc_delay; -- To view, visit https://gerrit.osmocom.org/1960 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:02:11 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:02:11 +0000 Subject: [PATCH] osmo-hlr[master]: Add global HLR struct In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1856 to look at the new patch set (#5). Add global HLR struct Introduce g_hlr of type 'struct hlr' which holds pointers to all globally accessible variables. Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Related: OS#1645 --- M src/db_test.c M src/hlr.c A src/hlr.h 3 files changed, 62 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/56/1856/5 diff --git a/src/db_test.c b/src/db_test.c index 75fcb62..998a37a 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -4,12 +4,13 @@ #include #include "db.h" +#include "hlr.h" #include "rand.h" #include "logging.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; -static int test(const char *imsi) +static int test(const char *imsi, struct db_context *dbc) { struct osmo_auth_vector vec[3]; int rc, i; @@ -19,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(g_dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; @@ -46,6 +47,8 @@ { int rc; + g_hlr = talloc_zero(NULL, struct hlr); + rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { fprintf(stderr, "Error initializing logging\n"); @@ -59,24 +62,24 @@ exit(1); } - g_dbc = db_open(NULL, "hlr.db"); - if (!g_dbc) { + g_hlr->dbc = db_open(NULL, "hlr.db"); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_ERROR, "Error opening database\n"); exit(1); } /* non-existing subscriber */ - rc = test("901990123456789"); + rc = test("901990123456789", g_hlr->dbc); /* 2G only AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000001"); + rc = test("901990000000001", g_hlr->dbc); /* 2G + 3G AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000002"); + rc = test("901990000000002", g_hlr->dbc); /* 3G AUC data (MILENAGE) */ - rc = test("901990000000003"); + rc = test("901990000000003", g_hlr->dbc); LOGP(DMAIN, LOGL_NOTICE, "Exiting\n"); - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.c b/src/hlr.c index d74d9fb..dba9c8b 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -41,7 +41,7 @@ #include "luop.h" #include "hlr_vty.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; /*********************************************************************** * Send Auth Info handling @@ -49,7 +49,8 @@ /* process an incoming SAI request */ static int rx_send_auth_info(struct osmo_gsup_conn *conn, - const struct osmo_gsup_message *gsup) + const struct osmo_gsup_message *gsup, + struct db_context *dbc) { struct osmo_gsup_message gsup_out; struct msgb *msg_out; @@ -59,7 +60,7 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(g_dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { @@ -157,7 +158,7 @@ /* Roughly follwing "Process Update_Location_HLR" of TS 09.02 */ /* check if subscriber is known at all */ - if (!lu_op_fill_subscr(luop, g_dbc, gsup->imsi)) { + if (!lu_op_fill_subscr(luop, g_hlr->dbc, gsup->imsi)) { /* Send Error back: Subscriber Unknown in HLR */ strcpy(luop->subscr.imsi, gsup->imsi); lu_op_tx_error(luop, GMM_CAUSE_IMSI_UNKNOWN); @@ -216,7 +217,7 @@ * we have on record. Only update if yes */ /* Perform the actual update of the DB */ - rc = db_subscr_purge(g_dbc, gsup->imsi, is_ps); + rc = db_subscr_purge(g_hlr->dbc, gsup->imsi, is_ps); if (rc == 1) gsup_reply.message_type = OSMO_GSUP_MSGT_PURGE_MS_RESULT; @@ -247,7 +248,7 @@ switch (gsup.message_type) { /* requests sent to us */ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST: - rx_send_auth_info(conn, &gsup); + rx_send_auth_info(conn, &gsup, g_hlr->dbc); break; case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST: rx_upd_loc_req(conn, &gsup); @@ -372,15 +373,14 @@ } static void *hlr_ctx = NULL; -static struct osmo_gsup_server *gs; static void signal_hdlr(int signal) { switch (signal) { case SIGINT: LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n"); - osmo_gsup_server_destroy(gs); - db_close(g_dbc); + osmo_gsup_server_destroy(g_hlr->gs); + db_close(g_hlr->dbc); log_fini(); talloc_report_full(hlr_ctx, stderr); exit(0); @@ -404,6 +404,8 @@ hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); + + g_hlr = talloc_zero(hlr_ctx, struct hlr); rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { @@ -437,14 +439,14 @@ exit(1); } - g_dbc = db_open(hlr_ctx, cmdline_opts.db_file); - if (!g_dbc) { + g_hlr->dbc = db_open(hlr_ctx, cmdline_opts.db_file); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_FATAL, "Error opening database\n"); exit(1); } - gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); - if (!gs) { + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); } @@ -465,7 +467,7 @@ osmo_select_main(0); } - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.h b/src/hlr.h new file mode 100644 index 0000000..77751dd --- /dev/null +++ b/src/hlr.h @@ -0,0 +1,33 @@ +/* OsmoHLR generic header */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +struct hlr { + /* GSUP server pointer */ + struct osmo_gsup_server *gs; + + /* DB context */ + struct db_context *dbc; +}; -- To view, visit https://gerrit.osmocom.org/1856 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Gerrit-PatchSet: 5 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:02:11 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:02:11 +0000 Subject: [PATCH] osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1827 to look at the new patch set (#13). Add CTRL interface Add command to query Packet Services (GPRS etc.) for particular IMSI. Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Related: OS#1645 --- M configure.ac M src/Makefile.am A src/ctrl.c A src/ctrl.h M src/hlr.c M src/hlr.h 6 files changed, 135 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/27/1827/13 diff --git a/configure.ac b/configure.ac index bfda9c5..a04185f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) PKG_CHECK_MODULES(SQLITE3, sqlite3) diff --git a/src/Makefile.am b/src/Makefile.am index 56a5670..ad744c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(NULL) @@ -19,6 +20,7 @@ gsup_server.h \ logging.h \ rand.h \ + ctrl.h \ hlr_vty.h \ $(NULL) @@ -32,6 +34,7 @@ osmo_hlr_SOURCES = \ auc.c \ + ctrl.c \ db.c \ luop.c \ db_auc.c \ @@ -48,6 +51,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(SQLITE3_LIBS) \ $(NULL) diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..a167171 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,81 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#include + +#include +#include +#include + +#include "gsup_server.h" +#include "logging.h" +#include "db.h" +#include "hlr.h" +#include "luop.h" +#include "ctrl.h" + +CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); +static int set_status_ps(struct ctrl_cmd *cmd, void *data) +{ + struct hlr *ctx = data; + struct lu_operation *luop = lu_op_alloc(ctx->gs); + if (!luop) { + cmd->reply = "Internal HLR error"; + return CTRL_CMD_ERROR; + } + + if (!lu_op_fill_subscr(luop, ctx->dbc, cmd->value)) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + cmd->reply = luop->subscr.nam_ps ? "1" : "0"; + + return CTRL_CMD_REPLY; +} + +int hlr_ctrl_cmds_install() +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); + + return rc; +} + +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs) +{ + int rc; + struct ctrl_handle *hdl = ctrl_interface_setup_dynip(ctx, + ctx->ctrl_bind_addr, + OSMO_CTRL_PORT_HLR, + NULL); + if (!hdl) + return NULL; + + rc = hlr_ctrl_cmds_install(); + if (rc) /* FIXME: close control interface? */ + return NULL; + + return hdl; +} diff --git a/src/ctrl.h b/src/ctrl.h new file mode 100644 index 0000000..663de30 --- /dev/null +++ b/src/ctrl.h @@ -0,0 +1,31 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +#include "gsup_server.h" + +int hlr_ctrl_cmds_install(); +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs); diff --git a/src/hlr.c b/src/hlr.c index dba9c8b..f0ceda6 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -34,6 +34,7 @@ #include #include "db.h" +#include "ctrl.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -298,6 +299,8 @@ printf(" -s --disable-color Do not print ANSI colors in the log\n"); printf(" -T --timestamp Prefix every log line with a timestamp.\n"); printf(" -e --log-level number Set a global loglevel.\n"); + printf(" -R --ctrl address Set address to which Control " + "Interface should be bound, defaults to 127.0.0.1.\n"); printf(" -V --version Print the version of OsmoHLR.\n"); } @@ -323,12 +326,13 @@ {"daemonize", 0, 0, 'D'}, {"disable-color", 0, 0, 's'}, {"log-level", 1, 0, 'e'}, + {"ctrl", 1, 0, 'R'}, {"timestamp", 0, 0, 'T'}, {"version", 0, 0, 'V' }, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "hc:l:d:Dse:TV", + c = getopt_long(argc, argv, "hc:l:d:Dse:R:TV", long_options, &option_index); if (c == -1) break; @@ -343,6 +347,9 @@ break; case 'l': cmdline_opts.db_file = optarg; + break; + case 'R': + g_hlr->ctrl_bind_addr = optarg; break; case 'd': log_parse_category_mask(osmo_stderr_target, optarg); @@ -451,6 +458,12 @@ exit(1); } + if (g_hlr->ctrl_bind_addr) + g_hlr->ctrl = hlr_controlif_setup(g_hlr, g_hlr->gs); + else + LOGP(DLGSUP, LOGL_NOTICE, "Control Interface is NOT created: " + "bind address missing\n"); + osmo_init_ignore_signals(); signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); diff --git a/src/hlr.h b/src/hlr.h index 77751dd..1e8eff8 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -30,4 +30,8 @@ /* DB context */ struct db_context *dbc; + + /* Control Interface */ + struct ctrl_handle *ctrl; + const char *ctrl_bind_addr; }; -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 13 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:02:19 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:02:19 +0000 Subject: [ABANDON] osmo-hlr[master]: Get rid of global config options struct In-Reply-To: References: Message-ID: Max has abandoned this change. Change subject: Get rid of global config options struct ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/1899 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I83f0a352327e6ea659b789c37deacf2f86eb3dde Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:14:02 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:14:02 +0000 Subject: [PATCH] osmo-hlr[master]: Add global HLR struct In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1856 to look at the new patch set (#6). Add global HLR struct Introduce g_hlr of type 'struct hlr' which holds pointers to all globally accessible variables. Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Related: OS#1645 --- M src/db_test.c M src/hlr.c A src/hlr.h 3 files changed, 63 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/56/1856/6 diff --git a/src/db_test.c b/src/db_test.c index 75fcb62..998a37a 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -4,12 +4,13 @@ #include #include "db.h" +#include "hlr.h" #include "rand.h" #include "logging.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; -static int test(const char *imsi) +static int test(const char *imsi, struct db_context *dbc) { struct osmo_auth_vector vec[3]; int rc, i; @@ -19,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(g_dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; @@ -46,6 +47,8 @@ { int rc; + g_hlr = talloc_zero(NULL, struct hlr); + rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { fprintf(stderr, "Error initializing logging\n"); @@ -59,24 +62,24 @@ exit(1); } - g_dbc = db_open(NULL, "hlr.db"); - if (!g_dbc) { + g_hlr->dbc = db_open(NULL, "hlr.db"); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_ERROR, "Error opening database\n"); exit(1); } /* non-existing subscriber */ - rc = test("901990123456789"); + rc = test("901990123456789", g_hlr->dbc); /* 2G only AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000001"); + rc = test("901990000000001", g_hlr->dbc); /* 2G + 3G AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000002"); + rc = test("901990000000002", g_hlr->dbc); /* 3G AUC data (MILENAGE) */ - rc = test("901990000000003"); + rc = test("901990000000003", g_hlr->dbc); LOGP(DMAIN, LOGL_NOTICE, "Exiting\n"); - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.c b/src/hlr.c index d74d9fb..bb6f05a 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -34,6 +34,7 @@ #include #include "db.h" +#include "hlr.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -41,7 +42,7 @@ #include "luop.h" #include "hlr_vty.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; /*********************************************************************** * Send Auth Info handling @@ -49,7 +50,8 @@ /* process an incoming SAI request */ static int rx_send_auth_info(struct osmo_gsup_conn *conn, - const struct osmo_gsup_message *gsup) + const struct osmo_gsup_message *gsup, + struct db_context *dbc) { struct osmo_gsup_message gsup_out; struct msgb *msg_out; @@ -59,7 +61,7 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(g_dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { @@ -157,7 +159,7 @@ /* Roughly follwing "Process Update_Location_HLR" of TS 09.02 */ /* check if subscriber is known at all */ - if (!lu_op_fill_subscr(luop, g_dbc, gsup->imsi)) { + if (!lu_op_fill_subscr(luop, g_hlr->dbc, gsup->imsi)) { /* Send Error back: Subscriber Unknown in HLR */ strcpy(luop->subscr.imsi, gsup->imsi); lu_op_tx_error(luop, GMM_CAUSE_IMSI_UNKNOWN); @@ -216,7 +218,7 @@ * we have on record. Only update if yes */ /* Perform the actual update of the DB */ - rc = db_subscr_purge(g_dbc, gsup->imsi, is_ps); + rc = db_subscr_purge(g_hlr->dbc, gsup->imsi, is_ps); if (rc == 1) gsup_reply.message_type = OSMO_GSUP_MSGT_PURGE_MS_RESULT; @@ -247,7 +249,7 @@ switch (gsup.message_type) { /* requests sent to us */ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST: - rx_send_auth_info(conn, &gsup); + rx_send_auth_info(conn, &gsup, g_hlr->dbc); break; case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST: rx_upd_loc_req(conn, &gsup); @@ -372,15 +374,14 @@ } static void *hlr_ctx = NULL; -static struct osmo_gsup_server *gs; static void signal_hdlr(int signal) { switch (signal) { case SIGINT: LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n"); - osmo_gsup_server_destroy(gs); - db_close(g_dbc); + osmo_gsup_server_destroy(g_hlr->gs); + db_close(g_hlr->dbc); log_fini(); talloc_report_full(hlr_ctx, stderr); exit(0); @@ -404,6 +405,8 @@ hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); + + g_hlr = talloc_zero(hlr_ctx, struct hlr); rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { @@ -437,14 +440,14 @@ exit(1); } - g_dbc = db_open(hlr_ctx, cmdline_opts.db_file); - if (!g_dbc) { + g_hlr->dbc = db_open(hlr_ctx, cmdline_opts.db_file); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_FATAL, "Error opening database\n"); exit(1); } - gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); - if (!gs) { + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); } @@ -465,7 +468,7 @@ osmo_select_main(0); } - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.h b/src/hlr.h new file mode 100644 index 0000000..77751dd --- /dev/null +++ b/src/hlr.h @@ -0,0 +1,33 @@ +/* OsmoHLR generic header */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +struct hlr { + /* GSUP server pointer */ + struct osmo_gsup_server *gs; + + /* DB context */ + struct db_context *dbc; +}; -- To view, visit https://gerrit.osmocom.org/1856 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Gerrit-PatchSet: 6 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:14:02 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:14:02 +0000 Subject: [PATCH] osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1827 to look at the new patch set (#14). Add CTRL interface Add command to query Packet Services (GPRS etc.) for particular IMSI. Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Related: OS#1645 --- M configure.ac M src/Makefile.am A src/ctrl.c A src/ctrl.h M src/hlr.c M src/hlr.h 6 files changed, 135 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/27/1827/14 diff --git a/configure.ac b/configure.ac index bfda9c5..a04185f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) PKG_CHECK_MODULES(SQLITE3, sqlite3) diff --git a/src/Makefile.am b/src/Makefile.am index 56a5670..ad744c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(NULL) @@ -19,6 +20,7 @@ gsup_server.h \ logging.h \ rand.h \ + ctrl.h \ hlr_vty.h \ $(NULL) @@ -32,6 +34,7 @@ osmo_hlr_SOURCES = \ auc.c \ + ctrl.c \ db.c \ luop.c \ db_auc.c \ @@ -48,6 +51,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(SQLITE3_LIBS) \ $(NULL) diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..a167171 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,81 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#include + +#include +#include +#include + +#include "gsup_server.h" +#include "logging.h" +#include "db.h" +#include "hlr.h" +#include "luop.h" +#include "ctrl.h" + +CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); +static int set_status_ps(struct ctrl_cmd *cmd, void *data) +{ + struct hlr *ctx = data; + struct lu_operation *luop = lu_op_alloc(ctx->gs); + if (!luop) { + cmd->reply = "Internal HLR error"; + return CTRL_CMD_ERROR; + } + + if (!lu_op_fill_subscr(luop, ctx->dbc, cmd->value)) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + cmd->reply = luop->subscr.nam_ps ? "1" : "0"; + + return CTRL_CMD_REPLY; +} + +int hlr_ctrl_cmds_install() +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); + + return rc; +} + +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs) +{ + int rc; + struct ctrl_handle *hdl = ctrl_interface_setup_dynip(ctx, + ctx->ctrl_bind_addr, + OSMO_CTRL_PORT_HLR, + NULL); + if (!hdl) + return NULL; + + rc = hlr_ctrl_cmds_install(); + if (rc) /* FIXME: close control interface? */ + return NULL; + + return hdl; +} diff --git a/src/ctrl.h b/src/ctrl.h new file mode 100644 index 0000000..663de30 --- /dev/null +++ b/src/ctrl.h @@ -0,0 +1,31 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +#include "gsup_server.h" + +int hlr_ctrl_cmds_install(); +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs); diff --git a/src/hlr.c b/src/hlr.c index bb6f05a..06715f3 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -35,6 +35,7 @@ #include "db.h" #include "hlr.h" +#include "ctrl.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -299,6 +300,8 @@ printf(" -s --disable-color Do not print ANSI colors in the log\n"); printf(" -T --timestamp Prefix every log line with a timestamp.\n"); printf(" -e --log-level number Set a global loglevel.\n"); + printf(" -R --ctrl address Set address to which Control " + "Interface should be bound, defaults to 127.0.0.1.\n"); printf(" -V --version Print the version of OsmoHLR.\n"); } @@ -324,12 +327,13 @@ {"daemonize", 0, 0, 'D'}, {"disable-color", 0, 0, 's'}, {"log-level", 1, 0, 'e'}, + {"ctrl", 1, 0, 'R'}, {"timestamp", 0, 0, 'T'}, {"version", 0, 0, 'V' }, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "hc:l:d:Dse:TV", + c = getopt_long(argc, argv, "hc:l:d:Dse:R:TV", long_options, &option_index); if (c == -1) break; @@ -344,6 +348,9 @@ break; case 'l': cmdline_opts.db_file = optarg; + break; + case 'R': + g_hlr->ctrl_bind_addr = optarg; break; case 'd': log_parse_category_mask(osmo_stderr_target, optarg); @@ -452,6 +459,12 @@ exit(1); } + if (g_hlr->ctrl_bind_addr) + g_hlr->ctrl = hlr_controlif_setup(g_hlr, g_hlr->gs); + else + LOGP(DLGSUP, LOGL_NOTICE, "Control Interface is NOT created: " + "bind address missing\n"); + osmo_init_ignore_signals(); signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); diff --git a/src/hlr.h b/src/hlr.h index 77751dd..1e8eff8 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -30,4 +30,8 @@ /* DB context */ struct db_context *dbc; + + /* Control Interface */ + struct ctrl_handle *ctrl; + const char *ctrl_bind_addr; }; -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 14 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:25:44 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:25:44 +0000 Subject: [PATCH] osmo-hlr[master]: Add global HLR struct In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1856 to look at the new patch set (#7). Add global HLR struct Introduce g_hlr of type 'struct hlr' which holds pointers to all globally accessible variables. Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Related: OS#1645 --- M src/Makefile.am M src/db_test.c M src/hlr.c A src/hlr.h 4 files changed, 64 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/56/1856/7 diff --git a/src/Makefile.am b/src/Makefile.am index 56a5670..1791343 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,7 @@ noinst_HEADERS = \ auc.h \ db.h \ + hlr.h \ luop.h \ gsup_router.h \ gsup_server.h \ diff --git a/src/db_test.c b/src/db_test.c index 75fcb62..998a37a 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -4,12 +4,13 @@ #include #include "db.h" +#include "hlr.h" #include "rand.h" #include "logging.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; -static int test(const char *imsi) +static int test(const char *imsi, struct db_context *dbc) { struct osmo_auth_vector vec[3]; int rc, i; @@ -19,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(g_dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; @@ -46,6 +47,8 @@ { int rc; + g_hlr = talloc_zero(NULL, struct hlr); + rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { fprintf(stderr, "Error initializing logging\n"); @@ -59,24 +62,24 @@ exit(1); } - g_dbc = db_open(NULL, "hlr.db"); - if (!g_dbc) { + g_hlr->dbc = db_open(NULL, "hlr.db"); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_ERROR, "Error opening database\n"); exit(1); } /* non-existing subscriber */ - rc = test("901990123456789"); + rc = test("901990123456789", g_hlr->dbc); /* 2G only AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000001"); + rc = test("901990000000001", g_hlr->dbc); /* 2G + 3G AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000002"); + rc = test("901990000000002", g_hlr->dbc); /* 3G AUC data (MILENAGE) */ - rc = test("901990000000003"); + rc = test("901990000000003", g_hlr->dbc); LOGP(DMAIN, LOGL_NOTICE, "Exiting\n"); - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.c b/src/hlr.c index d74d9fb..bb6f05a 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -34,6 +34,7 @@ #include #include "db.h" +#include "hlr.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -41,7 +42,7 @@ #include "luop.h" #include "hlr_vty.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; /*********************************************************************** * Send Auth Info handling @@ -49,7 +50,8 @@ /* process an incoming SAI request */ static int rx_send_auth_info(struct osmo_gsup_conn *conn, - const struct osmo_gsup_message *gsup) + const struct osmo_gsup_message *gsup, + struct db_context *dbc) { struct osmo_gsup_message gsup_out; struct msgb *msg_out; @@ -59,7 +61,7 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(g_dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { @@ -157,7 +159,7 @@ /* Roughly follwing "Process Update_Location_HLR" of TS 09.02 */ /* check if subscriber is known at all */ - if (!lu_op_fill_subscr(luop, g_dbc, gsup->imsi)) { + if (!lu_op_fill_subscr(luop, g_hlr->dbc, gsup->imsi)) { /* Send Error back: Subscriber Unknown in HLR */ strcpy(luop->subscr.imsi, gsup->imsi); lu_op_tx_error(luop, GMM_CAUSE_IMSI_UNKNOWN); @@ -216,7 +218,7 @@ * we have on record. Only update if yes */ /* Perform the actual update of the DB */ - rc = db_subscr_purge(g_dbc, gsup->imsi, is_ps); + rc = db_subscr_purge(g_hlr->dbc, gsup->imsi, is_ps); if (rc == 1) gsup_reply.message_type = OSMO_GSUP_MSGT_PURGE_MS_RESULT; @@ -247,7 +249,7 @@ switch (gsup.message_type) { /* requests sent to us */ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST: - rx_send_auth_info(conn, &gsup); + rx_send_auth_info(conn, &gsup, g_hlr->dbc); break; case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST: rx_upd_loc_req(conn, &gsup); @@ -372,15 +374,14 @@ } static void *hlr_ctx = NULL; -static struct osmo_gsup_server *gs; static void signal_hdlr(int signal) { switch (signal) { case SIGINT: LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n"); - osmo_gsup_server_destroy(gs); - db_close(g_dbc); + osmo_gsup_server_destroy(g_hlr->gs); + db_close(g_hlr->dbc); log_fini(); talloc_report_full(hlr_ctx, stderr); exit(0); @@ -404,6 +405,8 @@ hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); + + g_hlr = talloc_zero(hlr_ctx, struct hlr); rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { @@ -437,14 +440,14 @@ exit(1); } - g_dbc = db_open(hlr_ctx, cmdline_opts.db_file); - if (!g_dbc) { + g_hlr->dbc = db_open(hlr_ctx, cmdline_opts.db_file); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_FATAL, "Error opening database\n"); exit(1); } - gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); - if (!gs) { + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); } @@ -465,7 +468,7 @@ osmo_select_main(0); } - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.h b/src/hlr.h new file mode 100644 index 0000000..77751dd --- /dev/null +++ b/src/hlr.h @@ -0,0 +1,33 @@ +/* OsmoHLR generic header */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +struct hlr { + /* GSUP server pointer */ + struct osmo_gsup_server *gs; + + /* DB context */ + struct db_context *dbc; +}; -- To view, visit https://gerrit.osmocom.org/1856 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Gerrit-PatchSet: 7 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 11:28:33 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 11:28:33 +0000 Subject: [PATCH] osmo-bts[master]: Check for suitable lchan type when detecting HO In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1960 to look at the new patch set (#2). Check for suitable lchan type when detecting HO Log error when handover RACH is detected on wrong channel: according to 3GPP TS 44.018 it can only be seen on SACCH and DCCH. Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Related: OS#1898 --- M src/common/handover.c M tests/handover/handover_test.c 2 files changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/60/1960/2 diff --git a/src/common/handover.c b/src/common/handover.c index 03433ea..45ed040 100644 --- a/src/common/handover.c +++ b/src/common/handover.c @@ -106,9 +106,17 @@ return; } + /* Ignore handover on channels other than DCCH and SACCH */ + if (lchan->type != GSM_LCHAN_SDCCH && lchan->type != GSM_LCHAN_TCH_H && + lchan->type != GSM_LCHAN_TCH_F) { + LOGP(DHO, LOGL_ERROR, "%s handover RACH received on %s?!\n", + gsm_lchan_name(lchan), gsm_lchant_name(lchan->type)); + return; + } + LOGP(DHO, LOGL_NOTICE, - "%s RACH on dedicated channel received with TA=%u\n", - gsm_lchan_name(lchan), acc_delay); + "%s RACH on dedicated channel type %s received with TA=%u, ref=%u\n", + gsm_lchan_name(lchan), gsm_lchant_name(lchan->type), acc_delay, ra); /* Set timing advance */ lchan->rqd_ta = acc_delay; diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index a7a66d0..611c441 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -103,8 +103,10 @@ /* create two lchans for handover */ lchan = &trx->ts[1].lchan[0]; + lchan->type = GSM_LCHAN_SDCCH; l1sap_chan_act(lchan->ts->trx, 0x09, NULL); lchan = &trx->ts[2].lchan[0]; + lchan->type = GSM_LCHAN_TCH_F; lchan->ho.active = HANDOVER_ENABLED; lchan->ho.ref = 23; l1sap_chan_act(lchan->ts->trx, 0x0a, NULL); -- To view, visit https://gerrit.osmocom.org/1960 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 2 12:17:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 12:17:58 +0000 Subject: [PATCH] osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1827 to look at the new patch set (#16). Add CTRL interface Add command to query Packet Services (GPRS etc.) for particular IMSI. Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Related: OS#1645 --- M configure.ac M src/Makefile.am A src/ctrl.c A src/ctrl.h M src/hlr.c M src/hlr.h 6 files changed, 136 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/27/1827/16 diff --git a/configure.ac b/configure.ac index bfda9c5..a04185f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) PKG_CHECK_MODULES(SQLITE3, sqlite3) diff --git a/src/Makefile.am b/src/Makefile.am index 1791343..b410ff3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(NULL) @@ -20,6 +21,7 @@ gsup_server.h \ logging.h \ rand.h \ + ctrl.h \ hlr_vty.h \ $(NULL) @@ -33,6 +35,7 @@ osmo_hlr_SOURCES = \ auc.c \ + ctrl.c \ db.c \ luop.c \ db_auc.c \ @@ -49,6 +52,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(SQLITE3_LIBS) \ $(NULL) diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..a167171 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,81 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#include + +#include +#include +#include + +#include "gsup_server.h" +#include "logging.h" +#include "db.h" +#include "hlr.h" +#include "luop.h" +#include "ctrl.h" + +CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); +static int set_status_ps(struct ctrl_cmd *cmd, void *data) +{ + struct hlr *ctx = data; + struct lu_operation *luop = lu_op_alloc(ctx->gs); + if (!luop) { + cmd->reply = "Internal HLR error"; + return CTRL_CMD_ERROR; + } + + if (!lu_op_fill_subscr(luop, ctx->dbc, cmd->value)) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + cmd->reply = luop->subscr.nam_ps ? "1" : "0"; + + return CTRL_CMD_REPLY; +} + +int hlr_ctrl_cmds_install() +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); + + return rc; +} + +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs) +{ + int rc; + struct ctrl_handle *hdl = ctrl_interface_setup_dynip(ctx, + ctx->ctrl_bind_addr, + OSMO_CTRL_PORT_HLR, + NULL); + if (!hdl) + return NULL; + + rc = hlr_ctrl_cmds_install(); + if (rc) /* FIXME: close control interface? */ + return NULL; + + return hdl; +} diff --git a/src/ctrl.h b/src/ctrl.h new file mode 100644 index 0000000..663de30 --- /dev/null +++ b/src/ctrl.h @@ -0,0 +1,31 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +#include "gsup_server.h" + +int hlr_ctrl_cmds_install(); +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs); diff --git a/src/hlr.c b/src/hlr.c index bb6f05a..c69526e 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -35,6 +35,7 @@ #include "db.h" #include "hlr.h" +#include "ctrl.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -299,6 +300,8 @@ printf(" -s --disable-color Do not print ANSI colors in the log\n"); printf(" -T --timestamp Prefix every log line with a timestamp.\n"); printf(" -e --log-level number Set a global loglevel.\n"); + printf(" -R --ctrl address Set address to which Control " + "Interface should be bound, defaults to 127.0.0.1.\n"); printf(" -V --version Print the version of OsmoHLR.\n"); } @@ -324,12 +327,13 @@ {"daemonize", 0, 0, 'D'}, {"disable-color", 0, 0, 's'}, {"log-level", 1, 0, 'e'}, + {"ctrl", 1, 0, 'R'}, {"timestamp", 0, 0, 'T'}, {"version", 0, 0, 'V' }, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "hc:l:d:Dse:TV", + c = getopt_long(argc, argv, "hc:l:d:Dse:R:TV", long_options, &option_index); if (c == -1) break; @@ -344,6 +348,9 @@ break; case 'l': cmdline_opts.db_file = optarg; + break; + case 'R': + g_hlr->ctrl_bind_addr = optarg; break; case 'd': log_parse_category_mask(osmo_stderr_target, optarg); @@ -407,6 +414,7 @@ msgb_talloc_ctx_init(hlr_ctx, 0); g_hlr = talloc_zero(hlr_ctx, struct hlr); + g_hlr->ctrl_bind_addr = "127.0.0.1"; rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { @@ -452,6 +460,12 @@ exit(1); } + if (g_hlr->ctrl_bind_addr) + g_hlr->ctrl = hlr_controlif_setup(g_hlr, g_hlr->gs); + else + LOGP(DLGSUP, LOGL_NOTICE, "Control Interface is NOT created: " + "bind address missing\n"); + osmo_init_ignore_signals(); signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); diff --git a/src/hlr.h b/src/hlr.h index 77751dd..1e8eff8 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -30,4 +30,8 @@ /* DB context */ struct db_context *dbc; + + /* Control Interface */ + struct ctrl_handle *ctrl; + const char *ctrl_bind_addr; }; -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 16 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 12:31:23 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 12:31:23 +0000 Subject: [PATCH] openbsc[master]: Fix potential segfault in sgsn_libgtp.c Message-ID: Review at https://gerrit.osmocom.org/1961 Fix potential segfault in sgsn_libgtp.c * print pdp->address instead of mm->imsi if mm is NULL * print mm->imsi in debug log (move it below NULL check) Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205 --- M openbsc/src/gprs/sgsn_libgtp.c 1 file changed, 5 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/61/1961/1 diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index dde1e5e..c26abc9 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -641,8 +641,6 @@ struct msgb *msg; uint8_t *ud; - DEBUGP(DGPRS, "GTP DATA IND from GGSN, length=%u\n", len); - pdp = lib->priv; if (!pdp) { LOGP(DGPRS, LOGL_NOTICE, @@ -652,10 +650,14 @@ mm = pdp->mm; if (!mm) { LOGP(DGPRS, LOGL_ERROR, - "PDP context (imsi=%s) without MM context!\n", mm->imsi); + "PDP context (address=%u) without MM context!\n", + pdp->address); return -EIO; } + DEBUGP(DGPRS, "GTP DATA IND from GGSN for %s, length=%u\n", mm->imsi, + len); + if (mm->ran_type == MM_CTX_T_UTRAN_Iu) { #ifdef BUILD_IU /* Ignore the packet for now and page the UE to get the RAB -- To view, visit https://gerrit.osmocom.org/1961 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 2 13:17:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 13:17:37 +0000 Subject: openbsc[master]: Fix potential segfault in sgsn_libgtp.c In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1961 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 13:17:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 13:17:44 +0000 Subject: [MERGED] openbsc[master]: Fix potential segfault in sgsn_libgtp.c In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: Fix potential segfault in sgsn_libgtp.c ...................................................................... Fix potential segfault in sgsn_libgtp.c * print pdp->address instead of mm->imsi if mm is NULL * print mm->imsi in debug log (move it below NULL check) Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205 --- M openbsc/src/gprs/sgsn_libgtp.c 1 file changed, 5 insertions(+), 3 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index dde1e5e..c26abc9 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -641,8 +641,6 @@ struct msgb *msg; uint8_t *ud; - DEBUGP(DGPRS, "GTP DATA IND from GGSN, length=%u\n", len); - pdp = lib->priv; if (!pdp) { LOGP(DGPRS, LOGL_NOTICE, @@ -652,10 +650,14 @@ mm = pdp->mm; if (!mm) { LOGP(DGPRS, LOGL_ERROR, - "PDP context (imsi=%s) without MM context!\n", mm->imsi); + "PDP context (address=%u) without MM context!\n", + pdp->address); return -EIO; } + DEBUGP(DGPRS, "GTP DATA IND from GGSN for %s, length=%u\n", mm->imsi, + len); + if (mm->ran_type == MM_CTX_T_UTRAN_Iu) { #ifdef BUILD_IU /* Ignore the packet for now and page the UE to get the RAB -- To view, visit https://gerrit.osmocom.org/1961 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 13:48:56 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 13:48:56 +0000 Subject: [PATCH] libosmocore[master]: ctrl_type_vals: explicitly terminate Message-ID: Review at https://gerrit.osmocom.org/1962 ctrl_type_vals: explicitly terminate Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. >From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. My main motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc --- M include/osmocom/ctrl/control_cmd.h M src/ctrl/control_cmd.c 2 files changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/1962/1 diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index d82c9af..d9092f3 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -22,7 +22,7 @@ }; enum ctrl_type { - CTRL_TYPE_UNKNOWN = 0, + CTRL_TYPE_UNKNOWN, CTRL_TYPE_GET, CTRL_TYPE_SET, CTRL_TYPE_GET_REPLY, diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 1cc8247..875febc 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -40,13 +40,14 @@ extern vector ctrl_node_vec; const struct value_string ctrl_type_vals[] = { + { CTRL_TYPE_UNKNOWN, "(unknown)" }, { CTRL_TYPE_GET, "GET" }, { CTRL_TYPE_SET, "SET" }, { CTRL_TYPE_GET_REPLY, "GET_REPLY" }, { CTRL_TYPE_SET_REPLY, "SET_REPLY" }, { CTRL_TYPE_TRAP, "TRAP" }, { CTRL_TYPE_ERROR, "ERROR" }, - { CTRL_TYPE_UNKNOWN, NULL } + { 0, NULL } }; /* Functions from libosmocom */ -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 13:49:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 13:49:48 +0000 Subject: libosmocore[master]: Use value_string for ctrl_type In-Reply-To: References: Message-ID: Patch Set 4: I disagree with the termination of this value_string[] and the +2 and merge was done so fast that I could not react. Please see https://gerrit.osmocom.org/1962 -- To view, visit https://gerrit.osmocom.org/1895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 13:56:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 13:56:53 +0000 Subject: [PATCH] libosmocore[master]: ctrl_type_vals: fix range check, explicitly terminate In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1962 to look at the new patch set (#2). ctrl_type_vals: fix range check, explicitly terminate In ctrl_cmd_parse(), fix missing check for not parseable ctrl type. Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. >From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc --- M include/osmocom/ctrl/control_cmd.h M src/ctrl/control_cmd.c M tests/ctrl/ctrl_test.ok 3 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/1962/2 diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index d82c9af..d9092f3 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -22,7 +22,7 @@ }; enum ctrl_type { - CTRL_TYPE_UNKNOWN = 0, + CTRL_TYPE_UNKNOWN, CTRL_TYPE_GET, CTRL_TYPE_SET, CTRL_TYPE_GET_REPLY, diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 1cc8247..d706995 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -40,13 +40,14 @@ extern vector ctrl_node_vec; const struct value_string ctrl_type_vals[] = { + { CTRL_TYPE_UNKNOWN, "(unknown)" }, { CTRL_TYPE_GET, "GET" }, { CTRL_TYPE_SET, "SET" }, { CTRL_TYPE_GET_REPLY, "GET_REPLY" }, { CTRL_TYPE_SET_REPLY, "SET_REPLY" }, { CTRL_TYPE_TRAP, "TRAP" }, { CTRL_TYPE_ERROR, "ERROR" }, - { CTRL_TYPE_UNKNOWN, NULL } + { 0, NULL } }; /* Functions from libosmocom */ @@ -289,7 +290,7 @@ } cmd->type = get_string_value(ctrl_type_vals, tmp); - if (cmd->type == CTRL_TYPE_UNKNOWN) { + if (cmd->type < 0 || cmd->type == CTRL_TYPE_UNKNOWN) { cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; cmd->reply = "Request type unknown"; diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok index c4b05e9..8f97a27 100644 --- a/tests/ctrl/ctrl_test.ok +++ b/tests/ctrl/ctrl_test.ok @@ -1,5 +1,5 @@ Checking ctrl types... -ctrl type 0 is unknown 0x0 [PARSE FAILED] +ctrl type 0 is (unknown) -> 0 OK ctrl type 1 is GET -> 1 OK ctrl type 2 is SET -> 2 OK ctrl type 3 is GET_REPLY -> 3 OK -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:05:49 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 14:05:49 +0000 Subject: libosmocore[master]: ctrl_type_vals: fix range check, explicitly terminate In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1962/2/src/ctrl/control_cmd.c File src/ctrl/control_cmd.c: Line 293: if (cmd->type < 0 || cmd->type == CTRL_TYPE_UNKNOWN) { This seems to be unrelated to the rest of the patch. -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:05:54 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:05:54 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: yes, that was still in the patch queue, and I disagree(d) with that patch. Harald and you merged too fast for my feedback, so I submitted https://gerrit.osmocom.org/1962. I still want to keep an explicit terminator everywhere. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:08:56 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:08:56 +0000 Subject: libosmocore[master]: Check for proper lapdm_datalink entity In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/1959/2/src/gsm/lapdm.c File src/gsm/lapdm.c: Line 857: int length, ui_bts; (would be nicer to keep each int on its own line) -- To view, visit https://gerrit.osmocom.org/1959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:10:06 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 14:10:06 +0000 Subject: [MERGED] libosmocore[master]: Check for proper lapdm_datalink entity In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Check for proper lapdm_datalink entity ...................................................................... Check for proper lapdm_datalink entity Previously lapdm_datalink->entity->mode was dereferenced without checking if correct entity is present. This might lead to segfault. Check it explicitly before dereferencing, log error and gracefully return if necessary. Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Related: OS#1898 --- M src/gsm/lapdm.c 1 file changed, 8 insertions(+), 2 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index fa7769b..1fdf311 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -852,10 +852,16 @@ struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); uint8_t chan_nr = rllh->chan_nr; uint8_t link_id = rllh->link_id; - int ui_bts = (le->mode == LAPDM_MODE_BTS && (link_id & 0x40)); uint8_t sapi = link_id & 7; struct tlv_parsed tv; - int length; + int length, ui_bts; + + if (!le) { + LOGP(DLLAPD, LOGL_ERROR, "lapdm_datalink without entity error\n"); + msgb_free(msg); + return -EMLINK; + } + ui_bts = (le->mode == LAPDM_MODE_BTS && (link_id & 0x40)); /* check if the layer3 message length exceeds N201 */ -- To view, visit https://gerrit.osmocom.org/1959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:11:07 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 14:11:07 +0000 Subject: libosmocore[master]: Check for proper lapdm_datalink entity In-Reply-To: References: Message-ID: Patch Set 3: > would be nicer to keep each int on its own line why? it would just add more lines - we have plenty of places where we use single type specifier for multiple variables. -- To view, visit https://gerrit.osmocom.org/1959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:12:39 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 14:12:39 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: We can simplify checker even further and only look for last ", NULL }" I don't think we have any value_string with multiple NULLs in it. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:36:43 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:36:43 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: that would be nice for your "hidden" termination, yes. But the value_string code only recognizes a terminator that has {0, NULL}. (And I prefer an explicit termination anyway.) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:38:13 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:38:13 +0000 Subject: libosmocore[master]: Check for proper lapdm_datalink entity In-Reply-To: References: Message-ID: Patch Set 3: having each var on its own line makes it easier to resolve merge conflicts (during rebases, reverts, later patches are easier to read...) -- To view, visit https://gerrit.osmocom.org/1959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:39:50 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:39:50 +0000 Subject: python/osmo-python-tests[master]: speed up python tests more than 10 fold by sleeping less In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1924 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:40:20 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:40:20 +0000 Subject: python/osmo-python-tests[master]: cosmetic: put socket connection code in separate function In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1923 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2dddf8794b4241898373178c8a1aa2e98b01095c Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:41:09 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:41:09 +0000 Subject: python/osmo-python-tests[master]: cosmetic: early exit instead of if-cascade In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/1920/2/osmopy/obscvty.py File osmopy/obscvty.py: Line 73: if self.socket is None: if not self.socket: ? -- To view, visit https://gerrit.osmocom.org/1920 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:41:55 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:41:55 +0000 Subject: python/osmo-python-tests[master]: debug_tcp_sockets: clearly mark as global var In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/1919/1//COMMIT_MSG Commit Message: Line 9: Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 Some explanation? Do not risk to have a local variable shadown it? -- To view, visit https://gerrit.osmocom.org/1919 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:42:40 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:42:40 +0000 Subject: python/osmo-python-tests[master]: debug: also output nr of open file descriptors for 'tcp debug' In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1918 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8a583df549f3e2b79068fd8cd32b75473539410d Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:43:36 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:43:36 +0000 Subject: python/osmo-python-tests[master]: tcp debugging: allow switching on TCP debug by env var In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) What do you think? https://gerrit.osmocom.org/#/c/1917/1/osmopy/obscvty.py File osmopy/obscvty.py: Line 30: debug_tcp_sockets = 'OSMOPY_DEBUG_TCP_SOCKETS' in os.environ does not allow to have it as ENV=0/1. Maybe os.getenv('..') == '1'? -- To view, visit https://gerrit.osmocom.org/1917 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:45:12 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:45:12 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 So.. yeah unittest.main could solve it.. but we ar enot using it.. and it doesn't make much sense to spend more time on it.. So while I think we can do better.. for this case I am using the good enough and if it makes your life better. -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:48:00 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:48:00 +0000 Subject: python/osmo-python-tests[master]: osmoutil: end_proc: wait for term in a loop In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Okay... as someone that should use alias kill=kill -9.. i honor your graceful shutdown :) -- To view, visit https://gerrit.osmocom.org/1936 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:48:14 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:48:14 +0000 Subject: python/osmo-python-tests[master]: on Exception during test, also print the actual config In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1922/1/osmopy/osmotestconfig.py File osmopy/osmotestconfig.py: Line 68: print >> sys.stderr, "Config was\n%s" % open(config).read() That could remain open for a long time.. besides being lucky by the refcounting of cpython... -- To view, visit https://gerrit.osmocom.org/1922 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:48:50 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:48:50 +0000 Subject: python/osmo-python-tests[master]: tcp_debug: don't abort when socket can't be removed In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1921 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:49:10 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 14:49:10 +0000 Subject: python/osmo-python-tests[master]: tcp_debug: don't abort when socket can't be removed In-Reply-To: References: Message-ID: Patch Set 1: When was that all sockets introduced? -- To view, visit https://gerrit.osmocom.org/1921 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:49:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:49:30 +0000 Subject: libosmocore[master]: ctrl_type_vals: fix range check, explicitly terminate In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1962/2/src/ctrl/control_cmd.c File src/ctrl/control_cmd.c: Line 293: if (cmd->type < 0 || cmd->type == CTRL_TYPE_UNKNOWN) { > This seems to be unrelated to the rest of the patch. It is related to your original patch, which I would have liked to review some more before merging. This patch is the fixup for the original patch that introduced the failure. But I can split it up if you insist. -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:52:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:52:34 +0000 Subject: [PATCH] libosmocore[master]: ctrl_type_vals: explicitly terminate In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1962 to look at the new patch set (#3). ctrl_type_vals: explicitly terminate Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. >From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc --- M include/osmocom/ctrl/control_cmd.h M src/ctrl/control_cmd.c M tests/ctrl/ctrl_test.ok 3 files changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/1962/3 diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index d82c9af..d9092f3 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -22,7 +22,7 @@ }; enum ctrl_type { - CTRL_TYPE_UNKNOWN = 0, + CTRL_TYPE_UNKNOWN, CTRL_TYPE_GET, CTRL_TYPE_SET, CTRL_TYPE_GET_REPLY, diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index cdec8ef..d706995 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -40,13 +40,14 @@ extern vector ctrl_node_vec; const struct value_string ctrl_type_vals[] = { + { CTRL_TYPE_UNKNOWN, "(unknown)" }, { CTRL_TYPE_GET, "GET" }, { CTRL_TYPE_SET, "SET" }, { CTRL_TYPE_GET_REPLY, "GET_REPLY" }, { CTRL_TYPE_SET_REPLY, "SET_REPLY" }, { CTRL_TYPE_TRAP, "TRAP" }, { CTRL_TYPE_ERROR, "ERROR" }, - { CTRL_TYPE_UNKNOWN, NULL } + { 0, NULL } }; /* Functions from libosmocom */ diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok index c4b05e9..8f97a27 100644 --- a/tests/ctrl/ctrl_test.ok +++ b/tests/ctrl/ctrl_test.ok @@ -1,5 +1,5 @@ Checking ctrl types... -ctrl type 0 is unknown 0x0 [PARSE FAILED] +ctrl type 0 is (unknown) -> 0 OK ctrl type 1 is GET -> 1 OK ctrl type 2 is SET -> 2 OK ctrl type 3 is GET_REPLY -> 3 OK -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 14:52:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 14:52:34 +0000 Subject: [PATCH] libosmocore[master]: ctrl_type_vals: fix range check Message-ID: Review at https://gerrit.osmocom.org/1963 ctrl_type_vals: fix range check In ctrl_cmd_parse(), fix missing check for not parseable ctrl type. Fixup for Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28. Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0 --- M src/ctrl/control_cmd.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/1963/1 diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 1cc8247..cdec8ef 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -289,7 +289,7 @@ } cmd->type = get_string_value(ctrl_type_vals, tmp); - if (cmd->type == CTRL_TYPE_UNKNOWN) { + if (cmd->type < 0 || cmd->type == CTRL_TYPE_UNKNOWN) { cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; cmd->reply = "Request type unknown"; -- To view, visit https://gerrit.osmocom.org/1963 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:01:31 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:01:31 +0000 Subject: python/osmo-python-tests[master]: cosmetic: early exit instead of if-cascade In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1920/2/osmopy/obscvty.py File osmopy/obscvty.py: Line 73: if self.socket is None: > if not self.socket: a None check is more accurate. 'if not x' also catches x == 0, or if a class instance's boolean operator returns false, which is distinct from None. In this case socket will never be '0' or implement a bool, but None is what we really want to check for. -- To view, visit https://gerrit.osmocom.org/1920 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:03:56 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:03:56 +0000 Subject: python/osmo-python-tests[master]: tcp debugging: allow switching on TCP debug by env var In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1917/1/osmopy/obscvty.py File osmopy/obscvty.py: Line 30: debug_tcp_sockets = 'OSMOPY_DEBUG_TCP_SOCKETS' in os.environ > does not allow to have it as ENV=0/1. Maybe os.getenv('..') == '1'? my vision was to trigger on presence and avoid value validation for 1, yes, on, true, enabled checks, but if you want to be able to set to 0, fine with me. getenv != '0'? -- To view, visit https://gerrit.osmocom.org/1917 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:06:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:06:07 +0000 Subject: [PATCH] python/osmo-python-tests[master]: debug_tcp_sockets: clearly mark as global var In-Reply-To: References: Message-ID: Hello Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1919 to look at the new patch set (#2). debug_tcp_sockets: clearly mark as global var Usually python implicitly takes a global var if no local var is present. But it's easy to create a local var by accident that would then shadow the global one, e.g. with an assignment. Marking it as global ensures that we always use the one global var and avoid local shadows. Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 --- M osmopy/obscvty.py 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/19/1919/2 diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index a517a5f..b09d108 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -39,6 +39,7 @@ sys.stdout.flush() def print_used_tcp_sockets(): + global debug_tcp_sockets if not debug_tcp_sockets: return cmd('ls /proc/self/fd'); @@ -68,6 +69,7 @@ self.last_node = '' def _close_socket(self): + global debug_tcp_sockets if self.socket: if debug_tcp_sockets: VTYInteract.all_sockets.remove(self.socket) @@ -131,6 +133,7 @@ return 0 def _common_command(self, request, close=False, ends=None): + global debug_tcp_sockets if not ends: ends = [self.norm_end, self.priv_end] if not self.socket: -- To view, visit https://gerrit.osmocom.org/1919 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:06:33 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:06:33 +0000 Subject: python/osmo-python-tests[master]: debug_tcp_sockets: clearly mark as global var In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 (let me re-add holger's +2 lost due to commit log edit) -- To view, visit https://gerrit.osmocom.org/1919 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:08:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:08:42 +0000 Subject: python/osmo-python-tests[master]: on Exception during test, also print the actual config In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1922/1/osmopy/osmotestconfig.py File osmopy/osmotestconfig.py: Line 68: print >> sys.stderr, "Config was\n%s" % open(config).read() > That could remain open for a long time.. besides being lucky by the refcoun it doesn't in practice because we're raising an IOError and the program exits right away. -- To view, visit https://gerrit.osmocom.org/1922 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:11:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:11:34 +0000 Subject: python/osmo-python-tests[master]: tcp_debug: don't abort when socket can't be removed In-Reply-To: References: Message-ID: Patch Set 1: https://gerrit.osmocom.org/1904 -- I should have waited for a review but wanted to see what jenkins did with it (turned out that local tests were just as informative). BTW I have not fully understood why I hit the error that a socket could not be removed from the list. Plus the list is only enabled when the global tcp debugging is enabled, which now is off by default. -- To view, visit https://gerrit.osmocom.org/1921 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:13:12 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:13:12 +0000 Subject: python/osmo-python-tests[master]: osmoutil: end_proc: wait for term in a loop In-Reply-To: References: Message-ID: Patch Set 1: My hope was that SIGTERM somehow is better at cleaning up sockets and fds, which is just wishful thinking :P anyway... -- To view, visit https://gerrit.osmocom.org/1936 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:14:12 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 15:14:12 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 thanks and yes, it does. I guess two +1s make one +2? -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 15:19:31 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 2 Mar 2017 15:19:31 +0000 Subject: libosmocore[master]: ctrl_type_vals: fix range check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1963 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 2 17:01:28 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 2 Mar 2017 17:01:28 +0000 Subject: [PATCH] osmo-bts[master]: octphy: add conditional compilation to support latest octasi... Message-ID: Review at https://gerrit.osmocom.org/1964 octphy: add conditional compilation to support latest octasic header release With octasics latest release (octsdr-2g-02.07.01-B1351-beta), some struct members are moved or renamed. This patch adds ifdef-logic and configure checks to restore compatibilty. Change-Id: I73287983e8bed8bf64b2ab87e6b810c2c59ea6fd --- M configure.ac M src/osmo-bts-octphy/octphy_hw_api.c M src/osmo-bts-octphy/octphy_vty.c 3 files changed, 74 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/64/1964/1 diff --git a/configure.ac b/configure.ac index 001e10e..cbfbf12 100644 --- a/configure.ac +++ b/configure.ac @@ -72,10 +72,46 @@ if test "$enable_octphy" = "yes" ; then oldCPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$OCTSDR2G_INCDIR -I$srcdir/include $LIBOSMOCORE_CFLAGS" + AC_CHECK_HEADER([octphy/octvc1/gsm/octvc1_gsm_default.h],[], [AC_MSG_ERROR([octphy/octvc1/gsm/octvc1_gsm_default.h can not be found in $octsdr2g_incdir])], [#include ]) - AC_CHECK_MEMBER([tOCTVC1_GSM_TRX_CONFIG.usCentreArfcn], AC_DEFINE([OCTPHY_MULTI_TRX], [1], [Define to 1 if your octphy header files support multi-trx]), [], [#include ]) + + AC_CHECK_MEMBER([tOCTVC1_GSM_TRX_CONFIG.usCentreArfcn], + AC_DEFINE([OCTPHY_MULTI_TRX], + [1], + [Define to 1 if your octphy header files support multi-trx]), + [], + [#include ]) + + AC_CHECK_MEMBER([tOCTVC1_HW_RF_PORT_RX_STATS.Frequency], + AC_DEFINE([OCTPHY_USE_FREQUENCY], + [1], + [Define to 1 if your octphy header files support tOCTVC1_RADIO_FREQUENCY_VALUE type]), + [], + [#include ]) + + AC_CHECK_MEMBER([tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_RSP.ulSyncLossCnt], + AC_DEFINE([OCTPHY_USE_SYNC_LOSS_CNT], + [1], + [Define to 1 if your octphy header files renamed ulSyncLosseCnt to ulSyncLossCnt]), + [], + [#include ]) + + AC_CHECK_MEMBER([tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_RSP.TxConfig], + AC_DEFINE([OCTPHY_USE_TX_CONFIG], + [1], + [Define to 1 if your octphy header files support tOCTVC1_HW_RF_PORT_ANTENNA_TX_CONFIG type]), + [], + [#include ]) + + AC_CHECK_MEMBER([tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_RSP.RxConfig], + AC_DEFINE([OCTPHY_USE_RX_CONFIG], + [1], + [Define to 1 if your octphy header files support tOCTVC1_HW_RF_PORT_ANTENNA_RX_CONFIG type]), + [], + [#include ]) + CPPFLAGS=$oldCPPFLAGS fi diff --git a/src/osmo-bts-octphy/octphy_hw_api.c b/src/osmo-bts-octphy/octphy_hw_api.c index 6666f77..322f884 100644 --- a/src/osmo-bts-octphy/octphy_hw_api.c +++ b/src/osmo-bts-octphy/octphy_hw_api.c @@ -125,11 +125,19 @@ psr->RxStats.ulRxByteCnt, psr->RxStats.ulRxOverflowCnt, psr->RxStats.ulRxAverageBytePerSecond, psr->RxStats.ulRxAveragePeriodUs, +#if OCTPHY_USE_FREQUENCY == 1 + psr->RxStats.Frequency.ulValue, +#else psr->RxStats.ulFrequencyKhz, +#endif psr->TxStats.ulTxByteCnt, psr->TxStats.ulTxUnderflowCnt, psr->TxStats.ulTxAverageBytePerSecond, psr->TxStats.ulTxAveragePeriodUs, +#if OCTPHY_USE_FREQUENCY == 1 + psr->TxStats.Frequency.ulValue); +#else psr->TxStats.ulFrequencyKhz); +#endif get_cb_data = (struct octphy_hw_get_cb_data*) data; get_cb_data->cb(resp,get_cb_data->data); @@ -177,10 +185,15 @@ LOGP(DL1C, LOGL_INFO, "ANT-RX-CONFIG.resp(Port=%u, Ant=%u): %s, " "Gain %d dB, GainCtrlMode=%s\n", arc->ulPortIndex, arc->ulAntennaIndex, +#ifdef OCTPHY_USE_RX_CONFIG + arc->RxConfig.ulEnableFlag ? "Enabled" : "Disabled", + arc->RxConfig.lRxGaindB/512, + get_value_string(rx_gain_mode_vals, arc->RxConfig.ulRxGainMode)); +#else arc->ulEnableFlag ? "Enabled" : "Disabled", arc->lRxGaindB/512, get_value_string(rx_gain_mode_vals, arc->ulRxGainMode)); - +#endif msgb_free(resp); return 0; } @@ -219,9 +232,14 @@ LOGP(DL1C, LOGL_INFO, "ANT-TX-CONFIG.resp(Port=%u, Ant=%u): %s, " "Gain %d dB\n", atc->ulPortIndex, atc->ulAntennaIndex, +#ifdef OCTPHY_USE_TX_CONFIG + atc->TxConfig.ulEnableFlag? "Enabled" : "Disabled", + atc->TxConfig.lTxGaindB/512); +#else atc->ulEnableFlag ? "Enabled" : "Disabled", atc->lTxGaindB/512); +#endif msgb_free(resp); return 0; } @@ -326,7 +344,12 @@ get_value_string(clocksync_state_vals, csr->ulState), csr->lClockError, csr->lDroppedCycles, csr->ulPllFreqHz, csr->ulPllFractionalFreqHz, csr->ulSlipCnt, - csr->ulSyncLosseCnt, csr->ulSourceState, csr->ulDacValue); +#if OCTPHY_USE_SYNC_LOSS_CNT == 1 + csr->ulSyncLossCnt, +#else + csr->ulSyncLosseCnt, +#endif + csr->ulSourceState, csr->ulDacValue); get_cb_data = (struct octphy_hw_get_cb_data*) data; get_cb_data->cb(resp,get_cb_data->data); diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c index bc4acd6..370aff6 100644 --- a/src/osmo-bts-octphy/octphy_vty.c +++ b/src/osmo-bts-octphy/octphy_vty.c @@ -187,7 +187,11 @@ VTY_NEWLINE); vty_out(vty, "Rx Period=%u%s", psr->RxStats.ulRxAveragePeriodUs, VTY_NEWLINE); +#if OCTPHY_USE_FREQUENCY == 1 + vty_out(vty, "Rx Freq=%u%s", psr->RxStats.Frequency.ulValue, VTY_NEWLINE); +#else vty_out(vty, "Rx Freq=%u%s", psr->RxStats.ulFrequencyKhz, VTY_NEWLINE); +#endif vty_out(vty, "Tx Bytes=%u%s", psr->TxStats.ulTxByteCnt, VTY_NEWLINE); vty_out(vty, "Tx Underflow=%u%s", psr->TxStats.ulTxUnderflowCnt, VTY_NEWLINE); @@ -195,7 +199,11 @@ VTY_NEWLINE); vty_out(vty, "Tx Period=%u%s", psr->TxStats.ulTxAveragePeriodUs, VTY_NEWLINE); +#if OCTPHY_USE_FREQUENCY == 1 + vty_out(vty, "Tx Freq=%u%s", psr->TxStats.Frequency.ulValue, VTY_NEWLINE); +#else vty_out(vty, "Tx Freq=%u%s", psr->TxStats.ulFrequencyKhz, VTY_NEWLINE); +#endif } DEFUN(show_rf_port_stats, show_rf_port_stats_cmd, @@ -243,7 +251,11 @@ vty_out(vty, "PllFreqHz=%u%s", csr->ulPllFreqHz, VTY_NEWLINE); vty_out(vty, "PllFract=%u%s", csr->ulPllFractionalFreqHz, VTY_NEWLINE); vty_out(vty, "SlipCnt=%u%s", csr->ulSlipCnt, VTY_NEWLINE); +#if OCTPHY_USE_SYNC_LOSS_CNT == 1 + vty_out(vty, "SyncLosses=%u%s", csr->ulSyncLossCnt, VTY_NEWLINE); +#else vty_out(vty, "SyncLosses=%u%s", csr->ulSyncLosseCnt, VTY_NEWLINE); +#endif vty_out(vty, "SourceState=%u%s", csr->ulSourceState, VTY_NEWLINE); vty_out(vty, "DacValue=%u%s", csr->ulDacValue, VTY_NEWLINE); } -- To view, visit https://gerrit.osmocom.org/1964 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73287983e8bed8bf64b2ab87e6b810c2c59ea6fd Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 2 17:01:29 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 2 Mar 2017 17:01:29 +0000 Subject: [PATCH] osmo-bts[master]: octphy: align frame number for new firmware versions Message-ID: Review at https://gerrit.osmocom.org/1965 octphy: align frame number for new firmware versions Firmware releases OCTSDR-2G-02.07.00-B1314-BETA and newer require to align the GPRS frame number (fn-3) for ph_data indications. To preserve compatibility the header version is checked during compile time and the right method is compiled in. Change-Id: Ib93d5fb3b34ff92f10021a0e9ce9c8aa3044b7ff --- M src/osmo-bts-octphy/l1_if.c 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/65/1965/1 diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c index 0fc51fc..22c01e9 100644 --- a/src/osmo-bts-octphy/l1_if.c +++ b/src/osmo-bts-octphy/l1_if.c @@ -49,6 +49,12 @@ #include "l1_utils.h" #include "octpkt.h" +#include + +/* NOTE: The octphy GPRS frame number handling changed with + * OCTSDR-2G-02.07.00-B1314-BETA. From that version on, each ph_data_ind must + * subtract 3 from the frame number before passing the frame to the PCU */ +#define cOCTVC1_MAIN_VERSION_ID_FN_PARADIGM_CHG 0x41c0522 #include #define OCTVC1_RC2STRING_DECLARE @@ -1030,7 +1036,17 @@ PRIM_OP_INDICATION, l1p_msg); l1sap->u.data.link_id = link_id; l1sap->u.data.chan_nr = chan_nr; + +#if (cOCTVC1_MAIN_VERSION_ID >= cOCTVC1_MAIN_VERSION_ID_FN_PARADIGM_CHG) + if (sapi == cOCTVC1_GSM_SAPI_ENUM_PDTCH) { + /* FIXME::PCU is expecting encode frame number*/ + l1sap->u.data.fn = fn - 3; + } else + l1sap->u.data.fn = fn; +#else l1sap->u.data.fn = fn; +#endif + l1sap->u.data.rssi = rssi; b_total = data_ind->MeasurementInfo.usBERTotalBitCnt; b_error =data_ind->MeasurementInfo.usBERCnt; -- To view, visit https://gerrit.osmocom.org/1965 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib93d5fb3b34ff92f10021a0e9ce9c8aa3044b7ff Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 2 17:01:29 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 2 Mar 2017 17:01:29 +0000 Subject: [PATCH] osmo-bts[master]: octphy: fix usage of wrong define constant Message-ID: Review at https://gerrit.osmocom.org/1966 octphy: fix usage of wrong define constant octphy_hw_get_rf_ant_tx_config() uses define constant cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_CID instead of cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CID. This commit replaces exchanges the wrong constant with the correct one. Change-Id: Ie4de23daf79bb07ca0c0b818eefe350d18d27e4d --- M src/osmo-bts-octphy/octphy_hw_api.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/66/1966/1 diff --git a/src/osmo-bts-octphy/octphy_hw_api.c b/src/osmo-bts-octphy/octphy_hw_api.c index 322f884..7b988fe 100644 --- a/src/osmo-bts-octphy/octphy_hw_api.c +++ b/src/osmo-bts-octphy/octphy_hw_api.c @@ -255,7 +255,7 @@ msgb_put(msg, sizeof(*psc)); l1if_fill_msg_hdr(&psc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, - cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_CID); + cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CID); psc->ulPortIndex = port_idx; psc->ulAntennaIndex = ant_idx; -- To view, visit https://gerrit.osmocom.org/1966 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie4de23daf79bb07ca0c0b818eefe350d18d27e4d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 2 17:01:29 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 2 Mar 2017 17:01:29 +0000 Subject: [PATCH] osmo-bts[master]: l1sap: improve log output Message-ID: Review at https://gerrit.osmocom.org/1967 l1sap: improve log output Print toa and ra value with the "RACH for packet access" log message. Change-Id: I3a2dde95947438aa8348a0a9fc8566cbc177aa2d --- M src/common/l1sap.c 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/67/1967/1 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 19b38af..3592096 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -1029,7 +1029,9 @@ if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) || (trx == bts->c0 && rach_ind->is_11bit)) { - LOGP(DL1P, LOGL_INFO, "RACH for packet access\n"); + LOGP(DL1P, LOGL_INFO, "RACH for packet access (toa=%d, ra=%d)\n", + rach_ind->acc_delay, rach_ind->ra); + pcu_tx_rach_ind(bts, rach_ind->acc_delay << 2, rach_ind->ra, rach_ind->fn, rach_ind->is_11bit, rach_ind->burst_type); -- To view, visit https://gerrit.osmocom.org/1967 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3a2dde95947438aa8348a0a9fc8566cbc177aa2d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 2 19:48:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 2 Mar 2017 19:48:26 +0000 Subject: [PATCH] python/osmo-python-tests[master]: tcp debugging: allow switching on TCP debug by env var In-Reply-To: References: Message-ID: Hello Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1917 to look at the new patch set (#2). tcp debugging: allow switching on TCP debug by env var Print monitoring info about TCP sockets when the env var OSMOPY_DEBUG_TCP_SOCKETS is present. Makes it easy to enable it on jenkins without blowing up output of normal runs "at home". Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d --- M osmopy/obscvty.py 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/17/1917/2 diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index e4df57d..4457a90 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -19,6 +19,7 @@ import re import socket import sys, subprocess +import os """VTYInteract: interact with an osmocom vty @@ -26,7 +27,7 @@ Connections will be reestablished as necessary. Methods: __init__, command, enabled_command, verify, w_verify""" -debug_tcp_sockets = False +debug_tcp_sockets = (os.getenv('OSMOPY_DEBUG_TCP_SOCKETS', '0') != '0') def cmd(what): print '\n> %s' % what -- To view, visit https://gerrit.osmocom.org/1917 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 2 21:18:01 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Thu, 2 Mar 2017 21:18:01 +0000 Subject: [PATCH] libosmocore[master]: spell checking Message-ID: Review at https://gerrit.osmocom.org/1968 spell checking Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 --- M src/ctrl/control_if.c M src/gb/gprs_ns.c M src/gsm/auth_core.c M src/gsm/lapd_core.c M src/vty/logging_vty.c 5 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/68/1968/1 diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index f49d639..d2eb3e9 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -269,7 +269,7 @@ err: if (!cmd->reply) { if (ret == CTRL_CMD_ERROR) { - cmd->reply = "An error has occured."; + cmd->reply = "An error has occurred."; LOGP(DLCTRL, LOGL_NOTICE, "%s: cmd->reply has not been set (ERROR).\n", cmd->variable); diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 76e70ff..0649899 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -138,7 +138,7 @@ }; static const struct osmo_stat_item_desc nsvc_stat_description[] = { - { "alive.delay", "ALIVE reponse time ", "ms", 16, 0 }, + { "alive.delay", "ALIVE response time ", "ms", 16, 0 }, }; static const struct osmo_stat_item_group_desc nsvc_statg_desc = { diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c index acb65f5..9ca5d93 100644 --- a/src/gsm/auth_core.c +++ b/src/gsm/auth_core.c @@ -180,7 +180,7 @@ * based on the permanent subscriber data, a random value as well as the * AUTS and RAND values returned by the SIM/MS. This special variant is * needed if the sequence numbers between MS and AUC have for some - * reason become diffrent. + * reason become different. */ int osmo_auth_gen_vec_auts(struct osmo_auth_vector *vec, struct osmo_sub_auth_data *aud, diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 5ee88a4..301b8ea 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -856,7 +856,7 @@ if (memcmp(dl->cont_res->data, msg->data, length)) { LOGP(DLLAPD, LOGL_INFO, "Another SABM " - "with diffrent content - " + "with different content - " "ignoring! (dl=%p)\n", dl); msgb_free(msg); return 0; diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index aabcaa7..7bb79b8 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -342,7 +342,7 @@ gDEFUN(cfg_description, cfg_description_cmd, "description .TEXT", - "Save human-readable decription of the object\n" + "Save human-readable description of the object\n" "Text until the end of the line\n") { char **dptr = vty->index_sub; -- To view, visit https://gerrit.osmocom.org/1968 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz From gerrit-no-reply at lists.osmocom.org Thu Mar 2 23:49:03 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 2 Mar 2017 23:49:03 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: > thanks and yes, it does. > > I guess two +1s make one +2? at l;east in this context it is fair to assume. -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 01:34:03 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 3 Mar 2017 01:34:03 +0000 Subject: libosmocore[master]: spell checking In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (2 comments) drop the occurRed change, maybe tweak the commit log, otherwise good. https://gerrit.osmocom.org/#/c/1968/1//COMMIT_MSG Commit Message: Line 7: spell checking A general welcome to Osmocom code review: would be good to clearly state what the patch does in imperative form, like "fix spelling", as well as in what kinds of strings -- "in logging, vty doc, API doc" -- and also in which code secions "in ctrl, gb, auth, lapd, vty". I hope that fits on the short summary line? Otherwise abbreviate with "in various " and give details in the rest of the commit log. https://gerrit.osmocom.org/#/c/1968/1/src/ctrl/control_if.c File src/ctrl/control_if.c: Line 272: cmd->reply = "An error has occurred."; 'occured' is actually correct spelling -- To view, visit https://gerrit.osmocom.org/1968 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 3 09:37:57 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 3 Mar 2017 09:37:57 +0000 Subject: osmo-bts[master]: l1sap: improve log output In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1967 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3a2dde95947438aa8348a0a9fc8566cbc177aa2d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 09:41:44 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 3 Mar 2017 09:41:44 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: To me it feels like we're 1st introduce tool which is not robust enough and than try to workaround it. Let's get feedback from someone else to see more PoVs. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 16:51:05 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 3 Mar 2017 16:51:05 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: Even if we abandon this script, I still prefer all value_string[]s to be terminated explicitly. Every reader has to figure out that this define is 0 instead of seeing it right away. In my view you are introducing an unusual notation and using that as excuse to stop my script :) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 16:57:19 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 3 Mar 2017 16:57:19 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: That's not correct: I want this script to be merged. I just think that testing for ", NULL }" is better than for "{ 0, NULL }". -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 17:06:50 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 3 Mar 2017 17:06:50 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 3: but in my view your reason to want that is either not sound or not clear. Two lanes of discussion: 1. Allow terminating a value_string[] with { SOME_CONSTANT, NULL }? 2. How to design termination detection in the script: If 1 is answered with 'no', it's easy, keep it as it is. If 1 is answered with 'yes', I'll agree to change the script. So let's resolve 1 first. My vote for 1 (independently of 2) is: no, let's have literally the same termination of value_string[]s everywhere for code readability. And I agree it would be good to get someone else's opinion to help us resolve it and stop reiterating the same points ;) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 17:35:23 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 3 Mar 2017 17:35:23 +0000 Subject: python/osmo-python-tests[master]: osmoutil: end_proc: wait for term in a loop In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 (taking the liberty to combine the two +1 to a +2, and since we have no gerrit build job for osmo-python-tests, adding my +1 because it works for me) -- To view, visit https://gerrit.osmocom.org/1936 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 17:36:01 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 3 Mar 2017 17:36:01 +0000 Subject: python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 (since we have no gerrit build job for osmo-python-tests, adding my +1 because it works for me) -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 3 19:04:49 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Fri, 3 Mar 2017 19:04:49 +0000 Subject: libosmocore[master]: spell checking In-Reply-To: References: Message-ID: Patch Set 1: > (2 comments) > > drop the occurRed change, maybe tweak the commit log, otherwise > good. Hmmm, according to [1], [2] and [3] there are really two "r" in "occurred"! Google has 1.880.000.000 hits for two "r" and only 20.800.000 hits for one "r" and [4] explains why. Can I change the commit log within Gerrit or do I have to push another version? [1] http://www.dict.cc/englisch-deutsch/occurred.html [2] https://dict.leo.org/englisch-deutsch/occurred [3] http://www.dictionary.com/browse/occurred [4] https://www.grammarly.com/blog/occurred-occured-ocurred/ -- To view, visit https://gerrit.osmocom.org/1968 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Thorsten Alteholz Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 4 04:50:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 4 Mar 2017 04:50:37 +0000 Subject: libosmocore[master]: spell checking In-Reply-To: References: Message-ID: Patch Set 1: hmm, I actualy loked it up because I was unsure, but sems that the lokup mislead me. You can use the gerit [Edit] buton or push an amended patch version (keping the Change-Id), whichever is more convenient to you. -- To view, visit https://gerrit.osmocom.org/1968 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Thorsten Alteholz Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 4 18:41:59 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Sat, 4 Mar 2017 18:41:59 +0000 Subject: [PATCH] libosmocore[master]: fix spelling in API docu, command reply, logging, descriptions In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1968 to look at the new patch set (#2). fix spelling in API docu, command reply, logging, descriptions sections: ctrl, gb, gsm, vty Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 --- M src/ctrl/control_if.c M src/gb/gprs_ns.c M src/gsm/auth_core.c M src/gsm/lapd_core.c M src/vty/logging_vty.c 5 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/68/1968/2 diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index f49d639..d2eb3e9 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -269,7 +269,7 @@ err: if (!cmd->reply) { if (ret == CTRL_CMD_ERROR) { - cmd->reply = "An error has occured."; + cmd->reply = "An error has occurred."; LOGP(DLCTRL, LOGL_NOTICE, "%s: cmd->reply has not been set (ERROR).\n", cmd->variable); diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 76e70ff..0649899 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -138,7 +138,7 @@ }; static const struct osmo_stat_item_desc nsvc_stat_description[] = { - { "alive.delay", "ALIVE reponse time ", "ms", 16, 0 }, + { "alive.delay", "ALIVE response time ", "ms", 16, 0 }, }; static const struct osmo_stat_item_group_desc nsvc_statg_desc = { diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c index acb65f5..9ca5d93 100644 --- a/src/gsm/auth_core.c +++ b/src/gsm/auth_core.c @@ -180,7 +180,7 @@ * based on the permanent subscriber data, a random value as well as the * AUTS and RAND values returned by the SIM/MS. This special variant is * needed if the sequence numbers between MS and AUC have for some - * reason become diffrent. + * reason become different. */ int osmo_auth_gen_vec_auts(struct osmo_auth_vector *vec, struct osmo_sub_auth_data *aud, diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 5ee88a4..301b8ea 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -856,7 +856,7 @@ if (memcmp(dl->cont_res->data, msg->data, length)) { LOGP(DLLAPD, LOGL_INFO, "Another SABM " - "with diffrent content - " + "with different content - " "ignoring! (dl=%p)\n", dl); msgb_free(msg); return 0; diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index aabcaa7..7bb79b8 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -342,7 +342,7 @@ gDEFUN(cfg_description, cfg_description_cmd, "description .TEXT", - "Save human-readable decription of the object\n" + "Save human-readable description of the object\n" "Text until the end of the line\n") { char **dptr = vty->index_sub; -- To view, visit https://gerrit.osmocom.org/1968 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Thorsten Alteholz From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:18:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:18:19 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: bibliography: Add TES 35.205 on MILENAGE Message-ID: Review at https://gerrit.osmocom.org/1969 bibliography: Add TES 35.205 on MILENAGE Change-Id: Ifd4eee72b1dc7bf2a993670e28f6c8adb51ab00f --- M common/chapters/bibliography.adoc 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/69/1969/1 diff --git a/common/chapters/bibliography.adoc b/common/chapters/bibliography.adoc index 5d0c548..a3c6436 100644 --- a/common/chapters/bibliography.adoc +++ b/common/chapters/bibliography.adoc @@ -51,6 +51,8 @@ http://www.3gpp.org/DynaReport/31115.htm - [[[3gpp-ts-31-116]]] 3GPP TS 31.116: Remote APDU Structure for (U)SIM Toolkit applications http://www.3gpp.org/DynaReport/31116.htm +- [[[3gpp-ts-35-205]]] 3GPP TS 35.205: 3G Security; Specification of + the MILENAGE algorithm set: General - [[[3gpp-ts-35-206]]] 3GPP TS 35.206: 3G Security; Specification of the MILENAGE algorithm set: Algorithm specification http://www.3gpp.org/DynaReport/35206.htm -- To view, visit https://gerrit.osmocom.org/1969 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifd4eee72b1dc7bf2a993670e28f6c8adb51ab00f Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:19:17 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:19:17 +0000 Subject: osmo-hlr[master]: Add global HLR struct In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1856 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Gerrit-PatchSet: 7 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:19:38 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:19:38 +0000 Subject: osmo-hlr[master]: Make subscr parameter to db_subscr_get() optional In-Reply-To: References: Message-ID: Patch Set 10: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1853 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e Gerrit-PatchSet: 10 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:21:28 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:21:28 +0000 Subject: osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Patch Set 16: is it customary to specify the control interface bind address in the command line? Shouldn't this preferably be done via VTY? To me, command line arguments are always a relic of the past, from a time when we didn't have the VTY yet. But then, if all other programs have this command line argument, then let's have it also in new programs. -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 16 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:22:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:22:19 +0000 Subject: osmo-hlr[master]: CTRL: add enable/disable packet service cmds In-Reply-To: References: Message-ID: Patch Set 14: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1841/14/src/ctrl.c File src/ctrl.c: Line 51: if (!enable){ /* FIXME: only send to single SGSN where latest update for IMSI came from */ coding style -- To view, visit https://gerrit.osmocom.org/1841 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Gerrit-PatchSet: 14 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:23:17 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:23:17 +0000 Subject: [MERGED] openbsc[master]: vty tests: allow picking specific tests to run by name In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: vty tests: allow picking specific tests to run by name ...................................................................... vty tests: allow picking specific tests to run by name Depends: osmo-python-tests change-id I92f90c334169f31920c63dd5c5ac8dac215065e6 Change-Id: I849455e0423e1a63d6890aef7f9c6075ad53a920 --- M openbsc/tests/vty_test_runner.py 1 file changed, 5 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 5836cd4..0678ec3 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -1340,6 +1340,7 @@ help="searchpath for config") parser.add_argument("-w", "--workdir", dest="w", help="Working directory") + parser.add_argument("test_name", nargs="*", help="(parts of) test names to run, case-insensitive") args = parser.parse_args() verbose_level = 1 @@ -1362,6 +1363,10 @@ add_nat_test(suite, workdir) add_gbproxy_test(suite, workdir) add_sgsn_test(suite, workdir) + + if args.test_name: + osmoutil.pick_tests(suite, *args.test_name) + res = unittest.TextTestRunner(verbosity=verbose_level, stream=sys.stdout).run(suite) sys.exit(len(res.errors) + len(res.failures)) -- To view, visit https://gerrit.osmocom.org/1933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I849455e0423e1a63d6890aef7f9c6075ad53a920 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:23:49 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:23:49 +0000 Subject: osmo-pcu[master]: BTS: Convert relative frame numbers to absolute frame numbers In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1861 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759 Gerrit-PatchSet: 5 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:23:57 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:23:57 +0000 Subject: [MERGED] osmo-pcu[master]: BTS: Convert relative frame numbers to absolute frame numbers In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: BTS: Convert relative frame numbers to absolute frame numbers ...................................................................... BTS: Convert relative frame numbers to absolute frame numbers The implementation of the method rcv_rach() in class BTS, restores the absolute frame number of the incoming RACH-Request by using the relative frame number (RFn = Fn mod 42432) from the rach request and the already known internal absolute frame number m_cur_fn, which is continusly updated by the CCU interface. In some rare cases, a RACH request might be received by the BTS, a very short time before the frame number wraps in its 42432. Depending on the PCU location, RACH request might be received by the BSC, which forwards it to the PCU. It is then likely that, while the RACH request is being forwarded to the PCU, the PCU internal absolute frame number wraps before the RACH can be processed. The relative frame number from the rach request would then be interpreted as if it were received after the wrapping of the internal frame number modulos. This commit adds logic to detect and resolve this race condition. Also a unit test is added to check some cornercases. Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759 --- M src/bts.cpp M src/bts.h M tests/Makefile.am A tests/fn/FnTest.cpp A tests/fn/FnTest.ok M tests/testsuite.at 6 files changed, 301 insertions(+), 16 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/bts.cpp b/src/bts.cpp index 21e9d96..548d000 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -34,12 +34,16 @@ #include #include #include + #include } #include #include #include + +#define RFN_MODULUS 42432 +#define RFN_THRESHOLD RFN_MODULUS / 2 extern void *tall_pcu_ctx; @@ -516,6 +520,57 @@ return 0; } +/* Determine the full frame number from a relative frame number */ +uint32_t BTS::rfn_to_fn(uint32_t rfn) +{ + uint32_t m_cur_rfn; + uint32_t fn; + uint32_t fn_rounded; + + /* Note: If a BTS is sending in a rach request it will be fully aware + * of the frame number. If the PCU is used in a BSC-co-located setup. + * The BSC will forward the incoming RACH request. The RACH request + * only contains the relative frame number (Fn % 42432) in its request + * reference. This PCU implementation has to fit both scenarios, so + * we need to assume that Fn is a relative frame number. */ + + /* Ensure that all following calculations are performed with the + * relative frame number */ + rfn = rfn % 42432; + + /* Compute an internal relative frame number from the full internal + frame number */ + m_cur_rfn = m_cur_fn % RFN_MODULUS; + + /* Compute a "rounded" version of the internal frame number, which + * exactly fits in the RFN_MODULUS raster */ + fn_rounded = m_cur_fn - m_cur_rfn; + + /* If the delta between the internal and the external relative frame + * number exceeds a certain limit, we need to assume that the incoming + * rach request belongs to a the previous rfn period. To correct this, + * we roll back the rounded frame number by one RFN_MODULUS */ + if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { + LOGP(DRLCMAC, LOGL_DEBUG, + "Race condition between rfn (%u) and m_cur_fn (%u) detected: rfn belongs to the previos modulus %u cycle, wrappng...\n", + rfn, m_cur_fn, RFN_MODULUS); + if (fn_rounded < RFN_MODULUS) { + LOGP(DRLCMAC, LOGL_DEBUG, + "Cornercase detected: wrapping crosses %u border\n", + GSM_MAX_FN); + fn_rounded = GSM_MAX_FN - (RFN_MODULUS - fn_rounded); + } + else + fn_rounded -= RFN_MODULUS; + } + + /* The real frame number is the sum of the rounded frame number and the + * relative framenumber computed via RACH */ + fn = fn_rounded + rfn; + + return fn; +} + int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type) { @@ -536,20 +591,8 @@ if (is_11bit) rach_frame_11bit(); - /* Note: If a BTS is sending in a rach request it will be fully aware - * of the frame number. If the PCU is used in a BSC-co-located setup. - * The BSC will forward the incoming RACH request. The RACH request - * only contains the relative frame number (Fn % 42432) in its request - * reference. This PCU implementation has to fit both secenarious, so - * we need to assume that Fn is a relative frame number. */ - - /* Ensure that all following calculations are performed with the - * relative frame number */ - Fn = Fn % 42432; - - /* Restore the full frame number - * (See also 3GPP TS 44.018, section 10.5.2.38) */ - Fn = Fn + m_cur_fn - m_cur_fn % 42432; + /* Determine full frame number */ + Fn = rfn_to_fn(Fn); LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF on RACH, " "so we provide one: ra=0x%02x Fn=%u qta=%d is_11bit=%d:\n", diff --git a/src/bts.h b/src/bts.h index 2932154..5d8dc59 100644 --- a/src/bts.h +++ b/src/bts.h @@ -349,6 +349,8 @@ int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn); uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); + + uint32_t rfn_to_fn(uint32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); diff --git a/tests/Makefile.am b/tests/Makefile.am index a24f4ea..a03528c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ AM_LDFLAGS = -lrt -check_PROGRAMS = rlcmac/RLCMACTest alloc/AllocTest tbf/TbfTest types/TypesTest ms/MsTest llist/LListTest llc/LlcTest codel/codel_test edge/EdgeTest bitcomp/BitcompTest +check_PROGRAMS = rlcmac/RLCMACTest alloc/AllocTest tbf/TbfTest types/TypesTest ms/MsTest llist/LListTest llc/LlcTest codel/codel_test edge/EdgeTest bitcomp/BitcompTest fn/FnTest noinst_PROGRAMS = emu/pcu_emu rlcmac_RLCMACTest_SOURCES = rlcmac/RLCMACTest.cpp @@ -90,6 +90,14 @@ $(LIBOSMOCORE_LIBS) \ $(COMMON_LA) +fn_FnTest_SOURCES = fn/FnTest.cpp +fn_FnTest_LDADD = \ + $(top_builddir)/src/libgprs.la \ + $(LIBOSMOGB_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOCORE_LIBS) \ + $(COMMON_LA) + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -119,7 +127,8 @@ llc/LlcTest.ok llc/LlcTest.err \ llist/LListTest.ok llist/LListTest.err \ codel/codel_test.ok \ - edge/EdgeTest.ok + edge/EdgeTest.ok \ + fn/FnTest.ok DISTCLEANFILES = atconfig diff --git a/tests/fn/FnTest.cpp b/tests/fn/FnTest.cpp new file mode 100644 index 0000000..279903c --- /dev/null +++ b/tests/fn/FnTest.cpp @@ -0,0 +1,175 @@ +/* Frame number calculation test */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * 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 . + */ + +#include "bts.h" +#include +#include + +extern "C" { +#include +#include +#include +#include +} + +#define RFN_MODULUS 42432 + +/* globals used by the code */ void *tall_pcu_ctx; +int16_t spoof_mnc = 0, spoof_mcc = 0; + +static uint32_t calc_fn(BTS * bts, uint32_t rfn) +{ + uint32_t fn; + fn = bts->rfn_to_fn(rfn); + printf("rfn=%i ==> fn=%i\n", rfn, fn); + return fn; +} + +static void set_fn(BTS * bts, uint32_t fn) +{ + printf("\n"); + bts->set_current_frame_number(fn); + printf("bts: fn=%i\n", fn); +} + +static void run_test() +{ + BTS bts; + uint32_t fn; + + printf("RFN_MODULUS=%i\n",RFN_MODULUS); + printf("GSM_MAX_FN=%i\n",GSM_MAX_FN); + + + /* Test with a collection of real world examples, + * all all of them are not critical and do not + * assume the occurence of any race contions */ + set_fn(&bts, 1320462); + fn = calc_fn(&bts, 5066); + OSMO_ASSERT(fn == 1320458); + + set_fn(&bts, 8246); + fn = calc_fn(&bts, 8244); + OSMO_ASSERT(fn == 8244); + + set_fn(&bts, 10270); + fn = calc_fn(&bts, 10269); + OSMO_ASSERT(fn == 10269); + + set_fn(&bts, 311276); + fn = calc_fn(&bts, 14250); + OSMO_ASSERT(fn == 311274); + + + /* Now lets assume a case where the frame number + * just wrapped over a little bit above the + * modulo 42432 raster, but the rach request + * occurred before the wrapping */ + set_fn(&bts, RFN_MODULUS + 30); + fn = calc_fn(&bts, RFN_MODULUS - 10); + OSMO_ASSERT(fn == 42422); + + set_fn(&bts, RFN_MODULUS + 1); + fn = calc_fn(&bts, RFN_MODULUS - 1); + OSMO_ASSERT(fn == 42431); + + set_fn(&bts, RFN_MODULUS * 123 + 16); + fn = calc_fn(&bts, RFN_MODULUS - 4); + OSMO_ASSERT(fn == 5219132); + + set_fn(&bts, RFN_MODULUS * 123 + 451); + fn = calc_fn(&bts, RFN_MODULUS - 175); + OSMO_ASSERT(fn == 5218961); + + + /* Lets check a special cornercase. We assume that + * the BTS just wrapped its internal frame number + * but we still get rach requests with high relative + * frame numbers. */ + set_fn(&bts, 0); + fn = calc_fn(&bts, RFN_MODULUS - 13); + OSMO_ASSERT(fn == 2715635); + + set_fn(&bts, 453); + fn = calc_fn(&bts, RFN_MODULUS - 102); + OSMO_ASSERT(fn == 2715546); + + set_fn(&bts, 10); + fn = calc_fn(&bts, RFN_MODULUS - 10); + OSMO_ASSERT(fn == 2715638); + + set_fn(&bts, 23); + fn = calc_fn(&bts, RFN_MODULUS - 42); + OSMO_ASSERT(fn == 2715606); + + + /* Also check with some corner case + * values where Fn and RFn reach its + * maximum/minimum valid range */ + set_fn(&bts, GSM_MAX_FN); + fn = calc_fn(&bts, RFN_MODULUS-1); + OSMO_ASSERT(fn == GSM_MAX_FN-1); + + set_fn(&bts, 0); + fn = calc_fn(&bts, RFN_MODULUS-1); + OSMO_ASSERT(fn == GSM_MAX_FN-1); + + set_fn(&bts, GSM_MAX_FN); + fn = calc_fn(&bts, 0); + OSMO_ASSERT(fn == GSM_MAX_FN); + + set_fn(&bts, 0); + fn = calc_fn(&bts, 0); + OSMO_ASSERT(fn == 0); +} + +int main(int argc, char **argv) +{ + tall_pcu_ctx = talloc_named_const(NULL, 1, "fn test context"); + if (!tall_pcu_ctx) + abort(); + + msgb_talloc_ctx_init(tall_pcu_ctx, 0); + osmo_init_logging(&gprs_log_info); + log_set_use_color(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, 0); + log_set_log_level(osmo_stderr_target, LOGL_DEBUG); + + run_test(); + return EXIT_SUCCESS; +} + +/* + * stubs that should not be reached + */ +extern "C" { + void l1if_pdch_req() { + abort(); + } void l1if_connect_pdch() { + abort(); + } + void l1if_close_pdch() { + abort(); + } + void l1if_open_pdch() { + abort(); + } +} diff --git a/tests/fn/FnTest.ok b/tests/fn/FnTest.ok new file mode 100644 index 0000000..be6400f --- /dev/null +++ b/tests/fn/FnTest.ok @@ -0,0 +1,50 @@ +RFN_MODULUS=42432 +GSM_MAX_FN=2715648 + +bts: fn=1320462 +rfn=5066 ==> fn=1320458 + +bts: fn=8246 +rfn=8244 ==> fn=8244 + +bts: fn=10270 +rfn=10269 ==> fn=10269 + +bts: fn=311276 +rfn=14250 ==> fn=311274 + +bts: fn=42462 +rfn=42422 ==> fn=42422 + +bts: fn=42433 +rfn=42431 ==> fn=42431 + +bts: fn=5219152 +rfn=42428 ==> fn=5219132 + +bts: fn=5219587 +rfn=42257 ==> fn=5218961 + +bts: fn=0 +rfn=42419 ==> fn=2715635 + +bts: fn=453 +rfn=42330 ==> fn=2715546 + +bts: fn=10 +rfn=42422 ==> fn=2715638 + +bts: fn=23 +rfn=42390 ==> fn=2715606 + +bts: fn=2715648 +rfn=42431 ==> fn=2715647 + +bts: fn=0 +rfn=42431 ==> fn=2715647 + +bts: fn=2715648 +rfn=0 ==> fn=2715648 + +bts: fn=0 +rfn=0 ==> fn=0 diff --git a/tests/testsuite.at b/tests/testsuite.at index e42a0fd..d8f8f9a 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -70,3 +70,9 @@ cat $abs_srcdir/codel/codel_test.ok > expout AT_CHECK([$OSMO_QEMU $abs_top_builddir/tests/codel/codel_test], [0], [expout], [ignore]) AT_CLEANUP + +AT_SETUP([fn]) +AT_KEYWORDS([fn]) +cat $abs_srcdir/fn/FnTest.ok > expout +AT_CHECK([$OSMO_QEMU $abs_top_builddir/tests/fn/FnTest], [0], [expout], [ignore]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1861 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759 Gerrit-PatchSet: 6 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:24:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:24:22 +0000 Subject: openbsc[master]: sgsn: fix problem with leading-zero-IMSIs In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1938 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:24:26 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:24:26 +0000 Subject: [MERGED] openbsc[master]: sgsn: fix problem with leading-zero-IMSIs In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: sgsn: fix problem with leading-zero-IMSIs ...................................................................... sgsn: fix problem with leading-zero-IMSIs When the IMSI ACL is maintained via the VTY, users may enter IMSIs without leading zeros. Especially in test environments, where MCC=001 and MNC=01 is common, it is likely that someone enters the corresponding IMSI (001010000000001) without the two zeros at the beginning. This patch fixes the problem by sanitizing the IMSI, eventually missing zeros in the beginning will be automatically added. Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 --- M openbsc/src/gprs/sgsn_vty.c 1 file changed, 11 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 6c8b640..d42a165 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -586,9 +586,19 @@ "Remove IMSI from ACL\n" "IMSI of subscriber\n") { + char imsi_sanitized[GSM23003_IMSI_MAX_DIGITS+1]; const char *op = argv[0]; - const char *imsi = argv[1]; + const char *imsi = imsi_sanitized; int rc; + + /* Sanitize IMSI */ + if (strlen(argv[1]) > GSM23003_IMSI_MAX_DIGITS) { + vty_out(vty, "%% IMSI (%s) too long -- ignored!%s", + argv[1], VTY_NEWLINE); + return CMD_WARNING; + } + memset(imsi_sanitized, '0', sizeof(imsi_sanitized)); + strcpy(imsi_sanitized+GSM23003_IMSI_MAX_DIGITS-strlen(argv[1]),argv[1]); if (!strcmp(op, "add")) rc = sgsn_acl_add(imsi, g_cfg); @@ -597,7 +607,6 @@ if (rc < 0) { vty_out(vty, "%% unable to %s ACL%s", op, VTY_NEWLINE); - return CMD_WARNING; } -- To view, visit https://gerrit.osmocom.org/1938 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:24:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:24:48 +0000 Subject: [MERGED] openbsc[master]: vty tests: close msc socket after nat_msc_test In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: vty tests: close msc socket after nat_msc_test ...................................................................... vty tests: close msc socket after nat_msc_test Change-Id: Ib64cf8690627803e1b4a8497ea63f1e766960478 --- M openbsc/tests/vty_test_runner.py 1 file changed, 24 insertions(+), 20 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 0678ec3..3f4909c 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -783,28 +783,32 @@ self.vty.command("end") nat_msc_ip(self, ip, port) - msc = nat_msc_test(self, ip, port, verbose=True) - b0 = nat_bsc_sock_test(0, "lol", verbose=True, proc=self.proc) - b1 = nat_bsc_sock_test(1, "xyu", verbose=True, proc=self.proc) - b2 = nat_bsc_sock_test(5, "key", verbose=True, proc=self.proc) + msc_socket, msc = nat_msc_test(self, ip, port, verbose=True) + try: + b0 = nat_bsc_sock_test(0, "lol", verbose=True, proc=self.proc) + b1 = nat_bsc_sock_test(1, "xyu", verbose=True, proc=self.proc) + b2 = nat_bsc_sock_test(5, "key", verbose=True, proc=self.proc) - self.assertEquals("3 BSCs configured", self.vty.command("show nat num-bscs-configured")) - self.assertTrue(3 == nat_bsc_num_con(self)) - self.assertEquals("MSC is connected: 1", self.vty.command("show msc connection")) + self.assertEquals("3 BSCs configured", self.vty.command("show nat num-bscs-configured")) + self.assertTrue(3 == nat_bsc_num_con(self)) + self.assertEquals("MSC is connected: 1", self.vty.command("show msc connection")) - nat_bsc_reload(self) - bscs2 = self.vty.command("show bscs-config") - # check that the reset to initial config succeeded - self.assertEquals(bscs1, bscs2) + nat_bsc_reload(self) + bscs2 = self.vty.command("show bscs-config") + # check that the reset to initial config succeeded + self.assertEquals(bscs1, bscs2) - self.assertEquals("2 BSCs configured", self.vty.command("show nat num-bscs-configured")) - self.assertTrue(1 == nat_bsc_num_con(self)) - rem = self.vty.command("show bsc connections").split(' ') - # remaining connection is for BSC0 - self.assertEquals('0', rem[2]) - # remaining connection is authorized - self.assertEquals('1', rem[4]) - self.assertEquals("MSC is connected: 1", self.vty.command("show msc connection")) + self.assertEquals("2 BSCs configured", self.vty.command("show nat num-bscs-configured")) + self.assertTrue(1 == nat_bsc_num_con(self)) + rem = self.vty.command("show bsc connections").split(' ') + # remaining connection is for BSC0 + self.assertEquals('0', rem[2]) + # remaining connection is authorized + self.assertEquals('1', rem[4]) + self.assertEquals("MSC is connected: 1", self.vty.command("show msc connection")) + finally: + msc.close() + msc_socket.close() def testVtyTree(self): self.vty.enable() @@ -1238,7 +1242,7 @@ if not conn: raise Exception("VTY reports MSC is connected, but I haven't" " connected yet: %r %r" % (ip, port)) - return conn + return msc, conn def ipa_handle_small(x, verbose = False): s = data2str(x.recv(4)) -- To view, visit https://gerrit.osmocom.org/1934 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib64cf8690627803e1b4a8497ea63f1e766960478 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:25:09 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:25:09 +0000 Subject: openbsc[master]: add struct bsc_subscr, separating libbsc from gsm_subscriber In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1682 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e Gerrit-PatchSet: 8 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:25:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:25:37 +0000 Subject: [MERGED] osmo-hlr[master]: Make subscr parameter to db_subscr_get() optional In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Make subscr parameter to db_subscr_get() optional ...................................................................... Make subscr parameter to db_subscr_get() optional This allows to check for subscriber's presence in DB without the need to bother with unused structure allocation. While at it also call to db_remove_reset() and return explicitly instead of using goto to make it a bit easier to follow the code. Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e --- M src/db_hlr.c 1 file changed, 9 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/db_hlr.c b/src/db_hlr.c index 2c6b243..340e7ce 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -41,7 +41,7 @@ struct hlr_subscriber *subscr) { sqlite3_stmt *stmt = dbc->stmt[SEL_BY_IMSI]; - int rc, ret = 0; + int rc; if (!db_bind_imsi(stmt, imsi)) return -EINVAL; @@ -50,8 +50,13 @@ rc = sqlite3_step(stmt); if (rc != SQLITE_ROW) { LOGHLR(imsi, LOGL_ERROR, "Error executing SQL: %d\n", rc); - ret = -ENOEXEC; - goto out; + db_remove_reset(stmt); + return -ENOEXEC; + } + + if (!subscr) { + db_remove_reset(stmt); + return 0; } /* obtain the various columns */ @@ -70,10 +75,9 @@ subscr->ms_purged_cs = sqlite3_column_int(stmt, 11); subscr->ms_purged_ps = sqlite3_column_int(stmt, 12); -out: db_remove_reset(stmt); - return ret; + return 0; } int db_subscr_ps(struct db_context *dbc, const char *imsi, bool enable) -- To view, visit https://gerrit.osmocom.org/1853 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e Gerrit-PatchSet: 11 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Mar 5 12:25:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 5 Mar 2017 12:25:37 +0000 Subject: [MERGED] osmo-hlr[master]: Add global HLR struct In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add global HLR struct ...................................................................... Add global HLR struct Introduce g_hlr of type 'struct hlr' which holds pointers to all globally accessible variables. Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Related: OS#1645 --- M src/Makefile.am M src/db_test.c M src/hlr.c A src/hlr.h 4 files changed, 64 insertions(+), 24 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/Makefile.am b/src/Makefile.am index 56a5670..1791343 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,7 @@ noinst_HEADERS = \ auc.h \ db.h \ + hlr.h \ luop.h \ gsup_router.h \ gsup_server.h \ diff --git a/src/db_test.c b/src/db_test.c index 75fcb62..998a37a 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -4,12 +4,13 @@ #include #include "db.h" +#include "hlr.h" #include "rand.h" #include "logging.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; -static int test(const char *imsi) +static int test(const char *imsi, struct db_context *dbc) { struct osmo_auth_vector vec[3]; int rc, i; @@ -19,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(g_dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; @@ -46,6 +47,8 @@ { int rc; + g_hlr = talloc_zero(NULL, struct hlr); + rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { fprintf(stderr, "Error initializing logging\n"); @@ -59,24 +62,24 @@ exit(1); } - g_dbc = db_open(NULL, "hlr.db"); - if (!g_dbc) { + g_hlr->dbc = db_open(NULL, "hlr.db"); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_ERROR, "Error opening database\n"); exit(1); } /* non-existing subscriber */ - rc = test("901990123456789"); + rc = test("901990123456789", g_hlr->dbc); /* 2G only AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000001"); + rc = test("901990000000001", g_hlr->dbc); /* 2G + 3G AUC data (COMP128v1 / MILENAGE) */ - rc = test("901990000000002"); + rc = test("901990000000002", g_hlr->dbc); /* 3G AUC data (MILENAGE) */ - rc = test("901990000000003"); + rc = test("901990000000003", g_hlr->dbc); LOGP(DMAIN, LOGL_NOTICE, "Exiting\n"); - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.c b/src/hlr.c index d74d9fb..bb6f05a 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -34,6 +34,7 @@ #include #include "db.h" +#include "hlr.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -41,7 +42,7 @@ #include "luop.h" #include "hlr_vty.h" -static struct db_context *g_dbc; +static struct hlr *g_hlr; /*********************************************************************** * Send Auth Info handling @@ -49,7 +50,8 @@ /* process an incoming SAI request */ static int rx_send_auth_info(struct osmo_gsup_conn *conn, - const struct osmo_gsup_message *gsup) + const struct osmo_gsup_message *gsup, + struct db_context *dbc) { struct osmo_gsup_message gsup_out; struct msgb *msg_out; @@ -59,7 +61,7 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(g_dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { @@ -157,7 +159,7 @@ /* Roughly follwing "Process Update_Location_HLR" of TS 09.02 */ /* check if subscriber is known at all */ - if (!lu_op_fill_subscr(luop, g_dbc, gsup->imsi)) { + if (!lu_op_fill_subscr(luop, g_hlr->dbc, gsup->imsi)) { /* Send Error back: Subscriber Unknown in HLR */ strcpy(luop->subscr.imsi, gsup->imsi); lu_op_tx_error(luop, GMM_CAUSE_IMSI_UNKNOWN); @@ -216,7 +218,7 @@ * we have on record. Only update if yes */ /* Perform the actual update of the DB */ - rc = db_subscr_purge(g_dbc, gsup->imsi, is_ps); + rc = db_subscr_purge(g_hlr->dbc, gsup->imsi, is_ps); if (rc == 1) gsup_reply.message_type = OSMO_GSUP_MSGT_PURGE_MS_RESULT; @@ -247,7 +249,7 @@ switch (gsup.message_type) { /* requests sent to us */ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST: - rx_send_auth_info(conn, &gsup); + rx_send_auth_info(conn, &gsup, g_hlr->dbc); break; case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST: rx_upd_loc_req(conn, &gsup); @@ -372,15 +374,14 @@ } static void *hlr_ctx = NULL; -static struct osmo_gsup_server *gs; static void signal_hdlr(int signal) { switch (signal) { case SIGINT: LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n"); - osmo_gsup_server_destroy(gs); - db_close(g_dbc); + osmo_gsup_server_destroy(g_hlr->gs); + db_close(g_hlr->dbc); log_fini(); talloc_report_full(hlr_ctx, stderr); exit(0); @@ -404,6 +405,8 @@ hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR"); msgb_talloc_ctx_init(hlr_ctx, 0); + + g_hlr = talloc_zero(hlr_ctx, struct hlr); rc = osmo_init_logging(&hlr_log_info); if (rc < 0) { @@ -437,14 +440,14 @@ exit(1); } - g_dbc = db_open(hlr_ctx, cmdline_opts.db_file); - if (!g_dbc) { + g_hlr->dbc = db_open(hlr_ctx, cmdline_opts.db_file); + if (!g_hlr->dbc) { LOGP(DMAIN, LOGL_FATAL, "Error opening database\n"); exit(1); } - gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); - if (!gs) { + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); } @@ -465,7 +468,7 @@ osmo_select_main(0); } - db_close(g_dbc); + db_close(g_hlr->dbc); log_fini(); diff --git a/src/hlr.h b/src/hlr.h new file mode 100644 index 0000000..77751dd --- /dev/null +++ b/src/hlr.h @@ -0,0 +1,33 @@ +/* OsmoHLR generic header */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +struct hlr { + /* GSUP server pointer */ + struct osmo_gsup_server *gs; + + /* DB context */ + struct db_context *dbc; +}; -- To view, visit https://gerrit.osmocom.org/1856 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I275d3d54482f696e3378606b2406c7e0ad939e0f Gerrit-PatchSet: 8 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Mar 5 16:02:00 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Sun, 5 Mar 2017 16:02:00 +0000 Subject: [PATCH] osmo-sip-connector[master]: contrib: Add Dockerfile to build and configure a FreeSWITCH Message-ID: Review at https://gerrit.osmocom.org/1970 contrib: Add Dockerfile to build and configure a FreeSWITCH Rhizomatica is using FreeSWITCH and we should have an easy way to test against it. A docker container with exposed ports seems like the easiest. FreeSWITCH by default is giving us some exmaple numbers: * 5000 a menu... that allows DTMF * 9195 an echo test * 9198 tetris. The config is copied on top of the default/big config that is installed. If this PBX should be reached from the outside one needs to change 127.0.0.1 to the external address and maybe configure the acl as well to add more CIDRs. Besides that make container make run Will build it and start the container. Takes a bit of time and requires docker. With it configure one can see things like: 2017-03-05 15:32:49.913912 [INFO] switch_channel.c:515 RECV DTMF 3:2000 2017-03-05 15:32:50.952752 [INFO] switch_channel.c:515 RECV DTMF 2:2000 Now to test DTMF in the system. Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c --- A contrib/testpbx/Dockerfile A contrib/testpbx/Makefile A contrib/testpbx/README A contrib/testpbx/configs/acl.conf.xml A contrib/testpbx/configs/default.xml A contrib/testpbx/configs/internal.xml A contrib/testpbx/configs/public.xml A contrib/testpbx/configs/switch.conf.xml A contrib/testpbx/configs/vars.xml 9 files changed, 2,053 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/70/1970/1 diff --git a/contrib/testpbx/Dockerfile b/contrib/testpbx/Dockerfile new file mode 100644 index 0000000..2f03424 --- /dev/null +++ b/contrib/testpbx/Dockerfile @@ -0,0 +1,25 @@ +FROM debian:jessie + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget + +# They use comodo.. it was hacked.. so don't bother trying to +# install the right root certificates... +RUN wget --no-check-certificate -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add - +RUN echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list +RUN apt-get update && apt-get install -y freeswitch-meta-all + + +# Change the config... +COPY configs/vars.xml /etc/freeswitch/vars.xml +COPY configs/acl.conf.xml /etc/freeswitch/autoload_configs/acl.conf.xml +COPY configs/switch.conf.xml /etc/freeswitch/autoload_configs/switch.conf.xml +COPY configs/public.xml /etc/freeswitch/dialplan/public.xml +COPY configs/default.xml /etc/freeswitch/dialplan/default.xml +COPY configs/internal.xml /etc/freeswitch/sip_profiles/internal.xml + +# Prepare to run +# Reduce the number of ports.. as otherwise we wait a long time +EXPOSE 6000-6020/udp +EXPOSE 5060/udp +CMD /usr/bin/freeswitch -nf diff --git a/contrib/testpbx/Makefile b/contrib/testpbx/Makefile new file mode 100644 index 0000000..ea34799 --- /dev/null +++ b/contrib/testpbx/Makefile @@ -0,0 +1,12 @@ +all: container + +container: + docker build -t osmo-freeswitch-pbx:latest . + +run: + docker run -it --name=osmo-freeswitch-pbx \ + -p 5060:5060/udp -p 6000-6020:6000-6020/udp \ + --rm=true osmo-freeswitch-pbx:latest + +stop: + docker rm -f osmo-freeswitch-pbx diff --git a/contrib/testpbx/README b/contrib/testpbx/README new file mode 100644 index 0000000..11c16f0 --- /dev/null +++ b/contrib/testpbx/README @@ -0,0 +1,29 @@ +Provide a semi-stable remote PBX system. + +There is no preferred PBX but YaTE is pretty small and still +functional enough. Anyway Rhizomatica is using FreeSWITCH so +let's use that for testing. + +This is creating a docker image with a SIP configuration that +will allow to record audio, have a DTMF menu using some fixed +numbers. Feel free to extend it to support bidirectional calls +and routing. + +It is using the Debian packages and installs everything as I +am not interested to track dependencies and see what is missing. +Again feel free to optimize the size. + + +Build: + make + + or + + docker build -t yourimagename:tag . + + +Run: + + docker run yourimagename:tag + +SIP is exposed on 5060 of your port and audio on 6000-6020 diff --git a/contrib/testpbx/configs/acl.conf.xml b/contrib/testpbx/configs/acl.conf.xml new file mode 100644 index 0000000..70a64ea --- /dev/null +++ b/contrib/testpbx/configs/acl.conf.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/default.xml b/contrib/testpbx/configs/default.xml new file mode 100644 index 0000000..f0e0af1 --- /dev/null +++ b/contrib/testpbx/configs/default.xml @@ -0,0 +1,832 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/internal.xml b/contrib/testpbx/configs/internal.xml new file mode 100644 index 0000000..2a679fb --- /dev/null +++ b/contrib/testpbx/configs/internal.xml @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/public.xml b/contrib/testpbx/configs/public.xml new file mode 100644 index 0000000..d9b1d17 --- /dev/null +++ b/contrib/testpbx/configs/public.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/switch.conf.xml b/contrib/testpbx/configs/switch.conf.xml new file mode 100644 index 0000000..1a82409 --- /dev/null +++ b/contrib/testpbx/configs/switch.conf.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/vars.xml b/contrib/testpbx/configs/vars.xml new file mode 100644 index 0000000..1cb826d --- /dev/null +++ b/contrib/testpbx/configs/vars.xml @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- To view, visit https://gerrit.osmocom.org/1970 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Sun Mar 5 16:08:35 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Sun, 5 Mar 2017 16:08:35 +0000 Subject: osmo-sip-connector[master]: contrib: Add Dockerfile to build and configure a FreeSWITCH In-Reply-To: References: Message-ID: Patch Set 1: Just CC'ing you to make you see this change. It is my test setup now. -- To view, visit https://gerrit.osmocom.org/1970 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Keith Whyte Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 16:42:11 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Sun, 5 Mar 2017 16:42:11 +0000 Subject: [PATCH] mncc-python[master]: mncc_sock.py: Fix typo and say connecting Message-ID: Review at https://gerrit.osmocom.org/1971 mncc_sock.py: Fix typo and say connecting We don't have a connection yet, so let's say this meant connecting. Change-Id: Iba0423add3ae4d6920fed74800b0c2b298dda501 --- M mncc_sock.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/mncc-python refs/changes/71/1971/1 diff --git a/mncc_sock.py b/mncc_sock.py index 8d3e2b9..48da514 100644 --- a/mncc_sock.py +++ b/mncc_sock.py @@ -55,7 +55,7 @@ class MnccSocket(object): def __init__(self, address = '/tmp/bsc_mncc'): self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET) - print 'connectiong to %s' % address + print 'connecting to %s' % address try: self.sock.connect(address) except socket.error, errmsg: -- To view, visit https://gerrit.osmocom.org/1971 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iba0423add3ae4d6920fed74800b0c2b298dda501 Gerrit-PatchSet: 1 Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Sun Mar 5 20:31:05 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Sun, 5 Mar 2017 20:31:05 +0000 Subject: mncc-python[master]: mncc_sock.py: Fix typo and say connecting In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/1971 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iba0423add3ae4d6920fed74800b0c2b298dda501 Gerrit-PatchSet: 1 Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 5 20:31:07 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Sun, 5 Mar 2017 20:31:07 +0000 Subject: [MERGED] mncc-python[master]: mncc_sock.py: Fix typo and say connecting In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: mncc_sock.py: Fix typo and say connecting ...................................................................... mncc_sock.py: Fix typo and say connecting We don't have a connection yet, so let's say this meant connecting. Change-Id: Iba0423add3ae4d6920fed74800b0c2b298dda501 --- M mncc_sock.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Holger Freyther: Looks good to me, approved; Verified diff --git a/mncc_sock.py b/mncc_sock.py index 8d3e2b9..48da514 100644 --- a/mncc_sock.py +++ b/mncc_sock.py @@ -55,7 +55,7 @@ class MnccSocket(object): def __init__(self, address = '/tmp/bsc_mncc'): self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET) - print 'connectiong to %s' % address + print 'connecting to %s' % address try: self.sock.connect(address) except socket.error, errmsg: -- To view, visit https://gerrit.osmocom.org/1971 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iba0423add3ae4d6920fed74800b0c2b298dda501 Gerrit-PatchSet: 1 Gerrit-Project: mncc-python Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther From admin at opensuse.org Sun Mar 5 19:57:57 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 05 Mar 2017 19:57:57 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58bc9598cc8f3_431d621c04268965@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 129s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 129s] from /usr/include/osmocom/core/timer.h:35, [ 129s] from ./bts.h:29, [ 129s] from bts.cpp:21: [ 129s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 129s] abs(long long __x) { return __builtin_llabs (__x); } [ 129s] ^~~ [ 129s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 129s] abs(long __i) { return __builtin_labs(__i); } [ 129s] ^~~ [ 129s] Makefile:778: recipe for target 'bts.lo' failed [ 129s] make[2]: *** [bts.lo] Error 1 [ 129s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 129s] Makefile:403: recipe for target 'all-recursive' failed [ 129s] make[1]: *** [all-recursive] Error 1 [ 129s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 129s] dh_auto_build: make -j1 returned exit code 2 [ 129s] debian/rules:12: recipe for target 'build' failed [ 129s] make: *** [build] Error 2 [ 129s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 129s] [ 129s] lamb64 failed "build osmo-pcu_0.3.20170305.dsc" at Sun Mar 5 19:57:43 UTC 2017. [ 129s] [ 129s] ### VM INTERACTION START ### [ 132s] [ 118.627955] reboot: Power down [ 132s] ### VM INTERACTION END ### [ 132s] [ 132s] lamb64 failed "build osmo-pcu_0.3.20170305.dsc" at Sun Mar 5 19:57:46 UTC 2017. [ 132s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 5 19:59:06 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 05 Mar 2017 19:59:06 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58bc95a13af6e_431d621c04269597@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 110s] from bts.cpp:21: [ 110s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 110s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 110s] abs(long long __x) { return __builtin_llabs (__x); } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 110s] abs(long __i) { return __builtin_labs(__i); } [ 110s] ^~~ [ 110s] Makefile:778: recipe for target 'bts.lo' failed [ 110s] make[2]: *** [bts.lo] Error 1 [ 110s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 110s] Makefile:403: recipe for target 'all-recursive' failed [ 110s] make[1]: *** [all-recursive] Error 1 [ 110s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 110s] dh_auto_build: make -j1 returned exit code 2 [ 110s] debian/rules:12: recipe for target 'build' failed [ 110s] make: *** [build] Error 2 [ 110s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 110s] [ 110s] lamb54 failed "build osmo-pcu_0.3.20170305.dsc" at Sun Mar 5 19:58:59 UTC 2017. [ 110s] [ 110s] ### VM INTERACTION START ### [ 113s] [ 100.441691] reboot: Power down [ 113s] ### VM INTERACTION END ### [ 113s] [ 113s] lamb54 failed "build osmo-pcu_0.3.20170305.dsc" at Sun Mar 5 19:59:02 UTC 2017. [ 113s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Mon Mar 6 08:50:02 2017 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Mon, 6 Mar 2017 08:50:02 +0000 Subject: libosmocore[master]: utils/conv_gen.py: add header generation feature In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1593 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 08:54:41 2017 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Mon, 6 Mar 2017 08:54:41 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 15: Code-Review+1 Looks good. The HR table fix that was found by Max seems to be the proper fix to the only issue there was left with this set. -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 15 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 09:06:06 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 6 Mar 2017 09:06:06 +0000 Subject: [PATCH] osmo-sip-connector[master]: call: Fix call release handling on mncc connection loss Message-ID: Review at https://gerrit.osmocom.org/1972 call: Fix call release handling on mncc connection loss The app_mncc_disconnected will be called when the MNCC socket is down and lead to all calls being released. It directly released the call but did not stop the MNCC CMD timer. Go through the call release callback. ==3618== at 0x804A18A: app_mncc_disconnected (app.c:49) ==3618== by 0x804B52D: close_connection (mncc.c:255) This lead to the timer not being removed: ==3593== Invalid read of size 4 ==3593== at 0x4305D42: rb_first (rbtree.c:294) ==3593== by 0x42FCB37: osmo_timers_update (timer.c:220) ==3593== by 0x804D1D5: evpoll (evpoll.c:89) ==3593== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x8049AA6: main (main.c:171) ==3593== Address 0x47f3380 is 232 bytes inside a block of size 272 free'd ==3593== at 0x402A3A8: free (vg_replace_malloc.c:473) ==3593== by 0x42E7FD1: ??? (in /usr/lib/i386-linux-gnu/libtalloc.so.2.1.5) ==3593== by 0x804A3C4: call_leg_release (call.c:83) ==3593== by 0x804A188: app_mncc_disconnected (app.c:48) ==3593== by 0x804B52D: close_connection (mncc.c:255) ==3593== by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145) ==3593== by 0x804CC86: check_setup (mncc.c:435) ==3593== by 0x804CC86: mncc_data (mncc.c:795) ==3593== by 0x42FCF94: osmo_fd_disp_fds (select.c:167) ==3593== by 0x804D1F2: evpoll (evpoll.c:92) ==3593== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x8049AA6: main (main.c:171) Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e --- M src/app.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/72/1972/1 diff --git a/src/app.c b/src/app.c index 4a88b36..585b577 100644 --- a/src/app.c +++ b/src/app.c @@ -45,9 +45,9 @@ LOGP(DAPP, LOGL_NOTICE, "Going to release call(%u) due MNCC.\n", call->id); if (call->initial) - call_leg_release(call->initial); + call->initial->release_call(call->initial); if (call->remote) - call_leg_release(call->remote); + call->remote->release_call(call->remote); } } -- To view, visit https://gerrit.osmocom.org/1972 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Mon Mar 6 09:06:07 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 6 Mar 2017 09:06:07 +0000 Subject: [PATCH] osmo-sip-connector[master]: mncc: Fix use after free on mncc socket disconnection Message-ID: Review at https://gerrit.osmocom.org/1973 mncc: Fix use after free on mncc socket disconnection When the MNCC socket breaks down we would release all callds but when there is no remote call the call would be released before if (call->remote) ... is being executed leading to a use after free. Fix it by copying the legs first and assuming the call will be gone after that. ==3618== Invalid read of size 4 ==3618== at 0x804A18A: app_mncc_disconnected (app.c:49) ==3618== by 0x804B52D: close_connection (mncc.c:255) ==3618== by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145) ==3618== by 0x804CC86: check_setup (mncc.c:435) ==3618== by 0x804CC86: mncc_data (mncc.c:795) ==3618== by 0x42FCF94: osmo_fd_disp_fds (select.c:167) ==3618== by 0x804D1F2: evpoll (evpoll.c:92) ==3618== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x8049AA6: main (main.c:171) ==3618== Address 0x47f3258 is 64 bytes inside a block of size 76 free'd ==3618== at 0x402A3A8: free (vg_replace_malloc.c:473) ==3618== by 0x42E7FD1: ??? (in /usr/lib/i386-linux-gnu/libtalloc.so.2.1.5) ==3618== by 0x804A3FD: call_leg_release (call.c:87) ==3618== by 0x804A186: app_mncc_disconnected (app.c:48) ==3618== by 0x804B52D: close_connection (mncc.c:255) ==3618== by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145) ==3618== by 0x804CC86: check_setup (mncc.c:435) ==3618== by 0x804CC86: mncc_data (mncc.c:795) ==3618== by 0x42FCF94: osmo_fd_disp_fds (select.c:167) ==3618== by 0x804D1F2: evpoll (evpoll.c:92) ==3618== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x8049AA6: main (main.c:171) ==3618== Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a --- M src/app.c 1 file changed, 12 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/73/1973/1 diff --git a/src/app.c b/src/app.c index 585b577..97123b8 100644 --- a/src/app.c +++ b/src/app.c @@ -29,6 +29,7 @@ struct call *call, *tmp; llist_for_each_entry_safe(call, tmp, &g_call_list, entry) { + struct call_leg *initial, *remote; int has_mncc = 0; if (call->initial && call->initial->type == CALL_TYPE_MNCC) @@ -40,14 +41,20 @@ continue; /* - * this call has a MNCC component and we will release it. + * this call has a MNCC component and we will release it now. + * There might be no remote so on the release of the initial + * leg the call might be gone. We may not touch call beyond + * that point. */ LOGP(DAPP, LOGL_NOTICE, "Going to release call(%u) due MNCC.\n", call->id); - if (call->initial) - call->initial->release_call(call->initial); - if (call->remote) - call->remote->release_call(call->remote); + initial = call->initial; + remote = call->remote; + call = NULL; + if (initial) + initial->release_call(initial); + if (remote) + remote->release_call(remote); } } -- To view, visit https://gerrit.osmocom.org/1973 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Mon Mar 6 12:58:25 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 12:58:25 +0000 Subject: [PATCH] osmo-hlr[master]: CTRL: add enable/disable packet service cmds In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1841 to look at the new patch set (#15). CTRL: add enable/disable packet service cmds Add commands to enable/disable Packet Service for a given IMSI. Changes are synced to DB and propagated at runtime to SGSN (in case of disable command). Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Related: OS#1645 --- M src/ctrl.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M src/luop.c M src/luop.h 6 files changed, 79 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/41/1841/15 diff --git a/src/ctrl.c b/src/ctrl.c index a167171..81de961 100644 --- a/src/ctrl.c +++ b/src/ctrl.c @@ -33,6 +33,47 @@ #include "luop.h" #include "ctrl.h" +static int handle_cmd_ps(struct hlr *ctx, struct ctrl_cmd *cmd, bool enable) +{ + struct lu_operation *luop = NULL; + struct osmo_gsup_conn *co; + + if (db_subscr_get(ctx->dbc, cmd->value, NULL) < 0) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + if (db_subscr_ps(ctx->dbc, cmd->value, enable) < 0) { + cmd->reply = "Error updating DB"; + return CTRL_CMD_ERROR; + } + + /* FIXME: only send to single SGSN where latest update for IMSI came from */ + if (!enable) { + llist_for_each_entry(co, &ctx->gs->clients, list) { + luop = lu_op_alloc_conn(co); + lu_op_fill_subscr(luop, ctx->dbc, cmd->value); + lu_op_tx_del_subscr_data(luop); + } + } + + cmd->reply = "OK"; + + return CTRL_CMD_REPLY; +} + +CTRL_CMD_DEFINE_WO_NOVRF(enable_ps, "enable-ps"); +static int set_enable_ps(struct ctrl_cmd *cmd, void *data) +{ + return handle_cmd_ps(data, cmd, true); +} + +CTRL_CMD_DEFINE_WO_NOVRF(disable_ps, "disable-ps"); +static int set_disable_ps(struct ctrl_cmd *cmd, void *data) +{ + return handle_cmd_ps(data, cmd, false); +} + CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); static int set_status_ps(struct ctrl_cmd *cmd, void *data) { @@ -57,6 +98,8 @@ { int rc = 0; + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_enable_ps); + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_disable_ps); rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index ea51f7d..d431637 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -245,9 +245,9 @@ } struct osmo_gsup_server * -osmo_gsup_server_create(void *ctx, const char *ip_addr, - uint16_t tcp_port, - osmo_gsup_read_cb_t read_cb) +osmo_gsup_server_create(void *ctx, const char *ip_addr, uint16_t tcp_port, + osmo_gsup_read_cb_t read_cb, + struct llist_head *lu_op_lst) { struct osmo_gsup_server *gsups; int rc; @@ -272,6 +272,8 @@ if (rc < 0) goto failed; + gsups->luop = lu_op_lst; + return gsups; failed: diff --git a/src/gsup_server.h b/src/gsup_server.h index 484a0d7..885fe52 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -14,6 +14,9 @@ /* list of osmo_gsup_conn */ struct llist_head clients; + /* lu_operations list */ + struct llist_head *luop; + struct ipa_server_link *link; osmo_gsup_read_cb_t read_cb; struct llist_head routes; @@ -36,9 +39,10 @@ uint8_t tag); struct osmo_gsup_server *osmo_gsup_server_create(void *ctx, - const char *ip_addr, - uint16_t tcp_port, - osmo_gsup_read_cb_t read_cb); + const char *ip_addr, + uint16_t tcp_port, + osmo_gsup_read_cb_t read_cb, + struct llist_head *lu_op_lst); void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups); diff --git a/src/hlr.c b/src/hlr.c index 95a565e..00a6459 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -260,6 +260,14 @@ rx_purge_ms_req(conn, &gsup); break; /* responses to requests sent by us */ + case OSMO_GSUP_MSGT_DELETE_DATA_ERROR: + LOGP(DMAIN, LOGL_ERROR, "Error while deleting subscriber data " + "for IMSI %s\n", gsup.imsi); + break; + case OSMO_GSUP_MSGT_DELETE_DATA_RESULT: + LOGP(DMAIN, LOGL_ERROR, "Deleting subscriber data for IMSI %s\n", + gsup.imsi); + break; case OSMO_GSUP_MSGT_INSERT_DATA_ERROR: case OSMO_GSUP_MSGT_INSERT_DATA_RESULT: case OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR: @@ -456,7 +464,8 @@ exit(1); } - g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb, + &g_lu_ops); if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); diff --git a/src/luop.c b/src/luop.c index ecf31b4..937c02c 100644 --- a/src/luop.c +++ b/src/luop.c @@ -266,3 +266,16 @@ lu_op_statechg(luop, LU_S_ISD_SENT); osmo_timer_schedule(&luop->timer, ISD_TIMEOUT_SECS, 0); } + +/*! Transmit Delete Subscriber Data to new VLR/SGSN */ +void lu_op_tx_del_subscr_data(struct lu_operation *luop) +{ + struct osmo_gsup_message gsup; + + fill_gsup_msg(&gsup, luop, OSMO_GSUP_MSGT_DELETE_DATA_REQUEST); + + gsup.cn_domain = OSMO_GSUP_CN_DOMAIN_PS; + + /* Send ISD to new VLR/SGSN */ + _luop_tx_gsup(luop, &gsup); +} diff --git a/src/luop.h b/src/luop.h index 7e2fbb0..ab1bc24 100644 --- a/src/luop.h +++ b/src/luop.h @@ -78,3 +78,4 @@ void lu_op_tx_ack(struct lu_operation *luop); void lu_op_tx_cancel_old(struct lu_operation *luop); void lu_op_tx_insert_subscr_data(struct lu_operation *luop); +void lu_op_tx_del_subscr_data(struct lu_operation *luop); -- To view, visit https://gerrit.osmocom.org/1841 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Gerrit-PatchSet: 15 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 12:58:25 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 12:58:25 +0000 Subject: [PATCH] osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1827 to look at the new patch set (#17). Add CTRL interface * add command to query Packet Services (GPRS etc.) for particular IMSI. * add vty command to configure ctrl bind address * add missing vty copyright notice Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Related: OS#1645 --- M configure.ac M src/Makefile.am A src/ctrl.c A src/ctrl.h M src/hlr.c M src/hlr.h 6 files changed, 134 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/27/1827/17 diff --git a/configure.ac b/configure.ac index bfda9c5..a04185f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) PKG_CHECK_MODULES(SQLITE3, sqlite3) diff --git a/src/Makefile.am b/src/Makefile.am index 1791343..b410ff3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(NULL) @@ -20,6 +21,7 @@ gsup_server.h \ logging.h \ rand.h \ + ctrl.h \ hlr_vty.h \ $(NULL) @@ -33,6 +35,7 @@ osmo_hlr_SOURCES = \ auc.c \ + ctrl.c \ db.c \ luop.c \ db_auc.c \ @@ -49,6 +52,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(SQLITE3_LIBS) \ $(NULL) diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..a167171 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,81 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#include + +#include +#include +#include + +#include "gsup_server.h" +#include "logging.h" +#include "db.h" +#include "hlr.h" +#include "luop.h" +#include "ctrl.h" + +CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); +static int set_status_ps(struct ctrl_cmd *cmd, void *data) +{ + struct hlr *ctx = data; + struct lu_operation *luop = lu_op_alloc(ctx->gs); + if (!luop) { + cmd->reply = "Internal HLR error"; + return CTRL_CMD_ERROR; + } + + if (!lu_op_fill_subscr(luop, ctx->dbc, cmd->value)) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + cmd->reply = luop->subscr.nam_ps ? "1" : "0"; + + return CTRL_CMD_REPLY; +} + +int hlr_ctrl_cmds_install() +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); + + return rc; +} + +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs) +{ + int rc; + struct ctrl_handle *hdl = ctrl_interface_setup_dynip(ctx, + ctx->ctrl_bind_addr, + OSMO_CTRL_PORT_HLR, + NULL); + if (!hdl) + return NULL; + + rc = hlr_ctrl_cmds_install(); + if (rc) /* FIXME: close control interface? */ + return NULL; + + return hdl; +} diff --git a/src/ctrl.h b/src/ctrl.h new file mode 100644 index 0000000..663de30 --- /dev/null +++ b/src/ctrl.h @@ -0,0 +1,31 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +#include "gsup_server.h" + +int hlr_ctrl_cmds_install(); +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs); diff --git a/src/hlr.c b/src/hlr.c index bb6f05a..95a565e 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -32,9 +32,11 @@ #include #include #include +#include #include "db.h" #include "hlr.h" +#include "ctrl.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -393,9 +395,16 @@ } } +static const char vlr_copyright[] = + "Copyright (C) 2016, 2017 by Harald Welte, sysmocom s.f.m.c. GmbH\r\n" + "License AGPLv3+: GNU AGPL version 3 or later \r\n" + "This is free software: you are free to change and redistribute it.\r\n" + "There is NO WARRANTY, to the extent permitted by law.\r\n"; + static struct vty_app_info vty_info = { .name = "OsmoHLR", .version = PACKAGE_VERSION, + .copyright = vlr_copyright, .is_config_node = hlr_vty_is_config_node, }; @@ -415,6 +424,7 @@ } vty_init(&vty_info); + ctrl_vty_init(hlr_ctx); handle_options(argc, argv); hlr_vty_init(&hlr_log_info); @@ -452,6 +462,9 @@ exit(1); } + g_hlr->ctrl_bind_addr = ctrl_vty_get_bind_addr(); + g_hlr->ctrl = hlr_controlif_setup(g_hlr, g_hlr->gs); + osmo_init_ignore_signals(); signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); diff --git a/src/hlr.h b/src/hlr.h index 77751dd..1e8eff8 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -30,4 +30,8 @@ /* DB context */ struct db_context *dbc; + + /* Control Interface */ + struct ctrl_handle *ctrl; + const char *ctrl_bind_addr; }; -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 17 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 13:04:43 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 13:04:43 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: Ready for merge. -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 13:14:09 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 13:14:09 +0000 Subject: [PATCH] osmo-bts[master]: osmo-bts-trx: fix scheduling of broken frames In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1776 to look at the new patch set (#4). osmo-bts-trx: fix scheduling of broken frames * DTXu: don't set marker for broken frames * do not attempt to send 0-length bursts to avoid flood of errors after bts startup Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3 --- M src/osmo-bts-trx/scheduler_trx.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/76/1776/4 diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index d946ad5..da92d20 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -1236,7 +1236,8 @@ rc = tch_hr_decode(tch_data, *bursts_p, (((fn + 26 - 10) % 26) >> 2) & 1, &n_errors, &n_bits_total); - lchan_set_marker(osmo_hr_check_sid(tch_data, rc), lchan); /* DTXu */ + if (rc) /* DTXu */ + lchan_set_marker(osmo_hr_check_sid(tch_data, rc), lchan); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ /* the first FN 0,8,17 or 1,9,18 defines that CMI is included @@ -1375,7 +1376,8 @@ continue; } else gain = 0; - trx_if_data(l1h, tn, fn, gain, bits, nbits); + if (nbits) + trx_if_data(l1h, tn, fn, gain, bits, nbits); } } -- To view, visit https://gerrit.osmocom.org/1776 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Mon Mar 6 13:14:09 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 13:14:09 +0000 Subject: [PATCH] osmo-bts[master]: osmo-bts-trx: cosmetic log fixes Message-ID: Review at https://gerrit.osmocom.org/1974 osmo-bts-trx: cosmetic log fixes * print actual value causing error and the check range * fix log error message typo Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d --- M src/common/scheduler.c M src/osmo-bts-trx/gsm0503_coding.c 2 files changed, 14 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/74/1974/1 diff --git a/src/common/scheduler.c b/src/common/scheduler.c index 724fb5a..27b7630 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -305,11 +305,11 @@ goto wrong_type; } if (prim_fn > 100) { - LOGP(DL1C, LOGL_NOTICE, "Prim for trx=%u ts=%u at fn=%u " - "is out of range, or channel %s with type %s is " - "already disabled. If this happens in conjunction " - "with PCU, increase 'rts-advance' by 5. " - "(current fn=%u)\n", l1t->trx->nr, tn, + LOGP(DL1C, LOGL_NOTICE, "Prim %u for trx=%u ts=%u at " + "fn=%u is out of range (100), or channel %s with " + "type %s is already disabled. If this happens in " + "conjunction with PCU, increase 'rts-advance' by 5." + " (current fn=%u)\n", prim_fn, l1t->trx->nr, tn, l1sap->u.data.fn, get_lchan_by_chan_nr(l1t->trx, chan_nr)->name, get_value_string(trx_chan_type_names, chan), fn); @@ -1609,10 +1609,12 @@ no_data: /* in case of C0, we need a dummy burst to maintain RF power */ if (bits == NULL && l1t->trx == l1t->trx->bts->c0) { -if (0) if (chan != TRXC_IDLE) // hack - LOGP(DL1C, LOGL_DEBUG, "No burst data for %s fn=%u ts=%u " - "burst=%d on C0, so filling with dummy burst\n", - trx_chan_desc[chan].name, fn, tn, bid); +#if 0 + if (chan != TRXC_IDLE) // hack + LOGP(DL1C, LOGL_DEBUG, "No burst data for %s fn=%u ts=%u " + "burst=%d on C0, so filling with dummy burst\n", + trx_chan_desc[chan].name, fn, tn, bid); +#endif bits = (ubit_t *) dummy_burst; } diff --git a/src/osmo-bts-trx/gsm0503_coding.c b/src/osmo-bts-trx/gsm0503_coding.c index 4c4f7f1..9e04452 100644 --- a/src/osmo-bts-trx/gsm0503_coding.c +++ b/src/osmo-bts-trx/gsm0503_coding.c @@ -1687,7 +1687,7 @@ if (steal > 0) { rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { - LOGP(DL1C, LOGL_NOTICE, "tch_fr_decode(): error decoding FACCH frame (%d/%d bits)\n", *n_errors, *n_bits_total); + LOGP(DL1C, LOGL_NOTICE, "tch_fr_decode(): error decoding FACCH/F frame (%d/%d bits)\n", *n_errors, *n_bits_total); return -1; } @@ -1823,7 +1823,7 @@ rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { - LOGP(DL1C, LOGL_NOTICE, "tch_hr_decode(): error decoding FACCH frame (%d/%d bits)\n", *n_errors, *n_bits_total); + LOGP(DL1C, LOGL_NOTICE, "tch_hr_decode(): error decoding FACCH/H frame (%d/%d bits)\n", *n_errors, *n_bits_total); return -1; } @@ -1845,7 +1845,7 @@ rv = osmo_crc8gen_check_bits(&gsm0503_tch_fr_crc3, d + 73, 22, p); if (rv) { - LOGP(DL1C, LOGL_NOTICE, "tch_fr_decode(): error checking CRC8 for an HR frame\n"); + LOGP(DL1C, LOGL_NOTICE, "tch_hr_decode(): error checking CRC8 for an HR frame (%d/%d bits)\n", *n_errors, *n_bits_total); return -1; } -- To view, visit https://gerrit.osmocom.org/1974 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:00:16 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:00:16 +0000 Subject: osmo-sip-connector[master]: call: Fix call release handling on mncc connection loss In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1972 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:04:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:04:22 +0000 Subject: osmo-sip-connector[master]: mncc: Fix use after free on mncc socket disconnection In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1973 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:24:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:24:34 +0000 Subject: [ABANDON] python/osmo-python-tests[master]: osmoutil: end_proc: speed up tests yet a bit more In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: osmoutil: end_proc: speed up tests yet a bit more ...................................................................... Abandoned merged with I98849e4550116c5666fdf6f5d4cbb576ffa3e14a -- To view, visit https://gerrit.osmocom.org/1928 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I6fd520bae81be129e23a48e3daa122e6bae5630d Gerrit-PatchSet: 1 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:24 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:24 +0000 Subject: [PATCH] python/osmo-python-tests[master]: cosmetic: early exit instead of if-cascade In-Reply-To: References: Message-ID: Hello Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1920 to look at the new patch set (#3). cosmetic: early exit instead of if-cascade It appears that during some error conditions, the socket will not be in the tcp socket debug tracking list, and on top of an exception this barfs as well. Let's not care about the tcp debug list and avoid confusing error messages. Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 --- M osmopy/obscvty.py 1 file changed, 10 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/20/1920/3 diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index f614518..bbf6e45 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -70,14 +70,16 @@ def _close_socket(self): global debug_tcp_sockets - if self.socket: - if debug_tcp_sockets: - VTYInteract.all_sockets.remove(self.socket) - print "Socket: closing %s:%d %r (%d sockets open)" % ( - self.host, self.port, self.socket, - len(VTYInteract.all_sockets)) - self.socket.close() - self.socket = None + if self.socket is None: + return + + if debug_tcp_sockets: + VTYInteract.all_sockets.remove(self.socket) + print "Socket: closing %s:%d %r (%d sockets open)" % ( + self.host, self.port, self.socket, + len(VTYInteract.all_sockets)) + self.socket.close() + self.socket = None def _is_end(self, text, ends): """ -- To view, visit https://gerrit.osmocom.org/1920 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 Gerrit-PatchSet: 3 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:24 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:24 +0000 Subject: [PATCH] python/osmo-python-tests[master]: osmoutil: end_proc: wait for term in a loop In-Reply-To: References: Message-ID: Hello Harald Welte, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1936 to look at the new patch set (#2). osmoutil: end_proc: wait for term in a loop Recent commit b59b677c9b13483aac72b15f4f797863d841d958 called proc.terminate() instead of killing right away, with a .1 second sleep. Reduce this sleep to a minuscule first wait_time, remaining tolerant for processes that take longer. Actually all of our current processes are very fast to terminate. This patch was created while looking for a different problem, now that it's there we might as well keep it. Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a --- M osmopy/osmoutil.py 1 file changed, 19 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/36/1936/2 diff --git a/osmopy/osmoutil.py b/osmopy/osmoutil.py index 87203d5..8f0369b 100755 --- a/osmopy/osmoutil.py +++ b/osmopy/osmoutil.py @@ -47,13 +47,27 @@ return proc.terminate() - time.sleep(.1) - rc = proc.poll() - if rc is not None: - print "Terminated child process" - else: + time_to_wait_for_term = 5 + wait_step = 0.001 + waited_time = 0 + while True: + # poll returns None if proc is still running + rc = proc.poll() + if rc is not None: + break + waited_time += wait_step + # make wait_step approach 1.0 + wait_step = (1. + 5. * wait_step) / 6. + if waited_time >= time_to_wait_for_term: + break + time.sleep(wait_step) + + if proc.poll() is None: + # termination seems to be slower than that, let's just kill proc.kill() print "Killed child process" + elif waited_time > .002: + print "Terminating took %.3fs" % waited_time proc.wait() -- To view, visit https://gerrit.osmocom.org/1936 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:24 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:24 +0000 Subject: [PATCH] python/osmo-python-tests[master]: tcp debugging: allow switching on TCP debug by env var In-Reply-To: References: Message-ID: Hello Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1917 to look at the new patch set (#3). tcp debugging: allow switching on TCP debug by env var Print monitoring info about TCP sockets when the env var OSMOPY_DEBUG_TCP_SOCKETS is present and not "0". Makes it easy to enable it on jenkins without blowing up output of normal runs "at home". Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d --- M osmopy/obscvty.py 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/17/1917/3 diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index e4df57d..4457a90 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -19,6 +19,7 @@ import re import socket import sys, subprocess +import os """VTYInteract: interact with an osmocom vty @@ -26,7 +27,7 @@ Connections will be reestablished as necessary. Methods: __init__, command, enabled_command, verify, w_verify""" -debug_tcp_sockets = False +debug_tcp_sockets = (os.getenv('OSMOPY_DEBUG_TCP_SOCKETS', '0') != '0') def cmd(what): print '\n> %s' % what -- To view, visit https://gerrit.osmocom.org/1917 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d Gerrit-PatchSet: 3 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:24 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:24 +0000 Subject: [PATCH] python/osmo-python-tests[master]: debug_tcp_sockets: clearly mark as global var In-Reply-To: References: Message-ID: Hello Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1919 to look at the new patch set (#3). debug_tcp_sockets: clearly mark as global var Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 --- M osmopy/obscvty.py 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/19/1919/3 diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index f0cd4a1..f614518 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -39,6 +39,7 @@ sys.stdout.flush() def print_used_tcp_sockets(): + global debug_tcp_sockets if not debug_tcp_sockets: return cmd('ls /proc/self/fd'); @@ -68,6 +69,7 @@ self.last_node = '' def _close_socket(self): + global debug_tcp_sockets if self.socket: if debug_tcp_sockets: VTYInteract.all_sockets.remove(self.socket) @@ -131,6 +133,7 @@ return 0 def _common_command(self, request, close=False, ends=None): + global debug_tcp_sockets if not ends: ends = [self.norm_end, self.priv_end] if not self.socket: -- To view, visit https://gerrit.osmocom.org/1919 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 Gerrit-PatchSet: 3 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:51 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:51 +0000 Subject: [MERGED] python/osmo-python-tests[master]: osmoutil: end_proc: wait for term in a loop In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: osmoutil: end_proc: wait for term in a loop ...................................................................... osmoutil: end_proc: wait for term in a loop Recent commit b59b677c9b13483aac72b15f4f797863d841d958 called proc.terminate() instead of killing right away, with a .1 second sleep. Reduce this sleep to a minuscule first wait_time, remaining tolerant for processes that take longer. Actually all of our current processes are very fast to terminate. This patch was created while looking for a different problem, now that it's there we might as well keep it. Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a --- M osmopy/osmoutil.py 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/osmopy/osmoutil.py b/osmopy/osmoutil.py index 87203d5..8f0369b 100755 --- a/osmopy/osmoutil.py +++ b/osmopy/osmoutil.py @@ -47,13 +47,27 @@ return proc.terminate() - time.sleep(.1) - rc = proc.poll() - if rc is not None: - print "Terminated child process" - else: + time_to_wait_for_term = 5 + wait_step = 0.001 + waited_time = 0 + while True: + # poll returns None if proc is still running + rc = proc.poll() + if rc is not None: + break + waited_time += wait_step + # make wait_step approach 1.0 + wait_step = (1. + 5. * wait_step) / 6. + if waited_time >= time_to_wait_for_term: + break + time.sleep(wait_step) + + if proc.poll() is None: + # termination seems to be slower than that, let's just kill proc.kill() print "Killed child process" + elif waited_time > .002: + print "Terminating took %.3fs" % waited_time proc.wait() -- To view, visit https://gerrit.osmocom.org/1936 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:52 +0000 Subject: [MERGED] python/osmo-python-tests[master]: osmoutil: add pick_test() to pick unittest tests by name In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: osmoutil: add pick_test() to pick unittest tests by name ...................................................................... osmoutil: add pick_test() to pick unittest tests by name Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 --- M osmopy/osmoutil.py 1 file changed, 22 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Holger Freyther: Looks good to me, but someone else must approve diff --git a/osmopy/osmoutil.py b/osmopy/osmoutil.py index 01f74cc..87203d5 100755 --- a/osmopy/osmoutil.py +++ b/osmopy/osmoutil.py @@ -19,6 +19,7 @@ import sys import importlib import time +import unittest """Run a command, with stdout and stderr directed to devnull""" @@ -69,3 +70,24 @@ else: print >> sys.stderr, "set osmoappdesc location with -p " sys.exit(1) + + +def pick_tests(suite, *name_snippets): + '''for unittest: Non-standard way of picking only selected tests to run, + by name. Kind of stupid of python unittest to not provide this feature + more easily.''' + + new_tests = [] + for t in suite._tests: + if isinstance(t, unittest.suite.TestSuite): + pick_tests(t, *name_snippets) + new_tests.append(t) + continue + + if not isinstance(t, unittest.TestCase): + new_tests.append(t) + continue + + if any([n.lower() in t._testMethodName.lower() for n in name_snippets]): + new_tests.append(t) + suite._tests = new_tests -- To view, visit https://gerrit.osmocom.org/1935 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:52 +0000 Subject: [MERGED] python/osmo-python-tests[master]: speed up python tests more than 10 fold by sleeping less In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: speed up python tests more than 10 fold by sleeping less ...................................................................... speed up python tests more than 10 fold by sleeping less The VTYInteract tests gave a constant sleep(1) grace period for the process to startup. This caused the test to take minutes for no reason at all. Add code to VTYInteract._connect_socket() to try and connect right away, retrying up to three seconds in .1 second intervals. This flies through most tests without any sleep() at all. When TCP socket debugging is switched on, also print how many connection tries it took to connect the VTY socket. Note that the openbsc python tests also add some sleep()s that also need to be removed to benefit from this. Change-Id: Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39 --- M osmopy/obscvty.py M osmopy/osmodumpdoc.py M osmopy/osmotestconfig.py M osmopy/osmotestvty.py 4 files changed, 22 insertions(+), 8 deletions(-) Approvals: Holger Freyther: Looks good to me, approved diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index 857d75b..f1f1c59 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -20,6 +20,7 @@ import socket import sys, subprocess import os +import time """VTYInteract: interact with an osmocom vty @@ -71,13 +72,29 @@ def _connect_socket(self): if self.socket is not None: return - self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.socket.setblocking(1) - self.socket.connect((self.host, self.port)) + retries = 30 + took = 0 + while True: + took += 1 + try: + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.socket.setblocking(1) + self.socket.connect((self.host, self.port)) + except IOError: + retries -= 1 + if retries <= 0: + raise + # possibly the binary hasn't launched yet + if debug_tcp_sockets: + print "Connecting socket failed, retrying..." + time.sleep(.1) + continue + break + if debug_tcp_sockets: VTYInteract.all_sockets.append(self.socket) - print "Socket: connected to %s:%d %r (%d sockets open)" % ( - self.host, self.port, self.socket, + print "Socket: in %d tries, connected to %s:%d %r (%d sockets open)" % ( + took, self.host, self.port, self.socket, len(VTYInteract.all_sockets)) self.socket.recv(4096) diff --git a/osmopy/osmodumpdoc.py b/osmopy/osmodumpdoc.py index d9d52b5..0ff1f6b 100644 --- a/osmopy/osmodumpdoc.py +++ b/osmopy/osmodumpdoc.py @@ -48,7 +48,6 @@ print >> sys.stderr, "Skipping app %s" % appname failures += 1 else: - time.sleep(1) try: dump_doc(app[2], app[0], 'doc/%s_vty_reference.xml' % appname) successes += 1 diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py index 0d2b2d9..7b8ad66 100644 --- a/osmopy/osmotestconfig.py +++ b/osmopy/osmotestconfig.py @@ -55,7 +55,6 @@ print "Verifying %s, test %s" % (' '.join(cmd), run_test.__name__) proc = osmoutil.popen_devnull(cmd) - time.sleep(1) end = app_desc[2] port = app_desc[0] vty = obscvty.VTYInteract(end, "127.0.0.1", port) diff --git a/osmopy/osmotestvty.py b/osmopy/osmotestvty.py index 9f8dd0a..e513c05 100644 --- a/osmopy/osmotestvty.py +++ b/osmopy/osmotestvty.py @@ -41,7 +41,6 @@ except OSError: print >> sys.stderr, "Current directory: %s" % os.getcwd() print >> sys.stderr, "Consider setting -b" - time.sleep(1) appstring = osmoappdesc.vty_app[2] appport = osmoappdesc.vty_app[0] -- To view, visit https://gerrit.osmocom.org/1924 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:52 +0000 Subject: [MERGED] python/osmo-python-tests[master]: cosmetic: put socket connection code in separate function In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: put socket connection code in separate function ...................................................................... cosmetic: put socket connection code in separate function Prepare for upcoming patch that adds connection retries to speed up tests. Change-Id: I2dddf8794b4241898373178c8a1aa2e98b01095c --- M osmopy/obscvty.py 1 file changed, 15 insertions(+), 10 deletions(-) Approvals: Holger Freyther: Looks good to me, approved diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index f5c85fb..857d75b 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -68,6 +68,19 @@ self.priv_end = re.compile('\r\n%s(?:\(([\w-]*)\))?# $' % self.name) self.last_node = '' + def _connect_socket(self): + if self.socket is not None: + return + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.socket.setblocking(1) + self.socket.connect((self.host, self.port)) + if debug_tcp_sockets: + VTYInteract.all_sockets.append(self.socket) + print "Socket: connected to %s:%d %r (%d sockets open)" % ( + self.host, self.port, self.socket, + len(VTYInteract.all_sockets)) + self.socket.recv(4096) + def _close_socket(self): global debug_tcp_sockets if self.socket is None: @@ -141,16 +154,8 @@ global debug_tcp_sockets if not ends: ends = [self.norm_end, self.priv_end] - if not self.socket: - self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.socket.setblocking(1) - self.socket.connect((self.host, self.port)) - if debug_tcp_sockets: - VTYInteract.all_sockets.append(self.socket) - print "Socket: connected to %s:%d %r (%d sockets open)" % ( - self.host, self.port, self.socket, - len(VTYInteract.all_sockets)) - self.socket.recv(4096) + + self._connect_socket() # Now send the command self.socket.send("%s\r" % request) -- To view, visit https://gerrit.osmocom.org/1923 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2dddf8794b4241898373178c8a1aa2e98b01095c Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:52 +0000 Subject: [MERGED] python/osmo-python-tests[master]: tcp_debug: don't abort when socket can't be removed In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: tcp_debug: don't abort when socket can't be removed ...................................................................... tcp_debug: don't abort when socket can't be removed It appears that during some error conditions, the socket will not be in the tcp socket debug tracking list, and on top of an exception this barfs as well. Let's not care about the tcp debug list and avoid confusing error messages. Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f --- M osmopy/obscvty.py 1 file changed, 4 insertions(+), 1 deletion(-) Approvals: Holger Freyther: Looks good to me, approved diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index bbf6e45..f5c85fb 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -74,7 +74,10 @@ return if debug_tcp_sockets: - VTYInteract.all_sockets.remove(self.socket) + try: + VTYInteract.all_sockets.remove(self.socket) + except ValueError: + pass print "Socket: closing %s:%d %r (%d sockets open)" % ( self.host, self.port, self.socket, len(VTYInteract.all_sockets)) -- To view, visit https://gerrit.osmocom.org/1921 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:53 +0000 Subject: [MERGED] python/osmo-python-tests[master]: cosmetic: early exit instead of if-cascade In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: early exit instead of if-cascade ...................................................................... cosmetic: early exit instead of if-cascade It appears that during some error conditions, the socket will not be in the tcp socket debug tracking list, and on top of an exception this barfs as well. Let's not care about the tcp debug list and avoid confusing error messages. Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 --- M osmopy/obscvty.py 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index f614518..bbf6e45 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -70,14 +70,16 @@ def _close_socket(self): global debug_tcp_sockets - if self.socket: - if debug_tcp_sockets: - VTYInteract.all_sockets.remove(self.socket) - print "Socket: closing %s:%d %r (%d sockets open)" % ( - self.host, self.port, self.socket, - len(VTYInteract.all_sockets)) - self.socket.close() - self.socket = None + if self.socket is None: + return + + if debug_tcp_sockets: + VTYInteract.all_sockets.remove(self.socket) + print "Socket: closing %s:%d %r (%d sockets open)" % ( + self.host, self.port, self.socket, + len(VTYInteract.all_sockets)) + self.socket.close() + self.socket = None def _is_end(self, text, ends): """ -- To view, visit https://gerrit.osmocom.org/1920 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44 Gerrit-PatchSet: 3 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:53 +0000 Subject: [MERGED] python/osmo-python-tests[master]: debug_tcp_sockets: clearly mark as global var In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: debug_tcp_sockets: clearly mark as global var ...................................................................... debug_tcp_sockets: clearly mark as global var Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 --- M osmopy/obscvty.py 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Holger Freyther: Looks good to me, approved diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index f0cd4a1..f614518 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -39,6 +39,7 @@ sys.stdout.flush() def print_used_tcp_sockets(): + global debug_tcp_sockets if not debug_tcp_sockets: return cmd('ls /proc/self/fd'); @@ -68,6 +69,7 @@ self.last_node = '' def _close_socket(self): + global debug_tcp_sockets if self.socket: if debug_tcp_sockets: VTYInteract.all_sockets.remove(self.socket) @@ -131,6 +133,7 @@ return 0 def _common_command(self, request, close=False, ends=None): + global debug_tcp_sockets if not ends: ends = [self.norm_end, self.priv_end] if not self.socket: -- To view, visit https://gerrit.osmocom.org/1919 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3 Gerrit-PatchSet: 3 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:53 +0000 Subject: [MERGED] python/osmo-python-tests[master]: debug: also output nr of open file descriptors for 'tcp debug' In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: debug: also output nr of open file descriptors for 'tcp debug' ...................................................................... debug: also output nr of open file descriptors for 'tcp debug' Change-Id: I8a583df549f3e2b79068fd8cd32b75473539410d --- M osmopy/obscvty.py 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Holger Freyther: Looks good to me, approved diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index 4457a90..f0cd4a1 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -41,6 +41,7 @@ def print_used_tcp_sockets(): if not debug_tcp_sockets: return + cmd('ls /proc/self/fd'); cmd('ss -tn'); cmd('ss -tln'); cmd('ps xua | grep osmo'); -- To view, visit https://gerrit.osmocom.org/1918 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8a583df549f3e2b79068fd8cd32b75473539410d Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:31:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:31:53 +0000 Subject: [MERGED] python/osmo-python-tests[master]: tcp debugging: allow switching on TCP debug by env var In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: tcp debugging: allow switching on TCP debug by env var ...................................................................... tcp debugging: allow switching on TCP debug by env var Print monitoring info about TCP sockets when the env var OSMOPY_DEBUG_TCP_SOCKETS is present and not "0". Makes it easy to enable it on jenkins without blowing up output of normal runs "at home". Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d --- M osmopy/obscvty.py 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py index e4df57d..4457a90 100755 --- a/osmopy/obscvty.py +++ b/osmopy/obscvty.py @@ -19,6 +19,7 @@ import re import socket import sys, subprocess +import os """VTYInteract: interact with an osmocom vty @@ -26,7 +27,7 @@ Connections will be reestablished as necessary. Methods: __init__, command, enabled_command, verify, w_verify""" -debug_tcp_sockets = False +debug_tcp_sockets = (os.getenv('OSMOPY_DEBUG_TCP_SOCKETS', '0') != '0') def cmd(what): print '\n> %s' % what -- To view, visit https://gerrit.osmocom.org/1917 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d Gerrit-PatchSet: 3 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:35:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:35:52 +0000 Subject: libosmocore[master]: ctrl_type_vals: fix range check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1963 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:35:54 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:35:54 +0000 Subject: [MERGED] libosmocore[master]: ctrl_type_vals: fix range check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: ctrl_type_vals: fix range check ...................................................................... ctrl_type_vals: fix range check In ctrl_cmd_parse(), fix missing check for not parseable ctrl type. Fixup for Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28. Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0 --- M src/ctrl/control_cmd.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Max: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 1cc8247..cdec8ef 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -289,7 +289,7 @@ } cmd->type = get_string_value(ctrl_type_vals, tmp); - if (cmd->type == CTRL_TYPE_UNKNOWN) { + if (cmd->type < 0 || cmd->type == CTRL_TYPE_UNKNOWN) { cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; cmd->reply = "Request type unknown"; -- To view, visit https://gerrit.osmocom.org/1963 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7f8055225e3ee04b2a723bae07b12c42618963a0 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:50:21 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:50:21 +0000 Subject: [PATCH] openbsc[master]: add struct bsc_subscr, separating libbsc from gsm_subscriber In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1682 to look at the new patch set (#9). add struct bsc_subscr, separating libbsc from gsm_subscriber In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC subscriber: struct bsc_subscr. Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no longer have a backpointer to gsm_network (used to be via subscr->group). Create a separate logging filter for the new BSC subscriber. The implementation of adjusting the filter context is added in libbsc to not introduce bsc_subscr_get/_put() dependencies to libcommon. During Paging Response, fetch a bsc_subscr from the mobile identity, like we do for the gsm_subscriber. It looks like a duplication now, but will make sense for the VLR as well as for future MSC split patches. Naming: it was requested to not name the new struct bsc_sub, because 'sub' is too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast to type, relatively short, unambiguous, and the naming is consistent. Add bsc_subscr unit test. Related: OS#1592, OS#1594 Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e --- M openbsc/.gitignore M openbsc/include/openbsc/Makefile.am A openbsc/include/openbsc/bsc_subscriber.h M openbsc/include/openbsc/debug.h M openbsc/include/openbsc/gsm_04_08.h M openbsc/include/openbsc/gsm_data.h M openbsc/include/openbsc/osmo_bsc_grace.h M openbsc/include/openbsc/paging.h M openbsc/src/libbsc/Makefile.am M openbsc/src/libbsc/abis_rsl.c A openbsc/src/libbsc/bsc_subscriber.c M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libbsc/gsm_04_08_utils.c M openbsc/src/libbsc/paging.c M openbsc/src/libcommon-cs/common_cs.c M openbsc/src/libcommon/debug.c M openbsc/src/libmsc/gsm_04_08.c M openbsc/src/libmsc/gsm_subscriber.c M openbsc/src/libmsc/vty_interface_layer3.c M openbsc/src/osmo-bsc/osmo_bsc_bssap.c M openbsc/src/osmo-bsc/osmo_bsc_filter.c M openbsc/src/osmo-bsc/osmo_bsc_grace.c M openbsc/src/osmo-bsc/osmo_bsc_vty.c M openbsc/tests/channel/Makefile.am M openbsc/tests/channel/channel_test.c M openbsc/tests/subscr/Makefile.am A openbsc/tests/subscr/bsc_subscr_test.c A openbsc/tests/subscr/bsc_subscr_test.err A openbsc/tests/subscr/bsc_subscr_test.ok M openbsc/tests/testsuite.at 30 files changed, 615 insertions(+), 115 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/82/1682/9 diff --git a/openbsc/.gitignore b/openbsc/.gitignore index e3f25cb..4f8e7e6 100644 --- a/openbsc/.gitignore +++ b/openbsc/.gitignore @@ -79,6 +79,7 @@ tests/mgcp/mgcp_transcoding_test tests/sgsn/sgsn_test tests/subscr/subscr_test +tests/subscr/bsc_subscr_test tests/oap/oap_test tests/gtphub/gtphub_test tests/mm_auth/mm_auth_test diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 30c1191..7ddf323 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -10,6 +10,7 @@ bsc_nat_callstats.h \ bsc_nat_sccp.h \ bsc_rll.h \ + bsc_subscriber.h \ bss.h \ bts_ipaccess_nanobts_omlattr.h \ chan_alloc.h \ diff --git a/openbsc/include/openbsc/bsc_subscriber.h b/openbsc/include/openbsc/bsc_subscriber.h new file mode 100644 index 0000000..324734f --- /dev/null +++ b/openbsc/include/openbsc/bsc_subscriber.h @@ -0,0 +1,43 @@ +/* GSM subscriber details for use in BSC land */ + +#pragma once + +#include + +#include +#include + +struct log_target; + +struct bsc_subscr { + struct llist_head entry; + int use_count; + + char imsi[GSM23003_IMSI_MAX_DIGITS+1]; + uint32_t tmsi; + uint16_t lac; +}; + +const char *bsc_subscr_name(struct bsc_subscr *bsub); + +struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, + const char *imsi); +struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list, + uint32_t tmsi); + +struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list, + const char *imsi); +struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, + uint32_t tmsi); + +void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi); + +struct bsc_subscr *_bsc_subscr_get(struct bsc_subscr *bsub, + const char *file, int line); +struct bsc_subscr *_bsc_subscr_put(struct bsc_subscr *bsub, + const char *file, int line); +#define bsc_subscr_get(bsub) _bsc_subscr_get(bsub, __BASE_FILE__, __LINE__) +#define bsc_subscr_put(bsub) _bsc_subscr_put(bsub, __BASE_FILE__, __LINE__) + +void log_set_filter_bsc_subscr(struct log_target *target, + struct bsc_subscr *bsub); diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 6300020..74db723 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -42,6 +42,7 @@ struct gsm_subscriber; -void log_set_imsi_filter(struct log_target *target, struct gsm_subscriber *subscr); +void log_set_filter_vlr_subscr(struct log_target *target, + struct gsm_subscriber *vlr_subscr); extern const struct log_info log_info; diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index cb632f6..bdf4ed2 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -15,6 +15,7 @@ struct gsm_subscriber_connection; struct amr_multirate_conf; struct amr_mode; +struct bsc_subscr; #define GSM48_ALLOC_SIZE 2048 #define GSM48_ALLOC_HEADROOM 256 @@ -78,7 +79,8 @@ int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv); int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type); int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type); -int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr); +int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, + struct msgb *msg, struct bsc_subscr *bsub); int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode); int gsm48_rx_rr_modif_ack(struct msgb *msg); diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 620b6e4..a36083a 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -23,6 +23,7 @@ struct mncc_sock_state; struct gsm_subscriber_group; +struct bsc_subscr; #define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] @@ -118,6 +119,9 @@ /* To whom we are allocated at the moment */ struct gsm_subscriber *subscr; + + /* libbsc subscriber information */ + struct bsc_subscr *bsub; /* LU expiration handling */ uint8_t expire_timer_stopped; @@ -391,6 +395,14 @@ * BTS|RNC specific timezone overrides for multi-tz networks in * OsmoMSC, this should be tied to the location area code (LAC). */ struct gsm_tz tz; + + /* List of all struct bsc_subscr used in libbsc. This llist_head is + * allocated so that the llist_head pointer itself can serve as a + * talloc context (useful to not have to pass the entire gsm_network + * struct to the bsc_subscr_* API, and for bsc_susbscr unit tests to + * not require gsm_data.h). In an MSC-without-BSC environment, this + * pointer is NULL to indicate absence of a bsc_subscribers list. */ + struct llist_head *bsc_subscribers; }; struct osmo_esme; diff --git a/openbsc/include/openbsc/osmo_bsc_grace.h b/openbsc/include/openbsc/osmo_bsc_grace.h index ea5e4e2..5a81cd1 100644 --- a/openbsc/include/openbsc/osmo_bsc_grace.h +++ b/openbsc/include/openbsc/osmo_bsc_grace.h @@ -22,10 +22,14 @@ #define OSMO_BSC_GRACE_H #include +#include struct bsc_msc_data; int bsc_grace_allow_new_connection(struct gsm_network *net, struct gsm_bts *bts); -int bsc_grace_paging_request(struct gsm_subscriber *sub, int type, struct bsc_msc_data *msc); +int bsc_grace_paging_request(enum signal_rf rf_policy, + struct bsc_subscr *subscr, + int chan_needed, + struct bsc_msc_data *msc); #endif diff --git a/openbsc/include/openbsc/paging.h b/openbsc/include/openbsc/paging.h index 689ff51..7dd8500 100644 --- a/openbsc/include/openbsc/paging.h +++ b/openbsc/include/openbsc/paging.h @@ -27,7 +27,7 @@ #include #include -#include +#include /** * A pending paging request @@ -36,8 +36,8 @@ /* list_head for list of all paging requests */ struct llist_head entry; /* the subscriber which we're paging. Later gsm_paging_request - * should probably become a part of the gsm_subscriber struct? */ - struct gsm_subscriber *subscr; + * should probably become a part of the bsc_subsrc struct? */ + struct bsc_subscr *bsub; /* back-pointer to the BTS on which we are paging */ struct gsm_bts *bts; /* what kind of channel type do we ask the MS to establish */ @@ -55,13 +55,14 @@ }; /* schedule paging request */ -int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, +int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int type, gsm_cbfn *cbfn, void *data); -int paging_request_bts(struct gsm_bts *bts, struct gsm_subscriber *subscr, - int type, gsm_cbfn *cbfn, void *data); +int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, + int type, gsm_cbfn *cbfn, void *data); /* stop paging requests */ -void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, +void paging_request_stop(struct llist_head *bts_list, + struct gsm_bts *_bts, struct bsc_subscr *bsub, struct gsm_subscriber_connection *conn, struct msgb *msg); @@ -71,6 +72,6 @@ /* pending paging requests */ unsigned int paging_pending_requests_nr(struct gsm_bts *bts); -void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr); +void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub); #endif diff --git a/openbsc/src/libbsc/Makefile.am b/openbsc/src/libbsc/Makefile.am index b8e77e6..fd8f37a 100644 --- a/openbsc/src/libbsc/Makefile.am +++ b/openbsc/src/libbsc/Makefile.am @@ -24,6 +24,7 @@ abis_om2000_vty.c \ abis_rsl.c \ bsc_rll.c \ + bsc_subscriber.c \ paging.c \ bts_ericsson_rbs2000.c \ bts_ipaccess_nanobts.c \ diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 1cae832..5939e75 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1332,10 +1332,10 @@ static void print_meas_rep(struct gsm_lchan *lchan, struct gsm_meas_rep *mr) { int i; - char *name = ""; + const char *name = ""; if (lchan && lchan->conn) - name = subscr_name(lchan->conn->subscr); + name = bsc_subscr_name(lchan->conn->bsub); DEBUGP(DMEAS, "[%s] MEASUREMENT RESULT NR=%d ", name, mr->nr); diff --git a/openbsc/src/libbsc/bsc_subscriber.c b/openbsc/src/libbsc/bsc_subscriber.c new file mode 100644 index 0000000..a5e40cd --- /dev/null +++ b/openbsc/src/libbsc/bsc_subscriber.c @@ -0,0 +1,168 @@ +/* GSM subscriber details for use in BSC land */ + +/* + * (C) 2016 by sysmocom s.f.m.c. GmbH + * + * Author: Neels Hofmeyr + * + * 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 . + * + */ + +#include +#include +#include + +#include +#include + +#include +#include + +static struct bsc_subscr *bsc_subscr_alloc(struct llist_head *list) +{ + struct bsc_subscr *bsub; + + bsub = talloc_zero(list, struct bsc_subscr); + if (!bsub) + return NULL; + + llist_add_tail(&bsub->entry, list); + bsub->use_count = 1; + + return bsub; +} + +struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list, + const char *imsi) +{ + struct bsc_subscr *bsub; + + if (!imsi || !*imsi) + return NULL; + + llist_for_each_entry(bsub, list, entry) { + if (!strcmp(bsub->imsi, imsi)) + return bsc_subscr_get(bsub); + } + return NULL; +} + +struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, + uint32_t tmsi) +{ + struct bsc_subscr *bsub; + + if (tmsi == GSM_RESERVED_TMSI) + return NULL; + + llist_for_each_entry(bsub, list, entry) { + if (bsub->tmsi == tmsi) + return bsc_subscr_get(bsub); + } + return NULL; +} + +void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi) +{ + if (!bsub) + return; + strncpy(bsub->imsi, imsi, sizeof(bsub->imsi)); +} + +struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, + const char *imsi) +{ + struct bsc_subscr *bsub; + bsub = bsc_subscr_find_by_imsi(list, imsi); + if (bsub) + return bsub; + bsub = bsc_subscr_alloc(list); + bsc_subscr_set_imsi(bsub, imsi); + return bsub; +} + +struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list, + uint32_t tmsi) +{ + struct bsc_subscr *bsub; + bsub = bsc_subscr_find_by_tmsi(list, tmsi); + if (bsub) + return bsub; + bsub = bsc_subscr_alloc(list); + bsub->tmsi = tmsi; + return bsub; +} + +const char *bsc_subscr_name(struct bsc_subscr *bsub) +{ + static char buf[32]; + if (!bsub) + return "unknown"; + if (bsub->imsi[0]) + snprintf(buf, sizeof(buf), "IMSI:%s", bsub->imsi); + else + snprintf(buf, sizeof(buf), "TMSI:0x%08x", bsub->tmsi); + return buf; +} + +static void bsc_subscr_free(struct bsc_subscr *bsub) +{ + llist_del(&bsub->entry); + talloc_free(bsub); +} + +struct bsc_subscr *_bsc_subscr_get(struct bsc_subscr *bsub, + const char *file, int line) +{ + OSMO_ASSERT(bsub->use_count < INT_MAX); + bsub->use_count++; + LOGPSRC(DREF, LOGL_DEBUG, file, line, + "BSC subscr %s usage increases to: %d\n", + bsc_subscr_name(bsub), bsub->use_count); + return bsub; +} + +struct bsc_subscr *_bsc_subscr_put(struct bsc_subscr *bsub, + const char *file, int line) +{ + bsub->use_count--; + LOGPSRC(DREF, bsub->use_count >= 0? LOGL_DEBUG : LOGL_ERROR, + file, line, + "BSC subscr %s usage decreases to: %d\n", + bsc_subscr_name(bsub), bsub->use_count); + if (bsub->use_count <= 0) + bsc_subscr_free(bsub); + return NULL; +} + +void log_set_filter_bsc_subscr(struct log_target *target, + struct bsc_subscr *bsc_subscr) +{ + struct bsc_subscr **fsub = (void*)&target->filter_data[LOG_FLT_BSC_SUBSCR]; + + /* free the old data */ + if (*fsub) { + bsc_subscr_put(*fsub); + *fsub = NULL; + } + + if (bsc_subscr) { + target->filter_map |= (1 << LOG_FLT_BSC_SUBSCR); + *fsub = bsc_subscr_get(bsc_subscr); + } else + target->filter_map &= ~(1 << LOG_FLT_BSC_SUBSCR); +} diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 0a55cf4..b1747aa 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1023,6 +1023,16 @@ vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); } +static void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub) +{ + if (strlen(bsub->imsi)) + vty_out(vty, " IMSI: %s%s", bsub->imsi, VTY_NEWLINE); + if (bsub->tmsi != GSM_RESERVED_TMSI) + vty_out(vty, " TMSI: 0x%08x%s", bsub->tmsi, + VTY_NEWLINE); + vty_out(vty, " Use count: %d%s", bsub->use_count, VTY_NEWLINE); +} + static void meas_rep_dump_uni_vty(struct vty *vty, struct gsm_meas_rep_unidir *mru, const char *prefix, @@ -1318,7 +1328,7 @@ static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag) { vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE); - subscr_dump_vty(vty, pag->subscr); + bsc_subscr_dump_vty(vty, pag->bsub); } static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts) diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 98f0790..4a53b31 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -283,7 +283,7 @@ } int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, - struct msgb *msg, struct gsm_subscriber *subscr) + struct msgb *msg, struct bsc_subscr *bsub) { struct gsm_bts *bts = msg->lchan->ts->trx->bts; struct gsm48_hdr *gh = msgb_l3(msg); @@ -292,22 +292,24 @@ if (is_siemens_bts(bts)) send_siemens_mrpci(msg->lchan, classmark2_lv); - if (!conn->subscr) { - conn->subscr = subscr; - } else if (conn->subscr != subscr) { - LOGP(DRR, LOGL_ERROR, "<- Channel already owned by someone else?\n"); - subscr_put(subscr); + if (!conn->bsub) { + conn->bsub = bsub; + } else if (conn->bsub != bsub) { + LOGP(DRR, LOGL_ERROR, + "<- Channel already owned by someone else?\n"); + bsc_subscr_put(bsub); return -EINVAL; } else { DEBUGP(DRR, "<- Channel already owned by us\n"); - subscr_put(subscr); - subscr = conn->subscr; + bsc_subscr_put(bsub); + bsub = conn->bsub; } rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED]); /* Stop paging on the bts we received the paging response */ - paging_request_stop(conn->bts, subscr, conn, msg); + paging_request_stop(&bts->network->bts_list, conn->bts, bsub, conn, + msg); return 0; } diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c index eb37a33..bd23d89 100644 --- a/openbsc/src/libbsc/paging.c +++ b/openbsc/src/libbsc/paging.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -58,11 +59,11 @@ * Kill one paging request update the internal list... */ static void paging_remove_request(struct gsm_bts_paging_state *paging_bts, - struct gsm_paging_request *to_be_deleted) + struct gsm_paging_request *to_be_deleted) { osmo_timer_del(&to_be_deleted->T3113); llist_del(&to_be_deleted->entry); - subscr_put(to_be_deleted->subscr); + bsc_subscr_put(to_be_deleted->bsub); talloc_free(to_be_deleted); } @@ -77,21 +78,21 @@ if (!bts->oml_link) return; - log_set_context(LOG_CTX_VLR_SUBSCR, request->subscr); + log_set_context(LOG_CTX_BSC_SUBSCR, request->bsub); LOGP(DPAG, LOGL_INFO, "Going to send paging commands: imsi: %s tmsi: " - "0x%x for ch. type %d (attempt %d)\n", request->subscr->imsi, - request->subscr->tmsi, request->chan_type, request->attempts); + "0x%08x for ch. type %d (attempt %d)\n", request->bsub->imsi, + request->bsub->tmsi, request->chan_type, request->attempts); - if (request->subscr->tmsi == GSM_RESERVED_TMSI) - mi_len = gsm48_generate_mid_from_imsi(mi, request->subscr->imsi); + if (request->bsub->tmsi == GSM_RESERVED_TMSI) + mi_len = gsm48_generate_mid_from_imsi(mi, request->bsub->imsi); else - mi_len = gsm48_generate_mid_from_tmsi(mi, request->subscr->tmsi); + mi_len = gsm48_generate_mid_from_tmsi(mi, request->bsub->tmsi); page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc, - str_to_imsi(request->subscr->imsi)); + str_to_imsi(request->bsub->imsi)); gsm0808_page(bts, page_group, mi_len, mi, request->chan_type); - log_set_context(LOG_CTX_VLR_SUBSCR, NULL); + log_set_context(LOG_CTX_BSC_SUBSCR, NULL); } static void paging_schedule_if_needed(struct gsm_bts_paging_state *paging_bts) @@ -237,11 +238,12 @@ } static int paging_pending_request(struct gsm_bts_paging_state *bts, - struct gsm_subscriber *subscr) { + struct bsc_subscr *bsub) +{ struct gsm_paging_request *req; llist_for_each_entry(req, &bts->pending_requests, entry) { - if (subscr == req->subscr) + if (bsub == req->bsub) return 1; } @@ -255,10 +257,10 @@ gsm_cbfn *cbfn; int msg; - log_set_context(LOG_CTX_VLR_SUBSCR, req->subscr); + log_set_context(LOG_CTX_BSC_SUBSCR, req->bsub); LOGP(DPAG, LOGL_INFO, "T3113 expired for request %p (%s)\n", - req, req->subscr->imsi); + req, bsc_subscr_name(req->bsub)); /* must be destroyed before calling cbfn, to prevent double free */ rate_ctr_inc(&req->bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED]); @@ -277,21 +279,22 @@ } -static int _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, - int type, gsm_cbfn *cbfn, void *data) +static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, + int type, gsm_cbfn *cbfn, void *data) { struct gsm_bts_paging_state *bts_entry = &bts->paging; struct gsm_paging_request *req; - if (paging_pending_request(bts_entry, subscr)) { - LOGP(DPAG, LOGL_INFO, "Paging request already pending for %s\n", subscr->imsi); + if (paging_pending_request(bts_entry, bsub)) { + LOGP(DPAG, LOGL_INFO, "Paging request already pending for %s\n", + bsc_subscr_name(bsub)); return -EEXIST; } - LOGP(DPAG, LOGL_DEBUG, "Start paging of subscriber %llu on bts %d.\n", - subscr->id, bts->nr); + LOGP(DPAG, LOGL_DEBUG, "Start paging of subscriber %s on bts %d.\n", + bsc_subscr_name(bsub), bts->nr); req = talloc_zero(tall_paging_ctx, struct gsm_paging_request); - req->subscr = subscr_get(subscr); + req->bsub = bsc_subscr_get(bsub); req->bts = bts; req->chan_type = type; req->cbfn = cbfn; @@ -305,8 +308,8 @@ return 0; } -int paging_request_bts(struct gsm_bts *bts, struct gsm_subscriber *subscr, - int type, gsm_cbfn *cbfn, void *data) +int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, + int type, gsm_cbfn *cbfn, void *data) { int rc; @@ -317,15 +320,14 @@ /* maybe it is the first time we use it */ paging_init_if_needed(bts); - /* Trigger paging, pass any error to the caller */ - rc = _paging_request(bts, subscr, type, cbfn, data); + rc = _paging_request(bts, bsub, type, cbfn, data); if (rc < 0) return rc; return 1; } -int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, +int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int type, gsm_cbfn *cbfn, void *data) { struct gsm_bts *bts = NULL; @@ -337,13 +339,14 @@ do { int rc; - bts = gsm_bts_by_lac(network, subscr->lac, bts); + bts = gsm_bts_by_lac(network, bsub->lac, bts); if (!bts) break; - rc = paging_request_bts(bts, subscr, type, cbfn, data); + rc = paging_request_bts(bts, bsub, type, cbfn, data); if (rc < 0) { - paging_request_stop(NULL, subscr, NULL, NULL); + paging_request_stop(&network->bts_list, NULL, bsub, + NULL, NULL); return rc; } num_pages += rc; @@ -357,7 +360,7 @@ /* we consciously ignore the type of the request here */ -static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, +static void _paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub, struct gsm_subscriber_connection *conn, struct msgb *msg) { @@ -367,8 +370,8 @@ paging_init_if_needed(bts); llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, - entry) { - if (req->subscr == subscr) { + entry) { + if (req->bsub == bsub) { gsm_cbfn *cbfn = req->cbfn; void *param = req->cbfn_param; @@ -377,35 +380,36 @@ req = NULL; if (conn && cbfn) { - LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d, calling cbfn.\n", subscr->imsi, bts->nr); + LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d, calling cbfn.\n", bsub->imsi, bts->nr); cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED, - msg, conn, param); + msg, conn, param); } else - LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d silently.\n", subscr->imsi, bts->nr); + LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d silently.\n", bsub->imsi, bts->nr); break; } } } /* Stop paging on all other bts' */ -void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr, +void paging_request_stop(struct llist_head *bts_list, + struct gsm_bts *_bts, struct bsc_subscr *bsub, struct gsm_subscriber_connection *conn, struct msgb *msg) { struct gsm_bts *bts; - log_set_context(LOG_CTX_VLR_SUBSCR, subscr); + log_set_context(LOG_CTX_BSC_SUBSCR, bsub); /* Stop this first and dispatch the request */ if (_bts) - _paging_request_stop(_bts, subscr, conn, msg); + _paging_request_stop(_bts, bsub, conn, msg); /* Make sure to cancel this everywhere else */ - llist_for_each_entry(bts, &subscr->group->net->bts_list, list) { + llist_for_each_entry(bts, bts_list, list) { /* Sort of an optimization. */ if (bts == _bts) continue; - _paging_request_stop(bts, subscr, NULL, NULL); + _paging_request_stop(bts, bsub, NULL, NULL); } } @@ -434,12 +438,12 @@ /** * Find any paging data for the given subscriber at the given BTS. */ -void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr) +void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub) { struct gsm_paging_request *req; llist_for_each_entry(req, &bts->paging.pending_requests, entry) - if (req->subscr == subscr) + if (req->bsub == bsub) return req->cbfn_param; return NULL; diff --git a/openbsc/src/libcommon-cs/common_cs.c b/openbsc/src/libcommon-cs/common_cs.c index 3149580..7905802 100644 --- a/openbsc/src/libcommon-cs/common_cs.c +++ b/openbsc/src/libcommon-cs/common_cs.c @@ -70,6 +70,9 @@ INIT_LLIST_HEAD(&net->upqueue); INIT_LLIST_HEAD(&net->subscr_conns); + net->bsc_subscribers = talloc_zero(net, struct llist_head); + INIT_LLIST_HEAD(net->bsc_subscribers); + /* init statistics */ net->msc_ctrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0); net->active_calls = osmo_counter_alloc("msc.active_calls"); diff --git a/openbsc/src/libcommon/debug.c b/openbsc/src/libcommon/debug.c index 4d7bfed..0f82211 100644 --- a/openbsc/src/libcommon/debug.c +++ b/openbsc/src/libcommon/debug.c @@ -180,11 +180,16 @@ static int filter_fn(const struct log_context *ctx, struct log_target *tar) { const struct gsm_subscriber *subscr = ctx->ctx[LOG_CTX_VLR_SUBSCR]; + const struct bsc_subscr *bsub = ctx->ctx[LOG_CTX_BSC_SUBSCR]; const struct gprs_nsvc *nsvc = ctx->ctx[LOG_CTX_GB_NSVC]; const struct gprs_nsvc *bvc = ctx->ctx[LOG_CTX_GB_BVC]; if ((tar->filter_map & (1 << LOG_FLT_VLR_SUBSCR)) != 0 && subscr && subscr == tar->filter_data[LOG_FLT_VLR_SUBSCR]) + return 1; + + if ((tar->filter_map & (1 << LOG_FLT_BSC_SUBSCR)) != 0 + && bsub && bsub == tar->filter_data[LOG_FLT_BSC_SUBSCR]) return 1; /* Filter on the NS Virtual Connection */ @@ -206,7 +211,8 @@ .num_cat = ARRAY_SIZE(default_categories), }; -void log_set_imsi_filter(struct log_target *target, struct gsm_subscriber *subscr) +void log_set_filter_vlr_subscr(struct log_target *target, + struct gsm_subscriber *vlr_subscr) { struct gsm_subscriber **fsub = (void*)&target->filter_data[LOG_FLT_VLR_SUBSCR]; @@ -216,9 +222,9 @@ *fsub = NULL; } - if (subscr) { + if (vlr_subscr) { target->filter_map |= (1 << LOG_FLT_VLR_SUBSCR); - *fsub = subscr_get(subscr); + *fsub = subscr_get(vlr_subscr); } else target->filter_map &= ~(1 << LOG_FLT_VLR_SUBSCR); } diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index fff902d..c910d71 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -1433,6 +1433,8 @@ uint8_t mi_type; char mi_string[GSM48_MI_SIZE]; struct gsm_subscriber *subscr = NULL; + struct bsc_subscr *bsub; + uint32_t tmsi; int rc = 0; resp = (struct gsm48_pag_resp *) &gh->data[0]; @@ -1443,8 +1445,8 @@ switch (mi_type) { case GSM_MI_TYPE_TMSI: - subscr = subscr_get_by_tmsi(conn->network->subscr_group, - tmsi_from_string(mi_string)); + tmsi = tmsi_from_string(mi_string); + subscr = subscr_get_by_tmsi(conn->network->subscr_group, tmsi); break; case GSM_MI_TYPE_IMSI: subscr = subscr_get_by_imsi(conn->network->subscr_group, @@ -1457,6 +1459,19 @@ /* FIXME: request id? close channel? */ return -EINVAL; } + + if (!conn->subscr) { + conn->subscr = subscr; + } else if (conn->subscr != subscr) { + LOGP(DRR, LOGL_ERROR, "<- Channel already owned by someone else?\n"); + subscr_put(subscr); + return -EINVAL; + } else { + DEBUGP(DRR, "<- Channel already owned by us\n"); + subscr_put(subscr); + subscr = conn->subscr; + } + log_set_context(LOG_CTX_VLR_SUBSCR, subscr); DEBUGP(DRR, "<- Channel was requested by %s\n", subscr->name && strlen(subscr->name) ? subscr->name : subscr->imsi); @@ -1465,10 +1480,18 @@ memcpy(subscr->equipment.classmark2, classmark2_lv+1, *classmark2_lv); db_sync_equipment(&subscr->equipment); + /* TODO MSC split -- creating a BSC subscriber directly from MSC data + * structures in RAM. At some point the MSC will send a message to the + * BSC instead. */ + bsub = bsc_subscr_find_or_create_by_imsi(conn->network->bsc_subscribers, + subscr->imsi); + bsub->tmsi = subscr->tmsi; + bsub->lac = subscr->lac; + /* We received a paging */ conn->expire_timer_stopped = 1; - rc = gsm48_handle_paging_resp(conn, msg, subscr); + rc = gsm48_handle_paging_resp(conn, msg, bsub); return rc; } diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c index 568f1c5..1a03cf7 100644 --- a/openbsc/src/libmsc/gsm_subscriber.c +++ b/openbsc/src/libmsc/gsm_subscriber.c @@ -82,8 +82,11 @@ struct gsm_subscriber_connection *conn = data; struct gsm_subscriber *subscr = param; struct paging_signal_data sig_data; + struct bsc_subscr *bsub; + struct gsm_network *net; - OSMO_ASSERT(subscr->is_paging); + OSMO_ASSERT(subscr && subscr->is_paging); + net = subscr->group->net; /* * Stop paging on all other BTS. E.g. if this is @@ -91,7 +94,16 @@ * timeout soon as well. Let's just stop everything * and forget we wanted to page. */ - paging_request_stop(NULL, subscr, NULL, NULL); + + /* TODO MSC split -- creating a BSC subscriber directly from MSC data + * structures in RAM. At some point the MSC will send a message to the + * BSC instead. */ + bsub = bsc_subscr_find_or_create_by_imsi(net->bsc_subscribers, + subscr->imsi); + bsub->tmsi = subscr->tmsi; + bsub->lac = subscr->lac; + paging_request_stop(&net->bts_list, NULL, bsub, NULL, NULL); + bsc_subscr_put(bsub); /* Inform parts of the system we don't know */ sig_data.subscr = subscr; @@ -169,13 +181,23 @@ { int rc; struct subscr_request *request; + struct bsc_subscr *bsub; + struct gsm_network *net = subscr->group->net; /* Start paging.. we know it is async so we can do it before */ if (!subscr->is_paging) { LOGP(DMM, LOGL_DEBUG, "Subscriber %s not paged yet.\n", subscr_name(subscr)); - rc = paging_request(subscr->group->net, subscr, channel_type, - subscr_paging_cb, subscr); + /* TODO MSC split -- creating a BSC subscriber directly from + * MSC data structures in RAM. At some point the MSC will send + * a message to the BSC instead. */ + bsub = bsc_subscr_find_or_create_by_imsi(net->bsc_subscribers, + subscr->imsi); + bsub->tmsi = subscr->tmsi; + bsub->lac = subscr->lac; + rc = paging_request(net, bsub, channel_type, subscr_paging_cb, + subscr); + bsc_subscr_put(bsub); if (rc <= 0) { LOGP(DMM, LOGL_ERROR, "Subscriber %s paging failed: %d\n", subscr_name(subscr), rc); diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index cd5dfb7..1bc9372 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -1034,21 +1035,26 @@ LOGGING_STR FILTER_STR "Filter log messages by IMSI\n" "IMSI to be used as filter\n") { - struct gsm_subscriber *subscr; + struct gsm_subscriber *vlr_subscr; + struct bsc_subscr *bsc_subscr; struct gsm_network *gsmnet = gsmnet_from_vty(vty); struct log_target *tgt = osmo_log_vty2tgt(vty); + const char *imsi = argv[0]; if (!tgt) return CMD_WARNING; - subscr = subscr_get_by_imsi(gsmnet->subscr_group, argv[0]); - if (!subscr) { + vlr_subscr = subscr_get_by_imsi(gsmnet->subscr_group, imsi); + bsc_subscr = bsc_subscr_find_by_imsi(gsmnet->bsc_subscribers, imsi); + + if (!vlr_subscr && !bsc_subscr) { vty_out(vty, "%%no subscriber with IMSI(%s)%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } - log_set_imsi_filter(tgt, subscr); + log_set_filter_vlr_subscr(tgt, vlr_subscr); + log_set_filter_bsc_subscr(tgt, bsc_subscr); return CMD_SUCCESS; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c index dcfef40..100f664 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c @@ -20,9 +20,10 @@ #include #include +#include #include #include -#include +#include #include #include @@ -99,7 +100,7 @@ static int bssmap_handle_paging(struct bsc_msc_data *msc, struct msgb *msg, unsigned int payload_length) { - struct gsm_subscriber *subscr; + struct bsc_subscr *subscr; struct tlv_parsed tp; char mi_string[GSM48_MI_SIZE]; uint32_t tmsi = GSM_RESERVED_TMSI; @@ -157,7 +158,8 @@ LOGP(DMSC, LOGL_ERROR, "eMLPP is not handled\n"); } - subscr = subscr_get_or_create(msc->network->subscr_group, mi_string); + subscr = bsc_subscr_find_or_create_by_imsi(msc->network->bsc_subscribers, + mi_string); if (!subscr) { LOGP(DMSC, LOGL_ERROR, "Failed to allocate a subscriber for %s\n", mi_string); return -1; @@ -167,7 +169,8 @@ subscr->tmsi = tmsi; LOGP(DMSC, LOGL_INFO, "Paging request from MSC IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n", mi_string, tmsi, tmsi, lac); - bsc_grace_paging_request(subscr, chan_needed, msc); + bsc_grace_paging_request(msc->network->bsc_data->rf_ctrl->policy, + subscr, chan_needed, msc); return 0; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c index 3443bbe..2c84b16 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_filter.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_filter.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -54,14 +55,14 @@ } /* extract a subscriber from the paging response */ -static struct gsm_subscriber *extract_sub(struct gsm_subscriber_connection *conn, - struct msgb *msg) +static struct bsc_subscr *extract_sub(struct gsm_subscriber_connection *conn, + struct msgb *msg) { uint8_t mi_type; char mi_string[GSM48_MI_SIZE]; struct gsm48_hdr *gh; struct gsm48_pag_resp *resp; - struct gsm_subscriber *subscr; + struct bsc_subscr *subscr; if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*resp)) { LOGP(DMSC, LOGL_ERROR, "PagingResponse too small: %u\n", msgb_l3len(msg)); @@ -78,12 +79,12 @@ switch (mi_type) { case GSM_MI_TYPE_TMSI: - subscr = subscr_active_by_tmsi(conn->bts->network->subscr_group, - tmsi_from_string(mi_string)); + subscr = bsc_subscr_find_by_tmsi(conn->network->bsc_subscribers, + tmsi_from_string(mi_string)); break; case GSM_MI_TYPE_IMSI: - subscr = subscr_active_by_imsi(conn->bts->network->subscr_group, - mi_string); + subscr = bsc_subscr_find_by_imsi(conn->network->bsc_subscribers, + mi_string); break; default: subscr = NULL; @@ -96,15 +97,16 @@ /* we will need to stop the paging request */ static int handle_page_resp(struct gsm_subscriber_connection *conn, struct msgb *msg) { - struct gsm_subscriber *subscr = extract_sub(conn, msg); + struct bsc_subscr *subscr = extract_sub(conn, msg); if (!subscr) { LOGP(DMSC, LOGL_ERROR, "Non active subscriber got paged.\n"); return -1; } - paging_request_stop(conn->bts, subscr, conn, msg); - subscr_put(subscr); + paging_request_stop(&conn->network->bts_list, conn->bts, subscr, conn, + msg); + bsc_subscr_put(subscr); return 0; } @@ -130,7 +132,7 @@ uint8_t mtype; struct osmo_bsc_data *bsc; struct bsc_msc_data *msc, *pag_msc; - struct gsm_subscriber *subscr; + struct bsc_subscr *subscr; int is_emerg = 0; bsc = conn->bts->network->bsc_data; @@ -183,7 +185,7 @@ } pag_msc = paging_get_data(conn->bts, subscr); - subscr_put(subscr); + bsc_subscr_put(subscr); llist_for_each_entry(msc, &bsc->mscs, entry) { if (msc != pag_msc) diff --git a/openbsc/src/osmo-bsc/osmo_bsc_grace.c b/openbsc/src/osmo-bsc/osmo_bsc_grace.c index 5709eea..63afa20 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_grace.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_grace.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -34,8 +34,8 @@ } -static int normal_paging(struct gsm_subscriber *subscr, int chan_needed, - struct bsc_msc_data *msc) +static int normal_paging(struct bsc_subscr *subscr, int chan_needed, + struct bsc_msc_data *msc) { /* we can't page by lac.. we need to page everything */ if (msc->core_lac != -1) { @@ -47,12 +47,11 @@ return 0; } - return paging_request(subscr->group->net, subscr, chan_needed, NULL, - msc); + return paging_request(msc->network, subscr, chan_needed, NULL, msc); } -static int locked_paging(struct gsm_subscriber *subscr, int chan_needed, - struct bsc_msc_data *msc) +static int locked_paging(struct bsc_subscr *subscr, int chan_needed, + struct bsc_msc_data *msc) { struct gsm_bts *bts = NULL; @@ -84,10 +83,12 @@ /** * Try to not page if everything the cell is not on. */ -int bsc_grace_paging_request(struct gsm_subscriber *subscr, int chan_needed, - struct bsc_msc_data *msc) +int bsc_grace_paging_request(enum signal_rf rf_policy, + struct bsc_subscr *subscr, + int chan_needed, + struct bsc_msc_data *msc) { - if (subscr->group->net->bsc_data->rf_ctrl->policy == S_RF_ON) + if (rf_policy == S_RF_ON) return normal_paging(subscr, chan_needed, msc); return locked_paging(subscr, chan_needed, msc); } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c index d59c515..2336669 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -861,20 +861,19 @@ LOGGING_STR FILTER_STR "Filter log messages by IMSI\n" "IMSI to be used as filter\n") { - struct gsm_subscriber *subscr; + struct bsc_subscr *bsc_subscr; struct log_target *tgt = osmo_log_vty2tgt(vty); + const char *imsi = argv[0]; - if (!tgt) - return CMD_WARNING; + bsc_subscr = bsc_subscr_find_by_imsi(bsc_gsmnet->bsc_subscribers, imsi); - subscr = subscr_get_or_create(bsc_gsmnet->subscr_group, argv[0]); - if (!subscr) { + if (!bsc_subscr) { vty_out(vty, "%%no subscriber with IMSI(%s)%s", - argv[0], VTY_NEWLINE); + imsi, VTY_NEWLINE); return CMD_WARNING; } - log_set_imsi_filter(tgt, subscr); + log_set_filter_bsc_subscr(tgt, bsc_subscr); return CMD_SUCCESS; } diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 5e9583f..ca470ac 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -24,8 +24,8 @@ $(NULL) channel_test_LDADD = \ - $(top_builddir)/src/libbsc/libbsc.a \ $(top_builddir)/src/libmsc/libmsc.a \ + $(top_builddir)/src/libbsc/libbsc.a \ $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index c69c701..88293d0 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -49,7 +49,7 @@ } /* mock object for testing, directly invoke the cb... maybe later through the timer */ -int paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscriber, int type, gsm_cbfn *cbfn, void *data) +int paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, gsm_cbfn *cbfn, void *data) { s_data = data; s_cbfn = cbfn; @@ -72,6 +72,7 @@ exit(1); bts = gsm_bts_alloc(network); bts->location_area_code = 23; + s_conn.network = network; /* Create a dummy subscriber */ struct gsm_subscriber *subscr = subscr_alloc(); diff --git a/openbsc/tests/subscr/Makefile.am b/openbsc/tests/subscr/Makefile.am index ad8b20c..6342444 100644 --- a/openbsc/tests/subscr/Makefile.am +++ b/openbsc/tests/subscr/Makefile.am @@ -19,10 +19,13 @@ EXTRA_DIST = \ subscr_test.ok \ + bsc_subscr_test.ok \ + bsc_subscr_test.err \ $(NULL) noinst_PROGRAMS = \ subscr_test \ + bsc_subscr_test \ $(NULL) subscr_test_SOURCES = \ @@ -40,3 +43,19 @@ $(LIBSMPP34_LIBS) \ $(LIBOSMOVTY_LIBS) \ $(NULL) + +bsc_subscr_test_SOURCES = \ + bsc_subscr_test.c \ + $(NULL) + +bsc_subscr_test_LDADD = \ + $(top_builddir)/src/libbsc/libbsc.a \ + $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ + $(top_builddir)/src/libtrau/libtrau.a \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBSMPP34_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(NULL) diff --git a/openbsc/tests/subscr/bsc_subscr_test.c b/openbsc/tests/subscr/bsc_subscr_test.c new file mode 100644 index 0000000..60d687d --- /dev/null +++ b/openbsc/tests/subscr/bsc_subscr_test.c @@ -0,0 +1,130 @@ +/* (C) 2008 by Jan Luebbe + * (C) 2009 by Holger Hans Peter Freyther + * (C) 2014 by Alexander Chemeris + * 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 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 . + * + */ + +#include +#include + +#include +#include + +#include +#include +#include +#include + +struct llist_head *bsc_subscribers; + +#define VERBOSE_ASSERT(val, expect_op, fmt) \ + do { \ + printf(#val " == " fmt "\n", (val)); \ + OSMO_ASSERT((val) expect_op); \ + } while (0); + +static void assert_bsc_subscr(const struct bsc_subscr *bsub, const char *imsi) +{ + struct bsc_subscr *sfound; + OSMO_ASSERT(bsub); + OSMO_ASSERT(strcmp(bsub->imsi, imsi) == 0); + + sfound = bsc_subscr_find_by_imsi(bsc_subscribers, imsi); + OSMO_ASSERT(sfound == bsub); + + bsc_subscr_put(sfound); +} + +static void test_bsc_subscr(void) +{ + struct bsc_subscr *s1, *s2, *s3; + const char *imsi1 = "1234567890"; + const char *imsi2 = "9876543210"; + const char *imsi3 = "5656565656"; + + printf("Test BSC subscriber allocation and deletion\n"); + + /* Check for emptiness */ + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 0, "%d"); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi1) == NULL); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi2) == NULL); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi3) == NULL); + + /* Allocate entry 1 */ + s1 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi1); + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 1, "%d"); + assert_bsc_subscr(s1, imsi1); + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 1, "%d"); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi2) == NULL); + + /* Allocate entry 2 */ + s2 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi2); + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 2, "%d"); + + /* Allocate entry 3 */ + s3 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi3); + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 3, "%d"); + + /* Check entries */ + assert_bsc_subscr(s1, imsi1); + assert_bsc_subscr(s2, imsi2); + assert_bsc_subscr(s3, imsi3); + + /* Free entry 1 */ + bsc_subscr_put(s1); + s1 = NULL; + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 2, "%d"); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi1) == NULL); + + assert_bsc_subscr(s2, imsi2); + assert_bsc_subscr(s3, imsi3); + + /* Free entry 2 */ + bsc_subscr_put(s2); + s2 = NULL; + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 1, "%d"); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi1) == NULL); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi2) == NULL); + assert_bsc_subscr(s3, imsi3); + + /* Free entry 3 */ + bsc_subscr_put(s3); + s3 = NULL; + VERBOSE_ASSERT(llist_count(bsc_subscribers), == 0, "%d"); + OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi3) == NULL); + + OSMO_ASSERT(llist_empty(bsc_subscribers)); +} + +int main() +{ + printf("Testing BSC subscriber core code.\n"); + osmo_init_logging(&log_info); + log_set_print_filename(osmo_stderr_target, 0); + log_set_print_timestamp(osmo_stderr_target, 0); + log_set_use_color(osmo_stderr_target, 0); + log_set_print_category(osmo_stderr_target, 1); + log_set_category_filter(osmo_stderr_target, DREF, 1, LOGL_DEBUG); + + bsc_subscribers = talloc_zero(NULL, struct llist_head); + INIT_LLIST_HEAD(bsc_subscribers); + + test_bsc_subscr(); + + printf("Done\n"); + return 0; +} diff --git a/openbsc/tests/subscr/bsc_subscr_test.err b/openbsc/tests/subscr/bsc_subscr_test.err new file mode 100644 index 0000000..a66317a --- /dev/null +++ b/openbsc/tests/subscr/bsc_subscr_test.err @@ -0,0 +1,17 @@ +DREF BSC subscr IMSI:1234567890 usage increases to: 2 +DREF BSC subscr IMSI:1234567890 usage decreases to: 1 +DREF BSC subscr IMSI:1234567890 usage increases to: 2 +DREF BSC subscr IMSI:1234567890 usage decreases to: 1 +DREF BSC subscr IMSI:9876543210 usage increases to: 2 +DREF BSC subscr IMSI:9876543210 usage decreases to: 1 +DREF BSC subscr IMSI:5656565656 usage increases to: 2 +DREF BSC subscr IMSI:5656565656 usage decreases to: 1 +DREF BSC subscr IMSI:1234567890 usage decreases to: 0 +DREF BSC subscr IMSI:9876543210 usage increases to: 2 +DREF BSC subscr IMSI:9876543210 usage decreases to: 1 +DREF BSC subscr IMSI:5656565656 usage increases to: 2 +DREF BSC subscr IMSI:5656565656 usage decreases to: 1 +DREF BSC subscr IMSI:9876543210 usage decreases to: 0 +DREF BSC subscr IMSI:5656565656 usage increases to: 2 +DREF BSC subscr IMSI:5656565656 usage decreases to: 1 +DREF BSC subscr IMSI:5656565656 usage decreases to: 0 diff --git a/openbsc/tests/subscr/bsc_subscr_test.ok b/openbsc/tests/subscr/bsc_subscr_test.ok new file mode 100644 index 0000000..0f6a8be --- /dev/null +++ b/openbsc/tests/subscr/bsc_subscr_test.ok @@ -0,0 +1,11 @@ +Testing BSC subscriber core code. +Test BSC subscriber allocation and deletion +llist_count(bsc_subscribers) == 0 +llist_count(bsc_subscribers) == 1 +llist_count(bsc_subscribers) == 1 +llist_count(bsc_subscribers) == 2 +llist_count(bsc_subscribers) == 3 +llist_count(bsc_subscribers) == 2 +llist_count(bsc_subscribers) == 1 +llist_count(bsc_subscribers) == 0 +Done diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index 01737a3..280aeb2 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -13,6 +13,13 @@ AT_CHECK([$abs_top_builddir/tests/subscr/subscr_test], [], [expout], [ignore]) AT_CLEANUP +AT_SETUP([bsc_subscr]) +AT_KEYWORDS([bsc_subscr]) +cat $abs_srcdir/subscr/bsc_subscr_test.ok > expout +cat $abs_srcdir/subscr/bsc_subscr_test.err > experr +AT_CHECK([$abs_top_builddir/tests/subscr/bsc_subscr_test], [], [expout], [experr]) +AT_CLEANUP + AT_SETUP([db]) AT_KEYWORDS([db]) cat $abs_srcdir/db/db_test.ok > expout -- To view, visit https://gerrit.osmocom.org/1682 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 14:51:18 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 14:51:18 +0000 Subject: openbsc[master]: add struct bsc_subscr, separating libbsc from gsm_subscriber In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+2 (merely added some commentary and rebased, re-adding previous +2) -- To view, visit https://gerrit.osmocom.org/1682 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:06:36 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 15:06:36 +0000 Subject: [PATCH] openbsc[master]: Add MS time. offset to gsm_lchan In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1699 to look at the new patch set (#2). Add MS time. offset to gsm_lchan Add MS TIMING OFFSET (3GPP TS 48.058 ? 8.4.8) and P offset (3GPP TS 45.010 ? 1.2) which can be used to compute MS TO from known TA. This will be used by osmo-bts (see I4dfe5c48834a083e757d5de3236a02e15a238b28) to provide MS TO as part of RSL MEASUREMENT RESULT. Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Related: OS#1574 --- M openbsc/include/openbsc/gsm_data_shared.h 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/99/1699/2 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 91bdfce..26b0be6 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -327,6 +327,13 @@ uint8_t last_cmr; uint32_t last_fn; } tch; + + /* 3GPP TS 45.010 ? 1.2 MS TIMING OFFSET related data */ + uint8_t ms_t_offs; + bool ms_t_offs_valid; + uint8_t p_offs; + bool p_offs_valid; + /* BTS-side ciphering state (rx only, bi-directional, ...) */ uint8_t ciph_state; uint8_t ciph_ns; -- To view, visit https://gerrit.osmocom.org/1699 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:26:22 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:26:22 +0000 Subject: [PATCH] osmo-bts[master]: cosmetic: remove plenk character Message-ID: Review at https://gerrit.osmocom.org/1975 cosmetic: remove plenk character remove excess whitespace character at the line end Change-Id: Ica35c3a9146bacf87942b6f4cac7d24e0a935bae --- M src/common/measurement.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/75/1975/1 diff --git a/src/common/measurement.c b/src/common/measurement.c index 6a11888..1af023b 100644 --- a/src/common/measurement.c +++ b/src/common/measurement.c @@ -62,7 +62,7 @@ break; case GSM_PCHAN_TCH_H: fn_mod = fn % 104; - if (subch == 0) + if (subch == 0) tbl = tchh0_meas_rep_fn104; else tbl = tchh1_meas_rep_fn104; -- To view, visit https://gerrit.osmocom.org/1975 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica35c3a9146bacf87942b6f4cac7d24e0a935bae Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:26:22 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:26:22 +0000 Subject: [PATCH] osmo-bts[master]: octphy: set tx/rx antenne IDs via VTY Message-ID: Review at https://gerrit.osmocom.org/1976 octphy: set tx/rx antenne IDs via VTY add support for the TX/RX antenna-id feature that has been introduced with release OCTSDR-2G-02.07.00-B1314-BETA. The user can now set individual ID numbers for the TX and for the RX antenna. Change-Id: I872fe3c4d7b593358a4ce2f02cf0726611b9f3aa --- M configure.ac M include/osmo-bts/phy_link.h M src/osmo-bts-octphy/l1_oml.c M src/osmo-bts-octphy/octphy_vty.c 4 files changed, 56 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/76/1976/1 diff --git a/configure.ac b/configure.ac index cbfbf12..a03b2dd 100644 --- a/configure.ac +++ b/configure.ac @@ -112,6 +112,13 @@ [], [#include ]) + AC_CHECK_MEMBER([tOCTVC1_GSM_RF_CONFIG.ulTxAntennaId], + AC_DEFINE([OCTPHY_USE_ANTENNA_ID], + [1], + [Define to 1 if your octphy header files support antenna ids in tOCTVC1_GSM_RF_CONFIG]), + [], + [#include ]) + CPPFLAGS=$oldCPPFLAGS fi diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index e644a91..e8fd7eb 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -53,6 +53,10 @@ /* configuration */ uint32_t rf_port_index; +#if OCTPHY_USE_ANTENNA_ID == 1 + uint32_t rx_ant_id; + uint32_t tx_ant_id; +#endif uint32_t rx_gain_db; bool tx_atten_flag; uint32_t tx_atten_db; diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index a68169e..b4d519f 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -1380,6 +1380,11 @@ oc->RfConfig.ulTxAttndB = (trx->max_power_red) << 2; } +#if OCTPHY_USE_ANTENNA_ID == 1 + oc->RfConfig.ulTxAntennaId = plink->u.octphy.tx_ant_id; + oc->RfConfig.ulRxAntennaId = plink->u.octphy.rx_ant_id; +#endif + #if OCTPHY_MULTI_TRX == 1 LOGP(DL1C, LOGL_INFO, "Tx TRX-OPEN.req(trx=%u, rf_port=%u, arfcn=%u, " "center=%u, tsc=%u, rx_gain=%u, tx_atten=%u)\n", diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c index 370aff6..2a93434 100644 --- a/src/osmo-bts-octphy/octphy_vty.c +++ b/src/osmo-bts-octphy/octphy_vty.c @@ -117,6 +117,42 @@ return CMD_SUCCESS; } +#if OCTPHY_USE_ANTENNA_ID == 1 +DEFUN(cfg_phy_rx_ant_id, cfg_phy_rx_ant_id_cmd, + "octphy rx-ant-id <0-1>", + OCT_STR "Configure the RX Antenna for this TRX\n" "RX Antenna Id\n") +{ + struct phy_link *plink = vty->index; + + if (plink->state != PHY_LINK_SHUTDOWN) { + vty_out(vty, "Can only reconfigure a PHY link that is down%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + plink->u.octphy.rx_ant_id = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_phy_tx_ant_id, cfg_phy_tx_ant_id_cmd, + "octphy tx-ant-id <0-1>", + OCT_STR "Configure the TX Antenna for this TRX\n" "TX Antenna Id\n") +{ + struct phy_link *plink = vty->index; + + if (plink->state != PHY_LINK_SHUTDOWN) { + vty_out(vty, "Can only reconfigure a PHY link that is down%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + plink->u.octphy.tx_ant_id = atoi(argv[0]); + + return CMD_SUCCESS; +} +#endif + DEFUN(cfg_phy_rx_gain_db, cfg_phy_rx_gain_db_cmd, "octphy rx-gain <0-73>", OCT_STR "Configure the Rx Gain in dB\n" @@ -347,6 +383,10 @@ install_element(PHY_NODE, &cfg_phy_hwaddr_cmd); install_element(PHY_NODE, &cfg_phy_netdev_cmd); install_element(PHY_NODE, &cfg_phy_rf_port_idx_cmd); +#if OCTPHY_USE_ANTENNA_ID == 1 + install_element(PHY_NODE, &cfg_phy_rx_ant_id_cmd); + install_element(PHY_NODE, &cfg_phy_tx_ant_id_cmd); +#endif install_element(PHY_NODE, &cfg_phy_rx_gain_db_cmd); install_element(PHY_NODE, &cfg_phy_tx_atten_db_cmd); -- To view, visit https://gerrit.osmocom.org/1976 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I872fe3c4d7b593358a4ce2f02cf0726611b9f3aa Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:26:22 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:26:22 +0000 Subject: [PATCH] osmo-bts[master]: bts: revert trx shutdown order Message-ID: Review at https://gerrit.osmocom.org/1977 bts: revert trx shutdown order The BTS Transcievers are stored in a linked list. When the BTS is shut down, the rf is disabled and the trx is then closed. this patch reverts the order of the list processing. Change-Id: I18485de586b402610f9e98053d69e92bc9b18dc2 --- M src/common/bts.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/77/1977/1 diff --git a/src/common/bts.c b/src/common/bts.c index 9915e1c..6fceaae 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -207,7 +207,7 @@ LOGP(DOML, LOGL_NOTICE, "Shutting down BTS %u, Reason %s\n", bts->nr, reason); - llist_for_each_entry(trx, &bts->trx_list, list) { + llist_for_each_entry_reverse(trx, &bts->trx_list, list) { bts_model_trx_deact_rf(trx); bts_model_trx_close(trx); } -- To view, visit https://gerrit.osmocom.org/1977 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18485de586b402610f9e98053d69e92bc9b18dc2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:26:23 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:26:23 +0000 Subject: [PATCH] osmo-bts[master]: ap: fix PTCCH detection Message-ID: Review at https://gerrit.osmocom.org/1978 ap: fix PTCCH detection The macro L1SAP_IS_PTCCH(fn) only detects a PTCCH channel at fn%52 = 12, the detection logic has been extended in order to detect PTCCH at fn%52 = 38. See also 3GPP TS 05.02, Clause 7, Table 6 of 9 Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 --- M include/osmo-bts/l1sap.h 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/78/1978/1 diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index dcebc1d..a4f4a80 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -32,7 +32,10 @@ /* PTCH layout from frame number */ #define L1SAP_FN2MACBLOCK(fn) ((fn % 52) / 4) #define L1SAP_FN2PTCCHBLOCK(fn) ((fn / 104) & 3) -#define L1SAP_IS_PTCCH(fn) ((fn % 52) == 12) + +/* Calculate PTCCH occurrence, See also 3GPP TS 05.02, Clause 7, Table 6 of 9 */ +#define L1SAP_IS_PTCCH(fn) (((fn % 52) == 12) || ((fn % 52) == 38)) + static const uint8_t fill_frame[GSM_MACBLOCK_LEN] = { 0x03, 0x03, 0x01, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, -- To view, visit https://gerrit.osmocom.org/1978 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:26:23 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:26:23 +0000 Subject: [PATCH] osmo-bts[master]: octphy: add CBCH support Message-ID: Review at https://gerrit.osmocom.org/1979 octphy: add CBCH support add Support for CBCH channels in osmo-bts-octphy Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540 --- M src/osmo-bts-octphy/l1_if.c M src/osmo-bts-octphy/l1_oml.c 2 files changed, 19 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/79/1979/1 diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c index 22c01e9..8cd8456 100644 --- a/src/osmo-bts-octphy/l1_if.c +++ b/src/osmo-bts-octphy/l1_if.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "l1_if.h" #include "l1_oml.h" @@ -346,9 +347,11 @@ cbits = 0x02 + subCh; break; case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: cbits = 0x04 + subCh; break; case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: cbits = 0x08 + subCh; break; default: @@ -359,9 +362,11 @@ case cOCTVC1_GSM_SAPI_ENUM_SDCCH: switch (pchan) { case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: cbits = 0x04 + subCh; break; case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: cbits = 0x08 + subCh; break; default: @@ -924,6 +929,10 @@ (g_time.t1 << 7) | (g_time.t2 << 2) | (t3p >> 1); data_req->Data.abyDataContent[3] = (t3p & 1); break; + case cOCTVC1_GSM_SAPI_ENUM_CBCH: + rc = bts_cbch_get(bts, data_req->Data.abyDataContent, &g_time); + data_req->Data.ulDataLength = 23; /* GSM MAX BLK SIZE */ + break; case cOCTVC1_GSM_SAPI_ENUM_PRACH: #if 0 /* in case we decide to send an empty frame... */ @@ -1117,7 +1126,8 @@ l1sap->u.rach_ind.acc_delay = acc_delay; l1sap->u.rach_ind.fn = fn; if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH || - lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4) + lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 || + lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH) l1sap->u.rach_ind.chan_nr = 0x88; else l1sap->u.rach_ind.chan_nr = gsm_lchan2chan_nr(lchan); diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index b4d519f..dcb8739c 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -64,6 +64,12 @@ // TODO - watch out below two!!! [GSM_PCHAN_PDCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_PDTCHF_PACCHF_PTCCHF, [GSM_PCHAN_TCH_F_PDCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_PDTCHF_PACCHF_PTCCHF, +#ifdef cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4 + [GSM_PCHAN_CCCH_SDCCH4_CBCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4, +#endif +#ifdef cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8 + [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8, +#endif [GSM_PCHAN_UNKNOWN] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_EMPTY }; @@ -202,11 +208,13 @@ { switch (lchan->ts->pchan) { case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: if (lchan->type == GSM_LCHAN_CCCH) return cOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM_ALL; /* fall-through */ case GSM_PCHAN_TCH_H: case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: return (tOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM) lchan->nr; case GSM_PCHAN_NONE: case GSM_PCHAN_CCCH: -- To view, visit https://gerrit.osmocom.org/1979 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:26:23 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:26:23 +0000 Subject: [PATCH] osmo-bts[master]: octphy: remove old event control code Message-ID: Review at https://gerrit.osmocom.org/1980 octphy: remove old event control code Enable/Disable events is no longer required, this commit removes the related code Change-Id: I0652627495f6a9bcb0da2431b8beb839bc22062b --- M src/osmo-bts-octphy/l1_oml.c 1 file changed, 1 insertion(+), 83 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/80/1980/1 diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index dcb8739c..abbb36c 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -1089,84 +1089,6 @@ return 0; } -static int enable_events_compl_cb(struct octphy_hdl *fl1, struct msgb *resp, void *data) -{ - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *mser = - (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *) resp->l2h; - - /* in a completion call-back, we take msgb ownership and must - * release it before returning */ - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP_SWAP(mser); - - LOGP(DL1C, LOGL_INFO, "Rx ENABLE-EVT-REC.resp\n"); - - msgb_free(resp); - - return 0; -} - -static int disable_events_compl_cb(struct octphy_hdl *fl1, struct msgb *resp, void *data) -{ - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *mser = - (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *) resp->l2h; - - /* in a completion call-back, we take msgb ownership and must - * release it before returning */ - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP_SWAP(mser); - - LOGP(DL1C, LOGL_INFO, "Rx DISABLE-EVT-REC.resp\n"); - - msgb_free(resp); - - return 0; -} - -int l1if_enable_events(struct gsm_bts_trx *trx) -{ - struct phy_instance *pinst = trx_phy_instance(trx); - struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl; - struct msgb *msg = l1p_msgb_alloc(); - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *mse; - - mse = (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *) - msgb_put(msg, sizeof(*mse)); - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_DEF(mse); - - l1if_fill_msg_hdr(&mse->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, - cOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CID); - mse->ulEvtActiveFlag = cOCT_TRUE; - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_SWAP(mse); - - LOGP(DL1C, LOGL_INFO, "Tx ENABLE-EVT-REC.req\n"); - - return l1if_req_compl(fl1h, msg, disable_events_compl_cb, 0); -} - -int l1if_disable_events(struct gsm_bts_trx *trx) -{ - struct phy_instance *pinst = trx_phy_instance(trx); - struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl; - struct msgb *msg = l1p_msgb_alloc(); - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *mse; - - mse = (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *) - msgb_put(msg, sizeof(*mse)); - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_DEF(mse); - - l1if_fill_msg_hdr(&mse->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, - cOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CID); - mse->ulEvtActiveFlag = cOCT_FALSE; - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_SWAP(mse); - - LOGP(DL1C, LOGL_INFO, "Tx DISABLE-EVT-REC.req\n"); - - return l1if_req_compl(fl1h, msg, disable_events_compl_cb, 0); -} - #define talloc_replace(dst, ctx, src) \ do { \ if (dst) \ @@ -1347,8 +1269,7 @@ octphy_hw_get_clock_sync_info(fl1h); fl1h->opened = 1; - /* Temporary fix for enabling events after TRX Close + Reopen */ - return l1if_enable_events(trx); + return 0; } int l1if_trx_open(struct gsm_bts_trx *trx) @@ -1622,9 +1543,6 @@ int bts_model_trx_close(struct gsm_bts_trx *trx) { - /* disable events */ - l1if_disable_events(trx); - /* FIXME: close only one TRX */ return trx_close(trx); } -- To view, visit https://gerrit.osmocom.org/1980 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0652627495f6a9bcb0da2431b8beb839bc22062b Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:27:19 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:27:19 +0000 Subject: [PATCH] osmo-bts[master]: l1sap: fix PTCCH detection In-Reply-To: References: Message-ID: l1sap: fix PTCCH detection The macro L1SAP_IS_PTCCH(fn) only detects a PTCCH channel at fn%52 = 12, the detection logic has been extended in order to detect PTCCH at fn%52 = 38. See also 3GPP TS 05.02, Clause 7, Table 6 of 9 Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 --- M include/osmo-bts/l1sap.h 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/78/1978/2 diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index dcebc1d..a4f4a80 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -32,7 +32,10 @@ /* PTCH layout from frame number */ #define L1SAP_FN2MACBLOCK(fn) ((fn % 52) / 4) #define L1SAP_FN2PTCCHBLOCK(fn) ((fn / 104) & 3) -#define L1SAP_IS_PTCCH(fn) ((fn % 52) == 12) + +/* Calculate PTCCH occurrence, See also 3GPP TS 05.02, Clause 7, Table 6 of 9 */ +#define L1SAP_IS_PTCCH(fn) (((fn % 52) == 12) || ((fn % 52) == 38)) + static const uint8_t fill_frame[GSM_MACBLOCK_LEN] = { 0x03, 0x03, 0x01, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, -- To view, visit https://gerrit.osmocom.org/1978 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:27:19 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:27:19 +0000 Subject: [PATCH] osmo-bts[master]: octphy: add CBCH support In-Reply-To: References: Message-ID: octphy: add CBCH support add Support for CBCH channels in osmo-bts-octphy Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540 --- M src/osmo-bts-octphy/l1_if.c M src/osmo-bts-octphy/l1_oml.c 2 files changed, 19 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/79/1979/2 diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c index 22c01e9..8cd8456 100644 --- a/src/osmo-bts-octphy/l1_if.c +++ b/src/osmo-bts-octphy/l1_if.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "l1_if.h" #include "l1_oml.h" @@ -346,9 +347,11 @@ cbits = 0x02 + subCh; break; case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: cbits = 0x04 + subCh; break; case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: cbits = 0x08 + subCh; break; default: @@ -359,9 +362,11 @@ case cOCTVC1_GSM_SAPI_ENUM_SDCCH: switch (pchan) { case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: cbits = 0x04 + subCh; break; case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: cbits = 0x08 + subCh; break; default: @@ -924,6 +929,10 @@ (g_time.t1 << 7) | (g_time.t2 << 2) | (t3p >> 1); data_req->Data.abyDataContent[3] = (t3p & 1); break; + case cOCTVC1_GSM_SAPI_ENUM_CBCH: + rc = bts_cbch_get(bts, data_req->Data.abyDataContent, &g_time); + data_req->Data.ulDataLength = 23; /* GSM MAX BLK SIZE */ + break; case cOCTVC1_GSM_SAPI_ENUM_PRACH: #if 0 /* in case we decide to send an empty frame... */ @@ -1117,7 +1126,8 @@ l1sap->u.rach_ind.acc_delay = acc_delay; l1sap->u.rach_ind.fn = fn; if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH || - lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4) + lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 || + lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH) l1sap->u.rach_ind.chan_nr = 0x88; else l1sap->u.rach_ind.chan_nr = gsm_lchan2chan_nr(lchan); diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index b4d519f..dcb8739c 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -64,6 +64,12 @@ // TODO - watch out below two!!! [GSM_PCHAN_PDCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_PDTCHF_PACCHF_PTCCHF, [GSM_PCHAN_TCH_F_PDCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_PDTCHF_PACCHF_PTCCHF, +#ifdef cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4 + [GSM_PCHAN_CCCH_SDCCH4_CBCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4, +#endif +#ifdef cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8 + [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8, +#endif [GSM_PCHAN_UNKNOWN] = cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_EMPTY }; @@ -202,11 +208,13 @@ { switch (lchan->ts->pchan) { case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: if (lchan->type == GSM_LCHAN_CCCH) return cOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM_ALL; /* fall-through */ case GSM_PCHAN_TCH_H: case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: return (tOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM) lchan->nr; case GSM_PCHAN_NONE: case GSM_PCHAN_CCCH: -- To view, visit https://gerrit.osmocom.org/1979 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:27:19 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:27:19 +0000 Subject: [PATCH] osmo-bts[master]: octphy: remove old event control code In-Reply-To: References: Message-ID: octphy: remove old event control code Enable/Disable events is no longer required, this commit removes the related code Change-Id: I0652627495f6a9bcb0da2431b8beb839bc22062b --- M src/osmo-bts-octphy/l1_oml.c 1 file changed, 1 insertion(+), 83 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/80/1980/2 diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index dcb8739c..abbb36c 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -1089,84 +1089,6 @@ return 0; } -static int enable_events_compl_cb(struct octphy_hdl *fl1, struct msgb *resp, void *data) -{ - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *mser = - (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *) resp->l2h; - - /* in a completion call-back, we take msgb ownership and must - * release it before returning */ - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP_SWAP(mser); - - LOGP(DL1C, LOGL_INFO, "Rx ENABLE-EVT-REC.resp\n"); - - msgb_free(resp); - - return 0; -} - -static int disable_events_compl_cb(struct octphy_hdl *fl1, struct msgb *resp, void *data) -{ - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *mser = - (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP *) resp->l2h; - - /* in a completion call-back, we take msgb ownership and must - * release it before returning */ - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_RSP_SWAP(mser); - - LOGP(DL1C, LOGL_INFO, "Rx DISABLE-EVT-REC.resp\n"); - - msgb_free(resp); - - return 0; -} - -int l1if_enable_events(struct gsm_bts_trx *trx) -{ - struct phy_instance *pinst = trx_phy_instance(trx); - struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl; - struct msgb *msg = l1p_msgb_alloc(); - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *mse; - - mse = (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *) - msgb_put(msg, sizeof(*mse)); - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_DEF(mse); - - l1if_fill_msg_hdr(&mse->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, - cOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CID); - mse->ulEvtActiveFlag = cOCT_TRUE; - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_SWAP(mse); - - LOGP(DL1C, LOGL_INFO, "Tx ENABLE-EVT-REC.req\n"); - - return l1if_req_compl(fl1h, msg, disable_events_compl_cb, 0); -} - -int l1if_disable_events(struct gsm_bts_trx *trx) -{ - struct phy_instance *pinst = trx_phy_instance(trx); - struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl; - struct msgb *msg = l1p_msgb_alloc(); - tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *mse; - - mse = (tOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD *) - msgb_put(msg, sizeof(*mse)); - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_DEF(mse); - - l1if_fill_msg_hdr(&mse->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, - cOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CID); - mse->ulEvtActiveFlag = cOCT_FALSE; - - mOCTVC1_MAIN_MSG_API_SYSTEM_MODIFY_SESSION_EVT_CMD_SWAP(mse); - - LOGP(DL1C, LOGL_INFO, "Tx DISABLE-EVT-REC.req\n"); - - return l1if_req_compl(fl1h, msg, disable_events_compl_cb, 0); -} - #define talloc_replace(dst, ctx, src) \ do { \ if (dst) \ @@ -1347,8 +1269,7 @@ octphy_hw_get_clock_sync_info(fl1h); fl1h->opened = 1; - /* Temporary fix for enabling events after TRX Close + Reopen */ - return l1if_enable_events(trx); + return 0; } int l1if_trx_open(struct gsm_bts_trx *trx) @@ -1622,9 +1543,6 @@ int bts_model_trx_close(struct gsm_bts_trx *trx) { - /* disable events */ - l1if_disable_events(trx); - /* FIXME: close only one TRX */ return trx_close(trx); } -- To view, visit https://gerrit.osmocom.org/1980 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0652627495f6a9bcb0da2431b8beb839bc22062b Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 15:54:39 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 6 Mar 2017 15:54:39 +0000 Subject: [PATCH] osmo-pcu[master]: BTS: fix overloading ambiguity Message-ID: Review at https://gerrit.osmocom.org/1981 BTS: fix overloading ambiguity cast the result of rfn - m_cur_rfn to long int explicitly to avoid the overloading ambiguity. Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d --- M src/bts.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/81/1981/1 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..75beaec 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -550,7 +550,7 @@ * number exceeds a certain limit, we need to assume that the incoming * rach request belongs to a the previous rfn period. To correct this, * we roll back the rounded frame number by one RFN_MODULUS */ - if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { + if (abs((long int)(rfn - m_cur_rfn)) > RFN_THRESHOLD) { LOGP(DRLCMAC, LOGL_DEBUG, "Race condition between rfn (%u) and m_cur_fn (%u) detected: rfn belongs to the previos modulus %u cycle, wrappng...\n", rfn, m_cur_fn, RFN_MODULUS); -- To view, visit https://gerrit.osmocom.org/1981 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 6 16:36:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 16:36:30 +0000 Subject: [PATCH] osmo-hlr[master]: fix: properly handle error rc by osmo_gsup_conn_ccm_get() In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1952 to look at the new patch set (#2). fix: properly handle error rc by osmo_gsup_conn_ccm_get() Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26 --- M src/gsup_server.c 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/52/1952/2 diff --git a/src/gsup_server.c b/src/gsup_server.c index ea51f7d..38569b2 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -185,9 +185,15 @@ osmo_tlvp_dump(tlvp, DLGSUP, LOGL_INFO); addr_len = osmo_gsup_conn_ccm_get(clnt, &addr, IPAC_IDTAG_SERNR); - if (addr_len) - gsup_route_add(clnt, addr, addr_len); + if (addr_len <= 0) { + LOGP(DLGSUP, LOGL_ERROR, "GSUP client %s:%u has no %s IE and" + " cannot be routed\n", + conn->addr, conn->port, + ipa_ccm_idtag_name(IPAC_IDTAG_SERNR)); + return -EINVAL; + } + gsup_route_add(clnt, addr, addr_len); return 0; } -- To view, visit https://gerrit.osmocom.org/1952 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26 Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 6 16:40:33 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 16:40:33 +0000 Subject: [PATCH] osmo-pcu[master]: BTS: fix overloading ambiguity In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1981 to look at the new patch set (#2). BTS: fix overloading ambiguity cast the result of rfn - m_cur_rfn to long int explicitly to avoid the overloading ambiguity between various abs() implementations for int, long int, long long int. Fixes opensuse builds for nightly packages, which had error: [ 110s] bts.cpp: In member function 'uint32_t BTS::rfn_to_fn(uint32_t)': [ 110s] bts.cpp:553:25: error: call of overloaded 'abs(uint32_t)' is ambiguous [ 110s] if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { [ 110s] ^ [ 110s] In file included from /usr/include/c++/6/cstdlib:75:0, [ 110s] from /usr/include/c++/6/stdlib.h:36, [ 110s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 110s] from /usr/include/osmocom/core/timer.h:35, [ 110s] from ./bts.h:29, [ 110s] from bts.cpp:21: [ 110s] /usr/include/stdlib.h:735:12: note: candidate: int abs(int) [ 110s] extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; [ 110s] ^~~ [ 110s] In file included from /usr/include/c++/6/stdlib.h:36:0, [ 110s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 110s] from /usr/include/osmocom/core/timer.h:35, [ 110s] from ./bts.h:29, [ 110s] from bts.cpp:21: [ 110s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 110s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 110s] abs(long long __x) { return __builtin_llabs (__x); } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 110s] abs(long __i) { return __builtin_labs(__i); } [ 110s] ^~~ Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d --- M src/bts.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/81/1981/2 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..75beaec 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -550,7 +550,7 @@ * number exceeds a certain limit, we need to assume that the incoming * rach request belongs to a the previous rfn period. To correct this, * we roll back the rounded frame number by one RFN_MODULUS */ - if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { + if (abs((long int)(rfn - m_cur_rfn)) > RFN_THRESHOLD) { LOGP(DRLCMAC, LOGL_DEBUG, "Race condition between rfn (%u) and m_cur_fn (%u) detected: rfn belongs to the previos modulus %u cycle, wrappng...\n", rfn, m_cur_fn, RFN_MODULUS); -- To view, visit https://gerrit.osmocom.org/1981 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Mar 6 16:41:03 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 6 Mar 2017 16:41:03 +0000 Subject: osmo-pcu[master]: BTS: fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1981 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 16:41:40 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 16:41:40 +0000 Subject: [PATCH] libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1582 to look at the new patch set (#8). vty: fix "logging level ... everything" option * remove unused parameters to log_vty_command_*() and logging_vty_add_cmds() * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * make "logging level ... everything" into alias for "... debug" * mark log level descriptors static Related: OS#71 Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c --- M include/osmocom/core/logging.h M include/osmocom/vty/logging.h M src/logging.c M src/vty/logging_vty.c M tests/vty/vty_test.c 5 files changed, 20 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/1582/8 diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 7b28b2c..1cfe4c0 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -328,8 +328,8 @@ void log_del_target(struct log_target *target); /* Generate command string for VTY use */ -const char *log_vty_command_string(const struct log_info *info); -const char *log_vty_command_description(const struct log_info *info); +const char *log_vty_command_string(); +const char *log_vty_command_description(); struct log_target *log_target_find(int type, const char *fname); extern struct llist_head osmo_log_target_list; diff --git a/include/osmocom/vty/logging.h b/include/osmocom/vty/logging.h index 9e4b98f..544d117 100644 --- a/include/osmocom/vty/logging.h +++ b/include/osmocom/vty/logging.h @@ -4,6 +4,6 @@ #define FILTER_STR "Filter log messages\n" struct log_info; -void logging_vty_add_cmds(const struct log_info *cat); +void logging_vty_add_cmds(); struct vty; struct log_target *osmo_log_vty2tgt(struct vty *vty); diff --git a/src/logging.c b/src/logging.c index 6a1e929..4fc02e6 100644 --- a/src/logging.c +++ b/src/logging.c @@ -64,7 +64,7 @@ #define LOGLEVEL_DEFS 6 /* Number of loglevels.*/ static const struct value_string loglevel_strs[LOGLEVEL_DEFS+1] = { - { 0, "EVERYTHING" }, + { LOGL_DEBUG, "EVERYTHING" }, { LOGL_DEBUG, "DEBUG" }, { LOGL_INFO, "INFO" }, { LOGL_NOTICE, "NOTICE" }, @@ -144,7 +144,7 @@ /*! \brief descriptive string for each log level */ /* You have to keep this in sync with the structure loglevel_strs. */ -const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { +static const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { "Don't use. It doesn't log anything", "Log debug messages and higher levels", "Log informational messages and higher levels", @@ -359,7 +359,8 @@ return subsys; } -static inline int check_log_to_target(struct log_target *tar, int subsys, int level) +static inline bool should_log_to_target(struct log_target *tar, int subsys, + int level) { struct log_category *category; @@ -367,28 +368,28 @@ /* subsystem is not supposed to be logged */ if (!category->enabled) - return 0; + return false; /* Check the global log level */ if (tar->loglevel != 0 && level < tar->loglevel) - return 0; + return false; /* Check the category log level */ if (tar->loglevel == 0 && category->loglevel != 0 && level < category->loglevel) - return 0; + return false; /* Apply filters here... if that becomes messy we will * need to put filters in a list and each filter will * say stop, continue, output */ if ((tar->filter_map & (1 << LOG_FLT_ALL)) != 0) - return 1; + return true; if (osmo_log_info->filter_fn) return osmo_log_info->filter_fn(&log_context, tar); /* TODO: Check the filter/selector too? */ - return 1; + return true; } /*! \brief vararg version of logging function @@ -409,7 +410,7 @@ llist_for_each_entry(tar, &osmo_log_target_list, entry) { va_list bp; - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* According to the manpage, vsnprintf leaves the value of ap @@ -776,7 +777,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns vty command string for use by VTY command node */ -const char *log_vty_command_string(const struct log_info *unused_info) +const char *log_vty_command_string() { struct log_info *info = osmo_log_info; int len = 0, offset = 0, ret, i, rem; @@ -854,7 +855,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns logging command description for use by VTY command node */ -const char *log_vty_command_description(const struct log_info *unused_info) +const char *log_vty_command_description() { struct log_info *info = osmo_log_info; char *str; @@ -985,7 +986,7 @@ /* TODO: The following could/should be cached (update on config) */ llist_for_each_entry(tar, &osmo_log_target_list, entry) { - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* This might get logged (ignoring filters) */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index aabcaa7..9be5dd7 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -737,7 +737,7 @@ return 1; } -void logging_vty_add_cmds(const struct log_info *cat) +void logging_vty_add_cmds() { install_element_ve(&enable_logging_cmd); install_element_ve(&disable_logging_cmd); @@ -750,8 +750,8 @@ install_element_ve(&logging_set_category_mask_old_cmd); /* Logging level strings are generated dynamically. */ - logging_level_cmd.string = log_vty_command_string(cat); - logging_level_cmd.doc = log_vty_command_description(cat); + logging_level_cmd.string = log_vty_command_string(NULL); + logging_level_cmd.doc = log_vty_command_description(NULL); install_element_ve(&logging_level_cmd); install_element_ve(&show_logging_vty_cmd); install_element_ve(&show_alarms_cmd); diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c index 865c93e..1e1b495 100644 --- a/tests/vty/vty_test.c +++ b/tests/vty/vty_test.c @@ -318,7 +318,7 @@ vty_init(&vty_info); /* Setup VTY commands */ - logging_vty_add_cmds(&log_info); + logging_vty_add_cmds(); osmo_stats_vty_add_cmds(); test_cmd_string_from_valstr(); -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:04:56 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:04:56 +0000 Subject: osmo-gsm-manuals[master]: bibliography: Add TES 35.205 on MILENAGE In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1969 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd4eee72b1dc7bf2a993670e28f6c8adb51ab00f Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:05:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:05:02 +0000 Subject: [MERGED] osmo-gsm-manuals[master]: bibliography: Add TES 35.205 on MILENAGE In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bibliography: Add TES 35.205 on MILENAGE ...................................................................... bibliography: Add TES 35.205 on MILENAGE Change-Id: Ifd4eee72b1dc7bf2a993670e28f6c8adb51ab00f --- M common/chapters/bibliography.adoc 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/common/chapters/bibliography.adoc b/common/chapters/bibliography.adoc index 5d0c548..a3c6436 100644 --- a/common/chapters/bibliography.adoc +++ b/common/chapters/bibliography.adoc @@ -51,6 +51,8 @@ http://www.3gpp.org/DynaReport/31115.htm - [[[3gpp-ts-31-116]]] 3GPP TS 31.116: Remote APDU Structure for (U)SIM Toolkit applications http://www.3gpp.org/DynaReport/31116.htm +- [[[3gpp-ts-35-205]]] 3GPP TS 35.205: 3G Security; Specification of + the MILENAGE algorithm set: General - [[[3gpp-ts-35-206]]] 3GPP TS 35.206: 3G Security; Specification of the MILENAGE algorithm set: Algorithm specification http://www.3gpp.org/DynaReport/35206.htm -- To view, visit https://gerrit.osmocom.org/1969 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd4eee72b1dc7bf2a993670e28f6c8adb51ab00f Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:05:57 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:05:57 +0000 Subject: osmo-sip-connector[master]: contrib: Add Dockerfile to build and configure a FreeSWITCH In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1970 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Keith Whyte Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:06:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:06:14 +0000 Subject: libosmocore[master]: utils/conv_gen.py: add header generation feature In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1593 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:06:28 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:06:28 +0000 Subject: libosmocore[master]: utils/conv_gen.py: add test vectors generation feature In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1585 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie10c47ee952f253b1ba77ecf6e79f2c033545bc1 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:06:45 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:06:45 +0000 Subject: [MERGED] libosmocore[master]: utils/conv_gen.py: add test vectors generation feature In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: utils/conv_gen.py: add test vectors generation feature ...................................................................... utils/conv_gen.py: add test vectors generation feature Change-Id: Ie10c47ee952f253b1ba77ecf6e79f2c033545bc1 --- M utils/conv_gen.py 1 file changed, 76 insertions(+), 2 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/utils/conv_gen.py b/utils/conv_gen.py index e6eb50c..e929d3f 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -30,13 +30,16 @@ class ConvolutionalCode(object): def __init__(self, block_len, polys, name, - description = None, puncture = [], term_type = None): + description = None, puncture = [], term_type = None, + vec_in = None, vec_out = None): # Save simple params self.block_len = block_len self.k = 1 self.puncture = puncture self.rate_inv = len(polys) self.term_type = term_type + self.vec_in = vec_in + self.vec_out = vec_out # Infos self.name = name @@ -226,6 +229,44 @@ fi.write("\t.puncture = %s_puncture,\n" % self.name) fi.write("};\n\n") + def calc_out_len(self): + out_len = self.block_len * self.rate_inv + + # By default CONV_TERM_FLUSH + if self.term_type is None: + out_len += self.rate_inv * (self.k - 1) + + if len(self.puncture): + out_len -= len(self.puncture) - 1 + + return out_len + + def gen_test_vector(self, fi, prefix): + code_name = "%s_%s" % (prefix, self.name) + + fi.write("\t{\n") + fi.write("\t\t.name = \"%s\",\n" % code_name) + fi.write("\t\t.code = &%s,\n" % code_name) + + fi.write("\t\t.in_len = %d,\n" % self.block_len) + fi.write("\t\t.out_len = %d,\n" % self.calc_out_len()) + + # Print pre computed vectors if preset + if self.vec_in is not None and self.vec_out is not None: + fi.write("\t\t.has_vec = 1,\n") + fi.write("\t\t.vec_in = {\n") + print_formatted(self.vec_in, "0x%02x, ", 8, fi, indent = "\t\t\t") + fi.write("\t\t},\n") + fi.write("\t\t.vec_out = {\n") + print_formatted(self.vec_out, "0x%02x, ", 8, fi, indent = "\t\t\t") + fi.write("\t\t},\n") + else: + fi.write("\t\t.has_vec = 0,\n") + fi.write("\t\t.vec_in = { },\n") + fi.write("\t\t.vec_out = { },\n") + + fi.write("\t},\n") + poly = lambda *args: sum([(1 << x) for x in args]) def combine(src, sel, nb): @@ -281,13 +322,41 @@ code.gen_tables(prefix, f, shared_tables = shared) +def generate_vectors(codes, path, prefix, name, inc = None): + # Open a new file for writing + f = open(os.path.join(path, name), 'w') + f.write(mod_license + "\n") + + # Print includes + if inc is not None: + for item in inc: + f.write("%s\n" % item) + f.write("#include \n") + f.write("#include \"conv.h\"\n\n") + + sys.stderr.write("Generating test vectors...\n") + + vec_count = len(codes.conv_codes) + f.write("const int %s_vectors_len = %d;\n\n" + % (prefix, vec_count)) + + f.write("const struct conv_test_vector %s_vectors[%d] = {\n" + % (prefix, vec_count)) + + # Generate the vectors one by one + for code in codes.conv_codes: + sys.stderr.write("Generate '%s' test vector\n" % code.name) + code.gen_test_vector(f, prefix) + + f.write("};\n") + def parse_argv(): parser = argparse.ArgumentParser() # Positional arguments parser.add_argument("action", help = "what to generate", - choices = ["gen_codes"]) + choices = ["gen_codes", "gen_vectors"]) parser.add_argument("family", help = "convolutional code family", choices = ["gsm"]) @@ -306,15 +375,20 @@ # Parse and verify arguments argv = parse_argv() path = argv.target_path or os.getcwd() + inc = None # Determine convolutional code family if argv.family == "gsm": codes = conv_codes_gsm prefix = argv.prefix or "gsm0503" + inc = [ "#include " ] # What to generate? if argv.action == "gen_codes": name = argv.target_name or prefix + "_conv.c" generate_codes(codes, path, prefix, name) + elif argv.action == "gen_vectors": + name = argv.target_name or prefix + "_test_vectors.c" + generate_vectors(codes, path, prefix, name, inc) sys.stderr.write("Generation complete.\n") -- To view, visit https://gerrit.osmocom.org/1585 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie10c47ee952f253b1ba77ecf6e79f2c033545bc1 Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:06:46 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:06:46 +0000 Subject: [MERGED] libosmocore[master]: utils/conv_gen.py: add header generation feature In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: utils/conv_gen.py: add header generation feature ...................................................................... utils/conv_gen.py: add header generation feature Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea --- M utils/conv_gen.py 1 file changed, 44 insertions(+), 5 deletions(-) Approvals: tnt: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/utils/conv_gen.py b/utils/conv_gen.py index e929d3f..1ffeb3f 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -168,6 +168,20 @@ # Up to 12 numbers should be placed per line print_formatted(self.puncture, "%3d, ", 12, fi) + def print_description(self, fi, brief = False): + if brief is True: + fi.write("/*! \\brief ") + fi.write("structure describing %s\n" + % self.description[0]) + for line in self.description[1:]: + fi.write(" * %s\n" % line) + else: + fi.write("/**\n") + for line in self.description: + fi.write(" * %s\n" % line) + + fi.write(" */\n") + def print_state_and_output(self, fi): pack = lambda n: \ sum([x << (self.rate_inv - i - 1) for i, x in enumerate(n)]) @@ -205,10 +219,7 @@ # Write description as a multi-line comment if self.description is not None: - fi.write("/**\n") - for line in self.description: - fi.write(" * %s\n" % line) - fi.write(" */\n") + self.print_description(fi) # Print a final convolutional code definition fi.write("const struct osmo_conv_code %s_%s = {\n" % (pref, self.name)) @@ -350,13 +361,38 @@ f.write("};\n") +def generate_header(codes, path, prefix, name, description = None): + # Open a new file for writing + f = open(os.path.join(path, name), 'w') + + # Print license and includes + f.write(mod_license + "\n") + f.write("#pragma once\n\n") + f.write("#include \n") + f.write("#include \n\n") + + # Print general file description if preset + if description is not None: + f.write("/*! \\file %s.h\n" % prefix) + f.write(" * %s\n" % description) + f.write(" */\n\n") + + sys.stderr.write("Generating header file...\n") + + # Generate declarations one by one + for code in codes.conv_codes: + sys.stderr.write("Generate '%s' declaration\n" % code.name) + code.print_description(f, True) + f.write("extern const struct osmo_conv_code %s_%s;\n\n" + % (prefix, code.name)) + def parse_argv(): parser = argparse.ArgumentParser() # Positional arguments parser.add_argument("action", help = "what to generate", - choices = ["gen_codes", "gen_vectors"]) + choices = ["gen_codes", "gen_vectors", "gen_header"]) parser.add_argument("family", help = "convolutional code family", choices = ["gsm"]) @@ -390,5 +426,8 @@ elif argv.action == "gen_vectors": name = argv.target_name or prefix + "_test_vectors.c" generate_vectors(codes, path, prefix, name, inc) + elif argv.action == "gen_header": + name = argv.target_name or prefix + ".h" + generate_header(codes, path, prefix, name) sys.stderr.write("Generation complete.\n") -- To view, visit https://gerrit.osmocom.org/1593 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:06:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:06:47 +0000 Subject: [MERGED] libosmocore[master]: gsm0503.h: generate header automatically In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm0503.h: generate header automatically ...................................................................... gsm0503.h: generate header automatically Since we have automatic header generation, implemented in the utils/conv_gen.py, it's time to use this feature! Change-Id: I21caa4e433b2cc1861611e35350a9671da444c2a --- M .gitignore M include/Makefile.am D include/osmocom/gsm/gsm0503.h 3 files changed, 7 insertions(+), 174 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitignore b/.gitignore index 48642ca..84e11b8 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,7 @@ src/gsm/gsm0503_conv.c include/osmocom/core/crc*gen.h include/osmocom/core/bit*gen.h +include/osmocom/gsm/gsm0503.h # vi files *.sw? diff --git a/include/Makefile.am b/include/Makefile.am index 0a300a8..770a9c6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -143,3 +143,9 @@ osmocom/core/crc%gen.h: osmocom/core/crcXXgen.h.tpl $(AM_V_GEN)$(MKDIR_P) $(dir $@) $(AM_V_GEN)sed -e's/XX/$*/g' $< > $@ + +osmocom/gsm/gsm0503.h: + $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_header gsm \ + --target-path $(top_srcdir)/include/osmocom/gsm/ + +CLEANFILES = osmocom/gsm/gsm0503.h diff --git a/include/osmocom/gsm/gsm0503.h b/include/osmocom/gsm/gsm0503.h deleted file mode 100644 index de28ad2..0000000 --- a/include/osmocom/gsm/gsm0503.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * gsm0503.h - * - * Copyright (C) 2016 sysmocom s.f.m.c. GmbH - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#pragma once - -#include - -#include - -/*! \file gsm0503.h - * Osmocom convolutional encoder/decoder for xCCH channels, see 3GPP TS 05.03 - */ - -/*! \brief structure describing convolutional code xCCH - * - * Non-recursive code, flushed, not punctured code. - */ -extern const struct osmo_conv_code gsm0503_xcch; - -/*! \brief structure describing convolutional code RACH - */ -extern const struct osmo_conv_code gsm0503_rach; - -/*! \brief structure describing convolutional code SCH - */ -extern const struct osmo_conv_code gsm0503_sch; - -/*! \brief structures describing convolutional codes CS2/3 - */ -extern const struct osmo_conv_code gsm0503_cs2; -extern const struct osmo_conv_code gsm0503_cs3; - -/*! \brief structure describing convolutional code TCH/FR - */ -extern const struct osmo_conv_code gsm0503_tch_fr; - -/*! \brief structure describing convolutional code TCH/HR - */ -extern const struct osmo_conv_code gsm0503_tch_hr; - -/*! \brief structure describing convolutional code TCH/AFS 12.2 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_12_2; - -/*! \brief structure describing convolutional code TCH/AFS 10.2 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_10_2; - -/*! \brief structure describing convolutional code TCH/AFS 7.95 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_7_95; - -/*! \brief structure describing convolutional code TCH/AFS 7.4 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_7_4; - -/*! \brief structure describing convolutional code TCH/AFS 6.7 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_6_7; - -/*! \brief structure describing convolutional code TCH/AFS 5.9 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_5_9; - -/*! \brief structure describing convolutional code TCH/AFS 5.15 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_5_15; - -/*! \brief structure describing convolutional code TCH/AFS 4.75 - */ -extern const struct osmo_conv_code gsm0503_tch_afs_4_75; - -/*! \brief structure describing convolutional code TCH/AHS 7.95 - */ -extern const struct osmo_conv_code gsm0503_tch_ahs_7_95; - -/*! \brief structure describing convolutional code TCH/AHS 7.4 - */ -extern const struct osmo_conv_code gsm0503_tch_ahs_7_4; - -/*! \brief structure describing convolutional code TCH/AHS 6.7 - */ -extern const struct osmo_conv_code gsm0503_tch_ahs_6_7; - -/*! \brief structure describing convolutional code TCH/AHS 5.9 - */ -extern const struct osmo_conv_code gsm0503_tch_ahs_5_9; - -/*! \brief structure describing convolutional code TCH/AHS 5.15 - */ -extern const struct osmo_conv_code gsm0503_tch_ahs_5_15; - -/*! \brief structure describing convolutional code TCH/AHS 4.75 - */ -extern const struct osmo_conv_code gsm0503_tch_ahs_4_75; - -/*! \brief structure describing convolutional code EDGE MCS-1 DL HDR - */ -extern const struct osmo_conv_code gsm0503_mcs1_dl_hdr; - -/*! \brief structure describing convolutional code EDGE MCS-1 UL HDR - */ -extern const struct osmo_conv_code gsm0503_mcs1_ul_hdr; - -/*! \brief structure describing convolutional code EDGE MCS-1 - */ -extern const struct osmo_conv_code gsm0503_mcs1; - -/*! \brief structure describing convolutional code EDGE MCS-2 - */ -extern const struct osmo_conv_code gsm0503_mcs2; - -/*! \brief structure describing convolutional code EDGE MCS-3 - */ -extern const struct osmo_conv_code gsm0503_mcs3; - -/*! \brief structure describing convolutional code EDGE MCS-4 - */ -extern const struct osmo_conv_code gsm0503_mcs4; - -/*! \brief structure describing convolutional code EDGE MCS-5 DL HDR - */ -extern const struct osmo_conv_code gsm0503_mcs5_dl_hdr; - -/*! \brief structure describing convolutional code EDGE MCS-5 UL HDR - */ -extern const struct osmo_conv_code gsm0503_mcs5_ul_hdr; - -/*! \brief structure describing convolutional code EDGE MCS-5 - */ -extern const struct osmo_conv_code gsm0503_mcs5; - -/*! \brief structure describing convolutional code EDGE MCS-6 - */ -extern const struct osmo_conv_code gsm0503_mcs6; - -/*! \brief structure describing convolutional code EDGE MCS-7 DL HDR - */ -extern const struct osmo_conv_code gsm0503_mcs7_dl_hdr; - -/*! \brief structure describing convolutional code EDGE MCS-7 UL HDR - */ -extern const struct osmo_conv_code gsm0503_mcs7_ul_hdr; - -/*! \brief structure describing convolutional code EDGE MCS-7 - */ -extern const struct osmo_conv_code gsm0503_mcs7; - -/*! \brief structure describing convolutional code EDGE MCS-8 - */ -extern const struct osmo_conv_code gsm0503_mcs8; - -/*! \brief structure describing convolutional code EDGE MCS-9 - */ -extern const struct osmo_conv_code gsm0503_mcs9; -- To view, visit https://gerrit.osmocom.org/1594 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I21caa4e433b2cc1861611e35350a9671da444c2a Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:06:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:06:47 +0000 Subject: [MERGED] libosmocore[master]: tests/conv: separate test logic In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: tests/conv: separate test logic ...................................................................... tests/conv: separate test logic To be able to add some more tests, related to convolutional coding, without duplication of code, the test logic was separated from the conv_test.c into conv.c and conv.h. Change-Id: Idbdc7e19cb9b9a36cd1fccd621cd858e87530d98 --- M tests/Makefile.am A tests/conv/conv.c A tests/conv/conv.h M tests/conv/conv_test.c 4 files changed, 169 insertions(+), 153 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/Makefile.am b/tests/Makefile.am index 35b9150..0472082 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -57,7 +57,7 @@ bits_bitcomp_test_SOURCES = bits/bitcomp_test.c bits_bitcomp_test_LDADD = $(top_builddir)/src/libosmocore.la -conv_conv_test_SOURCES = conv/conv_test.c +conv_conv_test_SOURCES = conv/conv_test.c conv/conv.c conv_conv_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la gsm0808_gsm0808_test_SOURCES = gsm0808/gsm0808_test.c @@ -187,6 +187,7 @@ socket/socket_test.err DISTCLEANFILES = atconfig atlocal +noinst_HEADERS = conv/conv.h TESTSUITE = $(srcdir)/testsuite diff --git a/tests/conv/conv.c b/tests/conv/conv.c new file mode 100644 index 0000000..7dac155 --- /dev/null +++ b/tests/conv/conv.c @@ -0,0 +1,143 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include "conv.h" + +static void fill_random(ubit_t *b, int n) +{ + int i; + + for (i = 0; i < n; i++) + b[i] = random() & 1; +} + +int do_check(const struct conv_test_vector *test) +{ + ubit_t *bu0, *bu1; + sbit_t *bs; + int len, j; + + bu0 = malloc(sizeof(ubit_t) * MAX_LEN_BITS); + bu1 = malloc(sizeof(ubit_t) * MAX_LEN_BITS); + bs = malloc(sizeof(sbit_t) * MAX_LEN_BITS); + + srandom(time(NULL)); + + /* Test name */ + printf("[+] Testing: %s\n", test->name); + + /* Check length */ + len = osmo_conv_get_input_length(test->code, 0); + printf("[.] Input length : ret = %3d exp = %3d -> %s\n", + len, test->in_len, len == test->in_len ? "OK" : "Bad !"); + + if (len != test->in_len) { + fprintf(stderr, "[!] Failure for input length computation\n"); + return -1; + } + + len = osmo_conv_get_output_length(test->code, 0); + printf("[.] Output length : ret = %3d exp = %3d -> %s\n", + len, test->out_len, len == test->out_len ? "OK" : "Bad !"); + + if (len != test->out_len) { + fprintf(stderr, "[!] Failure for output length computation\n"); + return -1; + } + + /* Check pre-computed vector */ + if (test->has_vec) { + printf("[.] Pre computed vector checks:\n"); + + printf("[..] Encoding: "); + + osmo_pbit2ubit(bu0, test->vec_in, test->in_len); + + len = osmo_conv_encode(test->code, bu0, bu1); + if (len != test->out_len) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed encoding length check\n"); + return -1; + } + + osmo_pbit2ubit(bu0, test->vec_out, test->out_len); + + if (memcmp(bu0, bu1, test->out_len)) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed encoding: Results don't match\n"); + return -1; + }; + + printf("OK\n"); + + + printf("[..] Decoding: "); + + osmo_ubit2sbit(bs, bu0, len); + + len = osmo_conv_decode(test->code, bs, bu1); + if (len != 0) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed decoding: non-zero path (%d)\n", len); + return -1; + } + + osmo_pbit2ubit(bu0, test->vec_in, test->in_len); + + if (memcmp(bu0, bu1, test->in_len)) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed decoding: Results don't match\n"); + return -1; + } + + printf("OK\n"); + } + + /* Check random vector */ + printf("[.] Random vector checks:\n"); + + for (j = 0; j < 3; j++) { + printf("[..] Encoding / Decoding cycle : "); + + fill_random(bu0, test->in_len); + + len = osmo_conv_encode(test->code, bu0, bu1); + if (len != test->out_len) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed encoding length check\n"); + return -1; + } + + osmo_ubit2sbit(bs, bu1, len); + + len = osmo_conv_decode(test->code, bs, bu1); + if (len != 0) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed decoding: non-zero path (%d)\n", len); + return -1; + } + + if (memcmp(bu0, bu1, test->in_len)) { + printf("ERROR !\n"); + fprintf(stderr, "[!] Failed decoding: Results don't match\n"); + return -1; + } + + printf("OK\n"); + } + + /* Spacing */ + printf("\n"); + + free(bs); + free(bu1); + free(bu0); + + return 0; +} diff --git a/tests/conv/conv.h b/tests/conv/conv.h new file mode 100644 index 0000000..676c5af --- /dev/null +++ b/tests/conv/conv.h @@ -0,0 +1,16 @@ +#pragma once + +#define MAX_LEN_BITS 512 +#define MAX_LEN_BYTES (512/8) + +struct conv_test_vector { + const char *name; + const struct osmo_conv_code *code; + int in_len; + int out_len; + int has_vec; + pbit_t vec_in[MAX_LEN_BYTES]; + pbit_t vec_out[MAX_LEN_BYTES]; +}; + +int do_check(const struct conv_test_vector *test); diff --git a/tests/conv/conv_test.c b/tests/conv/conv_test.c index 3064f9c..131b459 100644 --- a/tests/conv/conv_test.c +++ b/tests/conv/conv_test.c @@ -1,16 +1,10 @@ #include #include -#include -#include -#include #include -#include #include -#define MAX_LEN_BITS 512 -#define MAX_LEN_BYTES (512/8) - +#include "conv.h" /* ------------------------------------------------------------------------ */ /* Test codes */ @@ -172,38 +166,15 @@ }; /* ------------------------------------------------------------------------ */ -/* Test vectors */ -/* ------------------------------------------------------------------------ */ - -struct conv_test_vector { - const char *name; - const struct osmo_conv_code *code; - int in_len; - int out_len; - int has_vec; - pbit_t vec_in[MAX_LEN_BYTES]; - pbit_t vec_out[MAX_LEN_BYTES]; -}; - -/* ------------------------------------------------------------------------ */ /* Main */ /* ------------------------------------------------------------------------ */ -static void -fill_random(ubit_t *b, int n) -{ - int i; - for (i=0; i Non recursive code, direct truncation, non-punctured */ + /* Random code -> Non recursive code, direct truncation, non-punctured */ const struct osmo_conv_code conv_trunc = { .N = 2, .K = 5, @@ -300,126 +271,11 @@ { /* end */ }, }; - srandom(time(NULL)); - - bu0 = malloc(sizeof(ubit_t) * MAX_LEN_BITS); - bu1 = malloc(sizeof(ubit_t) * MAX_LEN_BITS); - bs = malloc(sizeof(sbit_t) * MAX_LEN_BITS); - - for (tst=tests; tst->name; tst++) - { - int i,l; - - /* Test name */ - printf("[+] Testing: %s\n", tst->name); - - /* Check length */ - l = osmo_conv_get_input_length(tst->code, 0); - printf("[.] Input length : ret = %3d exp = %3d -> %s\n", - l, tst->in_len, l == tst->in_len ? "OK" : "Bad !"); - - if (l != tst->in_len) { - fprintf(stderr, "[!] Failure for input length computation\n"); - return -1; - } - - l = osmo_conv_get_output_length(tst->code, 0); - printf("[.] Output length : ret = %3d exp = %3d -> %s\n", - l, tst->out_len, l == tst->out_len ? "OK" : "Bad !"); - - if (l != tst->out_len) { - fprintf(stderr, "[!] Failure for output length computation\n"); - return -1; - } - - /* Check pre-computed vector */ - if (tst->has_vec) { - printf("[.] Pre computed vector checks:\n"); - - printf("[..] Encoding: "); - - osmo_pbit2ubit(bu0, tst->vec_in, tst->in_len); - - l = osmo_conv_encode(tst->code, bu0, bu1); - if (l != tst->out_len) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed encoding length check\n"); - return -1; - } - - osmo_pbit2ubit(bu0, tst->vec_out, tst->out_len); - - if (memcmp(bu0, bu1, tst->out_len)) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed encoding: Results don't match\n"); - return -1; - }; - - printf("OK\n"); - - - printf("[..] Decoding: "); - - osmo_ubit2sbit(bs, bu0, l); - - l = osmo_conv_decode(tst->code, bs, bu1); - if (l != 0) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed decoding: non-zero path (%d)\n", l); - return -1; - } - - osmo_pbit2ubit(bu0, tst->vec_in, tst->in_len); - - if (memcmp(bu0, bu1, tst->in_len)) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed decoding: Results don't match\n"); - return -1; - } - - printf("OK\n"); - } - - /* Check random vector */ - printf("[.] Random vector checks:\n"); - - for (i=0; i<3; i++) { - printf("[..] Encoding / Decoding cycle : "); - - fill_random(bu0, tst->in_len); - - l = osmo_conv_encode(tst->code, bu0, bu1); - if (l != tst->out_len) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed encoding length check\n"); - return -1; - } - - osmo_ubit2sbit(bs, bu1, l); - - l = osmo_conv_decode(tst->code, bs, bu1); - if (l != 0) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed decoding: non-zero path (%d)\n", l); - return -1; - } - - if (memcmp(bu0, bu1, tst->in_len)) { - printf("ERROR !\n"); - fprintf(stderr, "[!] Failed decoding: Results don't match\n"); - return -1; - } - - printf("OK\n"); - } - - /* Spacing */ - printf("\n"); + for (test = tests; test->name; test++) { + rc = do_check(test); + if (rc) + return rc; } - - free(bs); - free(bu1); - free(bu0); return 0; } -- To view, visit https://gerrit.osmocom.org/1627 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idbdc7e19cb9b9a36cd1fccd621cd858e87530d98 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:07:05 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:07:05 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 15: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 15 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:07:36 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:07:36 +0000 Subject: osmo-hlr[master]: CTRL: add enable/disable packet service cmds In-Reply-To: References: Message-ID: Patch Set 15: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1841 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Gerrit-PatchSet: 15 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:08:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:08:16 +0000 Subject: osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Patch Set 17: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 17 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:09:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:09:14 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:09:30 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:09:30 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+1 out of curiosity: how has this been (manually?) tested -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:09:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 17:09:45 +0000 Subject: [MERGED] osmo-hlr[master]: Add CTRL interface In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add CTRL interface ...................................................................... Add CTRL interface * add command to query Packet Services (GPRS etc.) for particular IMSI. * add vty command to configure ctrl bind address * add missing vty copyright notice Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Related: OS#1645 --- M configure.ac M src/Makefile.am A src/ctrl.c A src/ctrl.h M src/hlr.c M src/hlr.h 6 files changed, 134 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/configure.ac b/configure.ac index bfda9c5..a04185f 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) PKG_CHECK_MODULES(SQLITE3, sqlite3) diff --git a/src/Makefile.am b/src/Makefile.am index 1791343..b410ff3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(NULL) @@ -20,6 +21,7 @@ gsup_server.h \ logging.h \ rand.h \ + ctrl.h \ hlr_vty.h \ $(NULL) @@ -33,6 +35,7 @@ osmo_hlr_SOURCES = \ auc.c \ + ctrl.c \ db.c \ luop.c \ db_auc.c \ @@ -49,6 +52,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(SQLITE3_LIBS) \ $(NULL) diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..a167171 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,81 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#include + +#include +#include +#include + +#include "gsup_server.h" +#include "logging.h" +#include "db.h" +#include "hlr.h" +#include "luop.h" +#include "ctrl.h" + +CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); +static int set_status_ps(struct ctrl_cmd *cmd, void *data) +{ + struct hlr *ctx = data; + struct lu_operation *luop = lu_op_alloc(ctx->gs); + if (!luop) { + cmd->reply = "Internal HLR error"; + return CTRL_CMD_ERROR; + } + + if (!lu_op_fill_subscr(luop, ctx->dbc, cmd->value)) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + cmd->reply = luop->subscr.nam_ps ? "1" : "0"; + + return CTRL_CMD_REPLY; +} + +int hlr_ctrl_cmds_install() +{ + int rc = 0; + + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); + + return rc; +} + +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs) +{ + int rc; + struct ctrl_handle *hdl = ctrl_interface_setup_dynip(ctx, + ctx->ctrl_bind_addr, + OSMO_CTRL_PORT_HLR, + NULL); + if (!hdl) + return NULL; + + rc = hlr_ctrl_cmds_install(); + if (rc) /* FIXME: close control interface? */ + return NULL; + + return hdl; +} diff --git a/src/ctrl.h b/src/ctrl.h new file mode 100644 index 0000000..663de30 --- /dev/null +++ b/src/ctrl.h @@ -0,0 +1,31 @@ +/* OsmoHLR Control Interface implementation */ + +/* (C) 2017 sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Max Suraev + * + * 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 . + * + */ + +#pragma once + +#include + +#include "gsup_server.h" + +int hlr_ctrl_cmds_install(); +struct ctrl_handle *hlr_controlif_setup(struct hlr *ctx, + struct osmo_gsup_server *gs); diff --git a/src/hlr.c b/src/hlr.c index bb6f05a..95a565e 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -32,9 +32,11 @@ #include #include #include +#include #include "db.h" #include "hlr.h" +#include "ctrl.h" #include "logging.h" #include "gsup_server.h" #include "gsup_router.h" @@ -393,9 +395,16 @@ } } +static const char vlr_copyright[] = + "Copyright (C) 2016, 2017 by Harald Welte, sysmocom s.f.m.c. GmbH\r\n" + "License AGPLv3+: GNU AGPL version 3 or later \r\n" + "This is free software: you are free to change and redistribute it.\r\n" + "There is NO WARRANTY, to the extent permitted by law.\r\n"; + static struct vty_app_info vty_info = { .name = "OsmoHLR", .version = PACKAGE_VERSION, + .copyright = vlr_copyright, .is_config_node = hlr_vty_is_config_node, }; @@ -415,6 +424,7 @@ } vty_init(&vty_info); + ctrl_vty_init(hlr_ctx); handle_options(argc, argv); hlr_vty_init(&hlr_log_info); @@ -452,6 +462,9 @@ exit(1); } + g_hlr->ctrl_bind_addr = ctrl_vty_get_bind_addr(); + g_hlr->ctrl = hlr_controlif_setup(g_hlr, g_hlr->gs); + osmo_init_ignore_signals(); signal(SIGINT, &signal_hdlr); signal(SIGUSR1, &signal_hdlr); diff --git a/src/hlr.h b/src/hlr.h index 77751dd..1e8eff8 100644 --- a/src/hlr.h +++ b/src/hlr.h @@ -30,4 +30,8 @@ /* DB context */ struct db_context *dbc; + + /* Control Interface */ + struct ctrl_handle *ctrl; + const char *ctrl_bind_addr; }; -- To view, visit https://gerrit.osmocom.org/1827 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id787ef4aa88473c3bbde6ee25117b1fd99dc8fcb Gerrit-PatchSet: 17 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:09:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 17:09:45 +0000 Subject: [MERGED] osmo-hlr[master]: CTRL: add enable/disable packet service cmds In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: CTRL: add enable/disable packet service cmds ...................................................................... CTRL: add enable/disable packet service cmds Add commands to enable/disable Packet Service for a given IMSI. Changes are synced to DB and propagated at runtime to SGSN (in case of disable command). Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Related: OS#1645 --- M src/ctrl.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M src/luop.c M src/luop.h 6 files changed, 79 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/ctrl.c b/src/ctrl.c index a167171..81de961 100644 --- a/src/ctrl.c +++ b/src/ctrl.c @@ -33,6 +33,47 @@ #include "luop.h" #include "ctrl.h" +static int handle_cmd_ps(struct hlr *ctx, struct ctrl_cmd *cmd, bool enable) +{ + struct lu_operation *luop = NULL; + struct osmo_gsup_conn *co; + + if (db_subscr_get(ctx->dbc, cmd->value, NULL) < 0) { + cmd->reply = "Subscriber Unknown in HLR"; + return CTRL_CMD_ERROR; + } + + if (db_subscr_ps(ctx->dbc, cmd->value, enable) < 0) { + cmd->reply = "Error updating DB"; + return CTRL_CMD_ERROR; + } + + /* FIXME: only send to single SGSN where latest update for IMSI came from */ + if (!enable) { + llist_for_each_entry(co, &ctx->gs->clients, list) { + luop = lu_op_alloc_conn(co); + lu_op_fill_subscr(luop, ctx->dbc, cmd->value); + lu_op_tx_del_subscr_data(luop); + } + } + + cmd->reply = "OK"; + + return CTRL_CMD_REPLY; +} + +CTRL_CMD_DEFINE_WO_NOVRF(enable_ps, "enable-ps"); +static int set_enable_ps(struct ctrl_cmd *cmd, void *data) +{ + return handle_cmd_ps(data, cmd, true); +} + +CTRL_CMD_DEFINE_WO_NOVRF(disable_ps, "disable-ps"); +static int set_disable_ps(struct ctrl_cmd *cmd, void *data) +{ + return handle_cmd_ps(data, cmd, false); +} + CTRL_CMD_DEFINE_WO_NOVRF(status_ps, "status-ps"); static int set_status_ps(struct ctrl_cmd *cmd, void *data) { @@ -57,6 +98,8 @@ { int rc = 0; + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_enable_ps); + rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_disable_ps); rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_status_ps); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index ea51f7d..d431637 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -245,9 +245,9 @@ } struct osmo_gsup_server * -osmo_gsup_server_create(void *ctx, const char *ip_addr, - uint16_t tcp_port, - osmo_gsup_read_cb_t read_cb) +osmo_gsup_server_create(void *ctx, const char *ip_addr, uint16_t tcp_port, + osmo_gsup_read_cb_t read_cb, + struct llist_head *lu_op_lst) { struct osmo_gsup_server *gsups; int rc; @@ -272,6 +272,8 @@ if (rc < 0) goto failed; + gsups->luop = lu_op_lst; + return gsups; failed: diff --git a/src/gsup_server.h b/src/gsup_server.h index 484a0d7..885fe52 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -14,6 +14,9 @@ /* list of osmo_gsup_conn */ struct llist_head clients; + /* lu_operations list */ + struct llist_head *luop; + struct ipa_server_link *link; osmo_gsup_read_cb_t read_cb; struct llist_head routes; @@ -36,9 +39,10 @@ uint8_t tag); struct osmo_gsup_server *osmo_gsup_server_create(void *ctx, - const char *ip_addr, - uint16_t tcp_port, - osmo_gsup_read_cb_t read_cb); + const char *ip_addr, + uint16_t tcp_port, + osmo_gsup_read_cb_t read_cb, + struct llist_head *lu_op_lst); void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups); diff --git a/src/hlr.c b/src/hlr.c index 95a565e..00a6459 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -260,6 +260,14 @@ rx_purge_ms_req(conn, &gsup); break; /* responses to requests sent by us */ + case OSMO_GSUP_MSGT_DELETE_DATA_ERROR: + LOGP(DMAIN, LOGL_ERROR, "Error while deleting subscriber data " + "for IMSI %s\n", gsup.imsi); + break; + case OSMO_GSUP_MSGT_DELETE_DATA_RESULT: + LOGP(DMAIN, LOGL_ERROR, "Deleting subscriber data for IMSI %s\n", + gsup.imsi); + break; case OSMO_GSUP_MSGT_INSERT_DATA_ERROR: case OSMO_GSUP_MSGT_INSERT_DATA_RESULT: case OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR: @@ -456,7 +464,8 @@ exit(1); } - g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb); + g_hlr->gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb, + &g_lu_ops); if (!g_hlr->gs) { LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n"); exit(1); diff --git a/src/luop.c b/src/luop.c index ecf31b4..937c02c 100644 --- a/src/luop.c +++ b/src/luop.c @@ -266,3 +266,16 @@ lu_op_statechg(luop, LU_S_ISD_SENT); osmo_timer_schedule(&luop->timer, ISD_TIMEOUT_SECS, 0); } + +/*! Transmit Delete Subscriber Data to new VLR/SGSN */ +void lu_op_tx_del_subscr_data(struct lu_operation *luop) +{ + struct osmo_gsup_message gsup; + + fill_gsup_msg(&gsup, luop, OSMO_GSUP_MSGT_DELETE_DATA_REQUEST); + + gsup.cn_domain = OSMO_GSUP_CN_DOMAIN_PS; + + /* Send ISD to new VLR/SGSN */ + _luop_tx_gsup(luop, &gsup); +} diff --git a/src/luop.h b/src/luop.h index 7e2fbb0..ab1bc24 100644 --- a/src/luop.h +++ b/src/luop.h @@ -78,3 +78,4 @@ void lu_op_tx_ack(struct lu_operation *luop); void lu_op_tx_cancel_old(struct lu_operation *luop); void lu_op_tx_insert_subscr_data(struct lu_operation *luop); +void lu_op_tx_del_subscr_data(struct lu_operation *luop); -- To view, visit https://gerrit.osmocom.org/1841 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be Gerrit-PatchSet: 15 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:10:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:10:16 +0000 Subject: osmo-bts[master]: osmo-bts-trx: fix scheduling of broken frames In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1776 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:10:38 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:10:38 +0000 Subject: osmo-bts[master]: osmo-bts-trx: cosmetic log fixes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1974 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:11:21 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:11:21 +0000 Subject: osmo-sip-connector[master]: call: Fix call release handling on mncc connection loss In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1972 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:11:57 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:11:57 +0000 Subject: osmo-sip-connector[master]: mncc: Fix use after free on mncc socket disconnection In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1973 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:12:25 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:12:25 +0000 Subject: python/osmo-python-tests[master]: on Exception during test, also print the actual config In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1922 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:12:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:12:48 +0000 Subject: python/osmo-python-tests[master]: test_all_apps: actually count nr of errors In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1925 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I690dde3711555a3447e5ad4cc0a04a7a869a8296 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:14:30 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:14:30 +0000 Subject: osmo-bts[master]: cosmetic: remove plenk character In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 we normally don't clutter the commitlog with changes like this, but ok, since you went through the effort. Also, what is "plenk"? -- To view, visit https://gerrit.osmocom.org/1975 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ica35c3a9146bacf87942b6f4cac7d24e0a935bae Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:14:52 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 17:14:52 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: The dumbest way possible - I've disabled check in sysmobts-mgr so it always reports temperature instead of critical levels only. -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:16:23 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:16:23 +0000 Subject: openbsc[master]: Add MS time. offset to gsm_lchan In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1699/2/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 332: uint8_t ms_t_offs; one option to avoid having these separate 'member + valid' fields would be to have an integer, and use negative/-1 for invalid. You could even add a MS_TOFFS_INVALID #define to avoid the "-1 magic value" -- To view, visit https://gerrit.osmocom.org/1699 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:16:32 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 17:16:32 +0000 Subject: osmo-bts[master]: cosmetic: remove plenk character In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Adding myself as reviewer out of curiosity regarding "plenk" :) -- To view, visit https://gerrit.osmocom.org/1975 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ica35c3a9146bacf87942b6f4cac7d24e0a935bae Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:17:35 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:17:35 +0000 Subject: osmo-bts[master]: octphy: set tx/rx antenne IDs via VTY In-Reply-To: References: Message-ID: Patch Set 1: I think you're forgetting to save the values? -- To view, visit https://gerrit.osmocom.org/1976 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I872fe3c4d7b593358a4ce2f02cf0726611b9f3aa Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:18:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:18:16 +0000 Subject: osmo-bts[master]: bts: revert trx shutdown order In-Reply-To: References: Message-ID: Patch Set 1: would be great to have a rationale in the commit log as to *why* the order is being reversed. What kind of advantages has it? What kind of bugs does it fix (if any)? -- To view, visit https://gerrit.osmocom.org/1977 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I18485de586b402610f9e98053d69e92bc9b18dc2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:19:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:19:00 +0000 Subject: osmo-bts[master]: l1sap: fix PTCCH detection In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1978 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:19:28 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:19:28 +0000 Subject: osmo-bts[master]: octphy: add CBCH support In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1979 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:20:36 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:20:36 +0000 Subject: osmo-bts[master]: octphy: remove old event control code In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1980/2//COMMIT_MSG Commit Message: Line 9: Enable/Disable events is no longer required, this commit removes it is not required since when? Would be good to have a version number there. Also, did we make sure that this is true for versions != the most recent DSP version, which we still support compiling for? -- To view, visit https://gerrit.osmocom.org/1980 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0652627495f6a9bcb0da2431b8beb839bc22062b Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:20:57 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:20:57 +0000 Subject: osmo-hlr[master]: fix: properly handle error rc by osmo_gsup_conn_ccm_get() In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1952 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26 Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:21:45 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:21:45 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 8: I'll defer to neels on this issue. Please keep in mind to update the manual chapter on logging, if needed. -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:22:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 17:22:13 +0000 Subject: osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:34:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 17:34:58 +0000 Subject: [MERGED] osmo-bts[master]: Use oml-alert CTRL command for temp report In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Use oml-alert CTRL command for temp report ...................................................................... Use oml-alert CTRL command for temp report Send temperature reports via OML alert facility exposed by CTRL protocol. Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Related: OS#1615 --- M src/osmo-bts-sysmo/Makefile.am M src/osmo-bts-sysmo/misc/sysmobts_mgr.c M src/osmo-bts-sysmo/misc/sysmobts_mgr.h M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 4 files changed, 65 insertions(+), 13 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-sysmo/Makefile.am b/src/osmo-bts-sysmo/Makefile.am index 8e39a3a..7b27e70 100644 --- a/src/osmo-bts-sysmo/Makefile.am +++ b/src/osmo-bts-sysmo/Makefile.am @@ -29,7 +29,7 @@ misc/sysmobts_mgr_temp.c \ misc/sysmobts_mgr_calib.c \ eeprom.c -sysmobts_mgr_LDADD = $(LIBGPS_LIBS) $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCTRL_LIBS) $(top_builddir)/src/common/libbts.a $(COMMON_LDADD) +sysmobts_mgr_LDADD = $(LIBGPS_LIBS) $(top_builddir)/src/common/libbts.a $(COMMON_LDADD) sysmobts_util_SOURCES = misc/sysmobts_util.c misc/sysmobts_par.c eeprom.c sysmobts_util_LDADD = $(LIBOSMOCORE_LIBS) diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c index f126db2..e9c59bc 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c @@ -21,6 +21,8 @@ */ #include +#include +#include #include #include #include @@ -28,14 +30,19 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include #include +#include +#include #include "misc/sysmobts_misc.h" #include "misc/sysmobts_mgr.h" @@ -246,10 +253,12 @@ int main(int argc, char **argv) { int rc; - + struct ctrl_connection *ccon; tall_mgr_ctx = talloc_named_const(NULL, 1, "bts manager"); msgb_talloc_ctx_init(tall_mgr_ctx, 0); + + srand(time(NULL)); mgr_log_init(); if (classify_bts() != 0) @@ -294,7 +303,23 @@ exit(3); /* Initialize the temperature control */ - sysmobts_mgr_temp_init(&manager); + ccon = osmo_ctrl_conn_alloc(tall_mgr_ctx, NULL); + rc = -1; + if (ccon) { + ccon->write_queue.bfd.data = ccon; + rc = osmo_sock_init_ofd(&ccon->write_queue.bfd, AF_INET, + SOCK_STREAM, IPPROTO_TCP, + "localhost", OSMO_CTRL_PORT_BTS, + OSMO_SOCK_F_CONNECT); + } + if (rc < 0) + LOGP(DLCTRL, LOGL_ERROR, "Can't connect to CTRL @ localhost:%u\n", + OSMO_CTRL_PORT_BTS); + else + LOGP(DLCTRL, LOGL_NOTICE, "CTRL connected to locahost:%u\n", + OSMO_CTRL_PORT_BTS); + + sysmobts_mgr_temp_init(&manager, ccon); if (sysmobts_mgr_calib_init(&manager) != 0) exit(3); diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h index b393c38..88f4e24 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h @@ -3,7 +3,7 @@ #include #include - +#include #include #include @@ -108,7 +108,8 @@ int sysmobts_mgr_vty_init(void); int sysmobts_mgr_parse_config(struct sysmobts_mgr_instance *mgr); int sysmobts_mgr_nl_init(void); -int sysmobts_mgr_temp_init(struct sysmobts_mgr_instance *mgr); +int sysmobts_mgr_temp_init(struct sysmobts_mgr_instance *mgr, + struct ctrl_connection *ctrl); const char *sysmobts_mgr_temp_get_state(enum sysmobts_temp_state state); diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index 34af2ab..2a15d2e 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -28,6 +28,8 @@ #include #include +#include + static struct sysmobts_mgr_instance *s_mgr; static struct osmo_timer_list temp_ctrl_timer; @@ -185,13 +187,24 @@ } static void sysmobts_mgr_temp_handle(struct sysmobts_mgr_instance *manager, - int critical, int warning) + struct ctrl_connection *ctrl, int critical, + int warning) { - int new_state = next_state(manager->state, critical, warning); + int new_state = next_state(manager->state, critical, warning), rc; + struct ctrl_cmd *rep; + bool send = false; /* Nothing changed */ if (new_state < 0) return; + + rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); + if (!rep) { + LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed.\n"); + } else { + rep->id = talloc_asprintf(rep, "%d", rand()); + rep->variable = "oml-alert"; + } LOGP(DTEMP, LOGL_NOTICE, "Moving from state %s to %s.\n", get_value_string(state_names, manager->state), @@ -206,14 +219,24 @@ break; case STATE_WARNING: execute_warning_act(manager); + rep->value = "Temperature Warning"; + send = true; break; case STATE_CRITICAL: execute_critical_act(manager); + rep->value = "Temperature Critical"; + send = true; break; }; + + if (send) { + rc = ctrl_cmd_send(&ctrl->write_queue, rep); + LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + } + talloc_free(rep); } -static void temp_ctrl_check() +static void temp_ctrl_check(struct ctrl_connection *ctrl) { int rc; int warn_thresh_passed = 0; @@ -275,20 +298,23 @@ } } - sysmobts_mgr_temp_handle(s_mgr, crit_thresh_passed, warn_thresh_passed); + sysmobts_mgr_temp_handle(s_mgr, ctrl, crit_thresh_passed, + warn_thresh_passed); } -static void temp_ctrl_check_cb(void *unused) +static void temp_ctrl_check_cb(void *ctrl) { - temp_ctrl_check(); + temp_ctrl_check(ctrl); /* Check every two minutes? XXX make it configurable! */ osmo_timer_schedule(&temp_ctrl_timer, 2 * 60, 0); } -int sysmobts_mgr_temp_init(struct sysmobts_mgr_instance *mgr) +int sysmobts_mgr_temp_init(struct sysmobts_mgr_instance *mgr, + struct ctrl_connection *ctrl) { s_mgr = mgr; temp_ctrl_timer.cb = temp_ctrl_check_cb; - temp_ctrl_check_cb(NULL); + temp_ctrl_timer.data = ctrl; + temp_ctrl_check_cb(ctrl); return 0; } -- To view, visit https://gerrit.osmocom.org/1630 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If29fbd0ab01fefc76e87b90cf1fbc81b2089ba76 Gerrit-PatchSet: 7 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 6 17:40:30 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 6 Mar 2017 17:40:30 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 8: Sure, but I think we should 1st settle on particular way to resolve this. One option would be to deprecate "everything" completely: remove it from cfg examples and make sure that code which writes configs replace "everything" with "debug". -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 18:07:37 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 6 Mar 2017 18:07:37 +0000 Subject: [PATCH] libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Hello tnt, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/933 to look at the new patch set (#16). libosmocoding: migrate transcoding routines from OsmoBTS There are some projects, such as GR-GSM and OsmocomBB, which would benefit from using one shared implementation of GSM 05.03 code. So, this commit introduces a new sub-library called libosmocoding, which (for now) provides GSM, GPRS and EDGE transcoding routines, migrated from OsmoBTS. The original GSM 05.03 code from OsmoBTS was relicensed under GPLv2-or-later with permission of copyright holders (Andreas Eversberg, Alexander Chemeris and Tom Tsou). The following data types are currently supported: - xCCH - PDTCH (CS 1-4 and MCS 1-9) - TCH/FR - TCH/HR - TCH/AFS - RCH/AHS - RACH - SCH Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 --- M .gitignore A Doxyfile.coding.in M Makefile.am M configure.ac M debian/control M include/Makefile.am A include/osmocom/coding/gsm0503_coding.h A include/osmocom/coding/gsm0503_interleaving.h A include/osmocom/coding/gsm0503_mapping.h A include/osmocom/coding/gsm0503_parity.h A include/osmocom/coding/gsm0503_tables.h A libosmocoding.pc.in A src/coding/Makefile.am A src/coding/gsm0503_coding.c A src/coding/gsm0503_interleaving.c A src/coding/gsm0503_mapping.c A src/coding/gsm0503_parity.c A src/coding/gsm0503_tables.c A src/coding/libosmocoding.map M src/gsm/libosmogsm.map M tests/Makefile.am A tests/coding/coding_test.c A tests/coding/coding_test.ok M tests/testsuite.at M utils/conv_codes_gsm.py 25 files changed, 8,111 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/933/16 -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 16 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Mon Mar 6 18:20:07 2017 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Mon, 6 Mar 2017 18:20:07 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 16: Code-Review+1 I'm assuming that's just a rebase ... (looks like it at least) -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 16 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 18:24:49 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Mon, 6 Mar 2017 18:24:49 +0000 Subject: [PATCH] libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase in DTX mode. Message-ID: Review at https://gerrit.osmocom.org/1982 Fix RTP jitter buffer that never stop to increase in DTX mode. Duration that is passed to the osmo_rtp_send_frame_ext function is based on the last frame and the current one. It then must be added directly to the current timestamp. Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d --- M src/trau/osmo_ortp.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/82/1982/1 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index d4d4ff5..401918a 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -460,7 +460,7 @@ rtp_set_markbit(mblk, marker); rc = rtp_session_sendm_with_ts(rs->sess, mblk, - rs->tx_timestamp); + rs->tx_timestamp + duration); rs->tx_timestamp += duration; if (rc < 0) { /* no need to free() the mblk, as rtp_session_rtp_send() -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne From gerrit-no-reply at lists.osmocom.org Mon Mar 6 18:45:07 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Mon, 6 Mar 2017 18:45:07 +0000 Subject: [PATCH] osmo-bts[master]: Fix RTP duration adjustment not done when speech resumes in ... Message-ID: Review at https://gerrit.osmocom.org/1983 Fix RTP duration adjustment not done when speech resumes in DTX mode. RTP jitter increases continuously because duration is not updated when speech resumes in DTX mode. Change-Id: Ib51ed95a449369222c957b3acebd9ce1f66c5435 --- M src/common/l1sap.c 1 file changed, 2 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/83/1983/1 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 19b38af..b61e561 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -76,12 +76,8 @@ { uint32_t samples_passed, r; - /* don't adjust duration: - - when no DTX enabled at all - - for ONSET RTP packet to avoid timestamp gap with subsequent SPEECH - RTP packet*/ - if (lchan->rtp_tx_marker || - lchan->ts->trx->bts->dtxu == GSM48_DTX_SHALL_NOT_BE_USED) + /* don't adjust duration when DTX is not enabled */ + if (lchan->ts->trx->bts->dtxu == GSM48_DTX_SHALL_NOT_BE_USED) return GSM_RTP_DURATION; if (lchan->tch.last_fn != LCHAN_FN_DUMMY) { -- To view, visit https://gerrit.osmocom.org/1983 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib51ed95a449369222c957b3acebd9ce1f66c5435 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: jfdionne From gerrit-no-reply at lists.osmocom.org Mon Mar 6 18:51:17 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 6 Mar 2017 18:51:17 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 16: > I'm assuming that's just a rebase ... (looks like it at least) Yeah, sure. -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 16 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 19:24:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 19:24:59 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 16: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 16 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 19:25:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 6 Mar 2017 19:25:19 +0000 Subject: [MERGED] libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: libosmocoding: migrate transcoding routines from OsmoBTS ...................................................................... libosmocoding: migrate transcoding routines from OsmoBTS There are some projects, such as GR-GSM and OsmocomBB, which would benefit from using one shared implementation of GSM 05.03 code. So, this commit introduces a new sub-library called libosmocoding, which (for now) provides GSM, GPRS and EDGE transcoding routines, migrated from OsmoBTS. The original GSM 05.03 code from OsmoBTS was relicensed under GPLv2-or-later with permission of copyright holders (Andreas Eversberg, Alexander Chemeris and Tom Tsou). The following data types are currently supported: - xCCH - PDTCH (CS 1-4 and MCS 1-9) - TCH/FR - TCH/HR - TCH/AFS - RCH/AHS - RACH - SCH Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 --- M .gitignore A Doxyfile.coding.in M Makefile.am M configure.ac M debian/control M include/Makefile.am A include/osmocom/coding/gsm0503_coding.h A include/osmocom/coding/gsm0503_interleaving.h A include/osmocom/coding/gsm0503_mapping.h A include/osmocom/coding/gsm0503_parity.h A include/osmocom/coding/gsm0503_tables.h A libosmocoding.pc.in A src/coding/Makefile.am A src/coding/gsm0503_coding.c A src/coding/gsm0503_interleaving.c A src/coding/gsm0503_mapping.c A src/coding/gsm0503_parity.c A src/coding/gsm0503_tables.c A src/coding/libosmocoding.map M src/gsm/libosmogsm.map M tests/Makefile.am A tests/coding/coding_test.c A tests/coding/coding_test.ok M tests/testsuite.at M utils/conv_codes_gsm.py 25 files changed, 8,111 insertions(+), 7 deletions(-) Approvals: tnt: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified -- To view, visit https://gerrit.osmocom.org/933 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1 Gerrit-PatchSet: 16 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Mon Mar 6 19:34:31 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Mon, 6 Mar 2017 19:34:31 +0000 Subject: [PATCH] libosmocore[master]: Fix LAPD UA message buffer memory leak. Message-ID: Review at https://gerrit.osmocom.org/1984 Fix LAPD UA message buffer memory leak. The state check in lapd_dl_reset causes some buffers never to be released. Using talloc report LAPD UA message buffers are never released after each call and cause a memory leak. Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e --- M src/gsm/lapd_core.c 1 file changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/1984/1 diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 5ee88a4..f20b4c0 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -303,8 +303,6 @@ /* reset to IDLE state */ void lapd_dl_reset(struct lapd_datalink *dl) { - if (dl->state == LAPD_STATE_IDLE) - return; LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl); /* enter idle state (and remove eventual cont_res) */ lapd_dl_newstate(dl, LAPD_STATE_IDLE); -- To view, visit https://gerrit.osmocom.org/1984 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: jfdionne From admin at opensuse.org Mon Mar 6 19:53:19 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:53:19 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58bdbe4d38d8f_677f121fc043407d@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/i586 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 187s] /coding/html/search/functions_0.js exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_0.html exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_b.html exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_13.html exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_10.html exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_7.html exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/classes_5.js exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_14.html exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_b.js exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_0.js exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/lib/i386-linux-gnu/libosmocoding.so.0 exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: usr/lib/i386-linux-gnu/libosmocoding.so.0.0.0 exists in debian/tmp but is not installed to anywhere [ 187s] dh_install: missing files, aborting [ 187s] debian/rules:21: recipe for target 'override_dh_install' failed [ 187s] make[1]: *** [override_dh_install] Error 2 [ 187s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 187s] debian/rules:15: recipe for target 'binary' failed [ 187s] make: *** [binary] Error 2 [ 187s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 187s] [ 187s] lamb25 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:02 UTC 2017. [ 187s] [ 187s] ### VM INTERACTION START ### [ 188s] Powering off. [ 188s] [ 173.515541] reboot: Power down [ 188s] ### VM INTERACTION END ### [ 188s] [ 188s] lamb25 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:04 UTC 2017. [ 188s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:53:36 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:53:36 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/x86_64 In-Reply-To: References: Message-ID: <58bdbe6d4d645_677f121fc04346bc@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/x86_64 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/enumvalues_3.js exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_3.html exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_2.html exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_1.html exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/classes_1.js exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_5.js exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_8.js exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_10.html exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_16.html exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_0.js exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_1.html exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_4.js exists in debian/tmp but is not installed to anywhere [ 177s] dh_install: missing files, aborting [ 177s] debian/rules:21: recipe for target 'override_dh_install' failed [ 177s] make[1]: *** [override_dh_install] Error 2 [ 177s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 177s] debian/rules:15: recipe for target 'binary' failed [ 177s] make: *** [binary] Error 2 [ 177s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 177s] [ 177s] lamb07 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:20 UTC 2017. [ 177s] [ 177s] ### VM INTERACTION START ### [ 177s] [ 162.344134] serial8250: too much work for irq4 [ 178s] Powering off. [ 178s] ### VM INTERACTION END ### [ 178s] [ 178s] lamb07 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:21 UTC 2017. [ 178s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:53:36 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:53:36 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58bdbe6dae220_677f121fc04347ed@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_9.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_4.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_c.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_16.js exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/typedefs_4.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_8.js exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_13.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/typedefs_4.js exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/functions_4.js exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/functions_6.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_a.html exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/lib/x86_64-linux-gnu/libosmocoding.so.0 exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: usr/lib/x86_64-linux-gnu/libosmocoding.so.0.0.0 exists in debian/tmp but is not installed to anywhere [ 174s] dh_install: missing files, aborting [ 174s] debian/rules:21: recipe for target 'override_dh_install' failed [ 174s] make[1]: *** [override_dh_install] Error 2 [ 174s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 174s] debian/rules:15: recipe for target 'binary' failed [ 174s] make: *** [binary] Error 2 [ 174s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 174s] [ 174s] lamb59 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:22 UTC 2017. [ 174s] [ 174s] ### VM INTERACTION START ### [ 178s] [ 163.892785] reboot: Power down [ 178s] ### VM INTERACTION END ### [ 178s] [ 178s] lamb59 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:26 UTC 2017. [ 178s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:53:53 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:53:53 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/x86_64 In-Reply-To: References: Message-ID: <58bdbe8b36936_6785121fc0435920@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/x86_64 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_2.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_2.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_12.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_7.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_7.js exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_f.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/enums_3.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_a.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_d.js exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_2.js exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_1.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_1.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_11.html exists in debian/tmp but is not installed to anywhere [ 188s] dh_install: missing files, aborting [ 188s] debian/rules:21: recipe for target 'override_dh_install' failed [ 188s] make[1]: *** [override_dh_install] Error 2 [ 188s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 188s] debian/rules:15: recipe for target 'binary' failed [ 188s] make: *** [binary] Error 2 [ 188s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 188s] [ 188s] lamb22 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:36 UTC 2017. [ 188s] [ 188s] ### VM INTERACTION START ### [ 192s] [ 178.125635] reboot: Power down [ 192s] ### VM INTERACTION END ### [ 192s] [ 192s] lamb22 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:40 UTC 2017. [ 192s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:54:10 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:54:10 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58bdbe8df82c_6785121fc043607f@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/functions_5.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_c.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_11.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_16.js exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/search_l.png exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/groups_2.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_6.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/enums_0.js exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/typedefs_0.js exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_a.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_13.html exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/lib/i386-linux-gnu/libosmocoding.so.0 exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: usr/lib/i386-linux-gnu/libosmocoding.so.0.0.0 exists in debian/tmp but is not installed to anywhere [ 233s] dh_install: missing files, aborting [ 233s] debian/rules:21: recipe for target 'override_dh_install' failed [ 233s] make[1]: *** [override_dh_install] Error 2 [ 233s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 233s] debian/rules:15: recipe for target 'binary' failed [ 233s] make: *** [binary] Error 2 [ 233s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 233s] [ 233s] cloud111 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:53:58 UTC 2017. [ 233s] [ 233s] ### VM INTERACTION START ### [ 237s] [ 212.576626] reboot: Power down [ 240s] ### VM INTERACTION END ### [ 240s] [ 240s] cloud111 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:54:04 UTC 2017. [ 240s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:54:44 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:54:44 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58bdbeaa4f7e9_6785121fc0436324@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/search_r.png exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/functions_7.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_10.html exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_4.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_12.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/variables_14.html exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/functions_1.html exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/typedefs_2.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_9.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/enums_3.html exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/files_4.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/classes_4.html exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: usr/share/doc/libosmocore/coding/html/search/all_f.js exists in debian/tmp but is not installed to anywhere [ 225s] dh_install: missing files, aborting [ 225s] debian/rules:21: recipe for target 'override_dh_install' failed [ 225s] make[1]: *** [override_dh_install] Error 2 [ 225s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 225s] debian/rules:15: recipe for target 'binary' failed [ 225s] make: *** [binary] Error 2 [ 225s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 225s] [ 225s] cloud138 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:54:25 UTC 2017. [ 225s] [ 225s] ### VM INTERACTION START ### [ 228s] [ 208.911134] reboot: Power down [ 230s] ### VM INTERACTION END ### [ 230s] [ 230s] cloud138 failed "build libosmocore_0.9.6.20170306.dsc" at Mon Mar 6 19:54:31 UTC 2017. [ 230s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:55:39 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:55:39 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58bdbee2f2734_677f121fc0434863@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 110s] from bts.cpp:21: [ 110s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 110s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 110s] abs(long long __x) { return __builtin_llabs (__x); } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 110s] abs(long __i) { return __builtin_labs(__i); } [ 110s] ^~~ [ 110s] Makefile:778: recipe for target 'bts.lo' failed [ 110s] make[2]: *** [bts.lo] Error 1 [ 110s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 110s] Makefile:403: recipe for target 'all-recursive' failed [ 110s] make[1]: *** [all-recursive] Error 1 [ 110s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 110s] dh_auto_build: make -j1 returned exit code 2 [ 110s] debian/rules:12: recipe for target 'build' failed [ 110s] make: *** [build] Error 2 [ 110s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 110s] [ 110s] lamb67 failed "build osmo-pcu_0.3.20170306.dsc" at Mon Mar 6 19:55:31 UTC 2017. [ 110s] [ 110s] ### VM INTERACTION START ### [ 113s] [ 99.915127] reboot: Power down [ 113s] ### VM INTERACTION END ### [ 113s] [ 113s] lamb67 failed "build osmo-pcu_0.3.20170306.dsc" at Mon Mar 6 19:55:35 UTC 2017. [ 113s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Mon Mar 6 19:56:45 2017 From: admin at opensuse.org (OBS Notification) Date: Mon, 06 Mar 2017 19:56:45 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58bdbf0ea5e71_6778121fc04320b6@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 110s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 110s] from /usr/include/osmocom/core/timer.h:35, [ 110s] from ./bts.h:29, [ 110s] from bts.cpp:21: [ 110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 110s] abs(long long __x) { return __builtin_llabs (__x); } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 110s] abs(long __i) { return __builtin_labs(__i); } [ 110s] ^~~ [ 110s] Makefile:778: recipe for target 'bts.lo' failed [ 110s] make[2]: *** [bts.lo] Error 1 [ 110s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 110s] Makefile:403: recipe for target 'all-recursive' failed [ 110s] make[1]: *** [all-recursive] Error 1 [ 110s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 110s] dh_auto_build: make -j1 returned exit code 2 [ 110s] debian/rules:12: recipe for target 'build' failed [ 110s] make: *** [build] Error 2 [ 110s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 110s] [ 110s] lamb60 failed "build osmo-pcu_0.3.20170306.dsc" at Mon Mar 6 19:56:37 UTC 2017. [ 110s] [ 110s] ### VM INTERACTION START ### [ 113s] [ 99.974512] reboot: Power down [ 113s] ### VM INTERACTION END ### [ 113s] [ 113s] lamb60 failed "build osmo-pcu_0.3.20170306.dsc" at Mon Mar 6 19:56:41 UTC 2017. [ 113s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Mon Mar 6 21:09:35 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 6 Mar 2017 21:09:35 +0000 Subject: [MERGED] osmo-sip-connector[master]: contrib: Add Dockerfile to build and configure a FreeSWITCH In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: contrib: Add Dockerfile to build and configure a FreeSWITCH ...................................................................... contrib: Add Dockerfile to build and configure a FreeSWITCH Rhizomatica is using FreeSWITCH and we should have an easy way to test against it. A docker container with exposed ports seems like the easiest. FreeSWITCH by default is giving us some exmaple numbers: * 5000 a menu... that allows DTMF * 9195 an echo test * 9198 tetris. The config is copied on top of the default/big config that is installed. If this PBX should be reached from the outside one needs to change 127.0.0.1 to the external address and maybe configure the acl as well to add more CIDRs. Besides that make container make run Will build it and start the container. Takes a bit of time and requires docker. With it configure one can see things like: 2017-03-05 15:32:49.913912 [INFO] switch_channel.c:515 RECV DTMF 3:2000 2017-03-05 15:32:50.952752 [INFO] switch_channel.c:515 RECV DTMF 2:2000 Now to test DTMF in the system. Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c --- A contrib/testpbx/Dockerfile A contrib/testpbx/Makefile A contrib/testpbx/README A contrib/testpbx/configs/acl.conf.xml A contrib/testpbx/configs/default.xml A contrib/testpbx/configs/internal.xml A contrib/testpbx/configs/public.xml A contrib/testpbx/configs/switch.conf.xml A contrib/testpbx/configs/vars.xml 9 files changed, 2,053 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/testpbx/Dockerfile b/contrib/testpbx/Dockerfile new file mode 100644 index 0000000..2f03424 --- /dev/null +++ b/contrib/testpbx/Dockerfile @@ -0,0 +1,25 @@ +FROM debian:jessie + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget + +# They use comodo.. it was hacked.. so don't bother trying to +# install the right root certificates... +RUN wget --no-check-certificate -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add - +RUN echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list +RUN apt-get update && apt-get install -y freeswitch-meta-all + + +# Change the config... +COPY configs/vars.xml /etc/freeswitch/vars.xml +COPY configs/acl.conf.xml /etc/freeswitch/autoload_configs/acl.conf.xml +COPY configs/switch.conf.xml /etc/freeswitch/autoload_configs/switch.conf.xml +COPY configs/public.xml /etc/freeswitch/dialplan/public.xml +COPY configs/default.xml /etc/freeswitch/dialplan/default.xml +COPY configs/internal.xml /etc/freeswitch/sip_profiles/internal.xml + +# Prepare to run +# Reduce the number of ports.. as otherwise we wait a long time +EXPOSE 6000-6020/udp +EXPOSE 5060/udp +CMD /usr/bin/freeswitch -nf diff --git a/contrib/testpbx/Makefile b/contrib/testpbx/Makefile new file mode 100644 index 0000000..ea34799 --- /dev/null +++ b/contrib/testpbx/Makefile @@ -0,0 +1,12 @@ +all: container + +container: + docker build -t osmo-freeswitch-pbx:latest . + +run: + docker run -it --name=osmo-freeswitch-pbx \ + -p 5060:5060/udp -p 6000-6020:6000-6020/udp \ + --rm=true osmo-freeswitch-pbx:latest + +stop: + docker rm -f osmo-freeswitch-pbx diff --git a/contrib/testpbx/README b/contrib/testpbx/README new file mode 100644 index 0000000..11c16f0 --- /dev/null +++ b/contrib/testpbx/README @@ -0,0 +1,29 @@ +Provide a semi-stable remote PBX system. + +There is no preferred PBX but YaTE is pretty small and still +functional enough. Anyway Rhizomatica is using FreeSWITCH so +let's use that for testing. + +This is creating a docker image with a SIP configuration that +will allow to record audio, have a DTMF menu using some fixed +numbers. Feel free to extend it to support bidirectional calls +and routing. + +It is using the Debian packages and installs everything as I +am not interested to track dependencies and see what is missing. +Again feel free to optimize the size. + + +Build: + make + + or + + docker build -t yourimagename:tag . + + +Run: + + docker run yourimagename:tag + +SIP is exposed on 5060 of your port and audio on 6000-6020 diff --git a/contrib/testpbx/configs/acl.conf.xml b/contrib/testpbx/configs/acl.conf.xml new file mode 100644 index 0000000..70a64ea --- /dev/null +++ b/contrib/testpbx/configs/acl.conf.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/default.xml b/contrib/testpbx/configs/default.xml new file mode 100644 index 0000000..f0e0af1 --- /dev/null +++ b/contrib/testpbx/configs/default.xml @@ -0,0 +1,832 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/internal.xml b/contrib/testpbx/configs/internal.xml new file mode 100644 index 0000000..2a679fb --- /dev/null +++ b/contrib/testpbx/configs/internal.xml @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/public.xml b/contrib/testpbx/configs/public.xml new file mode 100644 index 0000000..d9b1d17 --- /dev/null +++ b/contrib/testpbx/configs/public.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/switch.conf.xml b/contrib/testpbx/configs/switch.conf.xml new file mode 100644 index 0000000..1a82409 --- /dev/null +++ b/contrib/testpbx/configs/switch.conf.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/testpbx/configs/vars.xml b/contrib/testpbx/configs/vars.xml new file mode 100644 index 0000000..1cb826d --- /dev/null +++ b/contrib/testpbx/configs/vars.xml @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- To view, visit https://gerrit.osmocom.org/1970 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Keith Whyte Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 21:10:02 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 6 Mar 2017 21:10:02 +0000 Subject: osmo-sip-connector[master]: call: Fix call release handling on mncc connection loss In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1972 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 6 21:10:07 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 6 Mar 2017 21:10:07 +0000 Subject: [MERGED] osmo-sip-connector[master]: call: Fix call release handling on mncc connection loss In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: call: Fix call release handling on mncc connection loss ...................................................................... call: Fix call release handling on mncc connection loss The app_mncc_disconnected will be called when the MNCC socket is down and lead to all calls being released. It directly released the call but did not stop the MNCC CMD timer. Go through the call release callback. ==3618== at 0x804A18A: app_mncc_disconnected (app.c:49) ==3618== by 0x804B52D: close_connection (mncc.c:255) This lead to the timer not being removed: ==3593== Invalid read of size 4 ==3593== at 0x4305D42: rb_first (rbtree.c:294) ==3593== by 0x42FCB37: osmo_timers_update (timer.c:220) ==3593== by 0x804D1D5: evpoll (evpoll.c:89) ==3593== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x8049AA6: main (main.c:171) ==3593== Address 0x47f3380 is 232 bytes inside a block of size 272 free'd ==3593== at 0x402A3A8: free (vg_replace_malloc.c:473) ==3593== by 0x42E7FD1: ??? (in /usr/lib/i386-linux-gnu/libtalloc.so.2.1.5) ==3593== by 0x804A3C4: call_leg_release (call.c:83) ==3593== by 0x804A188: app_mncc_disconnected (app.c:48) ==3593== by 0x804B52D: close_connection (mncc.c:255) ==3593== by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145) ==3593== by 0x804CC86: check_setup (mncc.c:435) ==3593== by 0x804CC86: mncc_data (mncc.c:795) ==3593== by 0x42FCF94: osmo_fd_disp_fds (select.c:167) ==3593== by 0x804D1F2: evpoll (evpoll.c:92) ==3593== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3593== by 0x8049AA6: main (main.c:171) Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e --- M src/app.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, but someone else must approve Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/src/app.c b/src/app.c index 4a88b36..585b577 100644 --- a/src/app.c +++ b/src/app.c @@ -45,9 +45,9 @@ LOGP(DAPP, LOGL_NOTICE, "Going to release call(%u) due MNCC.\n", call->id); if (call->initial) - call_leg_release(call->initial); + call->initial->release_call(call->initial); if (call->remote) - call_leg_release(call->remote); + call->remote->release_call(call->remote); } } -- To view, visit https://gerrit.osmocom.org/1972 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e Gerrit-PatchSet: 2 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 6 21:10:08 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 6 Mar 2017 21:10:08 +0000 Subject: [MERGED] osmo-sip-connector[master]: mncc: Fix use after free on mncc socket disconnection In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: mncc: Fix use after free on mncc socket disconnection ...................................................................... mncc: Fix use after free on mncc socket disconnection When the MNCC socket breaks down we would release all callds but when there is no remote call the call would be released before if (call->remote) ... is being executed leading to a use after free. Fix it by copying the legs first and assuming the call will be gone after that. ==3618== Invalid read of size 4 ==3618== at 0x804A18A: app_mncc_disconnected (app.c:49) ==3618== by 0x804B52D: close_connection (mncc.c:255) ==3618== by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145) ==3618== by 0x804CC86: check_setup (mncc.c:435) ==3618== by 0x804CC86: mncc_data (mncc.c:795) ==3618== by 0x42FCF94: osmo_fd_disp_fds (select.c:167) ==3618== by 0x804D1F2: evpoll (evpoll.c:92) ==3618== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x8049AA6: main (main.c:171) ==3618== Address 0x47f3258 is 64 bytes inside a block of size 76 free'd ==3618== at 0x402A3A8: free (vg_replace_malloc.c:473) ==3618== by 0x42E7FD1: ??? (in /usr/lib/i386-linux-gnu/libtalloc.so.2.1.5) ==3618== by 0x804A3FD: call_leg_release (call.c:87) ==3618== by 0x804A186: app_mncc_disconnected (app.c:48) ==3618== by 0x804B52D: close_connection (mncc.c:255) ==3618== by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145) ==3618== by 0x804CC86: check_setup (mncc.c:435) ==3618== by 0x804CC86: mncc_data (mncc.c:795) ==3618== by 0x42FCF94: osmo_fd_disp_fds (select.c:167) ==3618== by 0x804D1F2: evpoll (evpoll.c:92) ==3618== by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1) ==3618== by 0x8049AA6: main (main.c:171) ==3618== Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a --- M src/app.c 1 file changed, 12 insertions(+), 5 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/app.c b/src/app.c index 585b577..97123b8 100644 --- a/src/app.c +++ b/src/app.c @@ -29,6 +29,7 @@ struct call *call, *tmp; llist_for_each_entry_safe(call, tmp, &g_call_list, entry) { + struct call_leg *initial, *remote; int has_mncc = 0; if (call->initial && call->initial->type == CALL_TYPE_MNCC) @@ -40,14 +41,20 @@ continue; /* - * this call has a MNCC component and we will release it. + * this call has a MNCC component and we will release it now. + * There might be no remote so on the release of the initial + * leg the call might be gone. We may not touch call beyond + * that point. */ LOGP(DAPP, LOGL_NOTICE, "Going to release call(%u) due MNCC.\n", call->id); - if (call->initial) - call->initial->release_call(call->initial); - if (call->remote) - call->remote->release_call(call->remote); + initial = call->initial; + remote = call->remote; + call = NULL; + if (initial) + initial->release_call(initial); + if (remote) + remote->release_call(remote); } } -- To view, visit https://gerrit.osmocom.org/1973 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a Gerrit-PatchSet: 2 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 7 07:43:26 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 07:43:26 +0000 Subject: [PATCH] osmo-sip-connector[master]: evpoll: Add workaround for usage of IP_RECVERR in sofia-sip Message-ID: Review at https://gerrit.osmocom.org/1985 evpoll: Add workaround for usage of IP_RECVERR in sofia-sip We are using glib to benefit from the sofia-sip-glib eventloop integration and set a poll func (evpoll) to be called by glib to integrate with the rest of libosmocore. Sofia-sip will use IP_RECVERR to enable error reporting on the socket and then sets SU_WAIT_ERR (mapped to POLLERR if not using kqueue) in the internal events flag of the socket. This will be registered with a su_wait (mapped to struct pollfd) and then glib will be called with g_source_add_poll. At this point the the fd->events will still have the POLLERR bit set. Before glib is calling its internal poll routine or our one it will copy all registered fd into an array and mask the events flags: /* In direct contradiction to the Unix98 spec, IRIX runs into * difficulty if you pass in POLLERR, POLLHUP or POLLNVAL * flags in the events field of the pollfd while it should * just ignoring them. So we mask them out here. */ events = pollrec->fd->events & ~(G_IO_ERR|G_IO_HUP|G_IO_NVAL); This leads to the POLLERR flag never been set in the revents of the struct poll_fd and as such we never put them in the exceptionset and as such: static int tport_base_wakeup(tport_t *self, int events) { int error = 0; if (events & SU_WAIT_ERR) error = tport_error_event(self); tport_base_wakeup will never call tport_error_event. And the error will be stuck in the socket data forever and recvmsg will return a zero length packet. And this will repeat until the end of time. As a first hack I mapped SU_WAIT_ERR to POLLPRI but when using select the Linux kernel will not put the socket error into the except queue unless the sockopt SOCK_SELECT_ERR_QUEUE is used. One option might be to use poll and then map the select requirements to poll. Right now I just signal POLLERR as well to trigger tport_error_event. This will result in extra syscalls for each received UDP message right now. Change-Id: I5bec4a7b70f421ab670e649e5bc1ea6faf59707c --- M src/evpoll.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/85/1985/1 diff --git a/src/evpoll.c b/src/evpoll.c index 3273bd0..087955f 100644 --- a/src/evpoll.c +++ b/src/evpoll.c @@ -98,7 +98,7 @@ continue; if (FD_ISSET(fds[i].fd, &readset)) - fds[i].revents = POLLIN; + fds[i].revents = POLLIN | POLLERR; if (FD_ISSET(fds[i].fd, &writeset)) fds[i].revents |= POLLOUT; if (FD_ISSET(fds[i].fd, &exceptset)) -- To view, visit https://gerrit.osmocom.org/1985 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5bec4a7b70f421ab670e649e5bc1ea6faf59707c Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Tue Mar 7 08:44:32 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 08:44:32 +0000 Subject: osmo-bts[master]: Fix RTP duration adjustment not done when speech resumes in ... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1983 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51ed95a449369222c957b3acebd9ce1f66c5435 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 08:46:57 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 08:46:57 +0000 Subject: libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase in DTX mode. In-Reply-To: References: Message-ID: Patch Set 1: How does it work in non-DTX case? -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 08:52:55 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 08:52:55 +0000 Subject: osmo-bts[master]: l1sap: fix PTCCH detection In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1978 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 09:03:15 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 7 Mar 2017 09:03:15 +0000 Subject: osmo-bts[master]: cosmetic: remove plenk character In-Reply-To: References: Message-ID: Patch Set 1: > we normally don't clutter the commitlog with changes like this, but > ok, since you went through the effort. Also, what is "plenk"? I have seen that while diffing the octasic changes. How is the correct procedure to submit those type of changes? Collecting them silently and submitting many of them at once sounds right to me. -- To view, visit https://gerrit.osmocom.org/1975 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ica35c3a9146bacf87942b6f4cac7d24e0a935bae Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 10:54:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 7 Mar 2017 10:54:59 +0000 Subject: osmo-pcu[master]: BTS: fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 er actually, abs(uint32_t) makes no sense, it indicates that the calculation won't work out signedly anyway. There should be a cast to a signed type > 32bit *before* the calculation is carried out, e.g. cast the first operand / all operands. -- To view, visit https://gerrit.osmocom.org/1981 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 11:05:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 7 Mar 2017 11:05:44 +0000 Subject: osmo-bts[master]: cosmetic: remove plenk character In-Reply-To: References: Message-ID: Patch Set 1: > > we normally don't clutter the commitlog with changes like this, > but > > ok, since you went through the effort. Also, what is "plenk"? > > I have seen that while diffing the octasic changes. > > How is the correct procedure to submit those type of changes? > Collecting them silently and submitting many of them at once sounds > right to me. I would simply not change it unless we also change the code itself in the given line. Or, if at all, change all whitespace/style issues of the entire file at once. -- To view, visit https://gerrit.osmocom.org/1975 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ica35c3a9146bacf87942b6f4cac7d24e0a935bae Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:14:20 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 13:14:20 +0000 Subject: libosmocore[master]: Fix LAPD UA message buffer memory leak. In-Reply-To: References: Message-ID: Patch Set 1: I think it's suboptimal - instead of removing the "already in idle state" check entirely (which will lead to unnecessary calls to subsequent functions) it's better to keep it but ..free() memory before return. -- To view, visit https://gerrit.osmocom.org/1984 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:31:01 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 13:31:01 +0000 Subject: [PATCH] libosmocore[master]: select: Find the highest fd when filling the fd_sets Message-ID: Review at https://gerrit.osmocom.org/1986 select: Find the highest fd when filling the fd_sets Instead of returning maxfd, which is the highest fd ever seen, take the highest we have seen on this iteration. This makes a tiny difference for the osmo-sip-connector and its event loop integration. select.c ignores the return value of this function right now. Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4 --- M src/select.c 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/1986/1 diff --git a/src/select.c b/src/select.c index ab0734e..10c0b0c 100644 --- a/src/select.c +++ b/src/select.c @@ -121,6 +121,7 @@ { fd_set *readset = _rset, *writeset = _wset, *exceptset = _eset; struct osmo_fd *ufd; + int highfd = 0; llist_for_each_entry(ufd, &osmo_fds, list) { if (ufd->when & BSC_FD_READ) @@ -131,9 +132,12 @@ if (ufd->when & BSC_FD_EXCEPT) FD_SET(ufd->fd, exceptset); + + if (ufd->fd > highfd) + highfd = ufd->fd; } - return maxfd; + return highfd; } inline int osmo_fd_disp_fds(void *_rset, void *_wset, void *_eset) -- To view, visit https://gerrit.osmocom.org/1986 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:31:40 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 7 Mar 2017 13:31:40 +0000 Subject: [PATCH] libosmo-abis[master]: add basic unixsocket support In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1198 to look at the new patch set (#17). add basic unixsocket support Allow to connect to a unix socket for communicating with LAPD. Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a --- M include/osmocom/abis/e1_input.h M src/Makefile.am M src/e1_input.c M src/e1_input_vty.c A src/input/unixsocket.c A src/input/unixsocket_proto.h 6 files changed, 409 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/98/1198/17 diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index 4c7f8a0..8501d5c 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -183,6 +183,7 @@ unsigned int num; const char *name; unsigned int port_nr; + char *sock_path; struct rate_ctr_group *rate_ctr; /* keepalive configuration */ @@ -303,6 +304,9 @@ struct gsm_network; int ipaccess_setup(struct gsm_network *gsmnet); +/* activate superchannel or deactive to use timeslots. only valid for unixsocket driver */ +void e1inp_ericsson_set_altc(struct e1inp_line *unixlinue, int superchannel); + extern struct llist_head e1inp_driver_list; extern struct llist_head e1inp_line_list; diff --git a/src/Makefile.am b/src/Makefile.am index b24f2cf..760c1f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,7 +24,8 @@ input/lapd.c \ input/lapd_pcap.c \ input/misdn.c \ - input/rs232.c + input/rs232.c \ + input/unixsocket.c libosmotrau_la_CFLAGS = $(AM_CFLAGS) $(ORTP_CFLAGS) libosmotrau_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(TRAU_LIBVERSION) diff --git a/src/e1_input.c b/src/e1_input.c index 09fea59..1e1252e 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -807,6 +807,7 @@ void e1inp_dahdi_init(void); void e1inp_ipaccess_init(void); void e1inp_rs232_init(void); +void e1inp_unixsocket_init(void); void e1inp_init(void) { @@ -821,4 +822,5 @@ #endif e1inp_ipaccess_init(); e1inp_rs232_init(); + e1inp_unixsocket_init(); } diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c index 5320bb3..9d69586 100644 --- a/src/e1_input_vty.c +++ b/src/e1_input_vty.c @@ -38,12 +38,13 @@ /* CONFIG */ -#define E1_DRIVER_NAMES "(misdn|misdn_lapd|dahdi|ipa)" +#define E1_DRIVER_NAMES "(misdn|misdn_lapd|dahdi|ipa|unixsocket)" #define E1_DRIVER_HELP "mISDN supported E1 Card (kernel LAPD)\n" \ "mISDN supported E1 Card (userspace LAPD)\n" \ "DAHDI supported E1/T1/J1 Card\n" \ "IPA TCP/IP input\n" \ - "HSL TCP/IP input" + "HSL TCP/IP input\n" \ + "Unix socket input\n" #define E1_LINE_HELP "Configure E1/T1/J1 Line\n" "Line Number\n" @@ -84,6 +85,25 @@ } line->port_nr = atoi(argv[1]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_e1line_socket, cfg_e1_line_socket_cmd, + "e1_line <0-255> socket .SOCKET", + E1_LINE_HELP "Set socket path for unixsocket\n" + "socket path\n") +{ + struct e1inp_line *line; + int e1_nr = atoi(argv[0]); + + line = e1inp_line_find(e1_nr); + if (!line) { + vty_out(vty, "%% Line %d doesn't exist%s", e1_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + line->sock_path = talloc_strdup(line, argv[1]); return CMD_SUCCESS; } @@ -363,6 +383,7 @@ vty_install_default(L_E1INP_NODE); install_element(L_E1INP_NODE, &cfg_e1_line_driver_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_port_cmd); + install_element(L_E1INP_NODE, &cfg_e1_line_socket_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_name_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_params_cmd); diff --git a/src/input/unixsocket.c b/src/input/unixsocket.c new file mode 100644 index 0000000..cfe4f5c --- /dev/null +++ b/src/input/unixsocket.c @@ -0,0 +1,347 @@ +/* OpenBSC Abis receive lapd over a unix socket */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * + * Author: Alexander Couzens + * Based on other e1_input drivers. + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "internal.h" +#include "unixsocket_proto.h" + +void *tall_unixsocket_ctx; +#define UNIXSOCKET_ALLOC_SIZE 1600 +#define UNIXSOCKET_SOCK_PATH_DEFAULT "/tmp/osmo_abis_line_" + +struct unixsocket_line { + struct osmo_fd fd; +}; + +static int unixsocket_line_update(struct e1inp_line *line); +static int ts_want_write(struct e1inp_ts *e1i_ts); + +static int unixsocket_exception_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + + LOGP(DLINP, LOGL_ERROR, + "Socket connection failure, reconnecting... (line=%p, fd=%d)\n", + line, bfd->fd); + + /* Unregister faulty file descriptor from select loop */ + if(osmo_fd_is_registered(bfd)) { + LOGP(DLINP, LOGL_DEBUG, + "removing inactive socket from select loop... (line=%p, fd=%d)\n", + line, bfd->fd); + osmo_fd_unregister(bfd); + } + + /* Close faulty file descriptor */ + close(bfd->fd); + + unixsocket_line_update(line); + + return 0; +} + +static int unixsocket_read_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + struct msgb *msg = msgb_alloc(UNIXSOCKET_ALLOC_SIZE, "UNIXSOCKET TS"); + uint8_t version; + uint8_t controldata; + int ret; + + if (!msg) + return -ENOMEM; + + ret = read(bfd->fd, msg->data, UNIXSOCKET_ALLOC_SIZE - 16); + if (ret == 0) { + unixsocket_exception_cb(bfd); + goto fail; + } else if (ret < 0) { + perror("read "); + goto fail; + } else if (ret < 2) { + /* packet must be at least 2 byte long to hold version + control/data header */ + LOGP(DLMI, LOGL_ERROR, "received to small packet: %d < 2", ret); + ret = -1; + goto fail; + } + msgb_put(msg, ret); + + LOGP(DLMI, LOGL_DEBUG, "rx msg: %s (fd=%d)\n", + osmo_hexdump_nospc(msg->data, msg->len), bfd->fd); + + /* check version header */ + version = msgb_pull_u8(msg); + controldata = msgb_pull_u8(msg); + + if (version != UNIXSOCKET_PROTO_VERSION) { + LOGP(DLMI, LOGL_ERROR, "received message with invalid version %d. valid: %d", + ret, UNIXSOCKET_PROTO_VERSION); + ret = -1; + goto fail; + } + + switch (controldata) { + case UNIXSOCKET_PROTO_DATA: + return e1inp_rx_ts_lapd(&line->ts[0], msg); + case UNIXSOCKET_PROTO_CONTROL: + LOGP(DLMI, LOGL_ERROR, "received (invalid) control message."); + ret = -1; + break; + default: + LOGP(DLMI, LOGL_ERROR, "received invalid message."); + ret = -1; + break; + } +fail: + msgb_free(msg); + return ret; +} + +static void timeout_ts1_write(void *data) +{ + struct e1inp_ts *e1i_ts = (struct e1inp_ts *)data; + + /* trigger write of ts1, due to tx delay timer */ + ts_want_write(e1i_ts); +} + +static int unixsocket_write_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + struct e1inp_ts *e1i_ts = &line->ts[0]; + struct msgb *msg; + struct e1inp_sign_link *sign_link; + + bfd->when &= ~BSC_FD_WRITE; + + /* get the next msg for this timeslot */ + msg = e1inp_tx_ts(e1i_ts, &sign_link); + if (!msg) { + /* no message after tx delay timer */ + LOGP(DLINP, LOGL_INFO, + "no message available (line=%p)\n", line); + return 0; + } + + /* set tx delay timer for next event */ + e1i_ts->sign.tx_timer.cb = timeout_ts1_write; + e1i_ts->sign.tx_timer.data = e1i_ts; + + osmo_timer_schedule(&e1i_ts->sign.tx_timer, 0, e1i_ts->sign.delay); + + LOGP(DLINP, LOGL_DEBUG, "sending: %s (line=%p)\n", + msgb_hexdump(msg), line); + lapd_transmit(e1i_ts->lapd, sign_link->tei, + sign_link->sapi, msg); + + return 0; +} + +static int unixsocket_cb(struct osmo_fd *bfd, unsigned int what) +{ + int ret = 0; + + if (what & BSC_FD_READ) + ret = unixsocket_read_cb(bfd); + if (what & BSC_FD_WRITE) + ret = unixsocket_write_cb(bfd); + + return ret; +} + +static int ts_want_write(struct e1inp_ts *e1i_ts) +{ + struct unixsocket_line *line = e1i_ts->line->driver_data; + + line->fd.when |= BSC_FD_WRITE; + + return 0; +} + +static void unixsocket_write_msg(struct msgb *msg, struct osmo_fd *bfd) { + int ret; + + LOGP(DLMI, LOGL_DEBUG, "tx msg: %s (fd=%d)\n", + osmo_hexdump_nospc(msg->data, msg->len), bfd->fd); + + ret = write(bfd->fd, msg->data, msg->len); + msgb_free(msg); + if (ret == -1) + unixsocket_exception_cb(bfd); + else if (ret < 0) + LOGP(DLMI, LOGL_NOTICE, "%s write failed %d\n", __func__, ret); +} + +/*! + * \brief unixsocket_write_msg lapd callback for data to unixsocket + * \param msg + * \param cbdata + */ +static void unixsocket_write_msg_lapd_cb(struct msgb *msg, void *cbdata) +{ + struct osmo_fd *bfd = cbdata; + + /* data|control */ + msgb_push_u8(msg, UNIXSOCKET_PROTO_DATA); + /* add version header */ + msgb_push_u8(msg, UNIXSOCKET_PROTO_VERSION); + + unixsocket_write_msg(msg, bfd); +} + +static int unixsocket_line_update(struct e1inp_line *line) +{ + struct unixsocket_line *config; + char sock_path[PATH_MAX]; + int ret = 0; + int i; + + if (line->sock_path) + strcpy(sock_path, line->sock_path); + else + sprintf(sock_path, "%s%d", UNIXSOCKET_SOCK_PATH_DEFAULT, + line->num); + + LOGP(DLINP, LOGL_NOTICE, "line update (line=%p)\n", line); + + if (!line->driver_data) + line->driver_data = talloc_zero(line, struct unixsocket_line); + + if (!line->driver_data) { + LOGP(DLINP, LOGL_ERROR, + "OOM in line update (line=%p)\n", line); + return -ENOMEM; + } + + config = line->driver_data; + config->fd.data = line; + config->fd.when = BSC_FD_READ; + config->fd.cb = unixsocket_cb; + + /* Open unix domain socket */ + ret = osmo_sock_unix_init(SOCK_SEQPACKET, 0, sock_path, + OSMO_SOCK_F_CONNECT); + if (ret < 0) { + /* Note: We will not free the allocated driver_data memory if + * opening the socket fails. The caller may want to call this + * function multiple times using config->fd.data as line + * parameter. Freeing now would destroy that reference. */ + LOGP(DLINP, LOGL_ERROR, + "unable to open socket: %s (line=%p, fd=%d)\n", sock_path, + line, config->fd.fd); + return ret; + } + LOGP(DLINP, LOGL_DEBUG, + "successfully opend (new) socket: %s (line=%p, fd=%d, ret=%d)\n", + sock_path, line, config->fd.fd, ret); + config->fd.fd = ret; + + /* Register socket in select loop */ + if (osmo_fd_register(&config->fd) < 0) { + LOGP(DLINP, LOGL_ERROR, + "error registering new socket (line=%p, fd=%d)\n", + line, config->fd.fd); + close(config->fd.fd); + return -EIO; + } + + /* Set line parameter */ + for (i = 0; i < ARRAY_SIZE(line->ts); i++) { + struct e1inp_ts *e1i_ts = &line->ts[i]; + if (!e1i_ts->lapd) { + e1i_ts->lapd = lapd_instance_alloc(1, + unixsocket_write_msg_lapd_cb, &config->fd, + e1inp_dlsap_up, e1i_ts, &lapd_profile_abis); + } + } + + /* Ensure ericsson-superchannel is turned of when + * a new connection is made */ + e1inp_ericsson_set_altc(line, 0); + + return ret; +} + +struct e1inp_driver unixsocket_driver = { + .name = "unixsocket", + .want_write = ts_want_write, + .line_update = unixsocket_line_update, + .default_delay = 0, +}; + +void e1inp_unixsocket_init(void) +{ + tall_unixsocket_ctx = talloc_named_const(libosmo_abis_ctx, 1, "unixsocket"); + e1inp_driver_register(&unixsocket_driver); +} + +void e1inp_ericsson_set_altc(struct e1inp_line *unixline, int superchannel) +{ + struct unixsocket_line *config; + struct msgb *msg; + + if (!unixline) + return; + + if (unixline->driver != &unixsocket_driver) { + LOGP(DLMI, LOGL_NOTICE, "altc is only supported by unixsocket\n"); + return; + } + + config = unixline->driver_data; + if (!config) { + LOGP(DLMI, LOGL_NOTICE, "e1inp driver not yet initialized.\n"); + return; + } + + + msg = msgb_alloc_headroom(200, 100, "ALTC"); + + /* version header */ + msgb_put_u8(msg, UNIXSOCKET_PROTO_VERSION); + /* data|control */ + msgb_put_u8(msg, UNIXSOCKET_PROTO_CONTROL); + + /* magic */ + msgb_put_u32(msg, 0x23004200); + msgb_put_u8(msg, superchannel ? 1 : 0); + + unixsocket_write_msg(msg, &config->fd); +} + diff --git a/src/input/unixsocket_proto.h b/src/input/unixsocket_proto.h new file mode 100644 index 0000000..25718ff --- /dev/null +++ b/src/input/unixsocket_proto.h @@ -0,0 +1,31 @@ + +#ifndef UNIXSOCKET_PROTO_H +#define UNIXSOCKET_PROTO_H + +/* The unix socket protocol is using a 2 byte header + * containg the version and type. + * + * header: | 1b version | 1b type | + * + * for data packets it would be + * + * data: | 0x1 | 0x0 | lapd ..| + * control: | 0x1 | 0x1 | control payload | + * + * Atm there is only one control packet: + * - set_altc (superchannel or timeslot) + * + * set_altc payload: + * | 4b magic | 1b new_state| + * | 0x23004200 | 0x0 | to timeslot + * | 0x23004200 | 0x1 | to superchannel + */ + +#define UNIXSOCKET_PROTO_VERSION 0x1 + +enum { + UNIXSOCKET_PROTO_DATA = 0x0, + UNIXSOCKET_PROTO_CONTROL = 0x1, +}; + +#endif /* UNIXSOCKET_PROTO_H */ -- To view, visit https://gerrit.osmocom.org/1198 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a Gerrit-PatchSet: 17 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:40:08 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 7 Mar 2017 13:40:08 +0000 Subject: [PATCH] libosmo-abis[master]: add basic unixsocket support In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1198 to look at the new patch set (#18). add basic unixsocket support Allow to connect to a unix socket for communicating with LAPD. Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a --- M include/osmocom/abis/e1_input.h A include/osmocom/abis/unixsocket_proto.h M src/Makefile.am M src/e1_input.c M src/e1_input_vty.c A src/input/unixsocket.c 6 files changed, 409 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/98/1198/18 diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index 4c7f8a0..8501d5c 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -183,6 +183,7 @@ unsigned int num; const char *name; unsigned int port_nr; + char *sock_path; struct rate_ctr_group *rate_ctr; /* keepalive configuration */ @@ -303,6 +304,9 @@ struct gsm_network; int ipaccess_setup(struct gsm_network *gsmnet); +/* activate superchannel or deactive to use timeslots. only valid for unixsocket driver */ +void e1inp_ericsson_set_altc(struct e1inp_line *unixlinue, int superchannel); + extern struct llist_head e1inp_driver_list; extern struct llist_head e1inp_line_list; diff --git a/include/osmocom/abis/unixsocket_proto.h b/include/osmocom/abis/unixsocket_proto.h new file mode 100644 index 0000000..25718ff --- /dev/null +++ b/include/osmocom/abis/unixsocket_proto.h @@ -0,0 +1,31 @@ + +#ifndef UNIXSOCKET_PROTO_H +#define UNIXSOCKET_PROTO_H + +/* The unix socket protocol is using a 2 byte header + * containg the version and type. + * + * header: | 1b version | 1b type | + * + * for data packets it would be + * + * data: | 0x1 | 0x0 | lapd ..| + * control: | 0x1 | 0x1 | control payload | + * + * Atm there is only one control packet: + * - set_altc (superchannel or timeslot) + * + * set_altc payload: + * | 4b magic | 1b new_state| + * | 0x23004200 | 0x0 | to timeslot + * | 0x23004200 | 0x1 | to superchannel + */ + +#define UNIXSOCKET_PROTO_VERSION 0x1 + +enum { + UNIXSOCKET_PROTO_DATA = 0x0, + UNIXSOCKET_PROTO_CONTROL = 0x1, +}; + +#endif /* UNIXSOCKET_PROTO_H */ diff --git a/src/Makefile.am b/src/Makefile.am index b24f2cf..760c1f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,7 +24,8 @@ input/lapd.c \ input/lapd_pcap.c \ input/misdn.c \ - input/rs232.c + input/rs232.c \ + input/unixsocket.c libosmotrau_la_CFLAGS = $(AM_CFLAGS) $(ORTP_CFLAGS) libosmotrau_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(TRAU_LIBVERSION) diff --git a/src/e1_input.c b/src/e1_input.c index 09fea59..1e1252e 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -807,6 +807,7 @@ void e1inp_dahdi_init(void); void e1inp_ipaccess_init(void); void e1inp_rs232_init(void); +void e1inp_unixsocket_init(void); void e1inp_init(void) { @@ -821,4 +822,5 @@ #endif e1inp_ipaccess_init(); e1inp_rs232_init(); + e1inp_unixsocket_init(); } diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c index 5320bb3..9d69586 100644 --- a/src/e1_input_vty.c +++ b/src/e1_input_vty.c @@ -38,12 +38,13 @@ /* CONFIG */ -#define E1_DRIVER_NAMES "(misdn|misdn_lapd|dahdi|ipa)" +#define E1_DRIVER_NAMES "(misdn|misdn_lapd|dahdi|ipa|unixsocket)" #define E1_DRIVER_HELP "mISDN supported E1 Card (kernel LAPD)\n" \ "mISDN supported E1 Card (userspace LAPD)\n" \ "DAHDI supported E1/T1/J1 Card\n" \ "IPA TCP/IP input\n" \ - "HSL TCP/IP input" + "HSL TCP/IP input\n" \ + "Unix socket input\n" #define E1_LINE_HELP "Configure E1/T1/J1 Line\n" "Line Number\n" @@ -84,6 +85,25 @@ } line->port_nr = atoi(argv[1]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_e1line_socket, cfg_e1_line_socket_cmd, + "e1_line <0-255> socket .SOCKET", + E1_LINE_HELP "Set socket path for unixsocket\n" + "socket path\n") +{ + struct e1inp_line *line; + int e1_nr = atoi(argv[0]); + + line = e1inp_line_find(e1_nr); + if (!line) { + vty_out(vty, "%% Line %d doesn't exist%s", e1_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + line->sock_path = talloc_strdup(line, argv[1]); return CMD_SUCCESS; } @@ -363,6 +383,7 @@ vty_install_default(L_E1INP_NODE); install_element(L_E1INP_NODE, &cfg_e1_line_driver_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_port_cmd); + install_element(L_E1INP_NODE, &cfg_e1_line_socket_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_name_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_params_cmd); diff --git a/src/input/unixsocket.c b/src/input/unixsocket.c new file mode 100644 index 0000000..4f287ae --- /dev/null +++ b/src/input/unixsocket.c @@ -0,0 +1,347 @@ +/* OpenBSC Abis receive lapd over a unix socket */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * + * Author: Alexander Couzens + * Based on other e1_input drivers. + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include "internal.h" + +void *tall_unixsocket_ctx; +#define UNIXSOCKET_ALLOC_SIZE 1600 +#define UNIXSOCKET_SOCK_PATH_DEFAULT "/tmp/osmo_abis_line_" + +struct unixsocket_line { + struct osmo_fd fd; +}; + +static int unixsocket_line_update(struct e1inp_line *line); +static int ts_want_write(struct e1inp_ts *e1i_ts); + +static int unixsocket_exception_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + + LOGP(DLINP, LOGL_ERROR, + "Socket connection failure, reconnecting... (line=%p, fd=%d)\n", + line, bfd->fd); + + /* Unregister faulty file descriptor from select loop */ + if(osmo_fd_is_registered(bfd)) { + LOGP(DLINP, LOGL_DEBUG, + "removing inactive socket from select loop... (line=%p, fd=%d)\n", + line, bfd->fd); + osmo_fd_unregister(bfd); + } + + /* Close faulty file descriptor */ + close(bfd->fd); + + unixsocket_line_update(line); + + return 0; +} + +static int unixsocket_read_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + struct msgb *msg = msgb_alloc(UNIXSOCKET_ALLOC_SIZE, "UNIXSOCKET TS"); + uint8_t version; + uint8_t controldata; + int ret; + + if (!msg) + return -ENOMEM; + + ret = read(bfd->fd, msg->data, UNIXSOCKET_ALLOC_SIZE - 16); + if (ret == 0) { + unixsocket_exception_cb(bfd); + goto fail; + } else if (ret < 0) { + perror("read "); + goto fail; + } else if (ret < 2) { + /* packet must be at least 2 byte long to hold version + control/data header */ + LOGP(DLMI, LOGL_ERROR, "received to small packet: %d < 2", ret); + ret = -1; + goto fail; + } + msgb_put(msg, ret); + + LOGP(DLMI, LOGL_DEBUG, "rx msg: %s (fd=%d)\n", + osmo_hexdump_nospc(msg->data, msg->len), bfd->fd); + + /* check version header */ + version = msgb_pull_u8(msg); + controldata = msgb_pull_u8(msg); + + if (version != UNIXSOCKET_PROTO_VERSION) { + LOGP(DLMI, LOGL_ERROR, "received message with invalid version %d. valid: %d", + ret, UNIXSOCKET_PROTO_VERSION); + ret = -1; + goto fail; + } + + switch (controldata) { + case UNIXSOCKET_PROTO_DATA: + return e1inp_rx_ts_lapd(&line->ts[0], msg); + case UNIXSOCKET_PROTO_CONTROL: + LOGP(DLMI, LOGL_ERROR, "received (invalid) control message."); + ret = -1; + break; + default: + LOGP(DLMI, LOGL_ERROR, "received invalid message."); + ret = -1; + break; + } +fail: + msgb_free(msg); + return ret; +} + +static void timeout_ts1_write(void *data) +{ + struct e1inp_ts *e1i_ts = (struct e1inp_ts *)data; + + /* trigger write of ts1, due to tx delay timer */ + ts_want_write(e1i_ts); +} + +static int unixsocket_write_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + struct e1inp_ts *e1i_ts = &line->ts[0]; + struct msgb *msg; + struct e1inp_sign_link *sign_link; + + bfd->when &= ~BSC_FD_WRITE; + + /* get the next msg for this timeslot */ + msg = e1inp_tx_ts(e1i_ts, &sign_link); + if (!msg) { + /* no message after tx delay timer */ + LOGP(DLINP, LOGL_INFO, + "no message available (line=%p)\n", line); + return 0; + } + + /* set tx delay timer for next event */ + e1i_ts->sign.tx_timer.cb = timeout_ts1_write; + e1i_ts->sign.tx_timer.data = e1i_ts; + + osmo_timer_schedule(&e1i_ts->sign.tx_timer, 0, e1i_ts->sign.delay); + + LOGP(DLINP, LOGL_DEBUG, "sending: %s (line=%p)\n", + msgb_hexdump(msg), line); + lapd_transmit(e1i_ts->lapd, sign_link->tei, + sign_link->sapi, msg); + + return 0; +} + +static int unixsocket_cb(struct osmo_fd *bfd, unsigned int what) +{ + int ret = 0; + + if (what & BSC_FD_READ) + ret = unixsocket_read_cb(bfd); + if (what & BSC_FD_WRITE) + ret = unixsocket_write_cb(bfd); + + return ret; +} + +static int ts_want_write(struct e1inp_ts *e1i_ts) +{ + struct unixsocket_line *line = e1i_ts->line->driver_data; + + line->fd.when |= BSC_FD_WRITE; + + return 0; +} + +static void unixsocket_write_msg(struct msgb *msg, struct osmo_fd *bfd) { + int ret; + + LOGP(DLMI, LOGL_DEBUG, "tx msg: %s (fd=%d)\n", + osmo_hexdump_nospc(msg->data, msg->len), bfd->fd); + + ret = write(bfd->fd, msg->data, msg->len); + msgb_free(msg); + if (ret == -1) + unixsocket_exception_cb(bfd); + else if (ret < 0) + LOGP(DLMI, LOGL_NOTICE, "%s write failed %d\n", __func__, ret); +} + +/*! + * \brief unixsocket_write_msg lapd callback for data to unixsocket + * \param msg + * \param cbdata + */ +static void unixsocket_write_msg_lapd_cb(struct msgb *msg, void *cbdata) +{ + struct osmo_fd *bfd = cbdata; + + /* data|control */ + msgb_push_u8(msg, UNIXSOCKET_PROTO_DATA); + /* add version header */ + msgb_push_u8(msg, UNIXSOCKET_PROTO_VERSION); + + unixsocket_write_msg(msg, bfd); +} + +static int unixsocket_line_update(struct e1inp_line *line) +{ + struct unixsocket_line *config; + char sock_path[PATH_MAX]; + int ret = 0; + int i; + + if (line->sock_path) + strcpy(sock_path, line->sock_path); + else + sprintf(sock_path, "%s%d", UNIXSOCKET_SOCK_PATH_DEFAULT, + line->num); + + LOGP(DLINP, LOGL_NOTICE, "line update (line=%p)\n", line); + + if (!line->driver_data) + line->driver_data = talloc_zero(line, struct unixsocket_line); + + if (!line->driver_data) { + LOGP(DLINP, LOGL_ERROR, + "OOM in line update (line=%p)\n", line); + return -ENOMEM; + } + + config = line->driver_data; + config->fd.data = line; + config->fd.when = BSC_FD_READ; + config->fd.cb = unixsocket_cb; + + /* Open unix domain socket */ + ret = osmo_sock_unix_init(SOCK_SEQPACKET, 0, sock_path, + OSMO_SOCK_F_CONNECT); + if (ret < 0) { + /* Note: We will not free the allocated driver_data memory if + * opening the socket fails. The caller may want to call this + * function multiple times using config->fd.data as line + * parameter. Freeing now would destroy that reference. */ + LOGP(DLINP, LOGL_ERROR, + "unable to open socket: %s (line=%p, fd=%d)\n", sock_path, + line, config->fd.fd); + return ret; + } + LOGP(DLINP, LOGL_DEBUG, + "successfully opend (new) socket: %s (line=%p, fd=%d, ret=%d)\n", + sock_path, line, config->fd.fd, ret); + config->fd.fd = ret; + + /* Register socket in select loop */ + if (osmo_fd_register(&config->fd) < 0) { + LOGP(DLINP, LOGL_ERROR, + "error registering new socket (line=%p, fd=%d)\n", + line, config->fd.fd); + close(config->fd.fd); + return -EIO; + } + + /* Set line parameter */ + for (i = 0; i < ARRAY_SIZE(line->ts); i++) { + struct e1inp_ts *e1i_ts = &line->ts[i]; + if (!e1i_ts->lapd) { + e1i_ts->lapd = lapd_instance_alloc(1, + unixsocket_write_msg_lapd_cb, &config->fd, + e1inp_dlsap_up, e1i_ts, &lapd_profile_abis); + } + } + + /* Ensure ericsson-superchannel is turned of when + * a new connection is made */ + e1inp_ericsson_set_altc(line, 0); + + return ret; +} + +struct e1inp_driver unixsocket_driver = { + .name = "unixsocket", + .want_write = ts_want_write, + .line_update = unixsocket_line_update, + .default_delay = 0, +}; + +void e1inp_unixsocket_init(void) +{ + tall_unixsocket_ctx = talloc_named_const(libosmo_abis_ctx, 1, "unixsocket"); + e1inp_driver_register(&unixsocket_driver); +} + +void e1inp_ericsson_set_altc(struct e1inp_line *unixline, int superchannel) +{ + struct unixsocket_line *config; + struct msgb *msg; + + if (!unixline) + return; + + if (unixline->driver != &unixsocket_driver) { + LOGP(DLMI, LOGL_NOTICE, "altc is only supported by unixsocket\n"); + return; + } + + config = unixline->driver_data; + if (!config) { + LOGP(DLMI, LOGL_NOTICE, "e1inp driver not yet initialized.\n"); + return; + } + + + msg = msgb_alloc_headroom(200, 100, "ALTC"); + + /* version header */ + msgb_put_u8(msg, UNIXSOCKET_PROTO_VERSION); + /* data|control */ + msgb_put_u8(msg, UNIXSOCKET_PROTO_CONTROL); + + /* magic */ + msgb_put_u32(msg, 0x23004200); + msgb_put_u8(msg, superchannel ? 1 : 0); + + unixsocket_write_msg(msg, &config->fd); +} + -- To view, visit https://gerrit.osmocom.org/1198 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a Gerrit-PatchSet: 18 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:44:51 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 7 Mar 2017 13:44:51 +0000 Subject: [PATCH] libosmo-abis[master]: add basic unixsocket support In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1198 to look at the new patch set (#19). add basic unixsocket support Allow to connect to a unix socket for communicating with LAPD. Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a --- M include/Makefile.am M include/osmocom/abis/e1_input.h A include/osmocom/abis/unixsocket_proto.h M src/Makefile.am M src/e1_input.c M src/e1_input_vty.c A src/input/unixsocket.c 7 files changed, 411 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/98/1198/19 diff --git a/include/Makefile.am b/include/Makefile.am index 16fa506..2048520 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -3,4 +3,5 @@ nobase_include_HEADERS = osmocom/abis/ipa.h osmocom/abis/trau_frame.h \ osmocom/abis/ipa_proxy.h osmocom/abis/ipaccess.h osmocom/abis/abis.h \ osmocom/abis/subchan_demux.h osmocom/abis/e1_input.h \ - osmocom/abis/lapd.h osmocom/abis/lapd_pcap.h osmocom/trau/osmo_ortp.h + osmocom/abis/lapd.h osmocom/abis/lapd_pcap.h osmocom/trau/osmo_ortp.h \ + osmocom/abis/unixsocket_proto.h diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index 4c7f8a0..8501d5c 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -183,6 +183,7 @@ unsigned int num; const char *name; unsigned int port_nr; + char *sock_path; struct rate_ctr_group *rate_ctr; /* keepalive configuration */ @@ -303,6 +304,9 @@ struct gsm_network; int ipaccess_setup(struct gsm_network *gsmnet); +/* activate superchannel or deactive to use timeslots. only valid for unixsocket driver */ +void e1inp_ericsson_set_altc(struct e1inp_line *unixlinue, int superchannel); + extern struct llist_head e1inp_driver_list; extern struct llist_head e1inp_line_list; diff --git a/include/osmocom/abis/unixsocket_proto.h b/include/osmocom/abis/unixsocket_proto.h new file mode 100644 index 0000000..25718ff --- /dev/null +++ b/include/osmocom/abis/unixsocket_proto.h @@ -0,0 +1,31 @@ + +#ifndef UNIXSOCKET_PROTO_H +#define UNIXSOCKET_PROTO_H + +/* The unix socket protocol is using a 2 byte header + * containg the version and type. + * + * header: | 1b version | 1b type | + * + * for data packets it would be + * + * data: | 0x1 | 0x0 | lapd ..| + * control: | 0x1 | 0x1 | control payload | + * + * Atm there is only one control packet: + * - set_altc (superchannel or timeslot) + * + * set_altc payload: + * | 4b magic | 1b new_state| + * | 0x23004200 | 0x0 | to timeslot + * | 0x23004200 | 0x1 | to superchannel + */ + +#define UNIXSOCKET_PROTO_VERSION 0x1 + +enum { + UNIXSOCKET_PROTO_DATA = 0x0, + UNIXSOCKET_PROTO_CONTROL = 0x1, +}; + +#endif /* UNIXSOCKET_PROTO_H */ diff --git a/src/Makefile.am b/src/Makefile.am index b24f2cf..760c1f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,7 +24,8 @@ input/lapd.c \ input/lapd_pcap.c \ input/misdn.c \ - input/rs232.c + input/rs232.c \ + input/unixsocket.c libosmotrau_la_CFLAGS = $(AM_CFLAGS) $(ORTP_CFLAGS) libosmotrau_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(TRAU_LIBVERSION) diff --git a/src/e1_input.c b/src/e1_input.c index 09fea59..1e1252e 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -807,6 +807,7 @@ void e1inp_dahdi_init(void); void e1inp_ipaccess_init(void); void e1inp_rs232_init(void); +void e1inp_unixsocket_init(void); void e1inp_init(void) { @@ -821,4 +822,5 @@ #endif e1inp_ipaccess_init(); e1inp_rs232_init(); + e1inp_unixsocket_init(); } diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c index 5320bb3..9d69586 100644 --- a/src/e1_input_vty.c +++ b/src/e1_input_vty.c @@ -38,12 +38,13 @@ /* CONFIG */ -#define E1_DRIVER_NAMES "(misdn|misdn_lapd|dahdi|ipa)" +#define E1_DRIVER_NAMES "(misdn|misdn_lapd|dahdi|ipa|unixsocket)" #define E1_DRIVER_HELP "mISDN supported E1 Card (kernel LAPD)\n" \ "mISDN supported E1 Card (userspace LAPD)\n" \ "DAHDI supported E1/T1/J1 Card\n" \ "IPA TCP/IP input\n" \ - "HSL TCP/IP input" + "HSL TCP/IP input\n" \ + "Unix socket input\n" #define E1_LINE_HELP "Configure E1/T1/J1 Line\n" "Line Number\n" @@ -84,6 +85,25 @@ } line->port_nr = atoi(argv[1]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_e1line_socket, cfg_e1_line_socket_cmd, + "e1_line <0-255> socket .SOCKET", + E1_LINE_HELP "Set socket path for unixsocket\n" + "socket path\n") +{ + struct e1inp_line *line; + int e1_nr = atoi(argv[0]); + + line = e1inp_line_find(e1_nr); + if (!line) { + vty_out(vty, "%% Line %d doesn't exist%s", e1_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + line->sock_path = talloc_strdup(line, argv[1]); return CMD_SUCCESS; } @@ -363,6 +383,7 @@ vty_install_default(L_E1INP_NODE); install_element(L_E1INP_NODE, &cfg_e1_line_driver_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_port_cmd); + install_element(L_E1INP_NODE, &cfg_e1_line_socket_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_name_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_cmd); install_element(L_E1INP_NODE, &cfg_e1_line_keepalive_params_cmd); diff --git a/src/input/unixsocket.c b/src/input/unixsocket.c new file mode 100644 index 0000000..4f287ae --- /dev/null +++ b/src/input/unixsocket.c @@ -0,0 +1,347 @@ +/* OpenBSC Abis receive lapd over a unix socket */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * + * Author: Alexander Couzens + * Based on other e1_input drivers. + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include "internal.h" + +void *tall_unixsocket_ctx; +#define UNIXSOCKET_ALLOC_SIZE 1600 +#define UNIXSOCKET_SOCK_PATH_DEFAULT "/tmp/osmo_abis_line_" + +struct unixsocket_line { + struct osmo_fd fd; +}; + +static int unixsocket_line_update(struct e1inp_line *line); +static int ts_want_write(struct e1inp_ts *e1i_ts); + +static int unixsocket_exception_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + + LOGP(DLINP, LOGL_ERROR, + "Socket connection failure, reconnecting... (line=%p, fd=%d)\n", + line, bfd->fd); + + /* Unregister faulty file descriptor from select loop */ + if(osmo_fd_is_registered(bfd)) { + LOGP(DLINP, LOGL_DEBUG, + "removing inactive socket from select loop... (line=%p, fd=%d)\n", + line, bfd->fd); + osmo_fd_unregister(bfd); + } + + /* Close faulty file descriptor */ + close(bfd->fd); + + unixsocket_line_update(line); + + return 0; +} + +static int unixsocket_read_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + struct msgb *msg = msgb_alloc(UNIXSOCKET_ALLOC_SIZE, "UNIXSOCKET TS"); + uint8_t version; + uint8_t controldata; + int ret; + + if (!msg) + return -ENOMEM; + + ret = read(bfd->fd, msg->data, UNIXSOCKET_ALLOC_SIZE - 16); + if (ret == 0) { + unixsocket_exception_cb(bfd); + goto fail; + } else if (ret < 0) { + perror("read "); + goto fail; + } else if (ret < 2) { + /* packet must be at least 2 byte long to hold version + control/data header */ + LOGP(DLMI, LOGL_ERROR, "received to small packet: %d < 2", ret); + ret = -1; + goto fail; + } + msgb_put(msg, ret); + + LOGP(DLMI, LOGL_DEBUG, "rx msg: %s (fd=%d)\n", + osmo_hexdump_nospc(msg->data, msg->len), bfd->fd); + + /* check version header */ + version = msgb_pull_u8(msg); + controldata = msgb_pull_u8(msg); + + if (version != UNIXSOCKET_PROTO_VERSION) { + LOGP(DLMI, LOGL_ERROR, "received message with invalid version %d. valid: %d", + ret, UNIXSOCKET_PROTO_VERSION); + ret = -1; + goto fail; + } + + switch (controldata) { + case UNIXSOCKET_PROTO_DATA: + return e1inp_rx_ts_lapd(&line->ts[0], msg); + case UNIXSOCKET_PROTO_CONTROL: + LOGP(DLMI, LOGL_ERROR, "received (invalid) control message."); + ret = -1; + break; + default: + LOGP(DLMI, LOGL_ERROR, "received invalid message."); + ret = -1; + break; + } +fail: + msgb_free(msg); + return ret; +} + +static void timeout_ts1_write(void *data) +{ + struct e1inp_ts *e1i_ts = (struct e1inp_ts *)data; + + /* trigger write of ts1, due to tx delay timer */ + ts_want_write(e1i_ts); +} + +static int unixsocket_write_cb(struct osmo_fd *bfd) +{ + struct e1inp_line *line = bfd->data; + struct e1inp_ts *e1i_ts = &line->ts[0]; + struct msgb *msg; + struct e1inp_sign_link *sign_link; + + bfd->when &= ~BSC_FD_WRITE; + + /* get the next msg for this timeslot */ + msg = e1inp_tx_ts(e1i_ts, &sign_link); + if (!msg) { + /* no message after tx delay timer */ + LOGP(DLINP, LOGL_INFO, + "no message available (line=%p)\n", line); + return 0; + } + + /* set tx delay timer for next event */ + e1i_ts->sign.tx_timer.cb = timeout_ts1_write; + e1i_ts->sign.tx_timer.data = e1i_ts; + + osmo_timer_schedule(&e1i_ts->sign.tx_timer, 0, e1i_ts->sign.delay); + + LOGP(DLINP, LOGL_DEBUG, "sending: %s (line=%p)\n", + msgb_hexdump(msg), line); + lapd_transmit(e1i_ts->lapd, sign_link->tei, + sign_link->sapi, msg); + + return 0; +} + +static int unixsocket_cb(struct osmo_fd *bfd, unsigned int what) +{ + int ret = 0; + + if (what & BSC_FD_READ) + ret = unixsocket_read_cb(bfd); + if (what & BSC_FD_WRITE) + ret = unixsocket_write_cb(bfd); + + return ret; +} + +static int ts_want_write(struct e1inp_ts *e1i_ts) +{ + struct unixsocket_line *line = e1i_ts->line->driver_data; + + line->fd.when |= BSC_FD_WRITE; + + return 0; +} + +static void unixsocket_write_msg(struct msgb *msg, struct osmo_fd *bfd) { + int ret; + + LOGP(DLMI, LOGL_DEBUG, "tx msg: %s (fd=%d)\n", + osmo_hexdump_nospc(msg->data, msg->len), bfd->fd); + + ret = write(bfd->fd, msg->data, msg->len); + msgb_free(msg); + if (ret == -1) + unixsocket_exception_cb(bfd); + else if (ret < 0) + LOGP(DLMI, LOGL_NOTICE, "%s write failed %d\n", __func__, ret); +} + +/*! + * \brief unixsocket_write_msg lapd callback for data to unixsocket + * \param msg + * \param cbdata + */ +static void unixsocket_write_msg_lapd_cb(struct msgb *msg, void *cbdata) +{ + struct osmo_fd *bfd = cbdata; + + /* data|control */ + msgb_push_u8(msg, UNIXSOCKET_PROTO_DATA); + /* add version header */ + msgb_push_u8(msg, UNIXSOCKET_PROTO_VERSION); + + unixsocket_write_msg(msg, bfd); +} + +static int unixsocket_line_update(struct e1inp_line *line) +{ + struct unixsocket_line *config; + char sock_path[PATH_MAX]; + int ret = 0; + int i; + + if (line->sock_path) + strcpy(sock_path, line->sock_path); + else + sprintf(sock_path, "%s%d", UNIXSOCKET_SOCK_PATH_DEFAULT, + line->num); + + LOGP(DLINP, LOGL_NOTICE, "line update (line=%p)\n", line); + + if (!line->driver_data) + line->driver_data = talloc_zero(line, struct unixsocket_line); + + if (!line->driver_data) { + LOGP(DLINP, LOGL_ERROR, + "OOM in line update (line=%p)\n", line); + return -ENOMEM; + } + + config = line->driver_data; + config->fd.data = line; + config->fd.when = BSC_FD_READ; + config->fd.cb = unixsocket_cb; + + /* Open unix domain socket */ + ret = osmo_sock_unix_init(SOCK_SEQPACKET, 0, sock_path, + OSMO_SOCK_F_CONNECT); + if (ret < 0) { + /* Note: We will not free the allocated driver_data memory if + * opening the socket fails. The caller may want to call this + * function multiple times using config->fd.data as line + * parameter. Freeing now would destroy that reference. */ + LOGP(DLINP, LOGL_ERROR, + "unable to open socket: %s (line=%p, fd=%d)\n", sock_path, + line, config->fd.fd); + return ret; + } + LOGP(DLINP, LOGL_DEBUG, + "successfully opend (new) socket: %s (line=%p, fd=%d, ret=%d)\n", + sock_path, line, config->fd.fd, ret); + config->fd.fd = ret; + + /* Register socket in select loop */ + if (osmo_fd_register(&config->fd) < 0) { + LOGP(DLINP, LOGL_ERROR, + "error registering new socket (line=%p, fd=%d)\n", + line, config->fd.fd); + close(config->fd.fd); + return -EIO; + } + + /* Set line parameter */ + for (i = 0; i < ARRAY_SIZE(line->ts); i++) { + struct e1inp_ts *e1i_ts = &line->ts[i]; + if (!e1i_ts->lapd) { + e1i_ts->lapd = lapd_instance_alloc(1, + unixsocket_write_msg_lapd_cb, &config->fd, + e1inp_dlsap_up, e1i_ts, &lapd_profile_abis); + } + } + + /* Ensure ericsson-superchannel is turned of when + * a new connection is made */ + e1inp_ericsson_set_altc(line, 0); + + return ret; +} + +struct e1inp_driver unixsocket_driver = { + .name = "unixsocket", + .want_write = ts_want_write, + .line_update = unixsocket_line_update, + .default_delay = 0, +}; + +void e1inp_unixsocket_init(void) +{ + tall_unixsocket_ctx = talloc_named_const(libosmo_abis_ctx, 1, "unixsocket"); + e1inp_driver_register(&unixsocket_driver); +} + +void e1inp_ericsson_set_altc(struct e1inp_line *unixline, int superchannel) +{ + struct unixsocket_line *config; + struct msgb *msg; + + if (!unixline) + return; + + if (unixline->driver != &unixsocket_driver) { + LOGP(DLMI, LOGL_NOTICE, "altc is only supported by unixsocket\n"); + return; + } + + config = unixline->driver_data; + if (!config) { + LOGP(DLMI, LOGL_NOTICE, "e1inp driver not yet initialized.\n"); + return; + } + + + msg = msgb_alloc_headroom(200, 100, "ALTC"); + + /* version header */ + msgb_put_u8(msg, UNIXSOCKET_PROTO_VERSION); + /* data|control */ + msgb_put_u8(msg, UNIXSOCKET_PROTO_CONTROL); + + /* magic */ + msgb_put_u32(msg, 0x23004200); + msgb_put_u8(msg, superchannel ? 1 : 0); + + unixsocket_write_msg(msg, &config->fd); +} + -- To view, visit https://gerrit.osmocom.org/1198 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a Gerrit-PatchSet: 19 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:47:56 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 7 Mar 2017 13:47:56 +0000 Subject: libosmo-abis[master]: add basic unixsocket support In-Reply-To: References: Message-ID: Patch Set 19: @laforge: last changes: I've added the unixsocket_proto.h to the includes. -- To view, visit https://gerrit.osmocom.org/1198 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia5723b09a5c68a0505829dc732def981e60a907a Gerrit-PatchSet: 19 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:50:08 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 13:50:08 +0000 Subject: [PATCH] libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1582 to look at the new patch set (#9). vty: fix "logging level ... everything" option * remove unused parameter from logging_vty_add_cmds() * remove log_vty_command_*() from public API as it's only used by logging_vty_add_cmds() * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * make "logging level ... everything" into alias for "... debug" * mark log level descriptors static Related: OS#71 Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c --- M TODO-RELEASE M include/osmocom/core/logging.h M include/osmocom/vty/logging.h M src/logging.c M src/vty/logging_vty.c M tests/vty/vty_test.c 6 files changed, 23 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/1582/9 diff --git a/TODO-RELEASE b/TODO-RELEASE index a23fcea..42b4ed8 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,6 +8,7 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmocore new function osmo_sock_get_name() +libosmocore API change remove log_vty_command_string() and log_vty_command_description() libosmogsm/gsup ABI change fix AUTS length to 14, not 16 (length is implicit) libosmogsm/oap ABI change fix AUTS length to 14, not 16 (length is implicit) osmo-auc-gen UI change fix AUTS length to 14, not 16 (length is implicit) diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 7b28b2c..f40f7d3 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -327,10 +327,6 @@ void log_add_target(struct log_target *target); void log_del_target(struct log_target *target); -/* Generate command string for VTY use */ -const char *log_vty_command_string(const struct log_info *info); -const char *log_vty_command_description(const struct log_info *info); - struct log_target *log_target_find(int type, const char *fname); extern struct llist_head osmo_log_target_list; diff --git a/include/osmocom/vty/logging.h b/include/osmocom/vty/logging.h index 9e4b98f..544d117 100644 --- a/include/osmocom/vty/logging.h +++ b/include/osmocom/vty/logging.h @@ -4,6 +4,6 @@ #define FILTER_STR "Filter log messages\n" struct log_info; -void logging_vty_add_cmds(const struct log_info *cat); +void logging_vty_add_cmds(); struct vty; struct log_target *osmo_log_vty2tgt(struct vty *vty); diff --git a/src/logging.c b/src/logging.c index 6a1e929..4fc02e6 100644 --- a/src/logging.c +++ b/src/logging.c @@ -64,7 +64,7 @@ #define LOGLEVEL_DEFS 6 /* Number of loglevels.*/ static const struct value_string loglevel_strs[LOGLEVEL_DEFS+1] = { - { 0, "EVERYTHING" }, + { LOGL_DEBUG, "EVERYTHING" }, { LOGL_DEBUG, "DEBUG" }, { LOGL_INFO, "INFO" }, { LOGL_NOTICE, "NOTICE" }, @@ -144,7 +144,7 @@ /*! \brief descriptive string for each log level */ /* You have to keep this in sync with the structure loglevel_strs. */ -const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { +static const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { "Don't use. It doesn't log anything", "Log debug messages and higher levels", "Log informational messages and higher levels", @@ -359,7 +359,8 @@ return subsys; } -static inline int check_log_to_target(struct log_target *tar, int subsys, int level) +static inline bool should_log_to_target(struct log_target *tar, int subsys, + int level) { struct log_category *category; @@ -367,28 +368,28 @@ /* subsystem is not supposed to be logged */ if (!category->enabled) - return 0; + return false; /* Check the global log level */ if (tar->loglevel != 0 && level < tar->loglevel) - return 0; + return false; /* Check the category log level */ if (tar->loglevel == 0 && category->loglevel != 0 && level < category->loglevel) - return 0; + return false; /* Apply filters here... if that becomes messy we will * need to put filters in a list and each filter will * say stop, continue, output */ if ((tar->filter_map & (1 << LOG_FLT_ALL)) != 0) - return 1; + return true; if (osmo_log_info->filter_fn) return osmo_log_info->filter_fn(&log_context, tar); /* TODO: Check the filter/selector too? */ - return 1; + return true; } /*! \brief vararg version of logging function @@ -409,7 +410,7 @@ llist_for_each_entry(tar, &osmo_log_target_list, entry) { va_list bp; - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* According to the manpage, vsnprintf leaves the value of ap @@ -776,7 +777,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns vty command string for use by VTY command node */ -const char *log_vty_command_string(const struct log_info *unused_info) +const char *log_vty_command_string() { struct log_info *info = osmo_log_info; int len = 0, offset = 0, ret, i, rem; @@ -854,7 +855,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns logging command description for use by VTY command node */ -const char *log_vty_command_description(const struct log_info *unused_info) +const char *log_vty_command_description() { struct log_info *info = osmo_log_info; char *str; @@ -985,7 +986,7 @@ /* TODO: The following could/should be cached (update on config) */ llist_for_each_entry(tar, &osmo_log_target_list, entry) { - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* This might get logged (ignoring filters) */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index aabcaa7..757b2de 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -737,7 +737,11 @@ return 1; } -void logging_vty_add_cmds(const struct log_info *cat) +/* Generate command string for VTY use: implemented in logging.c */ +const char *log_vty_command_string(); +const char *log_vty_command_description(); + +void logging_vty_add_cmds() { install_element_ve(&enable_logging_cmd); install_element_ve(&disable_logging_cmd); @@ -750,8 +754,8 @@ install_element_ve(&logging_set_category_mask_old_cmd); /* Logging level strings are generated dynamically. */ - logging_level_cmd.string = log_vty_command_string(cat); - logging_level_cmd.doc = log_vty_command_description(cat); + logging_level_cmd.string = log_vty_command_string(); + logging_level_cmd.doc = log_vty_command_description(); install_element_ve(&logging_level_cmd); install_element_ve(&show_logging_vty_cmd); install_element_ve(&show_alarms_cmd); diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c index 865c93e..1e1b495 100644 --- a/tests/vty/vty_test.c +++ b/tests/vty/vty_test.c @@ -318,7 +318,7 @@ vty_init(&vty_info); /* Setup VTY commands */ - logging_vty_add_cmds(&log_info); + logging_vty_add_cmds(); osmo_stats_vty_add_cmds(); test_cmd_string_from_valstr(); -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:53:47 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 13:53:47 +0000 Subject: libosmocore[master]: select: Find the highest fd when filling the fd_sets In-Reply-To: References: Message-ID: Patch Set 1: I think it's worth adding doxygen in this case - especially because return value meaning have changed. Even if it has been ignored so far it's worth knowing what we're ignoring. -- To view, visit https://gerrit.osmocom.org/1986 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:56:34 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 13:56:34 +0000 Subject: [PATCH] libosmocore[master]: select: Find the highest fd when filling the fd_sets In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1986 to look at the new patch set (#2). select: Find the highest fd when filling the fd_sets Instead of returning maxfd, which is the highest fd ever seen, take the highest we have seen on this iteration. This makes a tiny difference for the osmo-sip-connector and its event loop integration. select.c ignores the return value of this function right now. This was seen while debugging the eventloop integration of the osmo-sip-connector before and after a VTY connection. The fds being polled didn't go down. Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4 --- M src/select.c 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/1986/2 diff --git a/src/select.c b/src/select.c index ab0734e..10c0b0c 100644 --- a/src/select.c +++ b/src/select.c @@ -121,6 +121,7 @@ { fd_set *readset = _rset, *writeset = _wset, *exceptset = _eset; struct osmo_fd *ufd; + int highfd = 0; llist_for_each_entry(ufd, &osmo_fds, list) { if (ufd->when & BSC_FD_READ) @@ -131,9 +132,12 @@ if (ufd->when & BSC_FD_EXCEPT) FD_SET(ufd->fd, exceptset); + + if (ufd->fd > highfd) + highfd = ufd->fd; } - return maxfd; + return highfd; } inline int osmo_fd_disp_fds(void *_rset, void *_wset, void *_eset) -- To view, visit https://gerrit.osmocom.org/1986 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 13:59:24 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 13:59:24 +0000 Subject: osmo-bts[master]: l1sap: fix PTCCH detection In-Reply-To: References: Message-ID: Patch Set 2: -Code-Review I think it's better to reference 3GPP TS 45.002 which is later version of the spec. -- To view, visit https://gerrit.osmocom.org/1978 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:01:40 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 7 Mar 2017 14:01:40 +0000 Subject: [PATCH] libosmocore[master]: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ... In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1361 to look at the new patch set (#5). gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASE This patch needs to be applied at the same time as openbsc change-id Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a. It was reverted to avoid a breakage in openbsc until the openbsc patch is ready. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/1361/5 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 767aa3d..fb93c56 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1458,6 +1458,8 @@ CHREQ_T_LMU, CHREQ_T_RESERVED_SDCCH, CHREQ_T_RESERVED_IGNORE, + CHREQ_T_PDCH_ONE_PHASE, + CHREQ_T_PDCH_TWO_PHASE, }; /* Chapter 11.3 */ -- To view, visit https://gerrit.osmocom.org/1361 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:07:59 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 7 Mar 2017 14:07:59 +0000 Subject: [PATCH] openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1360 to look at the new patch set (#4). libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_PDCH_TWO_PHASE When using a BSC located PCU the BSC must understand PDCH requests. Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a --- M openbsc/include/openbsc/gsm_data.h M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/gsm_04_08_utils.c 3 files changed, 16 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/60/1360/4 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index ac573c4..b1bae16 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -346,7 +346,7 @@ enum rrlp_mode mode; } rrlp; - enum gsm_chan_t ctype_by_chreq[16]; + enum gsm_chan_t ctype_by_chreq[18]; /* Use a TCH for handling requests of type paging any */ int pag_any_tch; diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4ec4f69..2a43732 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -46,6 +46,7 @@ GSM_CHREQ_REASON_CALL, GSM_CHREQ_REASON_LOCATION_UPD, GSM_CHREQ_REASON_OTHER, + GSM_CHREQ_REASON_PDCH, }; /* lchans 0..3 are SDCCH in combined channel configuration, diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 98f0790..c227fb9 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -75,7 +75,11 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x70, 0xf8, CHREQ_T_PDCH_TWO_PHASE }, + { 0x78, 0xfc, CHREQ_T_PDCH_ONE_PHASE }, + { 0x79, 0xfa, CHREQ_T_PDCH_ONE_PHASE }, + { 0x7a, 0xf9, CHREQ_T_PDCH_ONE_PHASE }, { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; @@ -92,7 +96,11 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x70, 0xf8, CHREQ_T_PDCH_TWO_PHASE }, + { 0x78, 0xfc, CHREQ_T_PDCH_ONE_PHASE }, + { 0x79, 0xfa, CHREQ_T_PDCH_ONE_PHASE }, + { 0x7a, 0xf9, CHREQ_T_PDCH_ONE_PHASE }, { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; @@ -112,6 +120,8 @@ [CHREQ_T_PAG_R_TCH_FH] = GSM_LCHAN_TCH_F, [CHREQ_T_LMU] = GSM_LCHAN_SDCCH, [CHREQ_T_RESERVED_SDCCH] = GSM_LCHAN_SDCCH, + [CHREQ_T_PDCH_ONE_PHASE] = GSM_LCHAN_PDTCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_LCHAN_PDTCH, [CHREQ_T_RESERVED_IGNORE] = GSM_LCHAN_UNKNOWN, }; @@ -130,6 +140,8 @@ [CHREQ_T_PAG_R_TCH_F] = GSM_CHREQ_REASON_PAG, [CHREQ_T_PAG_R_TCH_FH] = GSM_CHREQ_REASON_PAG, [CHREQ_T_LMU] = GSM_CHREQ_REASON_OTHER, + [CHREQ_T_PDCH_ONE_PHASE] = GSM_CHREQ_REASON_PDCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_CHREQ_REASON_PDCH, [CHREQ_T_RESERVED_SDCCH] = GSM_CHREQ_REASON_OTHER, [CHREQ_T_RESERVED_IGNORE] = GSM_CHREQ_REASON_OTHER, }; -- To view, visit https://gerrit.osmocom.org/1360 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:11:28 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 14:11:28 +0000 Subject: [PATCH] openbsc[master]: Add MS time. offset to gsm_lchan In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1699 to look at the new patch set (#3). Add MS time. offset to gsm_lchan Add MS TIMING OFFSET (3GPP TS 48.058 ? 8.4.8) and P offset (3GPP TS 45.010 ? 1.2) which can be used to compute MS TO from known TA. This will be used by osmo-bts (see I4dfe5c48834a083e757d5de3236a02e15a238b28) to provide MS TO as part of RSL MEASUREMENT RESULT. Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Related: OS#1574 --- M openbsc/include/openbsc/gsm_data_shared.h 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/99/1699/3 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 91bdfce..7c469ee 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -327,6 +327,12 @@ uint8_t last_cmr; uint32_t last_fn; } tch; + + /* 3GPP TS 48.058 ? 9.3.37: [0; 255] ok, -1 means invalid*/ + int16_t ms_t_offs; + /* 3GPP TS 45.010 ? 1.2 round trip propagation delay (in symbols) or -1 */ + int16_t p_offs; + /* BTS-side ciphering state (rx only, bi-directional, ...) */ uint8_t ciph_state; uint8_t ciph_ns; -- To view, visit https://gerrit.osmocom.org/1699 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:12:33 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 14:12:33 +0000 Subject: [PATCH] osmo-sip-connector[master]: evpoll: Implement poll with ppoll and map select to poll.. Message-ID: Review at https://gerrit.osmocom.org/1987 evpoll: Implement poll with ppoll and map select to poll.. To avoid the semantic difference with POLLERR, implement polling with ppoll. We use ppoll as the timeout is closer to select and copy fds around and clear it after. Passing empty/unused struct pollfd to the kernel is a bit wasteful but something we have to deal with right now but I will try to fix that up now. Change-Id: I12d3af23315d762a8fcd83255647a3df6aff7166 --- M src/evpoll.c 1 file changed, 84 insertions(+), 36 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/87/1987/1 diff --git a/src/evpoll.c b/src/evpoll.c index 087955f..291d0b5 100644 --- a/src/evpoll.c +++ b/src/evpoll.c @@ -18,46 +18,90 @@ * */ +#define _GNU_SOURCE #include "evpoll.h" +#include "logging.h" #include #include #include +#include -#include +#include -/* based on osmo_select_main GPLv2+ so combined compatible with AGPLv3+ */ +#include +#include + +#define my_ts_cmp(left, right, cmp) \ + (((left)->tv_sec cmp (right)->tv_sec) ? \ + ((left)->tv_nsec cmp (right)->tv_sec) : \ + ((left)->tv_sec cmp (right)->tv_sec)) + +static struct pollfd g_fds[FD_SETSIZE]; + +static struct timespec *timers_nearest() { + static struct timespec ts; + struct timeval *tv; + + tv = osmo_timers_nearest(); + if (!tv) + return NULL; + + ts.tv_sec = tv->tv_sec; + ts.tv_nsec = tv->tv_usec * 1000; + return &ts; +} + +#define MAYBE_CLEAR(fd, set, rflag) \ + if (FD_ISSET(fd, set)) \ + if ((g_fds[fd].revents & rflag) == 0) \ + FD_CLR(fd, set); + int evpoll(struct pollfd *fds, nfds_t nfds, int timeout) { - struct timeval *tv, null_tv = { 0, 0} , poll_tv; + struct timespec *ts, null_ts = { 0, 0} , poll_ts, osmo_ts; fd_set readset, writeset, exceptset; - int maxfd, rc, i; + int maxfd, i, rc, all_nfds; FD_ZERO(&readset); FD_ZERO(&writeset); FD_ZERO(&exceptset); - /* prepare read and write fdsets */ maxfd = osmo_fd_fill_fds(&readset, &writeset, &exceptset); + all_nfds = maxfd; + /* disable all fds */ + for (i = 0; i < ARRAY_SIZE(g_fds); ++i) { + g_fds[i].fd = -1; + g_fds[i].revents = 0; + } + + /* copy the osmocom selectors to pollfds */ + for (i = 0; i <= maxfd; ++i) { + if (!FD_ISSET(i, &readset) + && !FD_ISSET(i, &writeset) && !FD_ISSET(i, &exceptset)) + continue; + + g_fds[i].fd = i; + g_fds[i].events = 0; + if (FD_ISSET(i, &readset)) + g_fds[i].events |= POLLIN; + if (FD_ISSET(i, &writeset)) + g_fds[i].events |= POLLOUT; + } + + /* copy the remaining ones */ for (i = 0; i < nfds; ++i) { if (fds[i].fd < 0) continue; - if ((fds[i].events & (POLLIN | POLLOUT | POLLPRI)) == 0) + if (fds[i].fd >= ARRAY_SIZE(g_fds)) { + LOGP(DAPP, LOGL_ERROR, "Can not poll fd=%d.\n", fds[i].fd); continue; - - /* copy events. Not sure why glib maps PRI to exceptionset */ - if (fds[i].events & POLLIN) - FD_SET(fds[i].fd, &readset); - if (fds[i].events & POLLOUT) - FD_SET(fds[i].fd, &writeset); - if (fds[i].events & POLLPRI) - FD_SET(fds[i].fd, &exceptset); - - if (fds[i].fd > maxfd) - maxfd = fds[i].fd; + } + if (fds[i].fd > all_nfds) + all_nfds = fds[i].fd; + g_fds[fds[i].fd] = fds[i]; } - osmo_timers_check(); osmo_timers_prepare(); @@ -65,23 +109,24 @@ /* * 0 == wake-up immediately * -1 == block forever.. which will depend on our timers + * and convert */ if (timeout == 0) { - tv = &null_tv; + ts = &null_ts; } else if (timeout == -1) { - tv = osmo_timers_nearest(); + ts = timers_nearest(); } else { - poll_tv.tv_sec = timeout / 1000; - poll_tv.tv_usec = (timeout % 1000) * 1000; + poll_ts.tv_sec = timeout / 1000; + poll_ts.tv_nsec = (timeout % 1000) * 1000 * 1000; - tv = osmo_timers_nearest(); - if (!tv) - tv = &poll_tv; - else if (timercmp(&poll_tv, tv, <)) - tv = &poll_tv; + ts = timers_nearest(); + if (!ts) + ts = &poll_ts; + else if (my_ts_cmp(&poll_ts, &osmo_ts, <)) + ts = &poll_ts; } - rc = select(maxfd+1, &readset, &writeset, &exceptset, tv); + rc = ppoll(g_fds, all_nfds + 1, ts, NULL); if (rc < 0) return 0; @@ -89,21 +134,24 @@ osmo_timers_update(); /* call registered callback functions */ + for (i = 0; i <= maxfd; ++i) { + MAYBE_CLEAR(i, &readset, POLLIN) + MAYBE_CLEAR(i, &writeset, POLLOUT) + MAYBE_CLEAR(i, &exceptset, POLLERR) + } osmo_fd_disp_fds(&readset, &writeset, &exceptset); for (i = 0; i < nfds; ++i) { - fds[i].revents = 0; - if (fds[i].fd < 0) + if (fds[i].fd < 0) { + fds[i].revents = 0; continue; + } - if (FD_ISSET(fds[i].fd, &readset)) - fds[i].revents = POLLIN | POLLERR; - if (FD_ISSET(fds[i].fd, &writeset)) - fds[i].revents |= POLLOUT; - if (FD_ISSET(fds[i].fd, &exceptset)) - fds[i].revents |= POLLPRI; + fds[i].revents = g_fds[fds[i].fd].revents; } return rc; } + +#undef MAYBE_CLEAR -- To view, visit https://gerrit.osmocom.org/1987 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12d3af23315d762a8fcd83255647a3df6aff7166 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:12:34 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 14:12:34 +0000 Subject: [PATCH] osmo-sip-connector[master]: evpoll: Optimize layout of the pollfd array Message-ID: Review at https://gerrit.osmocom.org/1988 evpoll: Optimize layout of the pollfd array Avoid having too many empty entries in the pollfd entry but still have O(n) when iterating over the result. Segment the array and skip entries that were not added. Change-Id: I1dfd9716a3620ad7932e8f46fd17536a6619fe0e --- M src/evpoll.c 1 file changed, 25 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/88/1988/1 diff --git a/src/evpoll.c b/src/evpoll.c index 291d0b5..3645f1f 100644 --- a/src/evpoll.c +++ b/src/evpoll.c @@ -52,23 +52,22 @@ return &ts; } -#define MAYBE_CLEAR(fd, set, rflag) \ +#define MAYBE_CLEAR(fd, pollfd, set, rflag) \ if (FD_ISSET(fd, set)) \ - if ((g_fds[fd].revents & rflag) == 0) \ + if (((pollfd)->revents & rflag) == 0) \ FD_CLR(fd, set); int evpoll(struct pollfd *fds, nfds_t nfds, int timeout) { struct timespec *ts, null_ts = { 0, 0} , poll_ts, osmo_ts; fd_set readset, writeset, exceptset; - int maxfd, i, rc, all_nfds; + int maxfd, i, j, rc, last_fd = 0, select_fds; FD_ZERO(&readset); FD_ZERO(&writeset); FD_ZERO(&exceptset); maxfd = osmo_fd_fill_fds(&readset, &writeset, &exceptset); - all_nfds = maxfd; /* disable all fds */ for (i = 0; i < ARRAY_SIZE(g_fds); ++i) { @@ -82,25 +81,27 @@ && !FD_ISSET(i, &writeset) && !FD_ISSET(i, &exceptset)) continue; - g_fds[i].fd = i; - g_fds[i].events = 0; + g_fds[last_fd].fd = i; + g_fds[last_fd].events = 0; if (FD_ISSET(i, &readset)) - g_fds[i].events |= POLLIN; + g_fds[last_fd].events |= POLLIN; if (FD_ISSET(i, &writeset)) - g_fds[i].events |= POLLOUT; + g_fds[last_fd].events |= POLLOUT; + last_fd += 1; } + select_fds = last_fd; /* copy the remaining ones */ for (i = 0; i < nfds; ++i) { - if (fds[i].fd < 0) + if (fds[i].fd < 0) { + fds[i].revents = 0; continue; + } if (fds[i].fd >= ARRAY_SIZE(g_fds)) { LOGP(DAPP, LOGL_ERROR, "Can not poll fd=%d.\n", fds[i].fd); continue; } - if (fds[i].fd > all_nfds) - all_nfds = fds[i].fd; - g_fds[fds[i].fd] = fds[i]; + g_fds[last_fd++] = fds[i]; } osmo_timers_check(); @@ -126,7 +127,7 @@ ts = &poll_ts; } - rc = ppoll(g_fds, all_nfds + 1, ts, NULL); + rc = ppoll(g_fds, last_fd, ts, NULL); if (rc < 0) return 0; @@ -134,21 +135,23 @@ osmo_timers_update(); /* call registered callback functions */ - for (i = 0; i <= maxfd; ++i) { - MAYBE_CLEAR(i, &readset, POLLIN) - MAYBE_CLEAR(i, &writeset, POLLOUT) - MAYBE_CLEAR(i, &exceptset, POLLERR) + for (i = 0; i < select_fds; ++i) { + MAYBE_CLEAR(g_fds[i].fd, &g_fds[i], &readset, POLLIN) + MAYBE_CLEAR(g_fds[i].fd, &g_fds[i], &writeset, POLLOUT) + MAYBE_CLEAR(g_fds[i].fd, &g_fds[i], &exceptset, POLLERR) } osmo_fd_disp_fds(&readset, &writeset, &exceptset); - for (i = 0; i < nfds; ++i) { - - if (fds[i].fd < 0) { - fds[i].revents = 0; + i = select_fds; + j = 0; + while (i < last_fd && j < nfds) { + /* g_fds might have skipped some fds.. so progress */ + if (g_fds[i].fd != fds[j].fd) { + j += 1; continue; } - fds[i].revents = g_fds[fds[i].fd].revents; + fds[j++].revents = g_fds[i++].revents; } return rc; -- To view, visit https://gerrit.osmocom.org/1988 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1dfd9716a3620ad7932e8f46fd17536a6619fe0e Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:38:02 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 14:38:02 +0000 Subject: [PATCH] libosmocore[master]: libosmocoding: fix .deb building Message-ID: Review at https://gerrit.osmocom.org/1989 libosmocoding: fix .deb building dpkg-buildpackage fails due to missing file descriptions - add necessary .install and .doc-base files to fix it. Change-Id: I5fb7e813c0860a3b5037e805deb84f9bf649ffa3 --- A debian/libosmocoding-doc.doc-base A debian/libosmocoding-doc.install A debian/libosmocoding0.install 3 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/89/1989/1 diff --git a/debian/libosmocoding-doc.doc-base b/debian/libosmocoding-doc.doc-base new file mode 100644 index 0000000..a2f3a3a --- /dev/null +++ b/debian/libosmocoding-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmocoding-doc +Title: Documentation for the libosmocoding library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/coding/html/index.html +Files: /usr/share/doc/libosmocore/coding/html/*.html diff --git a/debian/libosmocoding-doc.install b/debian/libosmocoding-doc.install new file mode 100644 index 0000000..278e3b5 --- /dev/null +++ b/debian/libosmocoding-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/coding/ diff --git a/debian/libosmocoding0.install b/debian/libosmocoding0.install new file mode 100644 index 0000000..bf09dd4 --- /dev/null +++ b/debian/libosmocoding0.install @@ -0,0 +1 @@ +usr/lib/*/libosmocoding*.so.* -- To view, visit https://gerrit.osmocom.org/1989 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5fb7e813c0860a3b5037e805deb84f9bf649ffa3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:46:41 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Tue, 7 Mar 2017 14:46:41 +0000 Subject: libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase in DTX mode. In-Reply-To: References: Message-ID: Patch Set 1: This modification has no impact in non-DTX case because duration is always set to a fixed value(160). -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:52:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 14:52:45 +0000 Subject: libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase in DTX mode. In-Reply-To: References: Message-ID: Patch Set 1: Could you please elaborate? Previously we called rtp_session_sendm_with_ts(x, y), now it's rtp_session_sendm_with_ts(x, y + 160) - why the ts change will have no effect for non-DTX setup? -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:59:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 7 Mar 2017 14:59:14 +0000 Subject: libosmocore[master]: libosmocoding: fix .deb building In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1989 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5fb7e813c0860a3b5037e805deb84f9bf649ffa3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 14:59:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 7 Mar 2017 14:59:34 +0000 Subject: openbsc[master]: Add MS time. offset to gsm_lchan In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1699 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 15:00:04 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 15:00:04 +0000 Subject: [MERGED] libosmocore[master]: libosmocoding: fix .deb building In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: libosmocoding: fix .deb building ...................................................................... libosmocoding: fix .deb building dpkg-buildpackage fails due to missing file descriptions - add necessary .install and .doc-base files to fix it. Change-Id: I5fb7e813c0860a3b5037e805deb84f9bf649ffa3 --- A debian/libosmocoding-doc.doc-base A debian/libosmocoding-doc.install A debian/libosmocoding0.install 3 files changed, 9 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/libosmocoding-doc.doc-base b/debian/libosmocoding-doc.doc-base new file mode 100644 index 0000000..a2f3a3a --- /dev/null +++ b/debian/libosmocoding-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmocoding-doc +Title: Documentation for the libosmocoding library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/coding/html/index.html +Files: /usr/share/doc/libosmocore/coding/html/*.html diff --git a/debian/libosmocoding-doc.install b/debian/libosmocoding-doc.install new file mode 100644 index 0000000..278e3b5 --- /dev/null +++ b/debian/libosmocoding-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/coding/ diff --git a/debian/libosmocoding0.install b/debian/libosmocoding0.install new file mode 100644 index 0000000..bf09dd4 --- /dev/null +++ b/debian/libosmocoding0.install @@ -0,0 +1 @@ +usr/lib/*/libosmocoding*.so.* -- To view, visit https://gerrit.osmocom.org/1989 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5fb7e813c0860a3b5037e805deb84f9bf649ffa3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Tue Mar 7 15:00:31 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 15:00:31 +0000 Subject: [MERGED] openbsc[master]: Add MS time. offset to gsm_lchan In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add MS time. offset to gsm_lchan ...................................................................... Add MS time. offset to gsm_lchan Add MS TIMING OFFSET (3GPP TS 48.058 ? 8.4.8) and P offset (3GPP TS 45.010 ? 1.2) which can be used to compute MS TO from known TA. This will be used by osmo-bts (see I4dfe5c48834a083e757d5de3236a02e15a238b28) to provide MS TO as part of RSL MEASUREMENT RESULT. Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Related: OS#1574 --- M openbsc/include/openbsc/gsm_data_shared.h 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 91bdfce..7c469ee 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -327,6 +327,12 @@ uint8_t last_cmr; uint32_t last_fn; } tch; + + /* 3GPP TS 48.058 ? 9.3.37: [0; 255] ok, -1 means invalid*/ + int16_t ms_t_offs; + /* 3GPP TS 45.010 ? 1.2 round trip propagation delay (in symbols) or -1 */ + int16_t p_offs; + /* BTS-side ciphering state (rx only, bi-directional, ...) */ uint8_t ciph_state; uint8_t ciph_ns; -- To view, visit https://gerrit.osmocom.org/1699 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 15:07:20 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 15:07:20 +0000 Subject: [PATCH] osmo-sip-connector[master]: sip: Actually honor the remote port of the pbx Message-ID: Review at https://gerrit.osmocom.org/1990 sip: Actually honor the remote port of the pbx So far the remote_port has never been used. sofia-sip did the right thing and put the port into the "Contact" and the rport option for the via. But we would have never been able to connect a PBX on a different port (as sofia-sip seems to parse the destination from the to address). Change-Id: Ifbd49b4aa6b01b118fe67e39dddef50b2946159c --- M src/sip.c 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/90/1990/1 diff --git a/src/sip.c b/src/sip.c index afff393..348f478 100644 --- a/src/sip.c +++ b/src/sip.c @@ -293,12 +293,14 @@ { struct call_leg *other = leg->base.call->initial; - char *from = talloc_asprintf(leg, "sip:%s@%s", + char *from = talloc_asprintf(leg, "sip:%s@%s:%d", calling_num, - agent->app->sip.local_addr); - char *to = talloc_asprintf(leg, "sip:%s@%s", + agent->app->sip.local_addr, + agent->app->sip.local_port); + char *to = talloc_asprintf(leg, "sip:%s@%s:%d", called_num, - agent->app->sip.remote_addr); + agent->app->sip.remote_addr, + agent->app->sip.remote_port); char *sdp = sdp_create_file(leg, other); leg->state = SIP_CC_INITIAL; -- To view, visit https://gerrit.osmocom.org/1990 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifbd49b4aa6b01b118fe67e39dddef50b2946159c Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Tue Mar 7 15:15:07 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Tue, 7 Mar 2017 15:15:07 +0000 Subject: libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase in DTX mode. In-Reply-To: References: Message-ID: Patch Set 1: Previously rtp_session_sendm_with_ts(x, y); y += 160. With the change rtp_session_sendm_with_ts(x, y + 160); y += 160. The y += 160 could also have been placed before the rtp_session_sendm_with_ts call but I find it counterintuitive. -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 15:43:33 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 15:43:33 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 9: Code-Review-1 WIP. -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 7 16:17:27 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 16:17:27 +0000 Subject: [PATCH] libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1582 to look at the new patch set (#10). vty: fix "logging level ... everything" option * remove unused parameter from logging_vty_add_cmds() * remove log_vty_command_*() from public API as it's only used by logging_vty_add_cmds() * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * make "logging level ... everything" into alias for "... debug" * mark log level descriptors static Fixes: OS#71 Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c --- M TODO-RELEASE M include/osmocom/core/logging.h M include/osmocom/vty/logging.h M src/logging.c M src/vty/logging_vty.c M tests/vty/vty_test.c 6 files changed, 26 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/1582/10 diff --git a/TODO-RELEASE b/TODO-RELEASE index a23fcea..42b4ed8 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,6 +8,7 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmocore new function osmo_sock_get_name() +libosmocore API change remove log_vty_command_string() and log_vty_command_description() libosmogsm/gsup ABI change fix AUTS length to 14, not 16 (length is implicit) libosmogsm/oap ABI change fix AUTS length to 14, not 16 (length is implicit) osmo-auc-gen UI change fix AUTS length to 14, not 16 (length is implicit) diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 7b28b2c..f40f7d3 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -327,10 +327,6 @@ void log_add_target(struct log_target *target); void log_del_target(struct log_target *target); -/* Generate command string for VTY use */ -const char *log_vty_command_string(const struct log_info *info); -const char *log_vty_command_description(const struct log_info *info); - struct log_target *log_target_find(int type, const char *fname); extern struct llist_head osmo_log_target_list; diff --git a/include/osmocom/vty/logging.h b/include/osmocom/vty/logging.h index 9e4b98f..544d117 100644 --- a/include/osmocom/vty/logging.h +++ b/include/osmocom/vty/logging.h @@ -4,6 +4,6 @@ #define FILTER_STR "Filter log messages\n" struct log_info; -void logging_vty_add_cmds(const struct log_info *cat); +void logging_vty_add_cmds(); struct vty; struct log_target *osmo_log_vty2tgt(struct vty *vty); diff --git a/src/logging.c b/src/logging.c index 6a1e929..ccc1038 100644 --- a/src/logging.c +++ b/src/logging.c @@ -63,13 +63,15 @@ #define LOGLEVEL_DEFS 6 /* Number of loglevels.*/ -static const struct value_string loglevel_strs[LOGLEVEL_DEFS+1] = { - { 0, "EVERYTHING" }, +/* FIXME: +2 because of workaround for 'everything' */ +static const struct value_string loglevel_strs[LOGLEVEL_DEFS + 2] = { { LOGL_DEBUG, "DEBUG" }, + { LOGL_DEBUG, "EVERYTHING" }, /* FIXME: remove when 'everything' is no longer necessary */ { LOGL_INFO, "INFO" }, { LOGL_NOTICE, "NOTICE" }, { LOGL_ERROR, "ERROR" }, { LOGL_FATAL, "FATAL" }, + { 0, "DEBUG" }, /* FIXME: remove when 'everything' is no longer necessary */ { 0, NULL }, }; @@ -144,7 +146,7 @@ /*! \brief descriptive string for each log level */ /* You have to keep this in sync with the structure loglevel_strs. */ -const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { +static const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { "Don't use. It doesn't log anything", "Log debug messages and higher levels", "Log informational messages and higher levels", @@ -359,7 +361,8 @@ return subsys; } -static inline int check_log_to_target(struct log_target *tar, int subsys, int level) +static inline bool should_log_to_target(struct log_target *tar, int subsys, + int level) { struct log_category *category; @@ -367,28 +370,28 @@ /* subsystem is not supposed to be logged */ if (!category->enabled) - return 0; + return false; /* Check the global log level */ if (tar->loglevel != 0 && level < tar->loglevel) - return 0; + return false; /* Check the category log level */ if (tar->loglevel == 0 && category->loglevel != 0 && level < category->loglevel) - return 0; + return false; /* Apply filters here... if that becomes messy we will * need to put filters in a list and each filter will * say stop, continue, output */ if ((tar->filter_map & (1 << LOG_FLT_ALL)) != 0) - return 1; + return true; if (osmo_log_info->filter_fn) return osmo_log_info->filter_fn(&log_context, tar); /* TODO: Check the filter/selector too? */ - return 1; + return true; } /*! \brief vararg version of logging function @@ -409,7 +412,7 @@ llist_for_each_entry(tar, &osmo_log_target_list, entry) { va_list bp; - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* According to the manpage, vsnprintf leaves the value of ap @@ -776,7 +779,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns vty command string for use by VTY command node */ -const char *log_vty_command_string(const struct log_info *unused_info) +const char *log_vty_command_string() { struct log_info *info = osmo_log_info; int len = 0, offset = 0, ret, i, rem; @@ -854,7 +857,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns logging command description for use by VTY command node */ -const char *log_vty_command_description(const struct log_info *unused_info) +const char *log_vty_command_description() { struct log_info *info = osmo_log_info; char *str; @@ -985,7 +988,7 @@ /* TODO: The following could/should be cached (update on config) */ llist_for_each_entry(tar, &osmo_log_target_list, entry) { - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* This might get logged (ignoring filters) */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index aabcaa7..757b2de 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -737,7 +737,11 @@ return 1; } -void logging_vty_add_cmds(const struct log_info *cat) +/* Generate command string for VTY use: implemented in logging.c */ +const char *log_vty_command_string(); +const char *log_vty_command_description(); + +void logging_vty_add_cmds() { install_element_ve(&enable_logging_cmd); install_element_ve(&disable_logging_cmd); @@ -750,8 +754,8 @@ install_element_ve(&logging_set_category_mask_old_cmd); /* Logging level strings are generated dynamically. */ - logging_level_cmd.string = log_vty_command_string(cat); - logging_level_cmd.doc = log_vty_command_description(cat); + logging_level_cmd.string = log_vty_command_string(); + logging_level_cmd.doc = log_vty_command_description(); install_element_ve(&logging_level_cmd); install_element_ve(&show_logging_vty_cmd); install_element_ve(&show_alarms_cmd); diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c index 865c93e..1e1b495 100644 --- a/tests/vty/vty_test.c +++ b/tests/vty/vty_test.c @@ -318,7 +318,7 @@ vty_init(&vty_info); /* Setup VTY commands */ - logging_vty_add_cmds(&log_info); + logging_vty_add_cmds(); osmo_stats_vty_add_cmds(); test_cmd_string_from_valstr(); -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 7 16:31:25 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 16:31:25 +0000 Subject: [PATCH] osmo-bts[master]: Add MS TO to RSL measurements In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1700 to look at the new patch set (#2). Add MS TO to RSL measurements Add optional MS timing offset (3GPP TS 45.010 ? 1.2) to RSL MEASUREMENT RESULT (3GPP TS 48.058 ? 8.4.8). The value is calculated either directly from corresponding BTS measurement or from 3GPP TS 48.058 ? 9.3.17 Access Delay (for known TA) and invalidated after RSL report is sent until new measurement indication or RACH is received. Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28 Related: OS#1574 --- M src/common/l1sap.c M src/common/rsl.c 2 files changed, 33 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/00/1700/2 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 19b38af..d3a2d99 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -431,6 +431,20 @@ return 0; } + +static void set_ms_to_data(struct gsm_lchan *lchan, uint8_t data, bool set_ms_to) +{ + if (!lchan) + return; + if (set_ms_to) { + lchan->ms_t_offs = data; + lchan->p_offs = -1; + } else { + lchan->p_offs = data; + lchan->ms_t_offs = -1; + } +} + /* measurement information received from bts model */ static int l1sap_info_meas_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap, @@ -455,6 +469,8 @@ ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits; ulm.ber10k = info_meas_ind->ber10k; ulm.inv_rssi = info_meas_ind->inv_rssi; + /* we assume that symbol period is 1 bit: */ + set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true); lchan_new_ul_meas(lchan, &ulm); @@ -1008,6 +1024,7 @@ struct gsm_bts *bts = trx->bts; struct gsm_bts_role_bts *btsb = bts->role; struct lapdm_channel *lc; + struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, rach_ind->chan_nr); uint8_t acc_delay; DEBUGP(DL1P, "Rx PH-RA.ind"); @@ -1021,6 +1038,10 @@ return 0; } + /* According to 3GPP TS 48.058 ? 9.3.17 Access Delay is expressed same + way as TA (number of symbols) */ + set_ms_to_data(lchan, acc_delay, false); + /* check for handover rach */ if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) return l1sap_handover_rach(trx, l1sap, rach_ind); diff --git a/src/common/rsl.c b/src/common/rsl.c index 1d0bcea..93391dc 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -2221,7 +2221,8 @@ } /* 8.4.8 MEASUREMENT RESult */ -static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len) +static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, + uint8_t ms_to, bool use_ms_to) { struct msgb *msg; uint8_t meas_res[16]; @@ -2253,7 +2254,11 @@ lchan->meas.flags &= ~LC_UL_M_F_L1_VALID; } msgb_tl16v_put(msg, RSL_IE_L3_INFO, l3_len, l3); - //msgb_tv_put(msg, RSL_IE_MS_TIMING_OFFSET, FIXME); + if (use_ms_to) { + msgb_tv_put(msg, RSL_IE_MS_TIMING_OFFSET, ms_to); + lchan->ms_t_offs_valid = false; + lchan->p_offs_valid = false; + } rsl_dch_push_hdr(msg, RSL_MT_MEAS_RES, chan_nr); msg->trx = lchan->ts->trx; @@ -2266,8 +2271,6 @@ { struct gsm_lchan *lchan = ctx; struct abis_rsl_common_hdr *rh; - - /* NOTE: Parameter lapdm_entity *le is ignored */ OSMO_ASSERT(msg); rh = msgb_l2(msg); @@ -2306,7 +2309,11 @@ return 0; } - rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg)); + rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg), + (lchan->ms_t_offs != -1) ? + lchan->ms_t_offs : (lchan->p_offs - le->ta), + (lchan->ms_t_offs != -1) || + (lchan->p_offs != -1)); msgb_free(msg); return rc; } else { -- To view, visit https://gerrit.osmocom.org/1700 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 16:46:11 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 16:46:11 +0000 Subject: [PATCH] osmo-bts[master]: Handle ctrl cmd allocation failures Message-ID: Review at https://gerrit.osmocom.org/1991 Handle ctrl cmd allocation failures Check that ctrl command was successfully allocated before using it. Fixes: CID163884 Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 --- M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 1 file changed, 10 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/91/1991/1 diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index 2a15d2e..508fc11 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -192,7 +192,6 @@ { int new_state = next_state(manager->state, critical, warning), rc; struct ctrl_cmd *rep; - bool send = false; /* Nothing changed */ if (new_state < 0) @@ -219,21 +218,23 @@ break; case STATE_WARNING: execute_warning_act(manager); - rep->value = "Temperature Warning"; - send = true; + if (rep) + rep->value = "Temperature Warning"; break; case STATE_CRITICAL: execute_critical_act(manager); - rep->value = "Temperature Critical"; - send = true; + if (rep) + rep->value = "Temperature Critical"; break; }; - if (send) { - rc = ctrl_cmd_send(&ctrl->write_queue, rep); - LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + if (rep) { + if (rep->value) { + rc = ctrl_cmd_send(&ctrl->write_queue, rep); + LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + } + talloc_free(rep); } - talloc_free(rep); } static void temp_ctrl_check(struct ctrl_connection *ctrl) -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 16:49:59 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 7 Mar 2017 16:49:59 +0000 Subject: [PATCH] osmo-bts[master]: Add MS TO to RSL measurements In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1700 to look at the new patch set (#3). Add MS TO to RSL measurements Add optional MS timing offset (3GPP TS 45.010 ? 1.2) to RSL MEASUREMENT RESULT (3GPP TS 48.058 ? 8.4.8). The value is calculated either directly from corresponding BTS measurement or from 3GPP TS 48.058 ? 9.3.17 Access Delay (for known TA) and invalidated after RSL report is sent until new measurement indication or RACH is received. Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28 Related: OS#1574 --- M src/common/l1sap.c M src/common/rsl.c 2 files changed, 33 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/00/1700/3 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 19b38af..d3a2d99 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -431,6 +431,20 @@ return 0; } + +static void set_ms_to_data(struct gsm_lchan *lchan, uint8_t data, bool set_ms_to) +{ + if (!lchan) + return; + if (set_ms_to) { + lchan->ms_t_offs = data; + lchan->p_offs = -1; + } else { + lchan->p_offs = data; + lchan->ms_t_offs = -1; + } +} + /* measurement information received from bts model */ static int l1sap_info_meas_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap, @@ -455,6 +469,8 @@ ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits; ulm.ber10k = info_meas_ind->ber10k; ulm.inv_rssi = info_meas_ind->inv_rssi; + /* we assume that symbol period is 1 bit: */ + set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true); lchan_new_ul_meas(lchan, &ulm); @@ -1008,6 +1024,7 @@ struct gsm_bts *bts = trx->bts; struct gsm_bts_role_bts *btsb = bts->role; struct lapdm_channel *lc; + struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, rach_ind->chan_nr); uint8_t acc_delay; DEBUGP(DL1P, "Rx PH-RA.ind"); @@ -1021,6 +1038,10 @@ return 0; } + /* According to 3GPP TS 48.058 ? 9.3.17 Access Delay is expressed same + way as TA (number of symbols) */ + set_ms_to_data(lchan, acc_delay, false); + /* check for handover rach */ if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) return l1sap_handover_rach(trx, l1sap, rach_ind); diff --git a/src/common/rsl.c b/src/common/rsl.c index 1d0bcea..f4b2d88 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -2221,7 +2221,8 @@ } /* 8.4.8 MEASUREMENT RESult */ -static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len) +static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, + uint8_t ms_to, bool use_ms_to) { struct msgb *msg; uint8_t meas_res[16]; @@ -2253,7 +2254,11 @@ lchan->meas.flags &= ~LC_UL_M_F_L1_VALID; } msgb_tl16v_put(msg, RSL_IE_L3_INFO, l3_len, l3); - //msgb_tv_put(msg, RSL_IE_MS_TIMING_OFFSET, FIXME); + if (use_ms_to) { + msgb_tv_put(msg, RSL_IE_MS_TIMING_OFFSET, ms_to); + lchan->ms_t_offs = -1; + lchan->p_offs = -1; + } rsl_dch_push_hdr(msg, RSL_MT_MEAS_RES, chan_nr); msg->trx = lchan->ts->trx; @@ -2266,8 +2271,6 @@ { struct gsm_lchan *lchan = ctx; struct abis_rsl_common_hdr *rh; - - /* NOTE: Parameter lapdm_entity *le is ignored */ OSMO_ASSERT(msg); rh = msgb_l2(msg); @@ -2306,7 +2309,11 @@ return 0; } - rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg)); + rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg), + (lchan->ms_t_offs >= 0) ? + lchan->ms_t_offs : (lchan->p_offs - le->ta), + (lchan->ms_t_offs >= 0) || + (lchan->p_offs >= 0)); msgb_free(msg); return rc; } else { -- To view, visit https://gerrit.osmocom.org/1700 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 7 17:07:56 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 7 Mar 2017 17:07:56 +0000 Subject: [PATCH] osmo-sip-connector[master]: testpbx: Enable GSM and AMR as codecs to actually be relevant Message-ID: Review at https://gerrit.osmocom.org/1992 testpbx: Enable GSM and AMR as codecs to actually be relevant Without these codecs we will not have much joy when working with a default GSM BTS/BSC. Change-Id: I8719c392f57e0dbed0c0c792d1381592dcd662c1 --- M contrib/testpbx/configs/vars.xml 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/92/1992/1 diff --git a/contrib/testpbx/configs/vars.xml b/contrib/testpbx/configs/vars.xml index 1cb826d..5ef16c9 100644 --- a/contrib/testpbx/configs/vars.xml +++ b/contrib/testpbx/configs/vars.xml @@ -255,8 +255,8 @@ 127 - BV32 --> - - + + | hNodeB |<--Iuh---->| HNB-GW |<--IuCS-->| OsmoCSCN | - UE <-->| femto cell | ...-->| | ...-->| | - | | | | +----------+ - +------------+<--GTP-U | | - \ | | +------+ +------+ - | | |<--IuPS-->| SGSN |<--GTP-C-->| GGSN | - | +--------+ ...-->| | GTP-U-->| | - | +------+ / +------+ + +--------+ + ,-->| Osmo | + / | MGCPGW | + | | |<--MGCP + | +--------+ \ + / | + +------------+<--RTP +--------+ `->+----------+ + UE <-->| hNodeB | | Osmo | | OsmoMSC | +------+ + UE <-->| femto cell |<--Iuh---->| HNB-GW |<--IuCS-->| | | Osmo | + | | | | | (VLR)|<-GSUP->| HLR | + | | | | +----------+ GSUP->+------+ + +------------+<--GTP-U | | / + \ | | +------+<---' +------+ + | | |<--IuPS-->| Osmo |<--GTP-C--->| Open | + | +--------+ | SGSN | GTP-U--->| GGSN | + | +------+ / +------+ \_______________________________/ @@ -51,5 +58,3 @@ +--------------------------+ UE (User Endpoint) == MS (Mobile Subscriber) == mobile device -CSCN (Circuit Switched Core Network) == OsmoNITB without BSC - -- To view, visit https://gerrit.osmocom.org/2013 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I498446fd0e432968eb26faf1b2f64825c9eec5d5 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 8 16:07:18 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 8 Mar 2017 16:07:18 +0000 Subject: libosmocore[master]: ctrl_type_vals: explicitly terminate In-Reply-To: References: Message-ID: Patch Set 3: (2 comments) https://gerrit.osmocom.org/#/c/1962/3/include/osmocom/ctrl/control_cmd.h File include/osmocom/ctrl/control_cmd.h: Line 25: CTRL_TYPE_UNKNOWN, > that is still 0...so maybe omit? The ctrl code checks for CTRL_TYPE_UNKNOWN in some places. It's not needed really, but I like that a struct talloc_zero'd reflects a clearly defined invalid enum value. Anyway, if we want to remove CTRL_TYPE_UNKNOWN, that would probably be a separate patch. For me it's most important to patch up that other commit I didn't like much, so that I can also add the value_string[] termination check to jenkins in G#1940 (and finally end the deadlock between Max and me). https://gerrit.osmocom.org/#/c/1962/3/src/ctrl/control_cmd.c File src/ctrl/control_cmd.c: Line 50: { 0, NULL } > Okay.. so if the value_string array is used without the enum.. since I'm not sufficiently telepathic, would you mind completing the sentence? :) -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 8 16:46:10 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Wed, 8 Mar 2017 16:46:10 +0000 Subject: [PATCH] libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase. In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1982 to look at the new patch set (#2). Fix RTP jitter buffer that never stop to increase. Duration passed to osmo_rtp_send_frame_ext function is based on the last frame and the current one. Duration must then be added to the timestamp before being transmitted. Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d --- M src/trau/osmo_ortp.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/82/1982/2 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index d4d4ff5..0dd08e5 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -459,9 +459,9 @@ return -ENOMEM; rtp_set_markbit(mblk, marker); + rs->tx_timestamp += duration; rc = rtp_session_sendm_with_ts(rs->sess, mblk, rs->tx_timestamp); - rs->tx_timestamp += duration; if (rc < 0) { /* no need to free() the mblk, as rtp_session_rtp_send() * unconditionally free()s the mblk even in case of -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne From gerrit-no-reply at lists.osmocom.org Wed Mar 8 16:56:46 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 8 Mar 2017 16:56:46 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference Message-ID: Review at https://gerrit.osmocom.org/2014 osmo-nitb: Update VTY command reference Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca --- M OsmoNITB/vty/nitb_vty_reference.xml 1 file changed, 1,081 insertions(+), 429 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/14/2014/1 diff --git a/OsmoNITB/vty/nitb_vty_reference.xml b/OsmoNITB/vty/nitb_vty_reference.xml index 13e130b..5f49b09 100644 --- a/OsmoNITB/vty/nitb_vty_reference.xml +++ b/OsmoNITB/vty/nitb_vty_reference.xml @@ -116,14 +116,6 @@ - - - - - - - - @@ -176,6 +168,24 @@ + + + + + + + + + + + + + + + + + + @@ -192,7 +202,7 @@ - + @@ -220,6 +230,9 @@ + + + @@ -227,10 +240,13 @@ - + + + + - + @@ -246,6 +262,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -274,10 +313,10 @@ - - - - + + + + @@ -290,7 +329,7 @@ - + @@ -306,42 +345,48 @@ - - - - + + + + - - - - + + + + - + - - - - + + + + - - - + + + + + + + + + - - - - + + + + @@ -354,10 +399,10 @@ - - - - + + + + @@ -366,10 +411,10 @@ - - - - + + + + @@ -381,10 +426,10 @@ - - - - + + + + @@ -401,11 +446,12 @@ - + - - - + + + + @@ -587,14 +633,6 @@ - - - - - - - - @@ -647,6 +685,24 @@ + + + + + + + + + + + + + + + + + + @@ -663,7 +719,7 @@ - + @@ -691,6 +747,9 @@ + + + @@ -698,10 +757,13 @@ - + + + + - + @@ -719,6 +781,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -727,6 +812,12 @@ + + + + + + @@ -740,6 +831,15 @@ + + + + + + + + + @@ -842,10 +942,10 @@ - - - - + + + + @@ -858,7 +958,7 @@ - + @@ -874,42 +974,48 @@ - - - - + + + + - - - - + + + + - + - - - - + + + + - - - + + + + + + + + + - - - - + + + + @@ -922,10 +1028,10 @@ - - - - + + + + @@ -934,10 +1040,10 @@ - - - - + + + + @@ -949,10 +1055,10 @@ - - - - + + + + @@ -969,13 +1075,32 @@ + + + + + + + + + + + + + + + + + + + - - - - + + + + @@ -984,10 +1109,10 @@ - - - - + + + + @@ -996,10 +1121,10 @@ - - - - + + + + @@ -1009,10 +1134,10 @@ - - - - + + + + @@ -1021,46 +1146,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -1101,20 +1193,20 @@ - - - - + + + + - + - - - + + + @@ -1352,6 +1444,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1367,9 +1503,14 @@ - + - + + + + + + @@ -1448,7 +1589,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -1476,6 +1635,9 @@ + + + @@ -1483,20 +1645,15 @@ - + + + + - + - - - - - - - - @@ -1512,8 +1669,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1574,8 +1856,14 @@ + + + + + + - + @@ -1677,8 +1965,23 @@ + + + + + + + + + + + + + + + @@ -1758,13 +2061,20 @@ - + + + + + + + + @@ -1876,91 +2186,91 @@ - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + @@ -1987,7 +2297,7 @@ - + @@ -2072,6 +2382,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2146,6 +2483,13 @@ + + + + + + + @@ -2375,6 +2719,12 @@ + + + + + + @@ -2382,6 +2732,14 @@ + + + + + + + + @@ -2414,6 +2772,19 @@ + + + + + + + + + + + + + @@ -2583,6 +2954,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2665,6 +3078,370 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2681,8 +3458,14 @@ + + + + + + - + @@ -2801,7 +3584,7 @@ - + @@ -2851,7 +3634,7 @@ - + @@ -2863,6 +3646,9 @@ + + + @@ -2931,7 +3717,7 @@ - + @@ -2996,7 +3782,7 @@ - + @@ -3092,34 +3878,91 @@ + + + + + - + + + - - - - - - + - + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -3186,244 +4029,53 @@ - - - + - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + - + + - + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - \ No newline at end of file + -- To view, visit https://gerrit.osmocom.org/2014 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Wed Mar 8 16:56:46 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 8 Mar 2017 16:56:46 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: Update VTY command reference Message-ID: Review at https://gerrit.osmocom.org/2015 osmo-sgsn: Update VTY command reference Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 --- M OsmoSGSN/vty/sgsn_vty_reference.xml 1 file changed, 664 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/15/2015/1 diff --git a/OsmoSGSN/vty/sgsn_vty_reference.xml b/OsmoSGSN/vty/sgsn_vty_reference.xml index 15a4237..5ec0121 100644 --- a/OsmoSGSN/vty/sgsn_vty_reference.xml +++ b/OsmoSGSN/vty/sgsn_vty_reference.xml @@ -102,6 +102,24 @@ + + + + + + + + + + + + + + + + + + @@ -118,7 +136,7 @@ - + @@ -132,6 +150,10 @@ + + + + @@ -139,10 +161,13 @@ - + + + + - + @@ -158,6 +183,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -188,6 +236,13 @@ + + + + + + + @@ -254,6 +309,17 @@ + + + + + + + + + + + @@ -433,6 +499,24 @@ + + + + + + + + + + + + + + + + + + @@ -449,7 +533,7 @@ - + @@ -463,6 +547,10 @@ + + + + @@ -470,10 +558,13 @@ - + + + + - + @@ -489,6 +580,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -519,6 +633,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -596,6 +781,17 @@ + + + + + + + + + + + @@ -845,9 +1041,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -936,7 +1181,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -950,6 +1213,10 @@ + + + + @@ -957,10 +1224,13 @@ - + + + + - + @@ -1037,6 +1307,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1048,8 +1435,14 @@ + + + + + + - + @@ -1211,7 +1604,7 @@ - + @@ -1262,7 +1655,15 @@ - + + + + + + + + + @@ -1344,12 +1745,259 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + -- To view, visit https://gerrit.osmocom.org/2015 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Wed Mar 8 16:56:46 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Wed, 8 Mar 2017 16:56:46 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: improve auth-policy explaination Message-ID: Review at https://gerrit.osmocom.org/2016 osmo-sgsn: improve auth-policy explaination The explaination of the access policy is a bit unclear. Users that come from osmo-nitb might have trouble to grasp the functionality of the access control list based approack correctly. Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 24 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/16/2016/1 diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index a933d1b..97f1291 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -70,24 +70,35 @@ [[auth-pol]] === Authorization Policy -Authorization determines whether a particular subscriber can access -your network or not. +The authorization policy controls by which rules a subscriber is accepted or +rejected. The possible options range from accepting just all subscribers without +further checking, to a fine grained access-control, handled by an external HLR. -The following 4 authorization policy options are available: +accept-all:: All subscribers that attempt to attach to the GPRS network are +accepted without further checking. This option is intended to be used for +testing in a controlled environment only. A wide-open network may attract +subscribers from foreign networks and disrupt their service. It is highly +recommended to pick one of the options below. -`accept-all`: All IMSIs will be accepted. +remote:: This option allows to connect OsmoSGSN to an external HLR via the +GSUP protocol. This will be the preferred option in larger networks. -`acl-only`: Accept only IMSIs, which are explicitly white-listed -by the Access Control List (ACL), and the rest will be rejected. +acl-only:: If no external HLR is available, the network operator has the +option to control the access using an access control list. The access control +list contains the IMSI numbers of the allowed subscribers. This method offers +fine grained access control and is ideal for small networks and lab test +environments. -`closed`: Accept only home network subscribers. -The combination of MCC and MNC fully identifies a subscriber's -home network, also known as a Home Network Identity (HNI, i.e. -MCC and MNC found at the start of the IMSI, e.g. MCC 901 and -MNC 700 with IMSI 901700000003080). The ACL is also heeded. +closed:: This policy mode softens the strict *acl-only* only mode by also +implicitly accepting home network subscribers. The decision is made by the MCC +and MNC part of the IMSI number. The combination of MCC and MNC fully identifies +a subscribers home network, also known as a Home Network Identity (HNI, i.e. +MCC and MNC found at the start of the IMSI, e.g. MCC 901 and MNC 700 with +IMSI 901700000003080). -`remote`: GSUP protocol is used to remotely access a HLR. -Only remote subscription data will be used. +NOTE: The policy mode *closed* must not be confused with the equally named +policy that is defined for osmo-nitb! + .Example: Assign or change authorization policy: ---- -- To view, visit https://gerrit.osmocom.org/2016 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Wed Mar 8 17:07:59 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 8 Mar 2017 17:07:59 +0000 Subject: osmo-hlr[master]: add config example (mostly empty) In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2012/1/doc/examples/osmo-hlr.cfg File doc/examples/osmo-hlr.cfg: Line 14: ! logging. This file shall be extended as soon as that changes. That's not true - please add ctrl bind 127.0.0.8 to the example. -- To view, visit https://gerrit.osmocom.org/2012 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I38ef124e9f28bdd744bafd20fa8c310511c0b8ad Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 8 17:08:09 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 8 Mar 2017 17:08:09 +0000 Subject: osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2007/2/src/bts.cpp File src/bts.cpp: Line 554: if (abs((int32_t)rfn - m_cur_rfn) > RFN_THRESHOLD) { is rfn also limited to 22 bits? maybe add an OSMO_ASSERT for this / a less aggressive error message with bail out in case (int32_t)rfn would end up negative? (also serves to document beyond doubt what the code expects) m_cur_rfn is actually an int, which might be like a int64_t. We're not checking its magnitude ... If the first operand is int32_t, the calculation will also take place truncated to int32_t. Sure, this will practically not pose a problem when the numbers are always small enough anyway, but type safety here is still pretty mixed up :) I guess I'd rather cast to (int)rfn to match m_cur_rfn and make sure the result is never wrapped around some type boundary, for the odd case of erratic m_cur_rfn? Sorry if I'm nitpicking from a too theoretical viewpoint -- I don't really know this code so I don't trust it to stay within range of int32_t. -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 8 17:09:12 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 8 Mar 2017 17:09:12 +0000 Subject: libosmo-abis[master]: lapd: Improve log output In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2011 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9b961d5e36967cfd953551b24696849541257a1c Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 8 17:36:20 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 8 Mar 2017 17:36:20 +0000 Subject: [PATCH] openbsc[master]: bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy... Message-ID: Review at https://gerrit.osmocom.org/2017 bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy IMSI Fixes: coverity scan CID 163918 Change-Id: I4b2760b006a0707928530b4390c6997b79b02981 --- M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/libbsc/bsc_subscriber.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/17/2017/1 diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 2042ec6..1bb5141 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -157,7 +157,7 @@ gsub = gprs_subscr_alloc(); if (!gsub) return NULL; - strncpy(gsub->imsi, imsi, sizeof(gsub->imsi)); + osmo_strlcpy(gsub->imsi, imsi, sizeof(gsub->imsi)); } if (!gsub->sgsn_data) diff --git a/openbsc/src/libbsc/bsc_subscriber.c b/openbsc/src/libbsc/bsc_subscriber.c index a5e40cd..73e61e8 100644 --- a/openbsc/src/libbsc/bsc_subscriber.c +++ b/openbsc/src/libbsc/bsc_subscriber.c @@ -80,7 +80,7 @@ { if (!bsub) return; - strncpy(bsub->imsi, imsi, sizeof(bsub->imsi)); + osmo_strlcpy(bsub->imsi, imsi, sizeof(bsub->imsi)); } struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, -- To view, visit https://gerrit.osmocom.org/2017 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b2760b006a0707928530b4390c6997b79b02981 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 8 17:36:21 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 8 Mar 2017 17:36:21 +0000 Subject: [PATCH] openbsc[master]: ipaccess-config: properly create swload Message-ID: Review at https://gerrit.osmocom.org/2018 ipaccess-config: properly create swload Instead of 20, use the actual buffer sizes of struct sw_load, which are 255. Previous code would truncate a longer string at 20 without(!) NUL termination. In the _len members, store the actual length copied. In previous code, if the source string were longer than 20, we would store only 20 (without NUL term) but still reflect the longer length of the source string. Fix both of these issues for sw_load.file_id / file_id_len and sw_load.file_version / file_version_len. Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db --- M openbsc/src/ipaccess/ipaccess-config.c 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/18/2018/1 diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 0c3f888..a741836 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -624,11 +624,13 @@ load = talloc_zero(tall_ctx_config, struct sw_load); - strncpy((char *)load->file_id, header->firmware_info.sw_part, 20); - load->file_id_len = strlen(header->firmware_info.sw_part) + 1; + osmo_strlcpy((char *)load->file_id, header->firmware_info.sw_part, + sizeof(load->file_id)); + load->file_id_len = strlen((char*)load->file_id) + 1; - strncpy((char *)load->file_version, header->firmware_info.version, 20); - load->file_version_len = strlen(header->firmware_info.version) + 1; + osmo_strlcpy((char *)load->file_version, header->firmware_info.version, + sizeof(load->file_version)); + load->file_version_len = strlen((char*)load->file_version) + 1; return load; } -- To view, visit https://gerrit.osmocom.org/2018 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 8 18:10:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 8 Mar 2017 18:10:45 +0000 Subject: [PATCH] osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Hello dexter, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2007 to look at the new patch set (#3). Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by explicitly casting to bigger signed type before computing abs(). The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/07/2007/3 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..8a70558 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,15 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* GSM Frame Number cannot exceed: + 26 * 51 (superframe) * 2048 (hyperframe) */ + OSMO_ASSERT(rfn < 26 * 51 * 2048); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 8 18:11:46 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 8 Mar 2017 18:11:46 +0000 Subject: osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 3: You're right, it's better to tighten function arguments instead of making unnecessary casts. -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 8 18:13:36 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 8 Mar 2017 18:13:36 +0000 Subject: [PATCH] osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Hello dexter, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2007 to look at the new patch set (#4). Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by using signed 32 bit integer which is enough for Frame Number in GSM (added assert for max FN as well). The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/07/2007/4 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..8a70558 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,15 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* GSM Frame Number cannot exceed: + 26 * 51 (superframe) * 2048 (hyperframe) */ + OSMO_ASSERT(rfn < 26 * 51 * 2048); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 4 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 8 18:56:34 2017 From: gerrit-no-reply at lists.osmocom.org (jfdionne) Date: Wed, 8 Mar 2017 18:56:34 +0000 Subject: [PATCH] libosmocore[master]: Fix LAPD UA message buffer memory leak. In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1984 to look at the new patch set (#2). Fix LAPD UA message buffer memory leak. The state check in lapd_dl_reset causes some buffers never to be released. Using talloc report LAPD UA message buffers are never released after each call and cause a memory leak. Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e --- M src/gsm/lapd_core.c 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/1984/2 diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 5ee88a4..256401c 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -303,11 +303,6 @@ /* reset to IDLE state */ void lapd_dl_reset(struct lapd_datalink *dl) { - if (dl->state == LAPD_STATE_IDLE) - return; - LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl); - /* enter idle state (and remove eventual cont_res) */ - lapd_dl_newstate(dl, LAPD_STATE_IDLE); /* flush buffer */ lapd_dl_flush_tx(dl); lapd_dl_flush_send(dl); @@ -317,6 +312,11 @@ /* stop Timers */ lapd_stop_t200(dl); lapd_stop_t203(dl); + if (dl->state == LAPD_STATE_IDLE) + return; + LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl); + /* enter idle state (and remove eventual cont_res) */ + lapd_dl_newstate(dl, LAPD_STATE_IDLE); } /* reset and de-allocate history buffer */ -- To view, visit https://gerrit.osmocom.org/1984 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From admin at opensuse.org Wed Mar 8 19:59:23 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 08 Mar 2017 19:59:23 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c062bbb9792_6778121fc0420862a@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 113s] from bts.cpp:21: [ 113s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 113s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 113s] ^~~ [ 113s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 113s] abs(long long __x) { return __builtin_llabs (__x); } [ 113s] ^~~ [ 113s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 113s] abs(long __i) { return __builtin_labs(__i); } [ 113s] ^~~ [ 113s] Makefile:778: recipe for target 'bts.lo' failed [ 113s] make[2]: *** [bts.lo] Error 1 [ 113s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 113s] Makefile:403: recipe for target 'all-recursive' failed [ 113s] make[1]: *** [all-recursive] Error 1 [ 113s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 113s] dh_auto_build: make -j1 returned exit code 2 [ 113s] debian/rules:12: recipe for target 'build' failed [ 113s] make: *** [build] Error 2 [ 113s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 113s] [ 113s] lamb03 failed "build osmo-pcu_0.3.20170308.dsc" at Wed Mar 8 19:59:04 UTC 2017. [ 113s] [ 113s] ### VM INTERACTION START ### [ 116s] [ 103.517111] reboot: Power down [ 116s] ### VM INTERACTION END ### [ 116s] [ 116s] lamb03 failed "build osmo-pcu_0.3.20170308.dsc" at Wed Mar 8 19:59:08 UTC 2017. [ 116s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 8 20:01:23 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 08 Mar 2017 20:01:23 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c0633d601e6_6785121fc0422977c@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 198s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 198s] from /usr/include/osmocom/core/timer.h:35, [ 198s] from ./bts.h:29, [ 198s] from bts.cpp:21: [ 198s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 198s] abs(long long __x) { return __builtin_llabs (__x); } [ 198s] ^~~ [ 198s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 198s] abs(long __i) { return __builtin_labs(__i); } [ 198s] ^~~ [ 198s] Makefile:778: recipe for target 'bts.lo' failed [ 198s] make[2]: *** [bts.lo] Error 1 [ 198s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 198s] Makefile:403: recipe for target 'all-recursive' failed [ 198s] make[1]: *** [all-recursive] Error 1 [ 198s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 198s] dh_auto_build: make -j1 returned exit code 2 [ 198s] debian/rules:12: recipe for target 'build' failed [ 198s] make: *** [build] Error 2 [ 198s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 198s] [ 198s] cloud105 failed "build osmo-pcu_0.3.20170308.dsc" at Wed Mar 8 20:01:02 UTC 2017. [ 198s] [ 198s] ### VM INTERACTION START ### [ 202s] [ 176.698699] reboot: Power down [ 203s] ### VM INTERACTION END ### [ 203s] [ 203s] cloud105 failed "build osmo-pcu_0.3.20170308.dsc" at Wed Mar 8 20:01:07 UTC 2017. [ 203s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Wed Mar 8 22:10:09 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 8 Mar 2017 22:10:09 +0000 Subject: osmo-trx[master]: uhd: Increase MC-BTS FPGA clock rate to 51.2 MHz In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) > (1 comment) > > Does it fix https://projects.osmocom.org/issues/1963 ? Yes. Tested with UHD 3.6.1, 3.7.3, 3.8.5, 3.9.6, and 3.10.1.1 versions. https://gerrit.osmocom.org/#/c/2005/1/Transceiver52M/UHDDevice.cpp File Transceiver52M/UHDDevice.cpp: Line 1081: // Workaround for UHD tick rounding bug > Is there actual ticket reference available for uhd bug so we can remove thi There is an internal ticket tracking the issue. The workaround will likely stay for a while given older UHD version support. -- To view, visit https://gerrit.osmocom.org/2005 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I78fb2c0959abd0e666628ba39f433162aafb067e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 9 00:03:39 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 9 Mar 2017 00:03:39 +0000 Subject: osmo-trx[master]: uhd: Add support for UHD-3.11 logging control In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2001 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I223ebb9fae3f4061e0cb37c05263c1b569e8f628 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 00:03:42 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 9 Mar 2017 00:03:42 +0000 Subject: [MERGED] osmo-trx[master]: uhd: Add support for UHD-3.11 logging control In-Reply-To: References: Message-ID: Tom Tsou has submitted this change and it was merged. Change subject: uhd: Add support for UHD-3.11 logging control ...................................................................... uhd: Add support for UHD-3.11 logging control The logging API changes in UHD-3.11, which causes build failure if not properly handled. Change-Id: I223ebb9fae3f4061e0cb37c05263c1b569e8f628 --- M Transceiver52M/UHDDevice.cpp M configure.ac 2 files changed, 16 insertions(+), 7 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index d139cdc..35eb827 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -28,10 +28,13 @@ #include #include #include -#include #ifdef HAVE_CONFIG_H #include "config.h" +#endif + +#ifndef USE_UHD_3_11 +#include #endif #define B2XX_CLK_RT 26e6 @@ -84,7 +87,7 @@ /* * USRP version dependent device timings */ -#ifdef USE_UHD_3_9 +#if defined(USE_UHD_3_9) || defined(USE_UHD_3_11) #define B2XX_TIMING_1SPS 1.7153e-4 #define B2XX_TIMING_4SPS 1.1696e-4 #define B2XX_TIMING_4_4SPS 6.18462e-5 @@ -383,7 +386,8 @@ return NULL; } -/* +#ifndef USE_UHD_3_11 +/* Catch and drop underrun 'U' and overrun 'O' messages from stdout since we already report using the logging facility. Direct everything else appropriately. @@ -404,6 +408,7 @@ break; } } +#endif static void thread_enable_cancel(bool cancel) { @@ -995,9 +1000,10 @@ return false; } +#ifndef USE_UHD_3_11 // Register msg handler uhd::msg::register_handler(&uhd_msg_handler); - +#endif // Start asynchronous event (underrun check) loop async_event_thrd = new Thread(); async_event_thrd->start((void * (*)(void*))async_event_loop, (void*)this); diff --git a/configure.ac b/configure.ac index 649bb0e..f1159c6 100644 --- a/configure.ac +++ b/configure.ac @@ -97,9 +97,12 @@ ]) AS_IF([test "x$with_usrp1" != "xyes"],[ - PKG_CHECK_MODULES(UHD, uhd >= 003.009, - [AC_DEFINE(USE_UHD_3_9, 1, UHD version 3.9.0 or higher)], - [PKG_CHECK_MODULES(UHD, uhd >= 003.005.004)] + PKG_CHECK_MODULES(UHD, uhd >= 003.011, + [AC_DEFINE(USE_UHD_3_11, 1, UHD version 3.11.0 or higher)], + [PKG_CHECK_MODULES(UHD, uhd >= 003.009, + [AC_DEFINE(USE_UHD_3_9, 1, UHD version 3.9.0 or higher)], + [PKG_CHECK_MODULES(UHD, uhd >= 003.005)] + )] ) AC_DEFINE(USE_UHD, 1, All UHD versions) PKG_CHECK_MODULES(FFTWF, fftw3f) -- To view, visit https://gerrit.osmocom.org/2001 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I223ebb9fae3f4061e0cb37c05263c1b569e8f628 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Thu Mar 9 01:12:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 9 Mar 2017 01:12:48 +0000 Subject: osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 4: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2007/4/src/bts.cpp File src/bts.cpp: Line 532: OSMO_ASSERT(rfn < 26 * 51 * 2048); we have a #define for this in libosmocore. I mentioned this in the original patch introducing rfn_to_fn() alrady, and now again... Also, he reduced/relative frame number is generally much smaller than the real frame number. It would e really nonsensical to try to expand a non-reduced fn to a real fn. bu then, it is an assert, so let's keep it. -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 4 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 9 01:14:43 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 9 Mar 2017 01:14:43 +0000 Subject: osmo-pcu[master]: Add pkg-config file In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2008/1/osmo-pcu.pc.in File osmo-pcu.pc.in: Line 10: Libs: -L${libdir} -losmopcu I don't think this library exists. We only have a header file, so don't ask users to link against non-existing libraries? -- To view, visit https://gerrit.osmocom.org/2008 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0520045e5655794df152b98b9755d7cbbd334049 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 9 01:39:05 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 9 Mar 2017 01:39:05 +0000 Subject: osmo-hlr[master]: add config example (mostly empty) In-Reply-To: References: Message-ID: Patch Set 1: > (1 comment) ah of course, how could I forget! -- To view, visit https://gerrit.osmocom.org/2012 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I38ef124e9f28bdd744bafd20fa8c310511c0b8ad Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 01:49:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 9 Mar 2017 01:49:22 +0000 Subject: [PATCH] osmo-hlr[master]: add config example (mostly empty) In-Reply-To: References: Message-ID: Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2012 to look at the new patch set (#2). add config example (mostly empty) So far only the vty and ctrl bind configs exists. Change-Id: I38ef124e9f28bdd744bafd20fa8c310511c0b8ad --- A doc/examples/osmo-hlr.cfg 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/12/2012/2 diff --git a/doc/examples/osmo-hlr.cfg b/doc/examples/osmo-hlr.cfg new file mode 100644 index 0000000..2b49958 --- /dev/null +++ b/doc/examples/osmo-hlr.cfg @@ -0,0 +1,16 @@ +! +! OsmoHLR example configuration +! +log stderr + logging filter all 1 + logging color 1 + logging print category 1 + logging timestamp 1 + logging print extended-timestamp 1 + logging level all debug + logging level linp error +! +line vty + bind 127.0.0.1 +ctrl + bind 127.0.0.1 -- To view, visit https://gerrit.osmocom.org/2012 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I38ef124e9f28bdd744bafd20fa8c310511c0b8ad Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 9 01:50:31 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 9 Mar 2017 01:50:31 +0000 Subject: osmo-hlr[master]: add config example (mostly empty) In-Reply-To: References: Message-ID: Patch Set 2: actually we usually don't have vty and ctrl in the example configs, but it's good to get started with that. -- To view, visit https://gerrit.osmocom.org/2012 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I38ef124e9f28bdd744bafd20fa8c310511c0b8ad Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 10:09:48 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 10:09:48 +0000 Subject: [PATCH] osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Hello dexter, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2007 to look at the new patch set (#5). Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by using signed 32 bit integer which is enough for Frame Number in GSM (added assert for max FN as well). The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 8 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/07/2007/5 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..7561ba5 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,14 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* double-check that relative FN fits into int32_t */ + OSMO_ASSERT(rfn < GSM_MAX_FN); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 5 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Thu Mar 9 10:11:03 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 10:11:03 +0000 Subject: osmo-hlr[master]: add config example (mostly empty) In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2012 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I38ef124e9f28bdd744bafd20fa8c310511c0b8ad Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 10:11:37 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 10:11:37 +0000 Subject: osmo-trx[master]: uhd: Increase MC-BTS FPGA clock rate to 51.2 MHz In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2005 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I78fb2c0959abd0e666628ba39f433162aafb067e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 10:26:37 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 10:26:37 +0000 Subject: openbsc[master]: ipaccess-config: properly create swload In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2018/1/openbsc/src/ipaccess/ipaccess-config.c File openbsc/src/ipaccess/ipaccess-config.c: Line 629: load->file_id_len = strlen((char*)load->file_id) + 1; Why +1? The \0 added by osmo_strlcpy() is included in size parameter for it. -- To view, visit https://gerrit.osmocom.org/2018 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 9 10:27:36 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 10:27:36 +0000 Subject: openbsc[master]: bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2017 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b2760b006a0707928530b4390c6997b79b02981 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 11:17:50 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 11:17:50 +0000 Subject: [PATCH] osmo-pcu[master]: Add pkg-config file In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2008 to look at the new patch set (#2). Add pkg-config file We're installing header file pcuif_proto.h so it's better to use pkg-config for proper version tracking similar to the way it's done for OpenBSC. Change-Id: I0520045e5655794df152b98b9755d7cbbd334049 --- M .gitignore M Makefile.am M configure.ac M debian/osmo-pcu.install A osmo-pcu.pc.in 5 files changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/08/2008/2 diff --git a/.gitignore b/.gitignore index 959b09b..234ef0b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ debian/osmo-pcu.substvars debian/osmo-pcu/ debian/tmp/ + +osmo-pcu.pc diff --git a/Makefile.am b/Makefile.am index 12cb478..1536016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,5 @@ SUBDIRS = include src examples tests EXTRA_DIST = osmoappdesc.py +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = osmo-pcu.pc diff --git a/configure.ac b/configure.ac index dcde2ed..54c70ca 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,7 @@ AC_SUBST(STD_DEFINES_AND_INCLUDES) AC_OUTPUT( + osmo-pcu.pc include/Makefile src/Makefile examples/Makefile diff --git a/debian/osmo-pcu.install b/debian/osmo-pcu.install index 768719c..54dcc63 100644 --- a/debian/osmo-pcu.install +++ b/debian/osmo-pcu.install @@ -1,3 +1,4 @@ etc/osmocom/osmo-pcu.cfg usr/bin/osmo-pcu usr/include/osmocom/pcu/pcuif_proto.h +usr/lib/pkgconfig/osmo-pcu.pc diff --git a/osmo-pcu.pc.in b/osmo-pcu.pc.in new file mode 100644 index 0000000..b72e9a8 --- /dev/null +++ b/osmo-pcu.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/ + +Name: OsmoPCU +Description: Osmocom PCU implementation +Requires: +Version: @VERSION@ +Cflags: -I${includedir} -- To view, visit https://gerrit.osmocom.org/2008 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0520045e5655794df152b98b9755d7cbbd334049 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 9 11:27:14 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 11:27:14 +0000 Subject: [PATCH] openbsc[master]: Remove libs from openbsc.pc Message-ID: Review at https://gerrit.osmocom.org/2019 Remove libs from openbsc.pc OpenBSC does not produce any installable libraries, only header files so this section is unnecessary. Change-Id: I4c563d775a84f41f82404e0eaba1a25fdbaac1a5 --- M openbsc/openbsc.pc.in 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/19/2019/1 diff --git a/openbsc/openbsc.pc.in b/openbsc/openbsc.pc.in index aba07e2..17e265d 100644 --- a/openbsc/openbsc.pc.in +++ b/openbsc/openbsc.pc.in @@ -7,5 +7,4 @@ Description: OpenBSC base station controller Requires: Version: @VERSION@ -Libs: -L${libdir} -lopenbsc Cflags: -I${includedir} -- To view, visit https://gerrit.osmocom.org/2019 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4c563d775a84f41f82404e0eaba1a25fdbaac1a5 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 9 12:37:38 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 12:37:38 +0000 Subject: libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 Vadim, can you rebase this to latest master? -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 9 12:52:57 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 9 Mar 2017 12:52:57 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: improve auth-policy explaination In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2016 to look at the new patch set (#2). osmo-sgsn: improve auth-policy explaination The explaination of the access policy is a bit unclear. Users that come from osmo-nitb might have trouble to grasp the functionality of the access control list based approack correctly. Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 38 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/16/2016/2 diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index a933d1b..9551267 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -70,24 +70,35 @@ [[auth-pol]] === Authorization Policy -Authorization determines whether a particular subscriber can access -your network or not. +The authorization policy controls by which rules a subscriber is accepted or +rejected. The possible options range from accepting just all subscribers without +further checking, to a fine grained access-control, handled by an external HLR. -The following 4 authorization policy options are available: +accept-all:: All subscribers that attempt to attach to the GPRS network are +accepted without further checking. This option is intended to be used for +testing in a controlled environment only. A wide-open network may attract +subscribers from foreign networks and disrupt their service. It is highly +recommended to pick one of the options below. -`accept-all`: All IMSIs will be accepted. +remote:: This option allows to connect OsmoSGSN to an external HLR via the +GSUP protocol. This will be the preferred option in larger networks. -`acl-only`: Accept only IMSIs, which are explicitly white-listed -by the Access Control List (ACL), and the rest will be rejected. +acl-only:: If no external HLR is available, the network operator has the +option to control the access using an access control list. The access control +list contains the IMSI numbers of the allowed subscribers. This method offers +fine grained access control and is ideal for small networks and lab test +environments. -`closed`: Accept only home network subscribers. -The combination of MCC and MNC fully identifies a subscriber's -home network, also known as a Home Network Identity (HNI, i.e. -MCC and MNC found at the start of the IMSI, e.g. MCC 901 and -MNC 700 with IMSI 901700000003080). The ACL is also heeded. +closed:: This policy mode softens the strict *acl-only* only mode by also +implicitly accepting home network subscribers. The decision is made by the MCC +and MNC part of the IMSI number. The combination of MCC and MNC fully identifies +a subscribers home network, also known as a Home Network Identity (HNI, i.e. +MCC and MNC found at the start of the IMSI, e.g. MCC 901 and MNC 700 with +IMSI 901700000003080). -`remote`: GSUP protocol is used to remotely access a HLR. -Only remote subscription data will be used. +NOTE: The policy mode *closed* must not be confused with the equally named +policy that is defined for osmo-nitb! + .Example: Assign or change authorization policy: ---- @@ -105,6 +116,18 @@ <2> Saves current changes to cofiguration to make this policy persistent +.Example: Access control list: +---- +sgsn + auth-policy acl-only <1> + imsi-acl add 001010000000003 + imsi-acl add 001010000000002 + imsi-acl add 001010000000001 + imsi-acl add 901700000000068 <2> +---- +<1> Set the authorization policy +<2> Add as many subscribers as required + === Subscriber Configuration As opposed to OsmoNITB, OsmoSGSN does not feature a built-in HLR. @@ -112,7 +135,8 @@ It can thus operate only in the following two modes: . Accessing an external HLR (or HLR gateway) via the GSUP protocol -. Accepting subscribers based on internal ACL (access control list) +. Accepting subscribers based on internal ACL (access control list), + see also <> ==== Accessing an external HLR via GSUP -- To view, visit https://gerrit.osmocom.org/2016 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 9 12:52:57 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 9 Mar 2017 12:52:57 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: Explain TCP/IP header compression Message-ID: Review at https://gerrit.osmocom.org/2020 osmo-sgsn: Explain TCP/IP header compression The does not mention TCP/IP header compression yet. This commit adds some info about it Change-Id: I98408e72020a474d378e39263a933eb7567de146 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 79 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/20/2020/1 diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index 9551267..dce4c78 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -223,3 +223,82 @@ |pdp-terminate|Forced PDP context termination during MM context release |pdp-free|Release of the PDP context memory |=== + + +=== Traffic Compression + +In order to save scarce GPRS bandwith, OsmoSGSN implements header and data +compression schemes. The compression will reduce the packet length in order +to save radio bandwith. + +===== Header Compression + +On TCP/IP connections, each packet is perpended with a fairly long TCP/IP +header. The header contains a lot of static information that never changes +throughout the connection. (source and destination address, port numbers etc.) +OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also +known as SLHC. This type of header compression removes the TCP/IP header +entirely and replaces it with a shorter version, that only contains the +information that is absolutely necessary to identify and check the packet. +The receiving part then restores the original header and forwards it to higher +layers. + +*compression rfc1144 passive*:: +TCP/IP header compression has to be actively requested by the modem. The +network will not promote compression by its-self. This is the recommended mode +of operation. + +*compression rfc1144 active slots <1-256>*:: +TCP/IP header compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The number of slots is the the maximum number +of packet headers per subscriber that can be stored in the codebook. + +.Example: Accept compression if requested: +---- +sgsn + compression rfc1144 passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression rfc1144 active slots 8 +---- + +NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression +scheme. TCP/IP options may render RFC1144 ineffective if variable data is +encoded into the option section of the TCP/IP packet. + + +===== Data Compression + +Data compression works on the raw packet data, including the header part of the +packet. If enabled, header compression is applied before first data compression +is applied. OsmoSGSN implements the V.42bis data compression scheme. + +*compression rfc1144 passive*:: +V42bis data compression has to be actively requested by the modem. The network +will not promote compression by its-self. This is the recommended mode of +operation. + +*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*:: +V42bis data compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The direction configures which of the sides is +allowed to send compressed packets. For most cases, compressing *both* +directions will be the preferred option. The following to parameters configure +the codebook size by the maxium number (*codewords*) and size (*strlen*) of +entries. + +.Example: Accept compression if requested: +---- +sgsn + compression v42bis passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression v42bis active direction both codewords 512 strlen 20 +---- -- To view, visit https://gerrit.osmocom.org/2020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I98408e72020a474d378e39263a933eb7567de146 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 9 12:52:57 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 9 Mar 2017 12:52:57 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: Remove cut+paste error Message-ID: Review at https://gerrit.osmocom.org/2021 osmo-sgsn: Remove cut+paste error Change-Id: I73b0d042620792b8f2d58572f801410aa964aa25 --- M OsmoSGSN/chapters/running.adoc 1 file changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/21/2021/1 diff --git a/OsmoSGSN/chapters/running.adoc b/OsmoSGSN/chapters/running.adoc index d758b28..dfc1b35 100644 --- a/OsmoSGSN/chapters/running.adoc +++ b/OsmoSGSN/chapters/running.adoc @@ -13,8 +13,6 @@ *-h, --help*:: Print a short help message about the supported options -*-V, --version*:: - Print the compile-time version number of the OsmoBTS program *-d, --debug 'DBGMASK','DBGLEVELS'*:: Set the log subsystems and levels for logging to stderr. This has mostly been superseded by VTY-based logging configuration, -- To view, visit https://gerrit.osmocom.org/2021 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73b0d042620792b8f2d58572f801410aa964aa25 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 9 12:52:57 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 9 Mar 2017 12:52:57 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: fix arrow tips in flow diagrams Message-ID: Review at https://gerrit.osmocom.org/2022 osmo-sgsn: fix arrow tips in flow diagrams Change-Id: I7faa0c97ee3705a64289a47bc63f311d05f988b3 --- M OsmoSGSN/chapters/gsup.adoc 1 file changed, 37 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/22/2022/1 diff --git a/OsmoSGSN/chapters/gsup.adoc b/OsmoSGSN/chapters/gsup.adoc index 45c0e1d..d3f8711 100644 --- a/OsmoSGSN/chapters/gsup.adoc +++ b/OsmoSGSN/chapters/gsup.adoc @@ -65,8 +65,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; - Peer -> SGSN [label="SEND AUTHENTICATION INFO RESPONSE (Tuples)"]; + SGSN <= Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; + Peer <= SGSN [label="SEND AUTHENTICATION INFO RESPONSE (Tuples)"]; } ---- @@ -77,8 +77,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; - Peer -> SGSN [label="SEND AUTHENTICATION INFO ERROR (Cause)"]; + SGSN <= Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; + Peer <= SGSN [label="SEND AUTHENTICATION INFO ERROR (Cause)"]; } ---- @@ -94,7 +94,7 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="AUTHENTICATION FAILURE REPORT (IMSI)"]; + SGSN <= Peer [label="AUTHENTICATION FAILURE REPORT (IMSI)"]; } ---- @@ -115,10 +115,10 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; - Peer -> SGSN [label="INSERT SUBSCRIBER DATA"]; - SGSN -> Peer [label="INSERT SUBSCRIBER DATA ACK"]; - Peer -> SGSN [label="UPDATE LOCATTION RESULT"]; + SGSN <= Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; + Peer <= SGSN [label="INSERT SUBSCRIBER DATA"]; + SGSN <= Peer [label="INSERT SUBSCRIBER DATA ACK"]; + Peer <= SGSN [label="UPDATE LOCATTION RESULT"]; } ---- @@ -129,8 +129,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; - Peer -> SGSN [label="UPDATE LOCATTION ERROR (Cause)"]; + SGSN <= Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; + Peer <= SGSN [label="UPDATE LOCATTION ERROR (Cause)"]; } ---- @@ -146,8 +146,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - Peer -> SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; - SGSN -> Peer [label="CANCEL LOCATION RESULT"]; + Peer <= SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; + SGSN <= Peer [label="CANCEL LOCATION RESULT"]; } ---- @@ -158,8 +158,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - Peer -> SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; - SGSN -> Peer [label="CANCEL LOCATION ERROR (Cause)"]; + Peer <= SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; + SGSN <= Peer [label="CANCEL LOCATION ERROR (Cause)"]; } ---- @@ -176,8 +176,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="PURGE MS REQUEST (IMSI)"]; - Peer -> SGSN [label="PURGE MS RESULT"]; + SGSN <= Peer [label="PURGE MS REQUEST (IMSI)"]; + Peer <= SGSN [label="PURGE MS RESULT"]; } ---- @@ -195,8 +195,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - Peer -> SGSN [label="DELETE SUBSCRIBER DATA REQUEST (IMSI)"]; - SGSN -> Peer [label="DELETE SUBSCRIBER DATA RESULT"]; + Peer <= SGSN [label="DELETE SUBSCRIBER DATA REQUEST (IMSI)"]; + SGSN <= Peer [label="DELETE SUBSCRIBER DATA RESULT"]; } ---- @@ -221,7 +221,7 @@ ==== Send Authentication Info Request -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -239,7 +239,7 @@ ==== Send Authentication Info Error -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -251,7 +251,7 @@ ==== Send Authentication Info Response -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -263,7 +263,7 @@ ==== Authentication Failure Report -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -275,7 +275,7 @@ ==== Update Location Request -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -287,7 +287,7 @@ ==== Update Location Error -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -299,7 +299,7 @@ ==== Update Location Result -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -316,7 +316,7 @@ ==== Location Cancellation Request -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -329,7 +329,7 @@ ==== Location Cancellation Result -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -341,7 +341,7 @@ ==== Purge MS Request -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -354,7 +354,7 @@ ==== Purge MS Error -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -366,7 +366,7 @@ ==== Purge MS Result -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -378,7 +378,7 @@ ==== Insert Subscriber Data Request -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -396,7 +396,7 @@ ==== Insert Subscriber Data Error -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -408,7 +408,7 @@ ==== Insert Subscriber Data Result -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -419,7 +419,7 @@ ==== Delete Subscriber Data Request -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -432,7 +432,7 @@ ==== Delete Subscriber Data Error -Direction: SGSN -> Network peer +Direction: SGSN <= Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -444,7 +444,7 @@ ==== Delete Subscriber Data Result -Direction: Network peer -> SGSN +Direction: Network peer <= SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== -- To view, visit https://gerrit.osmocom.org/2022 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7faa0c97ee3705a64289a47bc63f311d05f988b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 9 13:48:39 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 9 Mar 2017 13:48:39 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: Explain TCP/IP header compression In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2020 to look at the new patch set (#2). osmo-sgsn: Explain TCP/IP header compression The does not mention TCP/IP header compression yet. This commit adds some info about it Change-Id: I98408e72020a474d378e39263a933eb7567de146 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 79 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/20/2020/2 diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index 9551267..7bd6eb2 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -223,3 +223,82 @@ |pdp-terminate|Forced PDP context termination during MM context release |pdp-free|Release of the PDP context memory |=== + + +=== Traffic Compression + +In order to save scarce GPRS bandwith, OsmoSGSN implements header and data +compression schemes. The compression will reduce the packet length in order +to save radio bandwith. + +==== Header Compression + +On TCP/IP connections, each packet is perpended with a fairly long TCP/IP +header. The header contains a lot of static information that never changes +throughout the connection. (source and destination address, port numbers etc.) +OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also +known as SLHC. This type of header compression removes the TCP/IP header +entirely and replaces it with a shorter version, that only contains the +information that is absolutely necessary to identify and check the packet. +The receiving part then restores the original header and forwards it to higher +layers. + +*compression rfc1144 passive*:: +TCP/IP header compression has to be actively requested by the modem. The +network will not promote compression by its-self. This is the recommended mode +of operation. + +*compression rfc1144 active slots <1-256>*:: +TCP/IP header compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The number of slots is the the maximum number +of packet headers per subscriber that can be stored in the codebook. + +.Example: Accept compression if requested: +---- +sgsn + compression rfc1144 passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression rfc1144 active slots 8 +---- + +NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression +scheme. TCP/IP options may render RFC1144 ineffective if variable data is +encoded into the option section of the TCP/IP packet. + + +==== Data Compression + +Data compression works on the raw packet data, including the header part of the +packet. If enabled, header compression is applied before first data compression +is applied. OsmoSGSN implements the V.42bis data compression scheme. + +*compression rfc1144 passive*:: +V42bis data compression has to be actively requested by the modem. The network +will not promote compression by its-self. This is the recommended mode of +operation. + +*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*:: +V42bis data compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The direction configures which of the sides is +allowed to send compressed packets. For most cases, compressing *both* +directions will be the preferred option. The following to parameters configure +the codebook size by the maxium number (*codewords*) and size (*strlen*) of +entries. + +.Example: Accept compression if requested: +---- +sgsn + compression v42bis passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression v42bis active direction both codewords 512 strlen 20 +---- -- To view, visit https://gerrit.osmocom.org/2020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I98408e72020a474d378e39263a933eb7567de146 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 9 15:17:54 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 9 Mar 2017 15:17:54 +0000 Subject: [PATCH] osmo-bts[master]: l1sap: fix rach reason (ra) parsing Message-ID: Review at https://gerrit.osmocom.org/2023 l1sap: fix rach reason (ra) parsing The ra parameter indicates the reason for the received rach request. osmo-bts uses the ra parameter to determine if the received rach request is packet access related. If yes, osmo-bts will forward the request to the PCU. In order to determine if the ra is packet related or not, the higher 4 bits must be equel to 0x7 and at least one of the lower 4 bits must be zero. The current method lacks checking of the lower 4 bits. It would also accept 0b01111111, which is reserved for future use. This commit extends the check to take also the last 4 bits into accound. See also: 3GPP TS 04.08, Table 9.9 Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 --- M include/osmo-bts/l1sap.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/23/2023/1 diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index dcebc1d..c99eaaa 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -24,7 +24,7 @@ #define L1SAP_IS_CHAN_AGCH_PCH(chan_nr) ((chan_nr & 0xf8) == 0x90) /* rach type from ra */ -#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70) +#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70 && (ra & 0x0F) != 0x0F) /* CCCH block from frame number */ #define L1SAP_FN2CCCHBLOCK(fn) ((fn % 51) / 5 - 1) -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 9 16:41:31 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 16:41:31 +0000 Subject: [PATCH] osmo-pcu[master]: tests: include headers from include/ Message-ID: Review at https://gerrit.osmocom.org/2024 tests: include headers from include/ In addition to .h files from src/ add include/ as well: some headers are now public and reside in separate directory. Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 --- M tests/Makefile.am 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/24/2024/1 diff --git a/tests/Makefile.am b/tests/Makefile.am index a03528c..79c3ef6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ -I$(top_srcdir)/include/ AM_LDFLAGS = -lrt check_PROGRAMS = rlcmac/RLCMACTest alloc/AllocTest tbf/TbfTest types/TypesTest ms/MsTest llist/LListTest llc/LlcTest codel/codel_test edge/EdgeTest bitcomp/BitcompTest fn/FnTest -- To view, visit https://gerrit.osmocom.org/2024 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 9 16:45:30 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Thu, 9 Mar 2017 16:45:30 +0000 Subject: osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2023/1/include/osmo-bts/l1sap.h File include/osmo-bts/l1sap.h: PS1, Line 27: (ra & 0x0F) != 0x0F) nitpick: can you use lower case F. -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 9 16:52:04 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 16:52:04 +0000 Subject: [PATCH] osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Hello dexter, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2007 to look at the new patch set (#6). Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by using signed 32 bit integer which is enough for Frame Number in GSM (added assert for max FN as well). The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/07/2007/6 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..a370030 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,15 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* double-check that relative FN is not negative and fits into int32_t */ + OSMO_ASSERT(rfn < GSM_MAX_FN); + OSMO_ASSERT(rfn >= 0); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 6 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Thu Mar 9 17:03:07 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 9 Mar 2017 17:03:07 +0000 Subject: [PATCH] osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Hello dexter, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2007 to look at the new patch set (#7). Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by using signed 32 bit integer which is enough for Frame Number in GSM. Also, mark parameter constraints more explicitly: - add assert for expected FN values - don't perform computation for non-relative FN The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 11 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/07/2007/7 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..38d5843 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,15 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* double-check that relative FN is not negative and fits into int32_t */ + OSMO_ASSERT(rfn < GSM_MAX_FN); + OSMO_ASSERT(rfn >= 0); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. @@ -536,7 +540,8 @@ /* Ensure that all following calculations are performed with the * relative frame number */ - rfn = rfn % 42432; + if (rfn >= 42432) + return rfn; /* Compute an internal relative frame number from the full internal frame number */ diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 7 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Thu Mar 9 17:52:01 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 9 Mar 2017 17:52:01 +0000 Subject: osmo-trx[master]: uhd: Increase MC-BTS FPGA clock rate to 51.2 MHz In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2005 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I78fb2c0959abd0e666628ba39f433162aafb067e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From admin at opensuse.org Thu Mar 9 19:55:37 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 09 Mar 2017 19:55:37 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c1b360463ca_5f3a31bc08999ab@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 110s] from bts.cpp:21: [ 110s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 110s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 110s] abs(long long __x) { return __builtin_llabs (__x); } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 110s] abs(long __i) { return __builtin_labs(__i); } [ 110s] ^~~ [ 110s] Makefile:778: recipe for target 'bts.lo' failed [ 110s] make[2]: *** [bts.lo] Error 1 [ 110s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 110s] Makefile:403: recipe for target 'all-recursive' failed [ 110s] make[1]: *** [all-recursive] Error 1 [ 110s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 110s] dh_auto_build: make -j1 returned exit code 2 [ 110s] debian/rules:12: recipe for target 'build' failed [ 110s] make: *** [build] Error 2 [ 110s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 110s] [ 110s] lamb08 failed "build osmo-pcu_0.3.20170309.dsc" at Thu Mar 9 19:55:16 UTC 2017. [ 110s] [ 110s] ### VM INTERACTION START ### [ 113s] [ 99.864509] reboot: Power down [ 113s] ### VM INTERACTION END ### [ 113s] [ 113s] lamb08 failed "build osmo-pcu_0.3.20170309.dsc" at Thu Mar 9 19:55:20 UTC 2017. [ 113s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 9 19:56:29 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 09 Mar 2017 19:56:29 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c1b37ca790e_5f4031bc089085d@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 110s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 110s] from /usr/include/osmocom/core/timer.h:35, [ 110s] from ./bts.h:29, [ 110s] from bts.cpp:21: [ 110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 110s] abs(long long __x) { return __builtin_llabs (__x); } [ 110s] ^~~ [ 110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 110s] abs(long __i) { return __builtin_labs(__i); } [ 110s] ^~~ [ 110s] Makefile:778: recipe for target 'bts.lo' failed [ 110s] make[2]: *** [bts.lo] Error 1 [ 110s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 110s] Makefile:403: recipe for target 'all-recursive' failed [ 110s] make[1]: *** [all-recursive] Error 1 [ 110s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 110s] dh_auto_build: make -j1 returned exit code 2 [ 110s] debian/rules:12: recipe for target 'build' failed [ 110s] make: *** [build] Error 2 [ 110s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 110s] [ 110s] lamb66 failed "build osmo-pcu_0.3.20170309.dsc" at Thu Mar 9 19:56:18 UTC 2017. [ 110s] [ 110s] ### VM INTERACTION START ### [ 113s] [ 100.647911] reboot: Power down [ 114s] ### VM INTERACTION END ### [ 114s] [ 114s] lamb66 failed "build osmo-pcu_0.3.20170309.dsc" at Thu Mar 9 19:56:22 UTC 2017. [ 114s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Thu Mar 9 22:39:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 9 Mar 2017 22:39:08 +0000 Subject: [PATCH] libosmocore[master]: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() Message-ID: Review at https://gerrit.osmocom.org/2025 fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 --- M include/osmocom/core/utils.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/2025/1 diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index d9c3097..63a73ab 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -18,7 +18,7 @@ /*! \brief Stringify the contents of a macro, e.g. a port number */ #define OSMO_STRINGIFY(x) #x /*! \brief Make a value_string entry from an enum value name */ -#define OSMO_VALUE_STRING(x) { x, OSMO_STRINGIFY(x) } +#define OSMO_VALUE_STRING(x) { x, #x } #include #include -- To view, visit https://gerrit.osmocom.org/2025 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 9 22:39:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 9 Mar 2017 22:39:08 +0000 Subject: [PATCH] libosmocore[master]: add gsm48_pdisc_names and gsm48_pdisc_name() Message-ID: Review at https://gerrit.osmocom.org/2026 add gsm48_pdisc_names and gsm48_pdisc_name() I often want to log the protocol discriminator in the openbsc debug log. It's more useful to get the name directly instead of looking it up every time. Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae --- M include/osmocom/gsm/protocol/gsm_04_08.h M src/gsm/gsm48.c M src/gsm/libosmogsm.map 3 files changed, 24 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/2026/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index da17755..96fdabe 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -926,6 +926,10 @@ #define GSM48_PDISC_MASK 0x0f #define GSM48_PDISC_USSD 0x11 +extern const struct value_string gsm48_pdisc_names[]; +static inline const char *gsm48_pdisc_name(uint8_t val) +{ return get_value_string(gsm48_pdisc_names, val); } + bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr); static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr) diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index b626f82..d408897 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -678,3 +678,22 @@ else return n_pag_blocks * (chan_desc->bs_pa_mfrms + 2); } + +const struct value_string gsm48_pdisc_names[] = { + OSMO_VALUE_STRING(GSM48_PDISC_GROUP_CC), + OSMO_VALUE_STRING(GSM48_PDISC_BCAST_CC), + OSMO_VALUE_STRING(GSM48_PDISC_PDSS1), + OSMO_VALUE_STRING(GSM48_PDISC_CC), + OSMO_VALUE_STRING(GSM48_PDISC_PDSS2), + OSMO_VALUE_STRING(GSM48_PDISC_MM), + OSMO_VALUE_STRING(GSM48_PDISC_RR), + OSMO_VALUE_STRING(GSM48_PDISC_MM_GPRS), + OSMO_VALUE_STRING(GSM48_PDISC_SMS), + OSMO_VALUE_STRING(GSM48_PDISC_SM_GPRS), + OSMO_VALUE_STRING(GSM48_PDISC_NC_SS), + OSMO_VALUE_STRING(GSM48_PDISC_LOC), + OSMO_VALUE_STRING(GSM48_PDISC_EXTEND), + OSMO_VALUE_STRING(GSM48_PDISC_MASK), + OSMO_VALUE_STRING(GSM48_PDISC_USSD), + { 0, NULL } +}; diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 8d28476..60f83de 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -217,6 +217,7 @@ gsm48_mcc_mnc_from_bcd; gsm48_chan_mode_names; gsm_chan_t_names; +gsm48_pdisc_names; gsm_7bit_decode; gsm_7bit_decode_ussd; -- To view, visit https://gerrit.osmocom.org/2026 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 9 22:39:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 9 Mar 2017 22:39:08 +0000 Subject: [PATCH] libosmocore[master]: add gsm48_pdisc_msgtype_name() Message-ID: Review at https://gerrit.osmocom.org/2027 add gsm48_pdisc_msgtype_name() Composing the message type string requires knowing the protocol discriminator. To ease printing the message type, add this function to switch between the defined value_string[]s depending on pdisc. Also publish the message type value_string[]s -- without inline functions to access them because it is anyway more convenient to use gsm48_pdisc_msgtype_name() instead. Since gsm48_pdisc_msgtype_name() is nontrivial, do not add as inline function -- in case the message type is not known, it needs a static string buffer. Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df --- M include/osmocom/gsm/protocol/gsm_04_08.h M src/gsm/gsm48.c M src/gsm/libosmogsm.map 3 files changed, 207 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/2027/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 96fdabe..f921bb8 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1180,6 +1180,11 @@ #define GSM48_MT_CC_START_DTMF_REJ 0x37 #define GSM48_MT_CC_FACILITY 0x3a +extern const struct value_string gsm48_rr_msgtype_names[]; +extern const struct value_string gsm48_mm_msgtype_names[]; +extern const struct value_string gsm48_cc_msgtype_names[]; +const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type); + /* FIXME: Table 10.4 / 10.4a (GPRS) */ /* Section 10.5.3.3 CM service type */ diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index d408897..757a855 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -697,3 +697,201 @@ OSMO_VALUE_STRING(GSM48_PDISC_USSD), { 0, NULL } }; + +const struct value_string gsm48_rr_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_RR_INIT_REQ), + OSMO_VALUE_STRING(GSM48_MT_RR_ADD_ASS), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS_EXT), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS_REJ), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_ASS_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_REJECT), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_REQUEST), + OSMO_VALUE_STRING(GSM48_MT_RR_PACKET_ASS), + + OSMO_VALUE_STRING(GSM48_MT_RR_CIPH_M_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_CIPH_M_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_ACK), + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_REJ), + + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_COMPL), + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_COMPL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_INFO), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_INFO), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_ASS_CMD), + + OSMO_VALUE_STRING(GSM48_MT_RR_CELL_CHG_ORDER), + OSMO_VALUE_STRING(GSM48_MT_RR_PDCH_ASS_CMD), + + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_REL), + OSMO_VALUE_STRING(GSM48_MT_RR_PART_REL), + OSMO_VALUE_STRING(GSM48_MT_RR_PART_REL_COMP), + + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_1), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_2), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_3), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_RESP), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_NCH), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_FACCH), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_RESP), + OSMO_VALUE_STRING(GSM48_MT_RR_PACKET_NOTIF), + OSMO_VALUE_STRING(GSM48_MT_RR_UTRAN_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_CDMA2K_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_IS_TO_UTRAN_HANDO), + OSMO_VALUE_STRING(GSM48_MT_RR_IS_TO_CDMA2K_HANDO), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_8), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_1), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_3), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_4), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_6), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_7), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2bis), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2ter), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2quater), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5bis), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5ter), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_9), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_13), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_16), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_17), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_18), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_19), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_20), + + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_MODE_MODIF), + OSMO_VALUE_STRING(GSM48_MT_RR_STATUS), + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_MODE_MODIF_ACK), + OSMO_VALUE_STRING(GSM48_MT_RR_FREQ_REDEF), + OSMO_VALUE_STRING(GSM48_MT_RR_MEAS_REP), + OSMO_VALUE_STRING(GSM48_MT_RR_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_CLSM_ENQ), + OSMO_VALUE_STRING(GSM48_MT_RR_EXT_MEAS_REP), + OSMO_VALUE_STRING(GSM48_MT_RR_EXT_MEAS_REP_ORD), + OSMO_VALUE_STRING(GSM48_MT_RR_GPRS_SUSP_REQ), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_INFO), + + OSMO_VALUE_STRING(GSM48_MT_RR_VGCS_UPL_GRANT), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_RELEASE), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_FREE), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_BUSY), + OSMO_VALUE_STRING(GSM48_MT_RR_TALKER_IND), + { 0, NULL } +}; + +const struct value_string gsm48_mm_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_MM_IMSI_DETACH_IND), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_ACCEPT), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_REJECT), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_REQUEST), + + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_REJ), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_RESP), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_FAIL), + OSMO_VALUE_STRING(GSM48_MT_MM_ID_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_ID_RESP), + OSMO_VALUE_STRING(GSM48_MT_MM_TMSI_REALL_CMD), + OSMO_VALUE_STRING(GSM48_MT_MM_TMSI_REALL_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_ACC), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_REJ), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_ABORT), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_PROMPT), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_REEST_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_ABORT), + + OSMO_VALUE_STRING(GSM48_MT_MM_NULL), + OSMO_VALUE_STRING(GSM48_MT_MM_STATUS), + OSMO_VALUE_STRING(GSM48_MT_MM_INFO), + { 0, NULL } +}; + +const struct value_string gsm48_cc_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_CC_ALERTING), + OSMO_VALUE_STRING(GSM48_MT_CC_CALL_CONF), + OSMO_VALUE_STRING(GSM48_MT_CC_CALL_PROC), + OSMO_VALUE_STRING(GSM48_MT_CC_CONNECT), + OSMO_VALUE_STRING(GSM48_MT_CC_CONNECT_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_EMERG_SETUP), + OSMO_VALUE_STRING(GSM48_MT_CC_PROGRESS), + OSMO_VALUE_STRING(GSM48_MT_CC_ESTAB), + OSMO_VALUE_STRING(GSM48_MT_CC_ESTAB_CONF), + OSMO_VALUE_STRING(GSM48_MT_CC_RECALL), + OSMO_VALUE_STRING(GSM48_MT_CC_START_CC), + OSMO_VALUE_STRING(GSM48_MT_CC_SETUP), + + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY), + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY_COMPL), + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY_REJECT), + OSMO_VALUE_STRING(GSM48_MT_CC_USER_INFO), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD_REJ), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR_REJ), + + OSMO_VALUE_STRING(GSM48_MT_CC_DISCONNECT), + OSMO_VALUE_STRING(GSM48_MT_CC_RELEASE), + OSMO_VALUE_STRING(GSM48_MT_CC_RELEASE_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_CC_CONG_CTRL), + OSMO_VALUE_STRING(GSM48_MT_CC_NOTIFY), + OSMO_VALUE_STRING(GSM48_MT_CC_STATUS), + OSMO_VALUE_STRING(GSM48_MT_CC_STATUS_ENQ), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF), + OSMO_VALUE_STRING(GSM48_MT_CC_STOP_DTMF), + OSMO_VALUE_STRING(GSM48_MT_CC_STOP_DTMF_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF_REJ), + OSMO_VALUE_STRING(GSM48_MT_CC_FACILITY), + { 0, NULL } +}; + +/*! /brief Compose a string naming the message type for given protocol. + * If the message type string is known, return the message type name, otherwise + * return ":". + * /param pdisc[in] protocol discriminator like GSM48_PDISC_MM + * /param msg_type[in] message type like GSM48_MT_MM_LOC_UPD_REQUEST + * /returns statically allocated string or string constant. + */ +const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type) +{ + static char namebuf[64]; + const struct value_string *msgt_names; + + switch (pdisc) { + case GSM48_PDISC_RR: + msgt_names = gsm48_rr_msgtype_names; + break; + case GSM48_PDISC_MM: + msgt_names = gsm48_mm_msgtype_names; + break; + case GSM48_PDISC_CC: + msgt_names = gsm48_cc_msgtype_names; + break; + default: + msgt_names = NULL; + break; + } + + if (msgt_names) + return get_value_string(msgt_names, msg_type); + + snprintf(namebuf, sizeof(namebuf), "%s:0x%02x", + gsm48_pdisc_name(pdisc), msg_type); + return namebuf; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 60f83de..4a33c46 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -218,6 +218,10 @@ gsm48_chan_mode_names; gsm_chan_t_names; gsm48_pdisc_names; +gsm48_rr_msgtype_names; +gsm48_mm_msgtype_names; +gsm48_cc_msgtype_names; +gsm48_pdisc_msgtype_name; gsm_7bit_decode; gsm_7bit_decode_ussd; -- To view, visit https://gerrit.osmocom.org/2027 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Mar 10 11:36:50 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 10 Mar 2017 11:36:50 +0000 Subject: osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 10 11:38:13 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 10 Mar 2017 11:38:13 +0000 Subject: libosmocore[master]: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2025 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 10 14:49:12 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 10 Mar 2017 14:49:12 +0000 Subject: osmo-sip-connector[master]: dtmf: Start handling the DTMF MNCC messages and respond In-Reply-To: References: Message-ID: Patch Set 3: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1873/3/src/mncc.c File src/mncc.c: Line 661: out_mncc.keypad = data->keypad; argh... out_mncc.fields |= MNCC_F_KEYPAD; is missing -- To view, visit https://gerrit.osmocom.org/1873 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5 Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 10 14:50:15 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 10 Mar 2017 14:50:15 +0000 Subject: libosmocore[master]: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 What was the original intention/first user of it? -- To view, visit https://gerrit.osmocom.org/2025 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 10 14:55:23 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 10 Mar 2017 14:55:23 +0000 Subject: [PATCH] osmo-sip-connector[master]: dtmf: Start handling the DTMF MNCC messages and respond In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1873 to look at the new patch set (#4). dtmf: Start handling the DTMF MNCC messages and respond Simply respond to the dtmf start/stop with a response and move on. Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5 --- M src/mncc.c 1 file changed, 59 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/73/1873/4 diff --git a/src/mncc.c b/src/mncc.c index 7926f5e..e96eed8 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -102,23 +102,33 @@ return NULL; } -static void mncc_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref) +static void mncc_fill_header(struct gsm_mncc *mncc, uint32_t msg_type, uint32_t callref) +{ + mncc->msg_type = msg_type; + mncc->callref = callref; +} + +static void mncc_write(struct mncc_connection *conn, struct gsm_mncc *mncc, uint32_t callref) { int rc; - struct gsm_mncc mncc = { 0, }; - - mncc.msg_type = msg_type; - mncc.callref = callref; /* * TODO: we need to put cause in here for release or such? shall we return a * static struct? */ - rc = write(conn->fd.fd, &mncc, sizeof(mncc)); - if (rc != sizeof(mncc)) { + rc = write(conn->fd.fd, mncc, sizeof(*mncc)); + if (rc != sizeof(*mncc)) { LOGP(DMNCC, LOGL_ERROR, "Failed to send message call(%u)\n", callref); close_connection(conn); } +} + +static void mncc_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref) +{ + struct gsm_mncc mncc = { 0, }; + + mncc_fill_header(&mncc, msg_type, callref); + mncc_write(conn, &mncc, callref); } static void mncc_rtp_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref) @@ -617,6 +627,42 @@ other_leg->connect_call(other_leg); } +static void check_dtmf_start(struct mncc_connection *conn, char *buf, int rc) +{ + struct gsm_mncc out_mncc = { 0, }; + struct gsm_mncc *data; + struct mncc_call_leg *leg; + + leg = find_leg(conn, buf, rc, &data); + if (!leg) + return; + + LOGP(DMNCC, LOGL_DEBUG, "leg(%u) DTMF key=%c\n", leg->callref, data->keypad); + + mncc_fill_header(&out_mncc, MNCC_START_DTMF_RSP, leg->callref); + out_mncc.fields |= MNCC_F_KEYPAD; + out_mncc.keypad = data->keypad; + mncc_write(conn, &out_mncc, leg->callref); +} + +static void check_dtmf_stop(struct mncc_connection *conn, char *buf, int rc) +{ + struct gsm_mncc out_mncc = { 0, }; + struct gsm_mncc *data; + struct mncc_call_leg *leg; + + leg = find_leg(conn, buf, rc, &data); + if (!leg) + return; + + LOGP(DMNCC, LOGL_DEBUG, "leg(%u) DTMF key=%c\n", leg->callref, data->keypad); + + mncc_fill_header(&out_mncc, MNCC_STOP_DTMF_RSP, leg->callref); + out_mncc.fields |= MNCC_F_KEYPAD; + out_mncc.keypad = data->keypad; + mncc_write(conn, &out_mncc, leg->callref); +} + static void check_hello(struct mncc_connection *conn, char *buf, int rc) { struct gsm_mncc_hello *hello; @@ -778,6 +824,12 @@ case MNCC_HOLD_IND: check_hold_ind(conn, buf, rc); break; + case MNCC_START_DTMF_IND: + check_dtmf_start(conn, buf, rc); + break; + case MNCC_STOP_DTMF_IND: + check_dtmf_stop(conn, buf, rc); + break; default: LOGP(DMNCC, LOGL_ERROR, "Unhandled message type %d/0x%x\n", msg_type, msg_type); -- To view, visit https://gerrit.osmocom.org/1873 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5 Gerrit-PatchSet: 4 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 10 15:14:49 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 10 Mar 2017 15:14:49 +0000 Subject: [PATCH] osmo-sip-connector[master]: testpbx: Add another number that will just play a ringback Message-ID: Review at https://gerrit.osmocom.org/2028 testpbx: Add another number that will just play a ringback This will enable early media to play a ringback to the phone. Change-Id: I4c778b1f0e7484a755716133f91767af8b1102c0 --- M contrib/testpbx/configs/public.xml 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/28/2028/1 diff --git a/contrib/testpbx/configs/public.xml b/contrib/testpbx/configs/public.xml index d9b1d17..e5d2bcc 100644 --- a/contrib/testpbx/configs/public.xml +++ b/contrib/testpbx/configs/public.xml @@ -59,6 +59,16 @@ --> + + + + + + + + + + -- To view, visit https://gerrit.osmocom.org/2028 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4c778b1f0e7484a755716133f91767af8b1102c0 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Fri Mar 10 15:16:46 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 10 Mar 2017 15:16:46 +0000 Subject: [PATCH] osmo-sip-connector[master]: mncc: Enable in-band signalling for early media Message-ID: Review at https://gerrit.osmocom.org/2029 mncc: Enable in-band signalling for early media Besides sending the alerting request we should inform the MS that there is in-band information now. We do not seem to export these flags in protocol/gsm_04_08.h so hardcode them for now (until I come up with good names for them). Related: OS#1784 Change-Id: I80b1e1f4ca045bd63536476702a5812f27d9b36d --- M src/mncc.c 1 file changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/29/2029/1 diff --git a/src/mncc.c b/src/mncc.c index 7926f5e..2e05465 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -184,12 +184,20 @@ static void mncc_call_leg_ring(struct call_leg *_leg) { + struct gsm_mncc out_mncc = { 0, }; struct mncc_call_leg *leg; OSMO_ASSERT(_leg->type == CALL_TYPE_MNCC); leg = (struct mncc_call_leg *) _leg; - mncc_send(leg->conn, MNCC_ALERT_REQ, leg->callref); + mncc_fill_header(&out_mncc, MNCC_ALERT_REQ, leg->callref); + /* GSM 04.08 10.5.4.21 */ + out_mncc.fields |= MNCC_F_PROGRESS; + out_mncc.progress.coding = 3; /* Standard defined for the GSM?PLMNS */ + out_mncc.progress.location = 1; /* Private network serving the local user */ + out_mncc.progress.descr = 8; /* In-band information or appropriate pattern now available */ + + mncc_write(leg->conn, &out_mncc, leg->callref); } static void mncc_call_leg_release(struct call_leg *_leg) -- To view, visit https://gerrit.osmocom.org/2029 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I80b1e1f4ca045bd63536476702a5812f27d9b36d Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Fri Mar 10 15:16:46 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 10 Mar 2017 15:16:46 +0000 Subject: [PATCH] osmo-sip-connector[master]: mncc/sip: Attempt to parse the media from session in progress Message-ID: Review at https://gerrit.osmocom.org/2030 mncc/sip: Attempt to parse the media from session in progress Parse the media from session in progress and if present in alerting connect the call early. Sadly this sets RTP to the sendrecv mode even if we would like to keep it as recvonly. Change-Id: I98d173abc46c67b87666ed2f193a581d6e72344b Related: OS#1784 --- M src/mncc.c M src/sip.c 2 files changed, 17 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/30/2030/1 diff --git a/src/mncc.c b/src/mncc.c index 2e05465..e647b73 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -1,5 +1,5 @@ /* - * (C) 2016 by Holger Hans Peter Freyther + * (C) 2016-2017 by Holger Hans Peter Freyther * * All Rights Reserved * @@ -186,6 +186,7 @@ { struct gsm_mncc out_mncc = { 0, }; struct mncc_call_leg *leg; + struct call_leg *other_leg; OSMO_ASSERT(_leg->type == CALL_TYPE_MNCC); leg = (struct mncc_call_leg *) _leg; @@ -198,6 +199,14 @@ out_mncc.progress.descr = 8; /* In-band information or appropriate pattern now available */ mncc_write(leg->conn, &out_mncc, leg->callref); + + /* + * If we have remote IP/port let's connect it already. + * FIXME: We would like to keep this as recvonly... + */ + other_leg = call_leg_other(&leg->base); + if (other_leg && other_leg->port != 0 && other_leg->ip != 0) + send_rtp_connect(leg, other_leg); } static void mncc_call_leg_release(struct call_leg *_leg) diff --git a/src/sip.c b/src/sip.c index afff393..2c14a31 100644 --- a/src/sip.c +++ b/src/sip.c @@ -1,5 +1,5 @@ /* - * (C) 2016 by Holger Hans Peter Freyther + * (C) 2016-2017 by Holger Hans Peter Freyther * * All Rights Reserved * @@ -38,12 +38,16 @@ static void sip_ring_call(struct call_leg *_leg); static void sip_connect_call(struct call_leg *_leg); -static void call_progress(struct sip_call_leg *leg, const sip_t *sip) +static void call_progress(struct sip_call_leg *leg, const sip_t *sip, int status) { struct call_leg *other = call_leg_other(&leg->base); if (!other) return; + + /* Extract SDP for session in progress with matching codec */ + if (status == 183) + sdp_extract_sdp(leg, sip, false); LOGP(DSIP, LOGL_NOTICE, "leg(%p) is now rining.\n", leg); other->ring_call(other); @@ -157,7 +161,7 @@ leg->state = SIP_CC_DLG_CNFD; if (status == 180 || status == 183) - call_progress(leg, sip); + call_progress(leg, sip, status); else if (status == 200) call_connect(leg, sip); else if (status >= 300) { -- To view, visit https://gerrit.osmocom.org/2030 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I98d173abc46c67b87666ed2f193a581d6e72344b Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther From gerrit-no-reply at lists.osmocom.org Fri Mar 10 15:32:28 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 10 Mar 2017 15:32:28 +0000 Subject: [MERGED] osmo-trx[master]: uhd: Increase MC-BTS FPGA clock rate to 51.2 MHz In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: uhd: Increase MC-BTS FPGA clock rate to 51.2 MHz ...................................................................... uhd: Increase MC-BTS FPGA clock rate to 51.2 MHz Addresses following issues where UHD 3.9 and likely other UHD versions would report a master clock (FPGA) rate error. Update MC-BTS FPGA clock for B200 and B210 to 51.2 MHz, which is supported by all UHD versions. Only B200/B210 is supported for MC-BTS operation. https://osmocom.org/issues/1963 https://osmocom.org/issues/1648 ALERT UHDDevice.cpp:548:set_master_clk: Failed to set master clock rate ALERT UHDDevice.cpp:549:set_master_clk: Requested clock rate 3.2e+06 ALERT UHDDevice.cpp:550:set_master_clk: Actual clock rate 5e+06 Change-Id: I78fb2c0959abd0e666628ba39f433162aafb067e --- M Transceiver52M/UHDDevice.cpp 1 file changed, 13 insertions(+), 10 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 35eb827..c5ea4c1 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -38,7 +38,7 @@ #endif #define B2XX_CLK_RT 26e6 -#define B2XX_MCBTS_CLK_RT 3.2e6 +#define B2XX_MCBTS_CLK_RT 51.2e6 #define E1XX_CLK_RT 52e6 #define LIMESDR_CLK_RT (GSMRATE*32) #define B100_BASE_RT 400000 @@ -91,10 +91,12 @@ #define B2XX_TIMING_1SPS 1.7153e-4 #define B2XX_TIMING_4SPS 1.1696e-4 #define B2XX_TIMING_4_4SPS 6.18462e-5 +#define B2XX_TIMING_MCBTS 7e-5 #else #define B2XX_TIMING_1SPS 9.9692e-5 #define B2XX_TIMING_4SPS 6.9248e-5 #define B2XX_TIMING_4_4SPS 4.52308e-5 +#define B2XX_TIMING_MCBTS 6.42452e-5 #endif /* @@ -118,7 +120,7 @@ { B200, 4, 1, B2XX_TIMING_4SPS, "B200 4/1 Tx/Rx SPS" }, { B210, 1, 1, B2XX_TIMING_1SPS, "B210 1 SPS" }, { B210, 4, 1, B2XX_TIMING_4SPS, "B210 4/1 Tx/Rx SPS" }, - { B2XX_MCBTS, 4, 4, 1.07188e-4, "B200/B210 4 SPS Multi-ARFCN" }, + { B2XX_MCBTS, 4, 4, B2XX_TIMING_MCBTS, "B200/B210 4 SPS Multi-ARFCN" }, { E1XX, 1, 1, 9.5192e-5, "E1XX 1 SPS" }, { E1XX, 4, 1, 6.5571e-5, "E1XX 4/1 Tx/Rx SPS" }, { E3XX, 1, 1, 1.84616e-4, "E3XX 1 SPS" }, @@ -1046,8 +1048,6 @@ int uhd_device::check_rx_md_err(uhd::rx_metadata_t &md, ssize_t num_smpls) { - uhd::time_spec_t ts; - if (!num_smpls) { LOG(ERR) << str_code(md); @@ -1070,18 +1070,21 @@ return ERROR_UNRECOVERABLE; } - ts = md.time_spec; - // Monotonicity check - if (ts < prev_ts) { + if (md.time_spec < prev_ts) { LOG(ALERT) << "UHD: Loss of monotonic time"; - LOG(ALERT) << "Current time: " << ts.get_real_secs() << ", " + LOG(ALERT) << "Current time: " << md.time_spec.get_real_secs() << ", " << "Previous time: " << prev_ts.get_real_secs(); return ERROR_TIMING; - } else { - prev_ts = ts; } + // Workaround for UHD tick rounding bug + TIMESTAMP ticks = md.time_spec.to_ticks(rx_rate); + if (ticks - prev_ts.to_ticks(rx_rate) == rx_spp - 1) + md.time_spec = uhd::time_spec_t::from_ticks(++ticks, rx_rate); + + prev_ts = md.time_spec; + return 0; } -- To view, visit https://gerrit.osmocom.org/2005 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I78fb2c0959abd0e666628ba39f433162aafb067e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 10 18:59:24 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 10 Mar 2017 18:59:24 +0000 Subject: osmo-pcu[master]: Add pkg-config file In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2008 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0520045e5655794df152b98b9755d7cbbd334049 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 10 19:00:29 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 10 Mar 2017 19:00:29 +0000 Subject: osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 7: (1 comment) https://gerrit.osmocom.org/#/c/2007/7/src/bts.cpp File src/bts.cpp: Line 543: if (rfn >= 42432) why are we not using RFN_MODULUS here? -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 7 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 10 19:01:05 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 10 Mar 2017 19:01:05 +0000 Subject: osmo-sip-connector[master]: dtmf: Start handling the DTMF MNCC messages and respond In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1873 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5 Gerrit-PatchSet: 4 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From admin at opensuse.org Fri Mar 10 19:54:48 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 10 Mar 2017 19:54:48 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c304962cac8_6b03efc1015328b@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 108s] from bts.cpp:21: [ 108s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 108s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 108s] ^~~ [ 108s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 108s] abs(long long __x) { return __builtin_llabs (__x); } [ 108s] ^~~ [ 108s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 108s] abs(long __i) { return __builtin_labs(__i); } [ 108s] ^~~ [ 108s] Makefile:778: recipe for target 'bts.lo' failed [ 108s] make[2]: *** [bts.lo] Error 1 [ 108s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 108s] Makefile:403: recipe for target 'all-recursive' failed [ 108s] make[1]: *** [all-recursive] Error 1 [ 108s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 108s] dh_auto_build: make -j1 returned exit code 2 [ 108s] debian/rules:12: recipe for target 'build' failed [ 108s] make: *** [build] Error 2 [ 108s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 108s] [ 108s] lamb63 failed "build osmo-pcu_0.3.20170310.dsc" at Fri Mar 10 19:54:40 UTC 2017. [ 108s] [ 108s] ### VM INTERACTION START ### [ 111s] [ 99.209521] reboot: Power down [ 111s] ### VM INTERACTION END ### [ 111s] [ 111s] lamb63 failed "build osmo-pcu_0.3.20170310.dsc" at Fri Mar 10 19:54:44 UTC 2017. [ 111s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 10 19:55:05 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 10 Mar 2017 19:55:05 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c304b11f1d5_6b03efc1015333c@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 112s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 112s] from /usr/include/osmocom/core/timer.h:35, [ 112s] from ./bts.h:29, [ 112s] from bts.cpp:21: [ 112s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 112s] abs(long long __x) { return __builtin_llabs (__x); } [ 112s] ^~~ [ 112s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 112s] abs(long __i) { return __builtin_labs(__i); } [ 112s] ^~~ [ 112s] Makefile:778: recipe for target 'bts.lo' failed [ 112s] make[2]: *** [bts.lo] Error 1 [ 112s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 112s] Makefile:403: recipe for target 'all-recursive' failed [ 112s] make[1]: *** [all-recursive] Error 1 [ 112s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 112s] dh_auto_build: make -j1 returned exit code 2 [ 112s] debian/rules:12: recipe for target 'build' failed [ 112s] make: *** [build] Error 2 [ 112s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 112s] [ 112s] lamb07 failed "build osmo-pcu_0.3.20170310.dsc" at Fri Mar 10 19:54:58 UTC 2017. [ 112s] [ 112s] ### VM INTERACTION START ### [ 115s] [ 101.351271] reboot: Power down [ 115s] ### VM INTERACTION END ### [ 115s] [ 115s] lamb07 failed "build osmo-pcu_0.3.20170310.dsc" at Fri Mar 10 19:55:02 UTC 2017. [ 115s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Sat Mar 11 00:54:29 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 11 Mar 2017 00:54:29 +0000 Subject: libosmocore[master]: gsm0503 coding: fix build in separate dir: -I builddir In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2003/1/src/coding/Makefile.am File src/coding/Makefile.am: Line 6: AM_CPPFLAGS = \ > Please don't combine reformatting with actual changes - it makes it harder I think in this case reformatting is required, because other way we will break the line length limitation. -- To view, visit https://gerrit.osmocom.org/2003 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0d465bc109765b1315d615243bea6af027afa368 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Sat Mar 11 01:00:34 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 11 Mar 2017 01:00:34 +0000 Subject: libosmocore[master]: build: generate gsm0503.h to builddir, not srcdir In-Reply-To: References: Message-ID: Patch Set 4: (1 comment) https://gerrit.osmocom.org/#/c/1996/4/utils/conv_gen.py File utils/conv_gen.py: Line 367: os.makedirs(path) I think, it would be great to move it into a separate commit and use such check in all generate_* functions. -- To view, visit https://gerrit.osmocom.org/1996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Sat Mar 11 01:01:10 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 11 Mar 2017 01:01:10 +0000 Subject: libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 11 01:01:51 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 11 Mar 2017 01:01:51 +0000 Subject: libosmocore[master]: build: fix distcheck: include gen scripts in EXTRA_DIST In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2004 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 11 01:04:32 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 11 Mar 2017 01:04:32 +0000 Subject: libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 11 01:12:38 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 11 Mar 2017 01:12:38 +0000 Subject: libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2002/2/src/gsm/Makefile.am File src/gsm/Makefile.am: Line 40: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm Should the $(top_srcdir) to be changed to the $(top_builddir)? -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes From admin at opensuse.org Sat Mar 11 19:57:26 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 11 Mar 2017 19:57:26 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c456bb33a45_6b03efc102634e5@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 111s] from bts.cpp:21: [ 111s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 111s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 111s] ^~~ [ 111s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 111s] abs(long long __x) { return __builtin_llabs (__x); } [ 111s] ^~~ [ 111s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 111s] abs(long __i) { return __builtin_labs(__i); } [ 111s] ^~~ [ 111s] Makefile:778: recipe for target 'bts.lo' failed [ 111s] make[2]: *** [bts.lo] Error 1 [ 111s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 111s] Makefile:403: recipe for target 'all-recursive' failed [ 111s] make[1]: *** [all-recursive] Error 1 [ 111s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 111s] dh_auto_build: make -j1 returned exit code 2 [ 111s] debian/rules:12: recipe for target 'build' failed [ 111s] make: *** [build] Error 2 [ 111s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 111s] [ 111s] lamb16 failed "build osmo-pcu_0.3.20170311.dsc" at Sat Mar 11 19:57:22 UTC 2017. [ 111s] [ 111s] ### VM INTERACTION START ### [ 115s] [ 102.127065] reboot: Power down [ 115s] ### VM INTERACTION END ### [ 115s] [ 115s] lamb16 failed "build osmo-pcu_0.3.20170311.dsc" at Sat Mar 11 19:57:26 UTC 2017. [ 115s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 11 19:57:43 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 11 Mar 2017 19:57:43 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c456bc1d66a_6b03efc1026359d@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 117s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 117s] from /usr/include/osmocom/core/timer.h:35, [ 117s] from ./bts.h:29, [ 117s] from bts.cpp:21: [ 117s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 117s] abs(long long __x) { return __builtin_llabs (__x); } [ 117s] ^~~ [ 117s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 117s] abs(long __i) { return __builtin_labs(__i); } [ 117s] ^~~ [ 117s] Makefile:778: recipe for target 'bts.lo' failed [ 117s] make[2]: *** [bts.lo] Error 1 [ 117s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 117s] Makefile:403: recipe for target 'all-recursive' failed [ 117s] make[1]: *** [all-recursive] Error 1 [ 117s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 117s] dh_auto_build: make -j1 returned exit code 2 [ 117s] debian/rules:12: recipe for target 'build' failed [ 117s] make: *** [build] Error 2 [ 117s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 117s] [ 117s] lamb19 failed "build osmo-pcu_0.3.20170311.dsc" at Sat Mar 11 19:57:31 UTC 2017. [ 117s] [ 117s] ### VM INTERACTION START ### [ 120s] [ 107.448583] reboot: Power down [ 120s] ### VM INTERACTION END ### [ 120s] [ 120s] lamb19 failed "build osmo-pcu_0.3.20170311.dsc" at Sat Mar 11 19:57:34 UTC 2017. [ 120s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 12 19:55:17 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 12 Mar 2017 19:55:17 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c5a7aba01b9_6b03efc103324be@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 113s] from /usr/include/osmocom/core/linuxrbtree.h:97, [ 113s] from /usr/include/osmocom/core/timer.h:35, [ 113s] from ./bts.h:29, [ 113s] from bts.cpp:21: [ 113s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 113s] abs(long long __x) { return __builtin_llabs (__x); } [ 113s] ^~~ [ 113s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 113s] abs(long __i) { return __builtin_labs(__i); } [ 113s] ^~~ [ 113s] Makefile:778: recipe for target 'bts.lo' failed [ 113s] make[2]: *** [bts.lo] Error 1 [ 113s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 113s] Makefile:403: recipe for target 'all-recursive' failed [ 113s] make[1]: *** [all-recursive] Error 1 [ 113s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 113s] dh_auto_build: make -j1 returned exit code 2 [ 113s] debian/rules:12: recipe for target 'build' failed [ 113s] make: *** [build] Error 2 [ 113s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 113s] [ 113s] lamb15 failed "build osmo-pcu_0.3.20170312.dsc" at Sun Mar 12 19:55:00 UTC 2017. [ 113s] [ 113s] ### VM INTERACTION START ### [ 116s] [ 103.111334] reboot: Power down [ 116s] ### VM INTERACTION END ### [ 116s] [ 116s] lamb15 failed "build osmo-pcu_0.3.20170312.dsc" at Sun Mar 12 19:55:05 UTC 2017. [ 116s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 12 19:56:59 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 12 Mar 2017 19:56:59 +0000 Subject: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c5a838b98f2_8b1119dc0469867@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-pcu Last lines of build log: [ 160s] from bts.cpp:21: [ 160s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) [ 160s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } [ 160s] ^~~ [ 160s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) [ 160s] abs(long long __x) { return __builtin_llabs (__x); } [ 160s] ^~~ [ 160s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) [ 160s] abs(long __i) { return __builtin_labs(__i); } [ 160s] ^~~ [ 160s] Makefile:778: recipe for target 'bts.lo' failed [ 160s] make[2]: *** [bts.lo] Error 1 [ 160s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' [ 160s] Makefile:403: recipe for target 'all-recursive' failed [ 160s] make[1]: *** [all-recursive] Error 1 [ 160s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 160s] dh_auto_build: make -j1 returned exit code 2 [ 160s] debian/rules:12: recipe for target 'build' failed [ 160s] make: *** [build] Error 2 [ 160s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 160s] [ 160s] cloud127 failed "build osmo-pcu_0.3.20170312.dsc" at Sun Mar 12 19:56:48 UTC 2017. [ 160s] [ 160s] ### VM INTERACTION START ### [ 163s] [ 142.013609] reboot: Power down [ 164s] ### VM INTERACTION END ### [ 164s] [ 164s] cloud127 failed "build osmo-pcu_0.3.20170312.dsc" at Sun Mar 12 19:56:52 UTC 2017. [ 164s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Mon Mar 13 01:33:28 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 01:33:28 +0000 Subject: osmo-pcu[master]: Fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2007/7//COMMIT_MSG Commit Message: Line 7: Fix overloading ambiguity let's mention "bts.cpp: ..." -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 7 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From nhofmeyr at sysmocom.de Mon Mar 13 01:44:40 2017 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:44:40 +0100 Subject: FYI: Build failure of network:osmocom:nightly/osmo-pcu in xUbuntu_16.10/x86_64 In-Reply-To: <58c456bb33a45_6b03efc102634e5@build.opensuse.org> References: <58c456bb33a45_6b03efc102634e5@build.opensuse.org> Message-ID: <20170313014440.GD25910@my.box> fyi, we're still getting daily failures by the opensuse builds, which should be fixed once https://gerrit.osmocom.org/2007 is merged. ~N On Sat, Mar 11, 2017 at 07:57:26PM +0000, OBS Notification wrote: > Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-pcu/xUbuntu_16.10/x86_64 > > Package network:osmocom:nightly/osmo-pcu failed to build in xUbuntu_16.10/x86_64 > > Check out the package for editing: > osc checkout network:osmocom:nightly osmo-pcu > > Last lines of build log: > [ 111s] from bts.cpp:21: > [ 111s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) > [ 111s] abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } > [ 111s] ^~~ > [ 111s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) > [ 111s] abs(long long __x) { return __builtin_llabs (__x); } > [ 111s] ^~~ > [ 111s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) > [ 111s] abs(long __i) { return __builtin_labs(__i); } > [ 111s] ^~~ > [ 111s] Makefile:778: recipe for target 'bts.lo' failed > [ 111s] make[2]: *** [bts.lo] Error 1 > [ 111s] make[2]: Leaving directory '/usr/src/packages/BUILD/src' > [ 111s] Makefile:403: recipe for target 'all-recursive' failed > [ 111s] make[1]: *** [all-recursive] Error 1 > [ 111s] make[1]: Leaving directory '/usr/src/packages/BUILD' > [ 111s] dh_auto_build: make -j1 returned exit code 2 > [ 111s] debian/rules:12: recipe for target 'build' failed > [ 111s] make: *** [build] Error 2 > [ 111s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 > [ 111s] > [ 111s] lamb16 failed "build osmo-pcu_0.3.20170311.dsc" at Sat Mar 11 19:57:22 UTC 2017. > [ 111s] > [ 111s] ### VM INTERACTION START ### > [ 115s] [ 102.127065] reboot: Power down > [ 115s] ### VM INTERACTION END ### > [ 115s] > [ 115s] lamb16 failed "build osmo-pcu_0.3.20170311.dsc" at Sat Mar 11 19:57:26 UTC 2017. > [ 115s] > > -- > Configure notifications at https://build.opensuse.org/user/notifications > openSUSE Build Service (https://build.opensuse.org/) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From gerrit-no-reply at lists.osmocom.org Mon Mar 13 01:48:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 01:48:37 +0000 Subject: openbsc[master]: deb: install openbsc.pc In-Reply-To: References: Message-ID: Patch Set 1: but why is this needed? Is anyone linking against openbsc and needs a pkgconfig for that? AFAIK openbsc only ever installs its binaries and no libraries? -- To view, visit https://gerrit.osmocom.org/2009 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5472a8fe74a81b98598fbdb688db778cb7d09e62 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 01:58:57 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 01:58:57 +0000 Subject: libosmo-abis[master]: lapd: Improve log output In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (3 comments) https://gerrit.osmocom.org/#/c/2011/1//COMMIT_MSG Commit Message: Line 7: lapd: Improve log output "Improve" is too general :) "log pointer addresses" https://gerrit.osmocom.org/#/c/2011/1/src/input/lapd.c File src/input/lapd.c: Line 234: sapi, teip->tei, &sap->dl, sap); this is actually NOTICE output, not DEBUG output as mentioned in the commit log. Aside: when writing tests and checking the produced log output, pointer addresses are very impractical because they change for every test run. I assume there isn't a better way, an id or name, to track the objects? And do we really need to track the pointers in the log output in production code? is this just to resolve a bug and then it just amounts to bloat? In libosmocore's fsm.c, a similar situation is solved by the fsm_log_addr flag, see https://git.osmocom.org/libosmocore/tree/src/fsm.c:91 We can add this, but please confirm that it really makes sense. Line 711: please drop this whitespace change -- To view, visit https://gerrit.osmocom.org/2011 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9b961d5e36967cfd953551b24696849541257a1c Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:00:10 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:00:10 +0000 Subject: libosmo-abis[master]: lapd: Reduce N200 (SABM retransmission count) In-Reply-To: References: Message-ID: Patch Set 1: maybe say in the commit log why it is too high. What are the adverse effects avoided by the lower value? -- To view, visit https://gerrit.osmocom.org/2010 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4f56f9d00520adc0c0a4497547762cd054030867 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:01:00 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:01:00 +0000 Subject: osmo-iuh[master]: doc: OsmoMSC + HLR instead of CSCN In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2013 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I498446fd0e432968eb26faf1b2f64825c9eec5d5 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:01:02 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:01:02 +0000 Subject: [MERGED] osmo-iuh[master]: doc: OsmoMSC + HLR instead of CSCN In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: doc: OsmoMSC + HLR instead of CSCN ...................................................................... doc: OsmoMSC + HLR instead of CSCN Change-Id: I498446fd0e432968eb26faf1b2f64825c9eec5d5 --- M doc/protocols_around_hnbgw.txt 1 file changed, 16 insertions(+), 11 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/doc/protocols_around_hnbgw.txt b/doc/protocols_around_hnbgw.txt index 5af2623..3eef155 100644 --- a/doc/protocols_around_hnbgw.txt +++ b/doc/protocols_around_hnbgw.txt @@ -1,15 +1,22 @@ Protocols Around the Home Node B Gateway ======================================== - +------------+ +--------+ +----------+ - UE <-->| hNodeB |<--Iuh---->| HNB-GW |<--IuCS-->| OsmoCSCN | - UE <-->| femto cell | ...-->| | ...-->| | - | | | | +----------+ - +------------+<--GTP-U | | - \ | | +------+ +------+ - | | |<--IuPS-->| SGSN |<--GTP-C-->| GGSN | - | +--------+ ...-->| | GTP-U-->| | - | +------+ / +------+ + +--------+ + ,-->| Osmo | + / | MGCPGW | + | | |<--MGCP + | +--------+ \ + / | + +------------+<--RTP +--------+ `->+----------+ + UE <-->| hNodeB | | Osmo | | OsmoMSC | +------+ + UE <-->| femto cell |<--Iuh---->| HNB-GW |<--IuCS-->| | | Osmo | + | | | | | (VLR)|<-GSUP->| HLR | + | | | | +----------+ GSUP->+------+ + +------------+<--GTP-U | | / + \ | | +------+<---' +------+ + | | |<--IuPS-->| Osmo |<--GTP-C--->| Open | + | +--------+ | SGSN | GTP-U--->| GGSN | + | +------+ / +------+ \_______________________________/ @@ -51,5 +58,3 @@ +--------------------------+ UE (User Endpoint) == MS (Mobile Subscriber) == mobile device -CSCN (Circuit Switched Core Network) == OsmoNITB without BSC - -- To view, visit https://gerrit.osmocom.org/2013 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I498446fd0e432968eb26faf1b2f64825c9eec5d5 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:10:41 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:10:41 +0000 Subject: openbsc[master]: ipaccess-config: properly create swload In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2018/1/openbsc/src/ipaccess/ipaccess-config.c File openbsc/src/ipaccess/ipaccess-config.c: Line 629: load->file_id_len = strlen((char*)load->file_id) + 1; > Why +1? The \0 added by osmo_strlcpy() is included in size parameter for it I'm a bit confused, what are you saying? The sizeof() passed to osmo_strlcpy() has no +1, obviously. load->file_id_len is an indicator to the rest of the program, I'm not going to change the meaning of this value, which was, apparently, and still is "strlen() + 1". If you'd like me to use osmo_strlcpy()'s return value instead of strlen(): actually osmo_strlcpy returns the length of the input string, not the length copied; neither does that include the \0. I tried to add an osmo_str*cpy that has an actually useful return value once, but discussion around that dragged on too far to be worth it. -- To view, visit https://gerrit.osmocom.org/2018 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:19:25 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:19:25 +0000 Subject: openbsc[master]: deb: install openbsc.pc In-Reply-To: References: Message-ID: Patch Set 1: Ah, so the debian install for openbsc-dev.install actually includes gsm_data_shared.[hc] and common_cs.h. But help me out ... why then are gsm_data_shared.h and common_cs.h still under noinst_HEADERS in the Makefile.am? The Makefile.am seems to install these files instead: bsc_api.h gsm_04_08.h meas_rep.h ... how does the debian build even work like this? -- To view, visit https://gerrit.osmocom.org/2009 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5472a8fe74a81b98598fbdb688db778cb7d09e62 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:25:20 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:25:20 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Remove cut+paste error In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2021/2/OsmoSGSN/chapters/running.adoc File OsmoSGSN/chapters/running.adoc: Line 15: Print a short help message about the supported options wait a minute, osmo-sgsn has no --version option? Let's add a version option in handle_options() with: case 'V': print_version(1); exit(0); break; and then fix to say "OsmoSGSN" here? -- To view, visit https://gerrit.osmocom.org/2021 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73b0d042620792b8f2d58572f801410aa964aa25 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:26:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:26:30 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Remove cut+paste error In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 hmm, just to mark it for discussion, let me -1 although the patch in itself is correct and +2able in the current situation. -- To view, visit https://gerrit.osmocom.org/2021 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73b0d042620792b8f2d58572f801410aa964aa25 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:31:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:31:34 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: fix arrow tips in flow diagrams In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-2 (4 comments) https://gerrit.osmocom.org/#/c/2022/2/OsmoSGSN/chapters/gsup.adoc File OsmoSGSN/chapters/gsup.adoc: Line 69: Peer <= SGSN [label="SEND AUTHENTICATION INFO RESPONSE (Tuples)"]; No, the SGSN is the one requesting auth info from the HLR, and then the HLR responds with tuples. Line 81: Peer <= SGSN [label="SEND AUTHENTICATION INFO ERROR (Cause)"]; nope Line 97: SGSN <= Peer [label="AUTHENTICATION FAILURE REPORT (IMSI)"]; again, nope. The HLR gets informed of auth failure in case the subscriber failed to authorize Line 118: SGSN <= Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; I think you're mistaking "peer" for the MS. The peer for GSUP is the HLR, and the SGSN is the "client" for retrieving data from the HLR database. All of these arrows were correct. -- To view, visit https://gerrit.osmocom.org/2022 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7faa0c97ee3705a64289a47bc63f311d05f988b3 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:41:18 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:41:18 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Explain TCP/IP header compression In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (8 comments) some details... https://gerrit.osmocom.org/#/c/2020/2/OsmoSGSN/chapters/configuration.adoc File OsmoSGSN/chapters/configuration.adoc: Line 230: In order to save scarce GPRS bandwith, OsmoSGSN implements header and data s/save scarce/optimize ? Line 236: On TCP/IP connections, each packet is perpended with a fairly long TCP/IP prepended Line 248: network will not promote compression by its-self. This is the recommended mode 'by itself' Line 254: compression parameters entirely. The number of slots is the the maximum number the the Line 271: encoded into the option section of the TCP/IP packet. we know of particular TCP/IP options that disturb this, maybe add them as "for example..."? Line 282: will not promote compression by its-self. This is the recommended mode of 'itself' Line 288: compression parameters entirely. The direction configures which of the sides is 'which sides are' Line 292: entries. BTW, does *bold* emphasis match the style of the rest of this manual? Don't we usually mark keywords with ticks like "number ('codewords') and" ? -- To view, visit https://gerrit.osmocom.org/2020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I98408e72020a474d378e39263a933eb7567de146 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:44:29 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:44:29 +0000 Subject: osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 I agree with the nitpick, but would also let this pass if you have better things to do. -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:46:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:46:07 +0000 Subject: osmo-pcu[master]: tests: include headers from include/ In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 seems sane, but wouldn't 'make check' fail if this was really needed? -- To view, visit https://gerrit.osmocom.org/2024 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 02:48:02 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 02:48:02 +0000 Subject: libosmocore[master]: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() In-Reply-To: References: Message-ID: Patch Set 1: as mentioned in the commit log: enum values / FSM state names, depending on which one you mean. -- To view, visit https://gerrit.osmocom.org/2025 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 03:06:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 03:06:59 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 10: Code-Review-1 (5 comments) As said before, I think we cannot fix 'everything' because the cat is out of the bag. As much as I'd like to fix 'everything', doing so might break working setups out there that have 'everything' in their config without being aware of it. We may explode their logs without warning; I believe that unfortunately all we can do is deprecate 'everything'. Also, with the unrelated cosmetic changes in this patch I fail to see the actual fix... And let's discuss changing the public API, which, as much as I'd like to have them because they make sense, might introduce build problems. https://gerrit.osmocom.org/#/c/1582/10/include/osmocom/core/logging.h File include/osmocom/core/logging.h: Line 329: I don't think we want to remove API that has once been published for backwards compat ... how sure are you that no-one anywhere is using this? https://gerrit.osmocom.org/#/c/1582/10/include/osmocom/vty/logging.h File include/osmocom/vty/logging.h: Line 7: void logging_vty_add_cmds(); this is also a change of the public API, right? How sure are you that no-one anywhere is calling logging_vty_add_cmds() with an arg outside of libosmocore? Also: unrelated to fixing 'all everything' https://gerrit.osmocom.org/#/c/1582/10/src/logging.c File src/logging.c: Line 69: { LOGL_DEBUG, "EVERYTHING" }, /* FIXME: remove when 'everything' is no longer necessary */ the same value twice?? Line 74: { 0, "DEBUG" }, /* FIXME: remove when 'everything' is no longer necessary */ LOGL_DEBUG and 0 both amount to "DEBUG"? Both directions of using this value_string[] are ambiguous. LOGL_DEBUG -> { "DEBUG", "EVERYTHING" } and "DEBUG" -> { LOGL_DEBUG, 0 }. Line 364: static inline bool should_log_to_target(struct log_target *tar, int subsys, I like this but is unrelated -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 03:26:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 03:26:37 +0000 Subject: osmo-bts[master]: osmo-bts-trx: cosmetic log fixes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1974/1/src/osmo-bts-trx/gsm0503_coding.c File src/osmo-bts-trx/gsm0503_coding.c: Line 1690: LOGP(DL1C, LOGL_NOTICE, "tch_fr_decode(): error decoding FACCH/F frame (%d/%d bits)\n", *n_errors, *n_bits_total); these could also use "%s(): ...", __func__, ... to avoid typos (like the one fixed below) beyond all doubt. -- To view, visit https://gerrit.osmocom.org/1974 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 03:37:57 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 03:37:57 +0000 Subject: osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1991/1/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c File src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c: Line 200: rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); now the code assumes that rep->value is NULL after ctrl_cmd_create(), which makes a lot of sense, but hopefully we will never introduce a default value in future. Maybe OSMO_ASSERT(!rep->value) here? -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 03:41:52 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 03:41:52 +0000 Subject: libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Patch Set 5: > Please review the log of why make distcheck didn't catch it. It > will build in the _build subdirectory. IIUC the make distcheck will copy all files clearly marked as needed by the build into the _build dir, but after that $srcdir == $builddir, so that it doesn't catch these errors. It will instead catch (some) Makefile.am inaccuracies. Right? -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 03:56:51 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 03:56:51 +0000 Subject: libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Patch Set 5: There actually is a ../configure during distcheck, but BUILT_SOURCES seem to be generated before 'make distcheck' moves to _builddir -- in the same way that they don't get rebuilt when they already exist. i.e. they first get generated in $builddir == $srcdir, and then during distcheck in _build they are merely used from $srcdir. So 'make distcheck' doesn't check BUILT_SOURCES for $builddir != $srcdir. -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 03:59:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 03:59:08 +0000 Subject: libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Patch Set 5: > Should we add the same check for other projects too? yes, in case this patch is accepted; but it seems we only really need it if we have BUILT_SOURCES, otherwise distcheck should suffice? -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 06:47:37 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 06:47:37 +0000 Subject: [ABANDON] libosmo-abis[master]: osmo_ortp: use ortp_set_log_level_mask In-Reply-To: References: Message-ID: lynxis lazus has abandoned this change. Change subject: osmo_ortp: use ortp_set_log_level_mask ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/1527 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: Icc87dbcd406906d8e2ef86b39360ff01efa38a9b Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 08:13:28 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 08:13:28 +0000 Subject: [PATCH] openbsc[master]: gsm_data_shared: add value strings for gsm_chreq Message-ID: Review at https://gerrit.osmocom.org/2031 gsm_data_shared: add value strings for gsm_chreq Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data_shared.c 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/31/2031/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 7c469ee..9d27e27 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -840,7 +840,7 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); - +const struct value_string gsm_chreq_descs[7]; const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; const char *gsm_pchan_name(enum gsm_phys_chan_config c); diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..dc1cf8d 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,16 @@ gsm_abis_mo_reset(mo); } +const struct value_string gsm_chreq_descs[7] = { + { GSM_CHREQ_REASON_EMERG, "emergency call" }, + { GSM_CHREQ_REASON_PAG, "answer to paging" }, + { GSM_CHREQ_REASON_CALL, "call re-establishment" }, + { GSM_CHREQ_REASON_LOCATION_UPD,"Location updating" }, + { GSM_CHREQ_REASON_PDCH, "one phase packet access" }, + { GSM_CHREQ_REASON_OTHER, "other" }, + { 0, NULL } +}; + const struct value_string gsm_pchant_names[13] = { { GSM_PCHAN_NONE, "NONE" }, { GSM_PCHAN_CCCH, "CCCH" }, -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 13 08:14:10 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 08:14:10 +0000 Subject: [PATCH] openbsc[master]: gprs: fix T3186 encoding in Sysinfo 13 Message-ID: Review at https://gerrit.osmocom.org/2032 gprs: fix T3186 encoding in Sysinfo 13 The timer T3186, which is described in 3GPP TS 44.060, is using 3 bits of the si13 mac block. This requires special encoding. In the case of T3186, the value is encoded by the formula: bits = t/500-1. Our implementation uses the formula bits=t/500, which is incorrect. Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb --- M openbsc/src/libbsc/rest_octets.c 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/32/2032/1 diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c index 6fae9cd..ed6c573 100644 --- a/openbsc/src/libbsc/rest_octets.c +++ b/openbsc/src/libbsc/rest_octets.c @@ -566,6 +566,8 @@ static int encode_t3192(unsigned int t3192) { + /* See also 3GPP TS 44.060 + Table 12.24.2: GPRS Cell Options information element details */ if (t3192 == 0) return 3; else if (t3192 <= 80) @@ -645,7 +647,11 @@ return drx_timer_max; bitvec_set_uint(bv, gco->nmo, 2); - bitvec_set_uint(bv, gco->t3168 / 500, 3); + + /* See also 3GPP TS 44.060 + Table 12.24.2: GPRS Cell Options information element details */ + bitvec_set_uint(bv, gco->t3168 / 500 - 1, 3); + bitvec_set_uint(bv, t3192, 3); bitvec_set_uint(bv, drx_timer_max, 3); /* ACCESS_BURST_TYPE: Hard-code 8bit */ -- To view, visit https://gerrit.osmocom.org/2032 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 13 08:23:42 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 08:23:42 +0000 Subject: [PATCH] openbsc[master]: unixsocket: start sabm for UNIXSOCKET Message-ID: Review at https://gerrit.osmocom.org/2033 unixsocket: start sabm for UNIXSOCKET openbsc only starts sabm messages for a subset of line drivers. Add unixsocket to those subset. Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e --- M openbsc/src/libbsc/bts_ericsson_rbs2000.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2033/1 diff --git a/openbsc/src/libbsc/bts_ericsson_rbs2000.c b/openbsc/src/libbsc/bts_ericsson_rbs2000.c index 1abf4a3..0cae6d8 100644 --- a/openbsc/src/libbsc/bts_ericsson_rbs2000.c +++ b/openbsc/src/libbsc/bts_ericsson_rbs2000.c @@ -141,13 +141,15 @@ case S_L_INP_LINE_INIT: case S_L_INP_LINE_NOALARM: if (strcasecmp(isd->line->driver->name, "DAHDI") - && strcasecmp(isd->line->driver->name, "MISDN_LAPD")) + && strcasecmp(isd->line->driver->name, "MISDN_LAPD") + && strcasecmp(isd->line->driver->name, "UNIXSOCKET")) break; start_sabm_in_line(isd->line, 1); break; case S_L_INP_LINE_ALARM: if (strcasecmp(isd->line->driver->name, "DAHDI") - && strcasecmp(isd->line->driver->name, "MISDN_LAPD")) + && strcasecmp(isd->line->driver->name, "MISDN_LAPD") + && strcasecmp(isd->line->driver->name, "UNIXSOCKET")) break; start_sabm_in_line(isd->line, 0); break; -- To view, visit https://gerrit.osmocom.org/2033 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 08:42:11 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 08:42:11 +0000 Subject: [PATCH] openbsc[master]: OM2000: Add FIXME comments for missing resolving of RX/TX MO! Message-ID: Review at https://gerrit.osmocom.org/2034 OM2000: Add FIXME comments for missing resolving of RX/TX MO! Change-Id: I45708df724c5fc3316eca6bd2ac2c0738b19a45b --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/34/2034/1 diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 6c987d8..62e8f6a 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -835,11 +835,13 @@ trx = gsm_bts_trx_num(bts, mo->inst); if (!trx) return NULL; + /* FIXME */ break; case OM2K_MO_CLS_RX: trx = gsm_bts_trx_num(bts, mo->inst); if (!trx) return NULL; + /* FIXME */ break; } -- To view, visit https://gerrit.osmocom.org/2034 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I45708df724c5fc3316eca6bd2ac2c0738b19a45b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 08:58:22 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 08:58:22 +0000 Subject: [MERGED] osmo-pcu[master]: Add pkg-config file In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add pkg-config file ...................................................................... Add pkg-config file We're installing header file pcuif_proto.h so it's better to use pkg-config for proper version tracking similar to the way it's done for OpenBSC. Change-Id: I0520045e5655794df152b98b9755d7cbbd334049 --- M .gitignore M Makefile.am M configure.ac M debian/osmo-pcu.install A osmo-pcu.pc.in 5 files changed, 16 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitignore b/.gitignore index 959b09b..234ef0b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ debian/osmo-pcu.substvars debian/osmo-pcu/ debian/tmp/ + +osmo-pcu.pc diff --git a/Makefile.am b/Makefile.am index 12cb478..1536016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,5 @@ SUBDIRS = include src examples tests EXTRA_DIST = osmoappdesc.py +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = osmo-pcu.pc diff --git a/configure.ac b/configure.ac index dcde2ed..54c70ca 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,7 @@ AC_SUBST(STD_DEFINES_AND_INCLUDES) AC_OUTPUT( + osmo-pcu.pc include/Makefile src/Makefile examples/Makefile diff --git a/debian/osmo-pcu.install b/debian/osmo-pcu.install index 768719c..54dcc63 100644 --- a/debian/osmo-pcu.install +++ b/debian/osmo-pcu.install @@ -1,3 +1,4 @@ etc/osmocom/osmo-pcu.cfg usr/bin/osmo-pcu usr/include/osmocom/pcu/pcuif_proto.h +usr/lib/pkgconfig/osmo-pcu.pc diff --git a/osmo-pcu.pc.in b/osmo-pcu.pc.in new file mode 100644 index 0000000..b72e9a8 --- /dev/null +++ b/osmo-pcu.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/ + +Name: OsmoPCU +Description: Osmocom PCU implementation +Requires: +Version: @VERSION@ +Cflags: -I${includedir} -- To view, visit https://gerrit.osmocom.org/2008 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0520045e5655794df152b98b9755d7cbbd334049 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:04:54 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:04:54 +0000 Subject: [PATCH] openbsc[master]: OM2000: Change the order of MO initialization Message-ID: Review at https://gerrit.osmocom.org/2035 OM2000: Change the order of MO initialization So far: CF-IS-CON-TF Now: CF-TF-CON-IS Change-Id: I8efd9bafdcf9504d2e5fc85c44c708fa53f4dff8 --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 30 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/35/2035/1 diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 6c987d8..a594929 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -2155,18 +2155,19 @@ struct gsm_bts *bts = obfp->bts; OSMO_ASSERT(event == OM2K_BTS_EVT_CF_DONE); - osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_IS, - BTS_FSM_TIMEOUT, 0); - om2k_mo_fsm_start(fi, OM2K_BTS_EVT_IS_DONE, bts->c0, - &bts->rbs2000.is.om2k_mo); + /* TF can take a long time to initialize, wait for 10min */ + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TF, 600, 0); + om2k_mo_fsm_start(fi, OM2K_BTS_EVT_TF_DONE, bts->c0, + &bts->rbs2000.tf.om2k_mo); } -static void om2k_bts_s_wait_is(struct osmo_fsm_inst *fi, uint32_t event, void *data) +static void om2k_bts_s_wait_tf(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct om2k_bts_fsm_priv *obfp = fi->priv; struct gsm_bts *bts = obfp->bts; - OSMO_ASSERT(event == OM2K_BTS_EVT_IS_DONE); + OSMO_ASSERT(event == OM2K_BTS_EVT_TF_DONE); + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_CON, BTS_FSM_TIMEOUT, 0); om2k_mo_fsm_start(fi, OM2K_BTS_EVT_CON_DONE, bts->c0, @@ -2179,18 +2180,19 @@ struct gsm_bts *bts = obfp->bts; OSMO_ASSERT(event == OM2K_BTS_EVT_CON_DONE); - /* TF can take a long time to initialize, wait for 10min */ - osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TF, 600, 0); - om2k_mo_fsm_start(fi, OM2K_BTS_EVT_TF_DONE, bts->c0, - &bts->rbs2000.tf.om2k_mo); + + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_IS, + BTS_FSM_TIMEOUT, 0); + om2k_mo_fsm_start(fi, OM2K_BTS_EVT_IS_DONE, bts->c0, + &bts->rbs2000.is.om2k_mo); } -static void om2k_bts_s_wait_tf(struct osmo_fsm_inst *fi, uint32_t event, void *data) +static void om2k_bts_s_wait_is(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct om2k_bts_fsm_priv *obfp = fi->priv; struct gsm_bts_trx *trx; - OSMO_ASSERT(event == OM2K_BTS_EVT_TF_DONE); + OSMO_ASSERT(event == OM2K_BTS_EVT_IS_DONE); osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX, BTS_FSM_TIMEOUT, 0); @@ -2229,31 +2231,31 @@ [OM2K_BTS_S_WAIT_CF] = { .in_event_mask = S(OM2K_BTS_EVT_CF_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_IS), + S(OM2K_BTS_S_WAIT_TF), .name = "WAIT-CF", .action = om2k_bts_s_wait_cf, - }, - [OM2K_BTS_S_WAIT_IS] = { - .in_event_mask = S(OM2K_BTS_EVT_IS_DONE), - .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_CON), - .name = "WAIT-IS", - .action = om2k_bts_s_wait_is, - }, - [OM2K_BTS_S_WAIT_CON] = { - .in_event_mask = S(OM2K_BTS_EVT_CON_DONE), - .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_TF), - .name = "WAIT-CON", - .action = om2k_bts_s_wait_con, }, [OM2K_BTS_S_WAIT_TF] = { .in_event_mask = S(OM2K_BTS_EVT_TF_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_TRX), + S(OM2K_BTS_S_WAIT_CON), .name = "WAIT-TF", .action = om2k_bts_s_wait_tf, }, + [OM2K_BTS_S_WAIT_CON] = { + .in_event_mask = S(OM2K_BTS_EVT_CON_DONE), + .out_state_mask = S(OM2K_BTS_S_ERROR) | + S(OM2K_BTS_S_WAIT_IS), + .name = "WAIT-CON", + .action = om2k_bts_s_wait_con, + }, + [OM2K_BTS_S_WAIT_IS] = { + .in_event_mask = S(OM2K_BTS_EVT_IS_DONE), + .out_state_mask = S(OM2K_BTS_S_ERROR) | + S(OM2K_BTS_S_WAIT_TRX), + .name = "WAIT-IS", + .action = om2k_bts_s_wait_is, + }, [OM2K_BTS_S_WAIT_TRX] = { .in_event_mask = S(OM2K_BTS_EVT_TRX_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | -- To view, visit https://gerrit.osmocom.org/2035 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8efd9bafdcf9504d2e5fc85c44c708fa53f4dff8 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:04:54 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:04:54 +0000 Subject: [PATCH] openbsc[master]: OM2000: Send ALTCRQ for SuperChannel after receiving IS Enab... Message-ID: Review at https://gerrit.osmocom.org/2036 OM2000: Send ALTCRQ for SuperChannel after receiving IS Enable Req Ack When the BTS is configured to use a SuperChannel and it is using a unix domain socket based transport towards the L2TP daemon, then we must instruct the L2TP daemon to instruct the SIU to change the Abis Lower Transport Mode using the ALTCRQ / ALTCRP L2TP signalling. Change-Id: I672bfaa09c42fbeb0c8459f24b2222b952de954b --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/abis_om2000.c M openbsc/src/libbsc/abis_om2000_vty.c 3 files changed, 32 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/36/2036/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 7c469ee..acc5494 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -728,6 +728,7 @@ struct om2k_mo om2k_mo; struct gsm_abis_mo mo; } tf; + uint32_t use_superchannel:1; } rbs2000; struct { uint8_t bts_type; diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index a594929..54e9b7c 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1652,6 +1652,7 @@ static void om2k_mo_st_wait_enable_accept(struct osmo_fsm_inst *fi, uint32_t event, void *data) { + struct om2k_mo_fsm_priv *omfp = fi->priv; struct om2k_decoded_msg *omd = data; switch (omd->msg_type) { @@ -1659,6 +1660,9 @@ osmo_fsm_inst_state_chg(fi, OM2K_ST_ERROR, 0, 0); break; case OM2K_MSGT_ENABLE_REQ_ACK: + if (omfp->mo->addr.class == OM2K_MO_CLS_IS && + omfp->trx->bts->rbs2000.use_superchannel) + e1inp_ericsson_set_altc(omfp->trx->bts->oml_link->ts->line, 1); osmo_fsm_inst_state_chg(fi, OM2K_ST_WAIT_ENABLE_RES, OM2K_TIMEOUT, 0); } diff --git a/openbsc/src/libbsc/abis_om2000_vty.c b/openbsc/src/libbsc/abis_om2000_vty.c index 060fb8b..a6bc4c7 100644 --- a/openbsc/src/libbsc/abis_om2000_vty.c +++ b/openbsc/src/libbsc/abis_om2000_vty.c @@ -417,6 +417,29 @@ return CMD_SUCCESS; } +DEFUN(cfg_bts_alt_mode, cfg_bts_alt_mode_cmd, + "abis-lower-transport (single-timeslot|super-channel)", + "Configure thee Abis Lower Transport\n" + "Single Timeslot (classic Abis)\n" + "SuperChannel (Packet Abis)\n") +{ + struct gsm_bts *bts = vty->index; + struct con_group *cg; + + if (bts->type != GSM_BTS_TYPE_RBS2000) { + vty_out(vty, "%% Command only works for RBS2000%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + if (!strcmp(argv[0], "super-channel")) + bts->rbs2000.use_superchannel = 1; + else + bts->rbs2000.use_superchannel = 0; + + return CMD_SUCCESS; +} + DEFUN(cfg_bts_is_conn_list, cfg_bts_is_conn_list_cmd, "is-connection-list (add|del) <0-2047> <0-2047> <0-255>", "Interface Switch Connection List\n" @@ -548,6 +571,9 @@ VTY_NEWLINE); dump_con_group(vty, cgrp); } + if (bts->rbs2000.use_superchannel) + vty_out(vty, " abis-lower-transport super-channel%s", + VTY_NEWLINE); } int abis_om2k_vty_init(void) @@ -575,6 +601,7 @@ install_element(OM2K_CON_GROUP_NODE, &cfg_om2k_con_path_conc_cmd); install_element(BTS_NODE, &cfg_bts_is_conn_list_cmd); + install_element(BTS_NODE, &cfg_bts_alt_mode_cmd); install_element(BTS_NODE, &cfg_om2k_con_group_cmd); install_element(BTS_NODE, &del_om2k_con_group_cmd); -- To view, visit https://gerrit.osmocom.org/2036 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I672bfaa09c42fbeb0c8459f24b2222b952de954b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:04:54 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:04:54 +0000 Subject: [PATCH] openbsc[master]: abis_om2k: protect MO FSMs by NULL check Message-ID: Review at https://gerrit.osmocom.org/2037 abis_om2k: protect MO FSMs by NULL check Also set MO FSMs to NULL after freeing them. Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200 --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/37/2037/1 diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 54e9b7c..b01aacf 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1695,7 +1695,17 @@ static void om2k_mo_s_done_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { + struct om2k_mo_fsm_priv *omfp = fi->priv; + omfp->mo->fsm = NULL; osmo_fsm_inst_term(fi, OSMO_FSM_TERM_REGULAR, NULL); +} + +static void om2k_mo_s_error_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct om2k_mo_fsm_priv *omfp = fi->priv; + + omfp->mo->fsm = NULL; + osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL); } static const struct osmo_fsm_state om2k_is_states[] = { @@ -1792,7 +1802,7 @@ .name = "ERROR", .in_event_mask = 0, .out_state_mask = 0, - .onenter = om2k_mo_s_done_onenter, + .onenter = om2k_mo_s_error_onenter, }, }; @@ -2695,6 +2705,12 @@ msgb_hexdump(msg)); return 0; } + if (!mo->fsm) { + LOGP(DNM, LOGL_ERROR, "MO object should not generate any message. fsm == NULL " + "%s: %s\n", get_value_string(om2k_msgcode_vals, msg_type), + msgb_hexdump(msg)); + return 0; + } /* Dispatch message to that MO */ om2k_mo_fsm_recvmsg(bts, mo, &odm); -- To view, visit https://gerrit.osmocom.org/2037 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:04:55 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:04:55 +0000 Subject: [PATCH] openbsc[master]: RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH Message-ID: Review at https://gerrit.osmocom.org/2038 RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH This seems to be mandatory when an Ericsson RBS2000 uses a SuperChannel as back-haul. Change-Id: I793e7d62df1ca9f9c38d39e22d3868064d446c8d --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/38/2038/1 diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 5939e75..26cafc2 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -507,6 +507,13 @@ msgb_tv_put(msg, RSL_IE_ACT_TYPE, RSL_ACT_OSMO_PDCH); + if (lchan->ts->trx->bts->type == GSM_BTS_TYPE_RBS2000 && + lchan->ts->trx->bts->rbs2000.use_superchannel) { + const uint8_t eric_pgsl_tmr[] = { 30, 1 }; + msgb_tv_fixed_put(msg, RSL_IE_ERIC_PGSL_TIMERS, + sizeof(eric_pgsl_tmr), eric_pgsl_tmr); + } + msg->dst = lchan->ts->trx->rsl_link; return abis_rsl_sendmsg(msg); -- To view, visit https://gerrit.osmocom.org/2038 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I793e7d62df1ca9f9c38d39e22d3868064d446c8d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:04:55 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:04:55 +0000 Subject: [PATCH] openbsc[master]: RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS Message-ID: Review at https://gerrit.osmocom.org/2039 RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS Change-Id: I66541f9b20e7fd67fbec329283fc3c821c970a56 --- M openbsc/include/openbsc/abis_rsl.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libbsc/bsc_api.c 3 files changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/39/2039/1 diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 758c555..692b464 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -22,6 +22,7 @@ #ifndef _RSL_H #define _RSL_H +#include #include #include @@ -49,7 +50,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *ts); int rsl_encryption_cmd(struct msgb *msg); int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len, - uint8_t *ms_ident, uint8_t chan_needed); + uint8_t *ms_ident, uint8_t chan_needed, bool is_gprs); int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val); int rsl_data_request(struct msgb *msg, uint8_t link_id); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 26cafc2..91cbd46 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1007,7 +1007,7 @@ } int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len, - uint8_t *ms_ident, uint8_t chan_needed) + uint8_t *ms_ident, uint8_t chan_needed, bool is_gprs) { struct abis_rsl_dchan_hdr *dh; struct msgb *msg = rsl_msgb_alloc(); @@ -1020,6 +1020,11 @@ msgb_tlv_put(msg, RSL_IE_MS_IDENTITY, len-2, ms_ident+2); msgb_tv_put(msg, RSL_IE_CHAN_NEEDED, chan_needed); + /* Ericsson wants to have this IE in case a paging message + * relates to packet paging */ + if (bts->type == GSM_BTS_TYPE_RBS2000 && is_gprs) + msgb_tv_put(msg, RSL_IE_ERIC_PACKET_PAG_IND, 0); + msg->dst = bts->c0->rsl_link; return abis_rsl_sendmsg(msg); diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 54978e5..253326f 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -419,7 +419,7 @@ 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); + return rsl_paging_cmd(bts, page_group, mi_len, mi, chan_type, false); } static void handle_ass_compl(struct gsm_subscriber_connection *conn, -- To view, visit https://gerrit.osmocom.org/2039 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66541f9b20e7fd67fbec329283fc3c821c970a56 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:38:12 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:38:12 +0000 Subject: [PATCH] openbsc[master]: libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a... Message-ID: Review at https://gerrit.osmocom.org/2040 libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a confirmation message ericsson can handle a reference at the end of a imm assign command which is used in the confirm response. The confirm response is only sent if the trailer is present. Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f --- M openbsc/include/openbsc/abis_rsl.h M openbsc/src/libbsc/abis_rsl.c 2 files changed, 27 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/40/2040/1 diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 692b464..e61d4ea 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -57,6 +57,9 @@ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id); int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); +/* Ericcson vendor specific RSL extensions */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val); + /* Siemens vendor-specific RSL extensions */ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 91cbd46..ef6c897 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1048,7 +1048,7 @@ } /* Chapter 8.5.6 */ -int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val) +struct msgb *rsl_imm_assign_cmd_common(struct gsm_bts *bts, uint8_t len, uint8_t *val) { struct msgb *msg = rsl_msgb_alloc(); struct abis_rsl_dchan_hdr *dh; @@ -1071,6 +1071,29 @@ } msg->dst = bts->c0->rsl_link; + return msg; +} + +/* Chapter 8.5.6 */ +int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + if (!msg) + return 1; + return abis_rsl_sendmsg(msg); +} + +/* Chapter 8.5.6 */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + if (!msg) + return 1; + + /* ericsson can handle a reference at the end of the message which is used in + * the confirm message. The confirm message is only sent if the trailer is present */ + msgb_put_u8(msg, 0xf1); + msgb_put_u32(msg, tlli); return abis_rsl_sendmsg(msg); } -- To view, visit https://gerrit.osmocom.org/2040 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 09:38:13 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 13 Mar 2017 09:38:13 +0000 Subject: [PATCH] openbsc[master]: libbsc: add debug log message to S_L_INP_* callbacks Message-ID: Review at https://gerrit.osmocom.org/2041 libbsc: add debug log message to S_L_INP_* callbacks Improve debug log output of input callbacks by adding a line containing the signal event name. Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2 --- M openbsc/src/libbsc/bsc_init.c M openbsc/src/libbsc/bts_ericsson_rbs2000.c 2 files changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/41/2041/1 diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index b17ff79..35a456a 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -316,6 +316,7 @@ switch (signal) { case S_L_INP_TEI_UP: + LOGP(DLMI, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_TEI_UP\n"); if (isd->link_type == E1INP_SIGN_OML) { /* TODO: this is required for the Nokia BTS, hopping is configured during OML, other MA is not set. */ @@ -338,6 +339,7 @@ bootstrap_rsl(trx); break; case S_L_INP_TEI_DN: + LOGP(DLMI, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_TEI_DN\n"); LOGP(DLMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", isd->link_type, trx); if (isd->link_type == E1INP_SIGN_OML) diff --git a/openbsc/src/libbsc/bts_ericsson_rbs2000.c b/openbsc/src/libbsc/bts_ericsson_rbs2000.c index 1abf4a3..191ce2b 100644 --- a/openbsc/src/libbsc/bts_ericsson_rbs2000.c +++ b/openbsc/src/libbsc/bts_ericsson_rbs2000.c @@ -116,6 +116,7 @@ switch (signal) { case S_L_INP_TEI_UP: + LOGP(DNM, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_TEI_UP\n"); switch (isd->link_type) { case E1INP_SIGN_OML: if (isd->trx->bts->type != GSM_BTS_TYPE_RBS2000) @@ -128,6 +129,7 @@ } break; case S_L_INP_TEI_DN: + LOGP(DNM, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_TEI_DN\n"); if (isd->trx->bts->type != GSM_BTS_TYPE_RBS2000) break; LOGP(DNM, LOGL_NOTICE, "Line-%u TS-%u TEI-%u SAPI-%u: Link " @@ -139,13 +141,16 @@ lapd_sap_start(e1i_ts->lapd, isd->tei, isd->sapi); break; case S_L_INP_LINE_INIT: + LOGP(DNM, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_LINE_INIT\n"); case S_L_INP_LINE_NOALARM: + LOGP(DNM, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_LINE_NOALARM\n"); if (strcasecmp(isd->line->driver->name, "DAHDI") && strcasecmp(isd->line->driver->name, "MISDN_LAPD")) break; start_sabm_in_line(isd->line, 1); break; case S_L_INP_LINE_ALARM: + LOGP(DNM, LOGL_DEBUG, "inp_sig_cb() signal: S_L_INP_LINE_ALARM\n"); if (strcasecmp(isd->line->driver->name, "DAHDI") && strcasecmp(isd->line->driver->name, "MISDN_LAPD")) break; -- To view, visit https://gerrit.osmocom.org/2041 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 13 10:17:12 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 10:17:12 +0000 Subject: osmo-pcu[master]: tests: include headers from include/ In-Reply-To: References: Message-ID: Patch Set 1: It is, but I've decided to split it into separate patch as this is generic fix. -- To view, visit https://gerrit.osmocom.org/2024 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:17:46 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:17:46 +0000 Subject: [PATCH] osmo-pcu[master]: bts.cpp: Fix overloading ambiguity In-Reply-To: References: Message-ID: Hello dexter, Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2007 to look at the new patch set (#8). bts.cpp: Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by using signed 32 bit integer which is enough for Frame Number in GSM. Also, mark parameter constraints more explicitly: - add assert for expected FN values - don't perform computation for non-relative FN The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 11 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/07/2007/8 diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..c36647e 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,15 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* double-check that relative FN is not negative and fits into int32_t */ + OSMO_ASSERT(rfn < GSM_MAX_FN); + OSMO_ASSERT(rfn >= 0); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. @@ -536,7 +540,8 @@ /* Ensure that all following calculations are performed with the * relative frame number */ - rfn = rfn % 42432; + if (rfn >= RFN_MODULUS) + return rfn; /* Compute an internal relative frame number from the full internal frame number */ diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 8 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:17:53 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:17:53 +0000 Subject: osmo-pcu[master]: bts.cpp: Fix overloading ambiguity In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 8 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:18:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:18:41 +0000 Subject: openbsc[master]: OM2000: Add FIXME comments for missing resolving of RX/TX MO! In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2034 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I45708df724c5fc3316eca6bd2ac2c0738b19a45b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:18:43 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:18:43 +0000 Subject: [MERGED] openbsc[master]: OM2000: Add FIXME comments for missing resolving of RX/TX MO! In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: OM2000: Add FIXME comments for missing resolving of RX/TX MO! ...................................................................... OM2000: Add FIXME comments for missing resolving of RX/TX MO! Change-Id: I45708df724c5fc3316eca6bd2ac2c0738b19a45b --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 6c987d8..62e8f6a 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -835,11 +835,13 @@ trx = gsm_bts_trx_num(bts, mo->inst); if (!trx) return NULL; + /* FIXME */ break; case OM2K_MO_CLS_RX: trx = gsm_bts_trx_num(bts, mo->inst); if (!trx) return NULL; + /* FIXME */ break; } -- To view, visit https://gerrit.osmocom.org/2034 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I45708df724c5fc3316eca6bd2ac2c0738b19a45b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:19:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:19:16 +0000 Subject: openbsc[master]: unixsocket: start sabm for UNIXSOCKET In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2033 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:19:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:19:19 +0000 Subject: [MERGED] openbsc[master]: unixsocket: start sabm for UNIXSOCKET In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: unixsocket: start sabm for UNIXSOCKET ...................................................................... unixsocket: start sabm for UNIXSOCKET openbsc only starts sabm messages for a subset of line drivers. Add unixsocket to those subset. Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e --- M openbsc/src/libbsc/bts_ericsson_rbs2000.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/bts_ericsson_rbs2000.c b/openbsc/src/libbsc/bts_ericsson_rbs2000.c index 1abf4a3..0cae6d8 100644 --- a/openbsc/src/libbsc/bts_ericsson_rbs2000.c +++ b/openbsc/src/libbsc/bts_ericsson_rbs2000.c @@ -141,13 +141,15 @@ case S_L_INP_LINE_INIT: case S_L_INP_LINE_NOALARM: if (strcasecmp(isd->line->driver->name, "DAHDI") - && strcasecmp(isd->line->driver->name, "MISDN_LAPD")) + && strcasecmp(isd->line->driver->name, "MISDN_LAPD") + && strcasecmp(isd->line->driver->name, "UNIXSOCKET")) break; start_sabm_in_line(isd->line, 1); break; case S_L_INP_LINE_ALARM: if (strcasecmp(isd->line->driver->name, "DAHDI") - && strcasecmp(isd->line->driver->name, "MISDN_LAPD")) + && strcasecmp(isd->line->driver->name, "MISDN_LAPD") + && strcasecmp(isd->line->driver->name, "UNIXSOCKET")) break; start_sabm_in_line(isd->line, 0); break; -- To view, visit https://gerrit.osmocom.org/2033 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:20:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 11:20:02 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2031/2/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 54: const struct value_string gsm_chreq_descs[7] = { I count only 6? -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 11:25:14 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 11:25:14 +0000 Subject: [MERGED] osmo-pcu[master]: bts.cpp: Fix overloading ambiguity In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: bts.cpp: Fix overloading ambiguity ...................................................................... bts.cpp: Fix overloading ambiguity Fix error introduced in 1275a3f91a744e011b0dba82b09124d249c7abb5 by using signed 32 bit integer which is enough for Frame Number in GSM. Also, mark parameter constraints more explicitly: - add assert for expected FN values - don't perform computation for non-relative FN The error was: bts.cpp: In member function ?uint32_t BTS::rfn_to_fn(uint32_t)?: bts.cpp:554:25: error: call of overloaded ?abs(uint32_t)? is ambiguous if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) { ^ In file included from /usr/include/c++/6/cstdlib:75:0, from /usr/include/c++/6/stdlib.h:36, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/stdlib.h:735:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ In file included from /usr/include/c++/6/stdlib.h:36:0, from /usr/include/osmocom/core/linuxrbtree.h:97, from /usr/include/osmocom/core/timer.h:35, from ./bts.h:29, from bts.cpp:21: /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128) abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } ^~~ /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 --- M src/bts.cpp M src/bts.h 2 files changed, 11 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/bts.cpp b/src/bts.cpp index 548d000..c36647e 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -521,11 +521,15 @@ } /* Determine the full frame number from a relative frame number */ -uint32_t BTS::rfn_to_fn(uint32_t rfn) +uint32_t BTS::rfn_to_fn(int32_t rfn) { - uint32_t m_cur_rfn; - uint32_t fn; - uint32_t fn_rounded; + int32_t m_cur_rfn; + int32_t fn; + int32_t fn_rounded; + + /* double-check that relative FN is not negative and fits into int32_t */ + OSMO_ASSERT(rfn < GSM_MAX_FN); + OSMO_ASSERT(rfn >= 0); /* Note: If a BTS is sending in a rach request it will be fully aware * of the frame number. If the PCU is used in a BSC-co-located setup. @@ -536,7 +540,8 @@ /* Ensure that all following calculations are performed with the * relative frame number */ - rfn = rfn % 42432; + if (rfn >= RFN_MODULUS) + return rfn; /* Compute an internal relative frame number from the full internal frame number */ diff --git a/src/bts.h b/src/bts.h index 5d8dc59..78ed002 100644 --- a/src/bts.h +++ b/src/bts.h @@ -350,7 +350,7 @@ uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); - uint32_t rfn_to_fn(uint32_t rfn); + uint32_t rfn_to_fn(int32_t rfn); int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, enum ph_burst_type burst_type); -- To view, visit https://gerrit.osmocom.org/2007 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib6d895a97aa35414f245ea4406c6e78f1b4fb5b8 Gerrit-PatchSet: 9 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Mar 13 12:06:37 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 12:06:37 +0000 Subject: osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Patch Set 1: Could you elaborate? Why do we need to check this particular part of ctrl_cmd in here? From what kind of potential error assert would help? It's obvious that if we change ctrl_cmd_create() in backward-incompatible way than we also have to change the code using it. -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 12:24:08 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 12:24:08 +0000 Subject: [PATCH] osmo-bts[master]: osmo-bts-trx: cosmetic log fix In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1974 to look at the new patch set (#2). osmo-bts-trx: cosmetic log fix Print actual value causing error and the check range. Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d --- M src/common/scheduler.c 1 file changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/74/1974/2 diff --git a/src/common/scheduler.c b/src/common/scheduler.c index 724fb5a..27b7630 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -305,11 +305,11 @@ goto wrong_type; } if (prim_fn > 100) { - LOGP(DL1C, LOGL_NOTICE, "Prim for trx=%u ts=%u at fn=%u " - "is out of range, or channel %s with type %s is " - "already disabled. If this happens in conjunction " - "with PCU, increase 'rts-advance' by 5. " - "(current fn=%u)\n", l1t->trx->nr, tn, + LOGP(DL1C, LOGL_NOTICE, "Prim %u for trx=%u ts=%u at " + "fn=%u is out of range (100), or channel %s with " + "type %s is already disabled. If this happens in " + "conjunction with PCU, increase 'rts-advance' by 5." + " (current fn=%u)\n", prim_fn, l1t->trx->nr, tn, l1sap->u.data.fn, get_lchan_by_chan_nr(l1t->trx, chan_nr)->name, get_value_string(trx_chan_type_names, chan), fn); @@ -1609,10 +1609,12 @@ no_data: /* in case of C0, we need a dummy burst to maintain RF power */ if (bits == NULL && l1t->trx == l1t->trx->bts->c0) { -if (0) if (chan != TRXC_IDLE) // hack - LOGP(DL1C, LOGL_DEBUG, "No burst data for %s fn=%u ts=%u " - "burst=%d on C0, so filling with dummy burst\n", - trx_chan_desc[chan].name, fn, tn, bid); +#if 0 + if (chan != TRXC_IDLE) // hack + LOGP(DL1C, LOGL_DEBUG, "No burst data for %s fn=%u ts=%u " + "burst=%d on C0, so filling with dummy burst\n", + trx_chan_desc[chan].name, fn, tn, bid); +#endif bits = (ubit_t *) dummy_burst; } -- To view, visit https://gerrit.osmocom.org/1974 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 12:34:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 12:34:11 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 10: > I believe that unfortunately all we can do is deprecate 'everything'. Using 'debug' has the same effect, though the 'everything' keyword skips the filter checking and thus avoids logging overhead (with all the printfs that might not make much of a difference, but maybe helps a little). So we could deprecate 'everything' and add a keyword 'all' for the fix? logging level rsl everything % 'everything' is deprecated, it did not work as documented. Use 'all' instead. logging level rsl all logging level all all -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 12:44:09 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 12:44:09 +0000 Subject: osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Patch Set 1: This is about coding style more than anything else. The point is that it is not immediately obvious from that local code that you are using a member of ctrl_cmd to decide whether to send further below. Calling ctrl_cmd_create() implies that you want to create a command, and if we were to change its behavior we wouldn't necessarily notice it -- because at least I would assume every caller to overwrite the .value member. I agree that it is unlikely, but it's a way of telling the reader what exactly is going on without having to think too much, and as a bonus anyone refactoring the code (however unlikely) is immediately told about having forgotten something. An even nicer way would be to store the 'value' string in a local var, and only allocate the ctrl_cmd in case we really want to send it. That would skip all the assumptions and unnecessary allocations. On another note, why are we even allocating it; ownership is not passed on to ctrl_cmd_send, so ctrl cmds in general could be local instances without need for allocation. -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 12:49:01 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 12:49:01 +0000 Subject: osmo-pcu[master]: tests: include headers from include/ In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 it's good to mention in the commit log the intention of preparing a future commit, so a reviewer doesn't need to ask this question... -- To view, visit https://gerrit.osmocom.org/2024 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 12:52:56 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 12:52:56 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2031/2/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 54: const struct value_string gsm_chreq_descs[7] = { > I count only 6? 7 is correct, maybe forgot to count the termination entry? but why do we have the array sizes explicitly here? All other value_string[]s we use rely on the terminator and define as well as declare the arrays with just '[]'. -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:01:02 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:01:02 +0000 Subject: openbsc[master]: gprs: fix T3186 encoding in Sysinfo 13 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2032 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:03:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 13:03:59 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2031/2/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 54: const struct value_string gsm_chreq_descs[7] = { > 7 is correct, maybe forgot to count the termination entry? I'm happy to do away with the explicit count if it's no longer needed. I am quite sure there were times/situations where at least some versions of gcc didn't like forward-declaraitons of undefined array sizes in header files. -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:35:45 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:35:45 +0000 Subject: [PATCH] libosmocore[master]: build: generate gsm0503.h to builddir, not srcdir In-Reply-To: References: Message-ID: Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1996 to look at the new patch set (#5). build: generate gsm0503.h to builddir, not srcdir To ensure that a separate build dir keeps the source dir clean of state, generate the gsm0503.h to the builddir instead of the srcdir. Adjustments for everyone to access the right paths were added in previous patches. Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 --- M include/Makefile.am 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/1996/5 diff --git a/include/Makefile.am b/include/Makefile.am index f8b1f8f..7d0b384 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -151,6 +151,6 @@ osmocom/gsm/gsm0503.h: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_header gsm \ - --target-path $(top_srcdir)/include/osmocom/gsm/ + --target-path $(builddir)/osmocom/gsm CLEANFILES = osmocom/gsm/gsm0503.h -- To view, visit https://gerrit.osmocom.org/1996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:35:45 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:35:45 +0000 Subject: [PATCH] libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1998 to look at the new patch set (#6). jenkins: also test build in separate dir To make sure that new patches don't break a build done in another dir than srcdir, make jenkins verify that it still works. Even though 'make distcheck' also tests a build from a separate dir, this does not verify that BUILT_SOURCES are generated properly. If these already exist in the source tree from a previous 'make' issued in the source tree, the BUILT_SOURCES are not regenerated during 'make distcheck'. Hence a separate test run is necessary to ensure stability of new patches. Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e --- M contrib/jenkins.sh 1 file changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/98/1998/6 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..92ff132 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -8,3 +8,15 @@ || cat-testlogs.sh $MAKE distcheck \ || cat-testlogs.sh + +# verify build in dir other than source tree +rm -rf * +git checkout . +autoreconf --install --force +mkdir builddir +cd builddir +../configure --enable-static +$MAKE $PARALLEL_MAKE check \ + || cat-testlogs.sh +$MAKE distcheck \ + || cat-testlogs.sh -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:35:46 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:35:46 +0000 Subject: [PATCH] libosmocore[master]: build: conv_gen.py: ensure parent dirs of written files exist Message-ID: Review at https://gerrit.osmocom.org/2042 build: conv_gen.py: ensure parent dirs of written files exist Previously, this would fail when generating to $builddir if that subtree did not exist yet in $builddir. Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 --- M utils/conv_gen.py 1 file changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/42/2042/1 diff --git a/utils/conv_gen.py b/utils/conv_gen.py index 1ffeb3f..0cdba75 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -306,9 +306,15 @@ code = ConvolutionalCode(0, polys, name = name) code.print_state_and_output(fi) +def open_for_writing(parent_dir, base_name): + path = os.path.join(parent_dir, base_name) + if not os.path.isdir(parent_dir): + os.makedirs(parent_dir) + return open(path, 'w') + def generate_codes(codes, path, prefix, name): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) f.write(mod_license + "\n") f.write("#include \n") f.write("#include \n\n") @@ -335,7 +341,7 @@ def generate_vectors(codes, path, prefix, name, inc = None): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) f.write(mod_license + "\n") # Print includes @@ -363,7 +369,7 @@ def generate_header(codes, path, prefix, name, description = None): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) # Print license and includes f.write(mod_license + "\n") -- To view, visit https://gerrit.osmocom.org/2042 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:39:42 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 13 Mar 2017 13:39:42 +0000 Subject: libosmocore[master]: build: generate gsm0503.h to builddir, not srcdir In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:41:35 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:41:35 +0000 Subject: libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2002/2/src/gsm/Makefile.am File src/gsm/Makefile.am: Line 40: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm > Should the $(top_srcdir) to be changed to the $(top_builddir)? no, the conv_gen.py is not the generated one, it is the python script that does the generation of gsm0503_conv.c. conv_gen.py must be distributed in the source. -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:42:12 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 13 Mar 2017 13:42:12 +0000 Subject: libosmocore[master]: build: conv_gen.py: ensure parent dirs of written files exist In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2042 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:43:22 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 13:43:22 +0000 Subject: [MERGED] osmo-pcu[master]: tests: include headers from include/ In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: tests: include headers from include/ ...................................................................... tests: include headers from include/ In addition to .h files from src/ add include/ as well: some headers are now public and reside in separate directory. Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 --- M tests/Makefile.am 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/Makefile.am b/tests/Makefile.am index a03528c..79c3ef6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ -I$(top_srcdir)/include/ AM_LDFLAGS = -lrt check_PROGRAMS = rlcmac/RLCMACTest alloc/AllocTest tbf/TbfTest types/TypesTest ms/MsTest llist/LListTest llc/LlcTest codel/codel_test edge/EdgeTest bitcomp/BitcompTest fn/FnTest -- To view, visit https://gerrit.osmocom.org/2024 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:47:25 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 13 Mar 2017 13:47:25 +0000 Subject: libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/2002/2/src/gsm/Makefile.am File src/gsm/Makefile.am: Line 40: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm > no, the conv_gen.py is not the generated one, it is the python script that Ah, yes, sorry. The target path isn't specified here, so it will be equal to the $(builddir). -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:04 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 13 Mar 2017 13:49:04 +0000 Subject: libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:22 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 13:49:22 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 10: > logging level all all I strongly disagree with that idea: 1) it's confusing as hell 2) even if we deprecate "everything", why do we need to add anything at all? why "debug" would not suffice? -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:26 +0000 Subject: [PATCH] libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2002 to look at the new patch set (#4). build: fix build dependencies for generated sources Ensure that a changed conv_gen.py and/or conv_codes_gsm.py result in regeneration of the gsm0503* generated sources. Before this patch, manual cleaning of the generated files was necessary to benefit from a code update. Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 --- M include/Makefile.am M src/gsm/Makefile.am 2 files changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/2002/4 diff --git a/include/Makefile.am b/include/Makefile.am index 7d0b384..e2a1b12 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,3 +1,5 @@ +BUILT_SOURCES = osmocom/gsm/gsm0503.h + nobase_include_HEADERS = \ osmocom/codec/codec.h \ osmocom/core/application.h \ @@ -149,7 +151,7 @@ $(AM_V_GEN)$(MKDIR_P) $(dir $@) $(AM_V_GEN)sed -e's/XX/$*/g' $< > $@ -osmocom/gsm/gsm0503.h: +osmocom/gsm/gsm0503.h: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_header gsm \ --target-path $(builddir)/osmocom/gsm diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 653bdb9..3a4a0cd 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -14,6 +14,8 @@ noinst_LTLIBRARIES = libgsmint.la lib_LTLIBRARIES = libosmogsm.la +BUILT_SOURCES = gsm0503_conv.c + libgsmint_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \ gprs_cipher_core.c gprs_rlc.c gsm0480.c abis_nm.c gsm0502.c \ @@ -34,7 +36,7 @@ EXTRA_DIST = libosmogsm.map # Convolutional codes generation -gsm0503_conv.c: +gsm0503_conv.c: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm CLEANFILES = gsm0503_conv.c -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:26 +0000 Subject: [PATCH] libosmocore[master]: build: coding/gsm0503: fix build in sep. dir: -I builddir In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2003 to look at the new patch set (#2). build: coding/gsm0503: fix build in sep. dir: -I builddir To allow building coding/gsm0503_interleaving.c which includes the generated bit*gen.h (via bits.h), add -I to the builddir include path in order to find the generated bit*gen.h headers there. Change-Id: I0d465bc109765b1315d615243bea6af027afa368 --- M src/coding/Makefile.am 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/2003/2 diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am index e19b187..cbdcf47 100644 --- a/src/coding/Makefile.am +++ b/src/coding/Makefile.am @@ -5,6 +5,7 @@ AM_CPPFLAGS = \ -I"$(top_srcdir)/include" \ + -I"$(top_builddir)/include" \ $(TALLOC_CFLAGS) AM_CFLAGS = -Wall -- To view, visit https://gerrit.osmocom.org/2003 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0d465bc109765b1315d615243bea6af027afa368 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:26 +0000 Subject: [PATCH] libosmocore[master]: build: fix distcheck: include gen scripts in EXTRA_DIST In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2004 to look at the new patch set (#3). build: fix distcheck: include gen scripts in EXTRA_DIST Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7 --- M utils/Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/04/2004/3 diff --git a/utils/Makefile.am b/utils/Makefile.am index e95f546..51af3d8 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -2,6 +2,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall +EXTRA_DIST = conv_gen.py conv_codes_gsm.py + bin_PROGRAMS = osmo-arfcn osmo-auc-gen osmo_arfcn_SOURCES = osmo-arfcn.c -- To view, visit https://gerrit.osmocom.org/2004 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:26 +0000 Subject: [PATCH] libosmocore[master]: build: conv_gen.py: ensure parent dirs of written files exist In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2042 to look at the new patch set (#2). build: conv_gen.py: ensure parent dirs of written files exist Previously, this would fail when generating to $builddir if that subtree did not exist yet in $builddir. Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 --- M utils/conv_gen.py 1 file changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/42/2042/2 diff --git a/utils/conv_gen.py b/utils/conv_gen.py index 1ffeb3f..0cdba75 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -306,9 +306,15 @@ code = ConvolutionalCode(0, polys, name = name) code.print_state_and_output(fi) +def open_for_writing(parent_dir, base_name): + path = os.path.join(parent_dir, base_name) + if not os.path.isdir(parent_dir): + os.makedirs(parent_dir) + return open(path, 'w') + def generate_codes(codes, path, prefix, name): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) f.write(mod_license + "\n") f.write("#include \n") f.write("#include \n\n") @@ -335,7 +341,7 @@ def generate_vectors(codes, path, prefix, name, inc = None): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) f.write(mod_license + "\n") # Print includes @@ -363,7 +369,7 @@ def generate_header(codes, path, prefix, name, description = None): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) # Print license and includes f.write(mod_license + "\n") -- To view, visit https://gerrit.osmocom.org/2042 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:26 +0000 Subject: [PATCH] libosmocore[master]: build: generate gsm0503.h to builddir, not srcdir In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1996 to look at the new patch set (#6). build: generate gsm0503.h to builddir, not srcdir To ensure that a separate build dir keeps the source dir clean of state, generate the gsm0503.h to the builddir instead of the srcdir. Adjustments for everyone to access the right paths were added in previous patches. Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 --- M include/Makefile.am 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/1996/6 diff --git a/include/Makefile.am b/include/Makefile.am index f8b1f8f..7d0b384 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -151,6 +151,6 @@ osmocom/gsm/gsm0503.h: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_header gsm \ - --target-path $(top_srcdir)/include/osmocom/gsm/ + --target-path $(builddir)/osmocom/gsm CLEANFILES = osmocom/gsm/gsm0503.h -- To view, visit https://gerrit.osmocom.org/1996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:26 +0000 Subject: [PATCH] libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Hello Vadim Yanitskiy, Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1998 to look at the new patch set (#7). jenkins: also test build in separate dir To make sure that new patches don't break a build done in another dir than srcdir, make jenkins verify that it still works. Even though 'make distcheck' also tests a build from a separate dir, this does not verify that BUILT_SOURCES are generated properly. If these already exist in the source tree from a previous 'make' issued in the source tree, the BUILT_SOURCES are not regenerated during 'make distcheck'. Hence a separate test run is necessary to ensure stability of new patches. Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e --- M contrib/jenkins.sh 1 file changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/98/1998/7 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..92ff132 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -8,3 +8,15 @@ || cat-testlogs.sh $MAKE distcheck \ || cat-testlogs.sh + +# verify build in dir other than source tree +rm -rf * +git checkout . +autoreconf --install --force +mkdir builddir +cd builddir +../configure --enable-static +$MAKE $PARALLEL_MAKE check \ + || cat-testlogs.sh +$MAKE distcheck \ + || cat-testlogs.sh -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 7 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:49:28 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:49:28 +0000 Subject: [PATCH] libosmocore[master]: build: cosmetic: coding: break a CPPFLAGS line Message-ID: Review at https://gerrit.osmocom.org/2043 build: cosmetic: coding: break a CPPFLAGS line Matches our general scheme and helps readability of an upcoming patch. Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 --- M src/coding/Makefile.am 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/43/2043/1 diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am index 5a055c8..e19b187 100644 --- a/src/coding/Makefile.am +++ b/src/coding/Makefile.am @@ -3,7 +3,9 @@ # documentation before making any modification LIBVERSION = 0:0:0 -AM_CPPFLAGS = -I$(top_srcdir)/include $(TALLOC_CFLAGS) +AM_CPPFLAGS = \ + -I"$(top_srcdir)/include" \ + $(TALLOC_CFLAGS) AM_CFLAGS = -Wall lib_LTLIBRARIES = libosmocoding.la -- To view, visit https://gerrit.osmocom.org/2043 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:54:39 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 13 Mar 2017 13:54:39 +0000 Subject: libosmocore[master]: build: coding/gsm0503: fix build in sep. dir: -I builddir In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2003 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0d465bc109765b1315d615243bea6af027afa368 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 13:55:04 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 13:55:04 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2031/2/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 54: const struct value_string gsm_chreq_descs[7] = { > I'm happy to do away with the explicit count if it's no longer needed. I a maybe one needs to declare them 'extern' in the header file to avoid such warnings? just guessing, that's what we do everywhere else. Maybe it's related to the PCU being C++. Anyway, I guess that would be a change not related to this patch. -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:02:31 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 14:02:31 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 10: > 1) it's confusing as hell I don't think it's confusing at all. We have a keyword for addressing all items, and using the keyword consistently for both subsystem as well as log level. Surely everyone is familiar with the concept of argument ordering. > why "debug" would not suffice? I explained so in my comment, please read above and look at the code. I assumed that this is the main reason why you submitted this patch in the first place: that the 'everything' skips all logging filters and prints logs right away. Also setting the 'all all' flag does not interfere with the more detailed logging levels per subsystem: I can set e.g. RSL to NOTICE and MM to ERROR, then for a short time I can set 'all all' to see really everything, and a minute later I can switch off the 'all all' to return back to RSL=NOTICE and MM=ERROR without having to redefine the logging landscape. Why else would you bother with this patch? :) -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:03:38 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 14:03:38 +0000 Subject: [PATCH] osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1991 to look at the new patch set (#2). Handle ctrl cmd allocation failures Check that ctrl command was successfully allocated before using it. Fixes: CID163884 Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 --- M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 1 file changed, 17 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/91/1991/2 diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index 2a15d2e..79b502d 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -190,21 +190,13 @@ struct ctrl_connection *ctrl, int critical, int warning) { - int new_state = next_state(manager->state, critical, warning), rc; + int new_state = next_state(manager->state, critical, warning); struct ctrl_cmd *rep; - bool send = false; + char *oml_alert = NULL; /* Nothing changed */ if (new_state < 0) return; - - rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); - if (!rep) { - LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed.\n"); - } else { - rep->id = talloc_asprintf(rep, "%d", rand()); - rep->variable = "oml-alert"; - } LOGP(DTEMP, LOGL_NOTICE, "Moving from state %s to %s.\n", get_value_string(state_names, manager->state), @@ -219,22 +211,28 @@ break; case STATE_WARNING: execute_warning_act(manager); - rep->value = "Temperature Warning"; - send = true; + oml_alert = "Temperature Warning"; break; case STATE_CRITICAL: execute_critical_act(manager); - rep->value = "Temperature Critical"; - send = true; + oml_alert = "Temperature Critical"; break; }; - if (send) { - rc = ctrl_cmd_send(&ctrl->write_queue, rep); - LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + if (oml_alert) { + rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); + if (rep) { + rep->id = talloc_asprintf(rep, "%d", rand()); + rep->variable = "oml-alert"; + rep->value = oml_alert; + LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", + ctrl_cmd_send(&ctrl->write_queue, rep)); + talloc_free(rep); + } else + LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed for " + "%s.\n", oml_alert); } - talloc_free(rep); -} +} static void temp_ctrl_check(struct ctrl_connection *ctrl) { -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:06:05 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 14:06:05 +0000 Subject: libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2002/2/src/gsm/Makefile.am File src/gsm/Makefile.am: Line 40: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm > Ah, yes, sorry. The target path isn't specified here, so it will be equal t ah ok, that's what you meant, correct. ...and sorry for the noise of rebasing the patches twice over, missed some earlier comments at first. -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:08:47 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 14:08:47 +0000 Subject: osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/1991/2/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c File src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c: Line 222: if (oml_alert) { exit early? Line 224: if (rep) { exit early? -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:13:10 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 14:13:10 +0000 Subject: [PATCH] osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1991 to look at the new patch set (#3). Handle ctrl cmd allocation failures Check that ctrl command was successfully allocated before using it. Fixes: CID163884 Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 --- M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 1 file changed, 19 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/91/1991/3 diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index 2a15d2e..f01fd14 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -190,21 +190,13 @@ struct ctrl_connection *ctrl, int critical, int warning) { - int new_state = next_state(manager->state, critical, warning), rc; + int new_state = next_state(manager->state, critical, warning); struct ctrl_cmd *rep; - bool send = false; + char *oml_alert = NULL; /* Nothing changed */ if (new_state < 0) return; - - rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); - if (!rep) { - LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed.\n"); - } else { - rep->id = talloc_asprintf(rep, "%d", rand()); - rep->variable = "oml-alert"; - } LOGP(DTEMP, LOGL_NOTICE, "Moving from state %s to %s.\n", get_value_string(state_names, manager->state), @@ -219,22 +211,31 @@ break; case STATE_WARNING: execute_warning_act(manager); - rep->value = "Temperature Warning"; - send = true; + oml_alert = "Temperature Warning"; break; case STATE_CRITICAL: execute_critical_act(manager); - rep->value = "Temperature Critical"; - send = true; + oml_alert = "Temperature Critical"; break; }; - if (send) { - rc = ctrl_cmd_send(&ctrl->write_queue, rep); - LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + if (!oml_alert) + return; + + rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); + if (!rep) { + LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed for %s.\n", + oml_alert); + return; } + + rep->id = talloc_asprintf(rep, "%d", rand()); + rep->variable = "oml-alert"; + rep->value = oml_alert; + LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", + ctrl_cmd_send(&ctrl->write_queue, rep)); talloc_free(rep); -} +} static void temp_ctrl_check(struct ctrl_connection *ctrl) { -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:18:18 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 14:18:18 +0000 Subject: libosmocore[master]: build: cosmetic: coding: break a CPPFLAGS line In-Reply-To: References: Message-ID: Patch Set 1: I thought the general rule were to break lines at 80 symbols. Why special exception for makefiles? I think it harms readability instead of improving it. -- To view, visit https://gerrit.osmocom.org/2043 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:21:06 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 14:21:06 +0000 Subject: [MERGED] python/osmo-python-tests[master]: test_all_apps: actually count nr of errors In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: test_all_apps: actually count nr of errors ...................................................................... test_all_apps: actually count nr of errors Each test run returns 1 on error, so instead of |=, why not count the number of errors with +=. Also print the final error count. Change-Id: I690dde3711555a3447e5ad4cc0a04a7a869a8296 --- M osmopy/osmotestconfig.py 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py index 5e19a40..2132c43 100644 --- a/osmopy/osmotestconfig.py +++ b/osmopy/osmotestconfig.py @@ -172,11 +172,13 @@ configs = app_configs[app[3]] for config in configs: config = os.path.join(confpath, config) - errors |= test_config(app, config, tmpdir, verbose) + errors += test_config(app, config, tmpdir, verbose) if rmtmp or not errors: remove_tmpdir(tmpdir) + if errors: + print >> sys.stderr, "ERRORS: %d" % errors return errors -- To view, visit https://gerrit.osmocom.org/1925 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I690dde3711555a3447e5ad4cc0a04a7a869a8296 Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:21:06 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 13 Mar 2017 14:21:06 +0000 Subject: [MERGED] python/osmo-python-tests[master]: on Exception during test, also print the actual config In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: on Exception during test, also print the actual config ...................................................................... on Exception during test, also print the actual config When a test run encounters an Exception, the test config file name is printed, but that may already be gone when done, so also print the complete actual test config file contents, making it easy to reproduce the failure manually. Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d --- M osmopy/osmotestconfig.py 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py index 7b8ad66..5e19a40 100644 --- a/osmopy/osmotestconfig.py +++ b/osmopy/osmotestconfig.py @@ -64,6 +64,7 @@ print >> sys.stderr, "Failed to verify %s" % ' '.join(cmd) print >> sys.stderr, "Current directory: %s" % os.getcwd() print >> sys.stderr, "Error was %s" % se + print >> sys.stderr, "Config was\n%s" % open(config).read() raise se finally: -- To view, visit https://gerrit.osmocom.org/1922 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d Gerrit-PatchSet: 2 Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:23:16 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 14:23:16 +0000 Subject: openbsc[master]: ipaccess-config: properly create swload In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2018/1/openbsc/src/ipaccess/ipaccess-config.c File openbsc/src/ipaccess/ipaccess-config.c: Line 629: load->file_id_len = strlen((char*)load->file_id) + 1; > I'm a bit confused, what are you saying? So why changing from header->firmware_info.sw_part -> load->file_id at all? -- To view, visit https://gerrit.osmocom.org/2018 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:29:49 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 14:29:49 +0000 Subject: osmo-sip-connector[master]: tests: Add copies of mncc.py/mncc_sock.py for (manual) tests In-Reply-To: References: Message-ID: Patch Set 3: Wouldn't it be better to add setup.py to mncc-python and install it via pip instead of duplicating code? -- To view, visit https://gerrit.osmocom.org/1993 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83a3ea8cd410a35f324caf9a01fae4cba44446f3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 14:38:17 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 14:38:17 +0000 Subject: openbsc[master]: deb: install openbsc.pc In-Reply-To: References: Message-ID: Patch Set 1: > but why is this needed? For proper versioning of installed headers - see related discussion in #1258. Curious thing regarding noinst_HEADERS - not sure yet why it's ignored, will have a look. -- To view, visit https://gerrit.osmocom.org/2009 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5472a8fe74a81b98598fbdb688db778cb7d09e62 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:03:42 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 15:03:42 +0000 Subject: openbsc[master]: deb: install openbsc.pc In-Reply-To: References: Message-ID: Patch Set 1: Ok, changing noinst_HEADERS doesn't seem to affect .deb at all: the correct packages are produced either way. As there's no special autotools option in debian/rules I suggest to move noinst_HEADERS discussion to separate patch/ticket (feel free to create them) - this seems to be somehow related to the way autotools works. -- To view, visit https://gerrit.osmocom.org/2009 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5472a8fe74a81b98598fbdb688db778cb7d09e62 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:33:39 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 15:33:39 +0000 Subject: [PATCH] osmo-hlr[master]: Add .deb packaging Message-ID: Review at https://gerrit.osmocom.org/2044 Add .deb packaging Add initial metadata for .deb packages. Change-Id: Ied02e445236410de51488fbb5aaea3170d02a31d Related: OS#1948 --- A debian/changelog A debian/compat A debian/control A debian/copyright A debian/osmo-hlr.install A debian/rules A debian/source/format 7 files changed, 76 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/44/2044/1 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9706926 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +osmo-hlr (0.0.1) UNRELEASED; urgency=low + + * Initial release (Closes: OS#1948) + + -- Max Suraev Mon, 13 Mar 2017 16:26:41 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..de7c5e5 --- /dev/null +++ b/debian/control @@ -0,0 +1,35 @@ +Source: osmo-hlr +Section: net +Priority: optional +Maintainer: Max Suraev +Build-Depends: debhelper (>= 9), + pkg-config, + dh-autoreconf, + dh-systemd (>= 1.5), + autotools-dev, + pkg-config, + libosmocore-dev, + libosmo-abis-dev, + libosmo-netif-dev, + libdbd-sqlite3, + libsqlite3-dev, + hardening-wrapper +Standards-Version: 3.9.6 +Vcs-Browser: http://cgit.osmocom.org/osmo-hlr +Vcs-Git: git://git.osmocom.org/osmo-hlr +Homepage: https://projects.osmocom.org/projects/osmo-hlr + +Package: osmo-hlr +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3 +Description: Osmocom Home Location Register + OsmoHLR is a Osmocom implementation of HLR (Home Location Registrar) which works over GSUP + protocol. The subscribers are store in sqlite DB. It supports both 2G and 3G authentication. + +Package: osmo-hlr-dbg +Architecture: any +Section: debug +Priority: extra +Depends: osmo-hlr (= ${binary:Version}), ${misc:Depends} +Description: Debug symbols for the osmo-hlr + Make debugging possible diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..c0e2b45 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: OsmoHLR +Source: http://cgit.osmocom.org/osmo-hlr/ + +Files: * +Copyright: 2016-2017 Sysmocom s. f. m. c. GmbH +License: AGPL-3+ + +License: AGPL-3+ + 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 . diff --git a/debian/osmo-hlr.install b/debian/osmo-hlr.install new file mode 100644 index 0000000..028b9b3 --- /dev/null +++ b/debian/osmo-hlr.install @@ -0,0 +1 @@ +/usr/bin/osmo-hlr diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..8797d5a --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ --with autoreconf + +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + +override_dh_strip: + dh_strip --dbg-package=osmo-hlr-dbg diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..9f67427 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) \ No newline at end of file -- To view, visit https://gerrit.osmocom.org/2044 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ied02e445236410de51488fbb5aaea3170d02a31d Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:51:06 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 15:51:06 +0000 Subject: libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:51:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 15:51:37 +0000 Subject: osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:51:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 15:51:54 +0000 Subject: libosmocore[master]: build: cosmetic: coding: break a CPPFLAGS line In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2043 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:55:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 15:55:20 +0000 Subject: osmo-sip-connector[master]: tests: Add copies of mncc.py/mncc_sock.py for (manual) tests In-Reply-To: References: Message-ID: Patch Set 3: not sure if we'd want to have copies of the code in different repositories? We could instead move it into openbsc.git and install it system-wide during 'make install'? Or package it as a separatem odule in mncc-python.git and install it using pip or the like? also, if it's for manual testing only, I'm not sure if we should merge it to master? -- To view, visit https://gerrit.osmocom.org/1993 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83a3ea8cd410a35f324caf9a01fae4cba44446f3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:56:27 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 15:56:27 +0000 Subject: osmo-hlr[master]: Add .deb packaging In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2044 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied02e445236410de51488fbb5aaea3170d02a31d Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 15:57:10 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 15:57:10 +0000 Subject: openbsc[master]: gprs: fix T3186 encoding in Sysinfo 13 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2032 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 16:11:08 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Mon, 13 Mar 2017 16:11:08 +0000 Subject: libosmocore[master]: build: cosmetic: coding: break a CPPFLAGS line In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2043 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 16:12:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 13 Mar 2017 16:12:45 +0000 Subject: [MERGED] osmo-hlr[master]: Add .deb packaging In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add .deb packaging ...................................................................... Add .deb packaging Add initial metadata for .deb packages. Change-Id: Ied02e445236410de51488fbb5aaea3170d02a31d Related: OS#1948 --- A debian/changelog A debian/compat A debian/control A debian/copyright A debian/osmo-hlr.install A debian/rules A debian/source/format 7 files changed, 76 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9706926 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +osmo-hlr (0.0.1) UNRELEASED; urgency=low + + * Initial release (Closes: OS#1948) + + -- Max Suraev Mon, 13 Mar 2017 16:26:41 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..de7c5e5 --- /dev/null +++ b/debian/control @@ -0,0 +1,35 @@ +Source: osmo-hlr +Section: net +Priority: optional +Maintainer: Max Suraev +Build-Depends: debhelper (>= 9), + pkg-config, + dh-autoreconf, + dh-systemd (>= 1.5), + autotools-dev, + pkg-config, + libosmocore-dev, + libosmo-abis-dev, + libosmo-netif-dev, + libdbd-sqlite3, + libsqlite3-dev, + hardening-wrapper +Standards-Version: 3.9.6 +Vcs-Browser: http://cgit.osmocom.org/osmo-hlr +Vcs-Git: git://git.osmocom.org/osmo-hlr +Homepage: https://projects.osmocom.org/projects/osmo-hlr + +Package: osmo-hlr +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3 +Description: Osmocom Home Location Register + OsmoHLR is a Osmocom implementation of HLR (Home Location Registrar) which works over GSUP + protocol. The subscribers are store in sqlite DB. It supports both 2G and 3G authentication. + +Package: osmo-hlr-dbg +Architecture: any +Section: debug +Priority: extra +Depends: osmo-hlr (= ${binary:Version}), ${misc:Depends} +Description: Debug symbols for the osmo-hlr + Make debugging possible diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..c0e2b45 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: OsmoHLR +Source: http://cgit.osmocom.org/osmo-hlr/ + +Files: * +Copyright: 2016-2017 Sysmocom s. f. m. c. GmbH +License: AGPL-3+ + +License: AGPL-3+ + 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 . diff --git a/debian/osmo-hlr.install b/debian/osmo-hlr.install new file mode 100644 index 0000000..028b9b3 --- /dev/null +++ b/debian/osmo-hlr.install @@ -0,0 +1 @@ +/usr/bin/osmo-hlr diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..8797d5a --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ --with autoreconf + +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + +override_dh_strip: + dh_strip --dbg-package=osmo-hlr-dbg diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..9f67427 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) \ No newline at end of file -- To view, visit https://gerrit.osmocom.org/2044 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ied02e445236410de51488fbb5aaea3170d02a31d Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 13 16:20:06 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 13 Mar 2017 16:20:06 +0000 Subject: osmo-sip-connector[master]: tests: Add copies of mncc.py/mncc_sock.py for (manual) tests In-Reply-To: References: Message-ID: Patch Set 3: Hehe. thanks for keeping us honest. Yeah.. we should not have code clones (sadly these files don't work with python3 either. e.g. the long is too long for python3). Are you open to have the MNCCServer in a common module too? The next patch following this one. -- To view, visit https://gerrit.osmocom.org/1993 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83a3ea8cd410a35f324caf9a01fae4cba44446f3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 16:23:43 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Mon, 13 Mar 2017 16:23:43 +0000 Subject: osmo-sip-connector[master]: tests: Add copies of mncc.py/mncc_sock.py for (manual) tests In-Reply-To: References: Message-ID: Patch Set 3: Code-Review-2 -- To view, visit https://gerrit.osmocom.org/1993 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83a3ea8cd410a35f324caf9a01fae4cba44446f3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 16:34:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 13 Mar 2017 16:34:08 +0000 Subject: osmo-sip-connector[master]: tests: Add copies of mncc.py/mncc_sock.py for (manual) tests In-Reply-To: References: Message-ID: Patch Set 3: > Hehe. thanks for keeping us honest. Yeah.. we should not have code > clones well, if we do we should at least use git-subtree/git-submodule. > (sadly these files don't work with python3 either. e.g. the > long is too long for python3). if there's something that can be improved to fix this, feel free to do so. I have still very limited knowledge of Python. > Are you open to have the MNCCServer in a common module too? The > next patch following this one. sure, why not. -- To view, visit https://gerrit.osmocom.org/1993 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I83a3ea8cd410a35f324caf9a01fae4cba44446f3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 13 18:41:53 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Mon, 13 Mar 2017 18:41:53 +0000 Subject: [PATCH] libosmocore[master]: compiler warnings: take care of compiler warning "unused-res... Message-ID: Review at https://gerrit.osmocom.org/2045 compiler warnings: take care of compiler warning "unused-result" Though it makes no sense to handle the return code of freopen() here, the compiler complains about it. The #pragma statements take care of that. Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82 --- M src/application.c 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/2045/1 diff --git a/src/application.c b/src/application.c index 8a325c8..7750b41 100644 --- a/src/application.c +++ b/src/application.c @@ -156,9 +156,16 @@ /* Redirect stdio to /dev/null */ /* since C89/C99 says stderr is a macro, we can safely do this! */ #ifdef stderr +/* + * it does not make sense to check the return code here, so we just + * ignore the compiler warning from gcc + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" freopen("/dev/null", "r", stdin); freopen("/dev/null", "w", stdout); freopen("/dev/null", "w", stderr); +#pragma GCC diagnostic pop #endif return 0; -- To view, visit https://gerrit.osmocom.org/2045 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz From gerrit-no-reply at lists.osmocom.org Mon Mar 13 18:52:33 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Mon, 13 Mar 2017 18:52:33 +0000 Subject: [PATCH] libosmocore[master]: fix wrong return code Message-ID: Review at https://gerrit.osmocom.org/2046 fix wrong return code In case we are a daemon, we do not need to daemonize again. On the other hand everything is fine and we also do not need to bail out with an error. The daemonize template at [1] does the same. [1] http://www.itp.uzh.ch/~dpotter/howto/daemonize Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e --- M src/application.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/46/2046/1 diff --git a/src/application.c b/src/application.c index 8a325c8..4112e75 100644 --- a/src/application.c +++ b/src/application.c @@ -124,7 +124,7 @@ /* Check if parent PID == init, in which case we are already a daemon */ if (getppid() == 1) - return -EEXIST; + return 0; /* Fork from the parent process */ pid = fork(); -- To view, visit https://gerrit.osmocom.org/2046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz From gerrit-no-reply at lists.osmocom.org Tue Mar 14 00:05:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 00:05:44 +0000 Subject: osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 00:08:41 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 00:08:41 +0000 Subject: [MERGED] libosmocore[master]: build: cosmetic: coding: break a CPPFLAGS line In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build: cosmetic: coding: break a CPPFLAGS line ...................................................................... build: cosmetic: coding: break a CPPFLAGS line Matches our general scheme and helps readability of an upcoming patch. Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 --- M src/coding/Makefile.am 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am index 5a055c8..e19b187 100644 --- a/src/coding/Makefile.am +++ b/src/coding/Makefile.am @@ -3,7 +3,9 @@ # documentation before making any modification LIBVERSION = 0:0:0 -AM_CPPFLAGS = -I$(top_srcdir)/include $(TALLOC_CFLAGS) +AM_CPPFLAGS = \ + -I"$(top_srcdir)/include" \ + $(TALLOC_CFLAGS) AM_CFLAGS = -Wall lib_LTLIBRARIES = libosmocoding.la -- To view, visit https://gerrit.osmocom.org/2043 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Tue Mar 14 00:11:29 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 00:11:29 +0000 Subject: openbsc[master]: deb: install openbsc.pc In-Reply-To: References: Message-ID: Patch Set 1: hmm, I thought the debian packaging performs a 'make install' and only acts on the installed files. If the installed headers are not installed by 'make install', how else do they end up in the debian package? -- To view, visit https://gerrit.osmocom.org/2009 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5472a8fe74a81b98598fbdb688db778cb7d09e62 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 00:16:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 00:16:22 +0000 Subject: openbsc[master]: ipaccess-config: properly create swload In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2018/1/openbsc/src/ipaccess/ipaccess-config.c File openbsc/src/ipaccess/ipaccess-config.c: Line 629: load->file_id_len = strlen((char*)load->file_id) + 1; > So why changing from header->firmware_info.sw_part -> load->file_id at all? sw_part is the source string, which could have arbitrary length. After osmo_strlcpy(), we possibly have copied only a part of it, and thus I want to use the actual really present number of characters in the length indicator, instead of the length we would have liked to copy. Thus I count the string length of the target, here load->file_id, after the copy. I explained this in the commit log. -- To view, visit https://gerrit.osmocom.org/2018 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 14 00:19:21 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 00:19:21 +0000 Subject: libosmocore[master]: build: cosmetic: coding: break a CPPFLAGS line In-Reply-To: References: Message-ID: Patch Set 1: > I thought the general rule were to break lines at 80 symbols. Why > special exception for makefiles? I think it harms readability > instead of improving it. I created this patch because you asked for it. It makes the other patch more readable, as clearly stated in the commit log. Obviously, in a makefile, we often add single files or flags to these lists. The diffs become far more readable if each file is on its own line. Please let's not discuss things just for the sake of discussing. -- To view, visit https://gerrit.osmocom.org/2043 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I174086a988b51b6e80f3661609069b69a3d41cc7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 00:24:13 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 00:24:13 +0000 Subject: libosmocore[master]: fix wrong return code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Interesting. Does this happen in "real life" scenarios? Can we test whether this improves a particular use case? -- To view, visit https://gerrit.osmocom.org/2046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 02:15:38 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 02:15:38 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: cosmetic fix: shown value is not SEQ.MS Message-ID: Review at https://gerrit.osmocom.org/2047 milenage_test: cosmetic fix: shown value is not SEQ.MS In the milenage_test, the console output printed "SEQ.MS = 33", but 33 is a) the SQN, not SEQ; b) the SQN *after* the next auth generation, i.e. SQN.MS would have been 31. While at it also use the proper PRIu64 from inttypes.h to output the sqn value. This prepares for upcoming sparation of SQN incrementing by SEQ and IND, particularly to clearly show where the changes in auth/milenage_test's expectations originate. Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/2047/1 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 473be92..187b9ad 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,8 @@ if (rc < 0) { printf("AUTS failed\n"); } else { - printf("AUTS success: SEQ.MS = %llu\n", (unsigned long long)test_aud.u.umts.sqn); + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); } opc_test(&test_aud); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 49146a5..20c47c6 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: SEQ.MS = 33 +AUTS success: tuple generated with SQN = 33 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2047 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 02:15:39 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 02:15:39 +0000 Subject: [PATCH] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next Message-ID: Review at https://gerrit.osmocom.org/2048 osmo_auth_gen_vec: UMTS auth: store last used SQN, not next Prepare for the implementation of splitting SQN increments in SEQ and an IND part; particularly to clearly show where the changes in auth/milenage_test's expectations originate. Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically stores the last used SQN, not the next one to be used. Particularly with the upcoming fix of the SQN scheme, this change is important: the next SQN will depend on which entity asks for it, because each auth consumer may have a particular slot in the IND part of SQN. It does not make sense to store the next SQN, because we will not know which consumer that will be for. The milenage_test has always calculated a tuple for SQN == 34. To account for the increment now happening before calculating a tuple, lower the test_aud->sqn by one to 0x21 == 33, so that it is still calculating for SQN == 34. Because we are no longer incrementing SQN after the tuple is generated, milenage_test's expected output after doing an AUTS resync to 31 changes to the next SQN = 32, the SQN used for the generated tuple. (BTW, a subsequent patch will illustrate AUTS in detail.) Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 --- M src/gsm/auth_milenage.c M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 3 files changed, 11 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/2048/1 diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index 1635ac6..e180762 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -30,10 +30,14 @@ const uint8_t *_rand) { size_t res_len = sizeof(vec->res); + uint64_t next_sqn; uint8_t sqn[6]; int rc; - osmo_store64be_ext(aud->u.umts.sqn, sqn, 6); + /* keep the incremented SQN local until gsm_milenage() succeeded. */ + next_sqn = aud->u.umts.sqn + 1; + + osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, sqn, _rand, vec->autn, vec->ik, vec->ck, vec->res, &res_len); @@ -43,7 +47,9 @@ return rc; vec->auth_types = OSMO_AUTH_TYPE_UMTS | OSMO_AUTH_TYPE_GSM; - aud->u.umts.sqn++; + + /* for storage in the caller's AUC database */ + aud->u.umts.sqn = next_sqn; return 0; } @@ -72,7 +78,7 @@ if (rc < 0) return rc; - aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16); + aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); } diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 187b9ad..405da65 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -36,7 +36,7 @@ .k = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, - .sqn = 0x22, + .sqn = 0x21, }, }; diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 20c47c6..b0eb44b 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: tuple generated with SQN = 33 +AUTS success: tuple generated with SQN = 32 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 02:15:39 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 02:15:39 +0000 Subject: [PATCH] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN increment Message-ID: Review at https://gerrit.osmocom.org/2049 osmo_auth_gen_vec: UMTS auth: fix SQN increment So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND separates a non-significant part of SQN from SEQ, and the more significant SEQ needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed i index. In other words, we will not assign i cyclically, but increment SEQ for each auth vector consumer. Add 'ind' and 'i' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. The verbose output of osmo-auc-gen with invoked with --auts parameter about SQN.MS and the next SQN needs adjustment. No longer show the next SQN, as it is not relevant. Show only the current SQN used for tuple generation, and show SQN.MS -- because we're still passing IND == 0, we can rely on single increments and know SQN.MS is sqn - 1. With nonzero IND, we would not actually know SQN.MS from the API, because we'll only be told what the next sensible SQN is. Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf --- M include/osmocom/crypt/auth.h M src/gsm/auth_milenage.c M tests/auth/milenage_test.c M utils/osmo-auc-gen.c 4 files changed, 72 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/2049/1 diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h index 7c6072b..a9e252d 100644 --- a/include/osmocom/crypt/auth.h +++ b/include/osmocom/crypt/auth.h @@ -39,6 +39,8 @@ uint8_t amf[2]; uint64_t sqn; /*!< sequence number */ int opc_is_op; /*!< is the OPC field OPC (0) or OP (1) ? */ + unsigned int ind; /*!< nr of bits not in SEQ, only SQN */ + unsigned int i; /*!< SQN slot, i.e. (SEQ << IND) + i */ } umts; struct { uint8_t ki[16]; /*!< secret key */ diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index e180762..626bac4 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -32,10 +32,66 @@ size_t res_len = sizeof(vec->res); uint64_t next_sqn; uint8_t sqn[6]; + uint64_t ind_mask; + uint64_t seq_1; int rc; + /* Determine next SQN, according to 3GPP TS 33.102: + * SQN consists of SEQ and a lower significant part of IND bits: + * + * |----------SEQ------------| + * |------------------------SQN-----------| + * |<---------->|<-- IND + * + * The IND part is used as "slots": e.g. a given HLR client will always + * get the same IND part, called i here, with incrementing SEQ. In the + * USIM, each IND slot enforces that its SEQ are used in ascending + * order -- as long as that constraint is satisfied, the SQN may jump + * forwards and backwards. For example, for IND == 5, asking the USIM + * for SQN = 32, 64, 33 is allowed, because 32 and 64 are SEQ || (i == + * 0), and though 33 is below 64, it is i == 1 and allowed. Not allowed + * would be 32, 96, 64, because 64 would go backwards after 96, both + * being i == 0. + * + * From the last used SQN, we want to increment SEQ + 1, and then pick + * the matching IND part. + * + * IND is suggested in TS 33.102 as 5. SQN is 48 bits long. If IND is + * passed too large here, the algorithms will break down. But at which + * point should we return an error? A sane limit seems to be IND == 10, + * but to protect against failure, limiting IND to 28 is enough, 28 + * being the number of bits to choose for the delta in 33.102, which is + * discussed to still require 2^15 > 32000 authentications to wrap the + * SQN back to the start. + * + * Note that if a caller with i == 1 generates N vectors, the SQN + * stored after this will reflect SEQ + N. If then another caller with + * i == 2 generates another N vectors, this will then use SEQ + N + * onwards and end up with SEQ + N + N. In other words, most of each + * SEQ's IND slots will remain unused. When looking at SQN being 48 + * bits wide, after dropping IND (say 5) bits from it, we will still + * have a sequence range of 2^43 = 8.8e12, eight trillion sequences, + * which is large enough to not bother further. With the maximum IND of + * 28 enforced below, we still get more than 1 million sequences, which + * is also sufficiently large. + * + * An IND of zero may be passed from legacy callers that are not aware + * of the IND extension. For these, below algorithm works out as + * before, simply incrementing SQN by 1. Assume that i is also 0 then. + */ + + if (aud->u.umts.ind > 28) + return -2; + + seq_1 = 1LL << aud->u.umts.ind; + ind_mask = ~(seq_1 - 1); + + /* the i index must not affect the SEQ part */ + if (aud->u.umts.i > seq_1) + return -3; + /* keep the incremented SQN local until gsm_milenage() succeeded. */ - next_sqn = aud->u.umts.sqn + 1; + next_sqn = ((aud->u.umts.sqn + seq_1) & ind_mask) + aud->u.umts.i; osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, @@ -78,6 +134,8 @@ if (rc < 0) return rc; + /* Update our "largest used SQN" from the USIM -- milenage_gen_vec() + * below will increment SQN. */ aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 405da65..f24a9ef 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -37,6 +37,8 @@ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, .sqn = 0x21, + .ind = 0, + .i = 0, }, }; @@ -79,6 +81,9 @@ #endif memset(vec, 0, sizeof(*vec)); + /* With IND == 0, this is the legacy mode of incrementing SQN by 1. + * sqn == 0x21 == 33, so the SQN used to generate the vector is + * sqn + 1 == 34. */ rc = osmo_auth_gen_vec(vec, &test_aud, _rand); if (rc < 0) { fprintf(stderr, "error generating auth vector\n"); @@ -90,6 +95,7 @@ const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; + /* Invoking with IND == 0, the next SQN after 31 is 32. */ rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); if (rc < 0) { printf("AUTS failed\n"); diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index f0cfa79..237f076 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -260,21 +260,15 @@ else dump_auth_vec(vec); - /* Print SQN from AUTS. It makes sense to print actually three SQN - * to clarify: - * After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does: - * aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16); - * Then calls milenage_gen_vec(), which, after it is done, does: - * aud->u.umts.sqn++; + /* Print SQN from AUTS. It makes sense to print actually two SQN to + * clarify: after recovering SQN.MS from AUTS, milenage_gen_vec() does + * aud->u.umts.sqn++, so to show SQN.MS we need to undo the ++. */ if (auts_is_set) printf("AUTS success: SQN.MS = %" PRIu64 - ", generated vector with SQN = %" PRIu64 - ", next SQN = %" PRIu64 "\n", - test_aud.u.umts.sqn - 2, + ", generated vector with SQN = %" PRIu64 "\n", test_aud.u.umts.sqn - 1, - test_aud.u.umts.sqn - ); + test_aud.u.umts.sqn); exit(0); } -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 02:15:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 02:15:40 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: enhance to verify new SQN increments Message-ID: Review at https://gerrit.osmocom.org/2050 milenage_test: enhance to verify new SQN increments After the legacy mode incrementing with IND == 0 is through, do another AUTS run with sensible IND and i, and then two more normal vector generations to verify proper SQN increments. Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/2050/1 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index f24a9ef..8d29571 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -104,6 +104,33 @@ test_aud.u.umts.sqn); } + /* Now test SQN incrementing scheme using SEQ and IND parts: with + * IND == 5 and i == 10, the next SQN after 31 is 32 + 10 == 42. */ + test_aud.u.umts.ind = 5; + test_aud.u.umts.i = 10; + rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); + if (rc < 0) + printf("AUTS failed\n"); + else + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after that is 64 + 10 == 74 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after *that* is 96 + 10 == 106 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + opc_test(&test_aud); exit(0); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index b0eb44b..1ddd50f 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -6,6 +6,7 @@ SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 AUTS success: tuple generated with SQN = 32 +AUTS success: tuple generated with SQN = 42 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 02:15:41 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 02:15:41 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: cosmetic: verify AUTS in comments Message-ID: Review at https://gerrit.osmocom.org/2051 milenage_test: cosmetic: verify AUTS in comments In a comment and by code #if'd away, illustrate that the AUTS used in the unit test is accurate. Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 --- M tests/auth/milenage_test.c 1 file changed, 56 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/2051/1 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 8d29571..7e91bfb 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -63,6 +63,15 @@ return rc; } +#define RECALC_AUTS 0 +#if RECALC_AUTS +typedef uint8_t u8; +extern int milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand, + u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar); +extern int milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand, + const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s); +#endif + int main(int argc, char **argv) { struct osmo_auth_vector _vec; @@ -92,6 +101,53 @@ dump_auth_vec(vec); + /* The USIM generates an AUTS to tell us it is at SQN == 31: + * + * SQN_MS = 00000000001f + * + * AUTS = Conc(SQN_MS) || MAC-S + * Conc(SQN_MS) = SQN_MS ? f5*[K](RAND) + * MAC-S = f1*[K] (SQN MS || RAND || AMF) + * + * K = 000102030405060708090a0b0c0d0e0f + * RAND = 00000000000000000000000000000000 + * + * f5*--> Conc(SQN_MS) = SQN_MS ^ f5*(K,RAND) + * = 00000000001f ^ 8711a0ec9e09 + * = 8711a0ec9e16 + * AMF = 0000 (TS 33.102 v7.0.0, 6.3.3) + * MAC-S = f1*[K] (SQN MS || RAND || AMF) + * = f1*[K] (00000000001f || 00000000000000000000000000000000 || 0000) + * = 37df17f80b384ee4 + * + * AUTS = 8711a0ec9e16 || 37df17f80b384ee4 + */ +#if RECALC_AUTS + uint8_t ak[6]; + uint8_t akstar[6]; + uint8_t opc[16]; + uint8_t k[16]; + uint8_t rand[16]; + osmo_hexparse("000102030405060708090a0b0c0d0e0f", k, sizeof(k)); + osmo_hexparse("000102030405060708090a0b0c0d0e0f", opc, sizeof(opc)); + osmo_hexparse("00000000000000000000000000000000", rand, sizeof(rand)); + milenage_f2345(opc, k, rand, NULL, NULL, NULL, ak, akstar); + printf("ak = %s\n", osmo_hexdump_nospc(ak, sizeof(ak))); + printf("akstar = %s\n", osmo_hexdump_nospc(akstar, sizeof(akstar))); + + uint8_t sqn_ms[6] = { 0, 0, 0, 0, 0, 31 }; + uint8_t amf[2] = {}; + uint8_t mac_s[8]; + milenage_f1(opc, k, rand, sqn_ms, amf, NULL, mac_s); + printf("mac_s = %s\n", osmo_hexdump_nospc(mac_s, sizeof(mac_s))); + /* verify valid AUTS resulting in SQN 31 with: + osmo-auc-gen -3 -a milenage -k 000102030405060708090a0b0c0d0e0f \ + -o 000102030405060708090a0b0c0d0e0f \ + -r 00000000000000000000000000000000 \ + -A 8711a0ec9e1637df17f80b384ee4 + */ +#endif + const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; -- To view, visit https://gerrit.osmocom.org/2051 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 02:22:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 02:22:07 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: enhance to verify new SQN increments In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2050 to look at the new patch set (#2). milenage_test: enhance to verify new SQN increments After the legacy mode incrementing with IND == 0 is through, do another AUTS run with sensible IND and i, and then two more normal vector generations to verify proper SQN increments. Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 30 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/2050/2 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index f24a9ef..8d29571 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -104,6 +104,33 @@ test_aud.u.umts.sqn); } + /* Now test SQN incrementing scheme using SEQ and IND parts: with + * IND == 5 and i == 10, the next SQN after 31 is 32 + 10 == 42. */ + test_aud.u.umts.ind = 5; + test_aud.u.umts.i = 10; + rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); + if (rc < 0) + printf("AUTS failed\n"); + else + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after that is 64 + 10 == 74 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after *that* is 96 + 10 == 106 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + opc_test(&test_aud); exit(0); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index b0eb44b..5a0a602 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -6,6 +6,9 @@ SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 AUTS success: tuple generated with SQN = 32 +AUTS success: tuple generated with SQN = 42 +tuple generated with SQN = 74 +tuple generated with SQN = 106 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Tue Mar 14 08:59:19 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 08:59:19 +0000 Subject: [MERGED] osmo-bts[master]: Handle ctrl cmd allocation failures In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Handle ctrl cmd allocation failures ...................................................................... Handle ctrl cmd allocation failures Check that ctrl command was successfully allocated before using it. Fixes: CID163884 Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 --- M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 1 file changed, 19 insertions(+), 18 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index 2a15d2e..f01fd14 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -190,21 +190,13 @@ struct ctrl_connection *ctrl, int critical, int warning) { - int new_state = next_state(manager->state, critical, warning), rc; + int new_state = next_state(manager->state, critical, warning); struct ctrl_cmd *rep; - bool send = false; + char *oml_alert = NULL; /* Nothing changed */ if (new_state < 0) return; - - rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); - if (!rep) { - LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed.\n"); - } else { - rep->id = talloc_asprintf(rep, "%d", rand()); - rep->variable = "oml-alert"; - } LOGP(DTEMP, LOGL_NOTICE, "Moving from state %s to %s.\n", get_value_string(state_names, manager->state), @@ -219,22 +211,31 @@ break; case STATE_WARNING: execute_warning_act(manager); - rep->value = "Temperature Warning"; - send = true; + oml_alert = "Temperature Warning"; break; case STATE_CRITICAL: execute_critical_act(manager); - rep->value = "Temperature Critical"; - send = true; + oml_alert = "Temperature Critical"; break; }; - if (send) { - rc = ctrl_cmd_send(&ctrl->write_queue, rep); - LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", rc); + if (!oml_alert) + return; + + rep = ctrl_cmd_create(tall_mgr_ctx, CTRL_TYPE_SET); + if (!rep) { + LOGP(DTEMP, LOGL_ERROR, "OML alert creation failed for %s.\n", + oml_alert); + return; } + + rep->id = talloc_asprintf(rep, "%d", rand()); + rep->variable = "oml-alert"; + rep->value = oml_alert; + LOGP(DTEMP, LOGL_ERROR, "OML alert sent: %d\n", + ctrl_cmd_send(&ctrl->write_queue, rep)); talloc_free(rep); -} +} static void temp_ctrl_check(struct ctrl_connection *ctrl) { -- To view, visit https://gerrit.osmocom.org/1991 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id19e1ce5fae6f936c9ed93f9a6317b57d28d7311 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 09:01:03 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 09:01:03 +0000 Subject: openbsc[master]: ipaccess-config: properly create swload In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2018 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e34a1348a290d3f58dd830d08da65b94b3270db Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From admin at opensuse.org Tue Mar 14 11:08:32 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 11:08:32 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58c7cf56eb2f1_6aa3efc107818a7@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/Debian_8.0/i586 Package network:osmocom:nightly/OsmoHLR failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 83s] #define STDC_HEADERS 1 [ 83s] #define HAVE_SYS_TYPES_H 1 [ 83s] #define HAVE_SYS_STAT_H 1 [ 83s] #define HAVE_STDLIB_H 1 [ 83s] #define HAVE_STRING_H 1 [ 83s] #define HAVE_MEMORY_H 1 [ 83s] #define HAVE_STRINGS_H 1 [ 83s] #define HAVE_INTTYPES_H 1 [ 83s] #define HAVE_STDINT_H 1 [ 83s] #define HAVE_UNISTD_H 1 [ 83s] #define HAVE_DLFCN_H 1 [ 83s] #define LT_OBJDIR ".libs/" [ 83s] #define PACKAGE "osmo-hlr" [ 83s] #define VERSION "UNKNOWN" [ 83s] [ 83s] configure: exit 1 [ 83s] dh_auto_configure: ./configure --build=i586-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libdir=${prefix}/lib/i386-linux-gnu --libexecdir=${prefix}/lib/i386-linux-gnu --disable-maintainer-mode --disable-dependency-tracking returned exit code 1 [ 83s] debian/rules:6: recipe for target 'build' failed [ 83s] make: *** [build] Error 255 [ 83s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 83s] [ 83s] build84 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:08:12 UTC 2017. [ 83s] [ 83s] ### VM INTERACTION START ### [ 84s] Powering off. [ 84s] ### VM INTERACTION END ### [ 84s] [ 84s] build84 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:08:14 UTC 2017. [ 84s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 11:08:49 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 11:08:49 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c7cf5a5d2c0_6aa3efc1078191d@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 93s] #define STDC_HEADERS 1 [ 93s] #define HAVE_SYS_TYPES_H 1 [ 93s] #define HAVE_SYS_STAT_H 1 [ 93s] #define HAVE_STDLIB_H 1 [ 93s] #define HAVE_STRING_H 1 [ 93s] #define HAVE_MEMORY_H 1 [ 93s] #define HAVE_STRINGS_H 1 [ 93s] #define HAVE_INTTYPES_H 1 [ 93s] #define HAVE_STDINT_H 1 [ 93s] #define HAVE_UNISTD_H 1 [ 93s] #define HAVE_DLFCN_H 1 [ 93s] #define LT_OBJDIR ".libs/" [ 93s] #define PACKAGE "osmo-hlr" [ 93s] #define VERSION "UNKNOWN" [ 93s] [ 93s] configure: exit 1 [ 93s] dh_auto_configure: ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking returned exit code 1 [ 93s] debian/rules:6: recipe for target 'build' failed [ 93s] make: *** [build] Error 2 [ 93s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 93s] [ 93s] build71 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:08:31 UTC 2017. [ 93s] [ 93s] ### VM INTERACTION START ### [ 96s] [ 84.568904] reboot: Power down [ 96s] ### VM INTERACTION END ### [ 96s] [ 96s] build71 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:08:35 UTC 2017. [ 96s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 11:09:57 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 11:09:57 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.04/x86_64 In-Reply-To: References: Message-ID: <58c7cfac137d3_6b63efc10756625@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.04/x86_64 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.04/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 171s] #define STDC_HEADERS 1 [ 171s] #define HAVE_SYS_TYPES_H 1 [ 171s] #define HAVE_SYS_STAT_H 1 [ 171s] #define HAVE_STDLIB_H 1 [ 171s] #define HAVE_STRING_H 1 [ 171s] #define HAVE_MEMORY_H 1 [ 171s] #define HAVE_STRINGS_H 1 [ 171s] #define HAVE_INTTYPES_H 1 [ 171s] #define HAVE_STDINT_H 1 [ 171s] #define HAVE_UNISTD_H 1 [ 171s] #define HAVE_DLFCN_H 1 [ 171s] #define LT_OBJDIR ".libs/" [ 171s] #define PACKAGE "osmo-hlr" [ 171s] #define VERSION "UNKNOWN" [ 171s] [ 171s] configure: exit 1 [ 171s] dh_auto_configure: ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking returned exit code 1 [ 171s] debian/rules:6: recipe for target 'build' failed [ 171s] make: *** [build] Error 255 [ 171s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 171s] [ 171s] build32 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:09:50 UTC 2017. [ 171s] [ 171s] ### VM INTERACTION START ### [ 173s] [ 155.382568] reboot: Power down [ 174s] ### VM INTERACTION END ### [ 174s] [ 174s] build32 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:09:54 UTC 2017. [ 174s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 11:10:14 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 11:10:14 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58c7cfae4c424_6b63efc10756844@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.04/i586 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 182s] #define STDC_HEADERS 1 [ 182s] #define HAVE_SYS_TYPES_H 1 [ 182s] #define HAVE_SYS_STAT_H 1 [ 182s] #define HAVE_STDLIB_H 1 [ 182s] #define HAVE_STRING_H 1 [ 182s] #define HAVE_MEMORY_H 1 [ 182s] #define HAVE_STRINGS_H 1 [ 182s] #define HAVE_INTTYPES_H 1 [ 182s] #define HAVE_STDINT_H 1 [ 182s] #define HAVE_UNISTD_H 1 [ 182s] #define HAVE_DLFCN_H 1 [ 182s] #define LT_OBJDIR ".libs/" [ 182s] #define PACKAGE "osmo-hlr" [ 182s] #define VERSION "UNKNOWN" [ 182s] [ 182s] configure: exit 1 [ 182s] dh_auto_configure: ./configure --build=i686-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/i386-linux-gnu --libexecdir=${prefix}/lib/i386-linux-gnu --disable-maintainer-mode --disable-dependency-tracking returned exit code 1 [ 182s] debian/rules:6: recipe for target 'build' failed [ 182s] make: *** [build] Error 255 [ 182s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 182s] [ 182s] cloud120 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:10:00 UTC 2017. [ 182s] [ 182s] ### VM INTERACTION START ### [ 185s] [ 154.643349] reboot: Power down [ 189s] ### VM INTERACTION END ### [ 189s] [ 189s] cloud120 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:10:07 UTC 2017. [ 189s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 11:09:57 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 11:09:57 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c7cfac59d8c_6b63efc107567e0@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.10/i586 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 177s] #define STDC_HEADERS 1 [ 177s] #define HAVE_SYS_TYPES_H 1 [ 177s] #define HAVE_SYS_STAT_H 1 [ 177s] #define HAVE_STDLIB_H 1 [ 177s] #define HAVE_STRING_H 1 [ 177s] #define HAVE_MEMORY_H 1 [ 177s] #define HAVE_STRINGS_H 1 [ 177s] #define HAVE_INTTYPES_H 1 [ 177s] #define HAVE_STDINT_H 1 [ 177s] #define HAVE_UNISTD_H 1 [ 177s] #define HAVE_DLFCN_H 1 [ 177s] #define LT_OBJDIR ".libs/" [ 177s] #define PACKAGE "osmo-hlr" [ 177s] #define VERSION "UNKNOWN" [ 177s] [ 177s] configure: exit 1 [ 177s] dh_auto_configure: ./configure --build=i686-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/i386-linux-gnu --libexecdir=${prefix}/lib/i386-linux-gnu --disable-maintainer-mode --disable-dependency-tracking returned exit code 1 [ 177s] debian/rules:6: recipe for target 'build' failed [ 177s] make: *** [build] Error 2 [ 177s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 177s] [ 177s] lamb23 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:09:51 UTC 2017. [ 177s] [ 177s] ### VM INTERACTION START ### [ 179s] [ 166.013607] reboot: Power down [ 180s] ### VM INTERACTION END ### [ 180s] [ 180s] lamb23 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:09:56 UTC 2017. [ 180s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 11:10:49 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 11:10:49 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in Debian_8.0/x86_64 In-Reply-To: References: Message-ID: <58c7cfca549c5_6b63efc107570dd@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/Debian_8.0/x86_64 Package network:osmocom:nightly/OsmoHLR failed to build in Debian_8.0/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 193s] #define HAVE_SYS_TYPES_H 1 [ 193s] #define HAVE_SYS_STAT_H 1 [ 193s] #define HAVE_STDLIB_H 1 [ 193s] #define HAVE_STRING_H 1 [ 193s] #define HAVE_MEMORY_H 1 [ 193s] #define HAVE_STRINGS_H 1 [ 193s] #define HAVE_INTTYPES_H 1 [ 193s] #define HAVE_STDINT_H 1 [ 193s] #define HAVE_UNISTD_H 1 [ 193s] #define HAVE_DLFCN_H 1 [ 193s] #define LT_OBJDIR ".libs/" [ 193s] #define PACKAGE "osmo-hlr" [ 193s] #define VERSION "UNKNOWN" [ 193s] [ 193s] configure: exit 1 [ 193s] dh_auto_configure: ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking returned exit code 1 [ 193s] debian/rules:6: recipe for target 'build' failed [ 193s] make: *** [build] Error 255 [ 193s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 193s] [ 193s] cloud114 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:10:30 UTC 2017. [ 193s] [ 193s] ### VM INTERACTION START ### [ 195s] Powering off. [ 195s] [ 150.886669] reboot: Power down [ 196s] ### VM INTERACTION END ### [ 197s] [ 197s] cloud114 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 11:10:34 UTC 2017. [ 197s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Tue Mar 14 11:23:38 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 11:23:38 +0000 Subject: [MERGED] openbsc[master]: python tests: vty and smpp: speed up >10 times In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: python tests: vty and smpp: speed up >10 times ...................................................................... python tests: vty and smpp: speed up >10 times osmo-python-tests now includes code that retries connecting the VTY socket and needs no external sleep()ing. This flies through most tests without any sleep() at all. See osmo-python-tests.git change-id Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39 Change-Id: I42161d9716fe5bb0ef1c56e4bfb770bb99bbca7a --- M openbsc/tests/smpp_test_runner.py M openbsc/tests/vty_test_runner.py 2 files changed, 0 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/smpp_test_runner.py b/openbsc/tests/smpp_test_runner.py index 4527ac4..06fb766 100644 --- a/openbsc/tests/smpp_test_runner.py +++ b/openbsc/tests/smpp_test_runner.py @@ -47,7 +47,6 @@ except OSError: print >> sys.stderr, "Current directory: %s" % os.getcwd() print >> sys.stderr, "Consider setting -b" - time.sleep(1) appstring = self.vty_app()[2] appport = self.vty_app()[0] diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 3f4909c..87b9eba 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -49,7 +49,6 @@ except OSError: print >> sys.stderr, "Current directory: %s" % os.getcwd() print >> sys.stderr, "Consider setting -b" - time.sleep(1) appstring = self.vty_app()[2] appport = self.vty_app()[0] -- To view, visit https://gerrit.osmocom.org/1927 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I42161d9716fe5bb0ef1c56e4bfb770bb99bbca7a Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 11:51:09 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 11:51:09 +0000 Subject: [PATCH] osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker Message-ID: Review at https://gerrit.osmocom.org/2052 cosmetic: add/tweak log output, add vim indenting marker While testing the sysmoUSIM, I found that I wanted to see errors more prominently and some output for cases that lacked any response at all. Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 --- M card/USIM.py 1 file changed, 13 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sim-auth refs/changes/52/2052/1 diff --git a/card/USIM.py b/card/USIM.py index d8cbb85..a5adc5b 100644 --- a/card/USIM.py +++ b/card/USIM.py @@ -242,8 +242,7 @@ # prepare input data for authentication if ctx in ('3G', 'VGCS', 'GBA', 'MBMS') and len(RAND) != 16 \ and len(AUTN) != 16: - if self.dbg: - print '[WNG] authenticate: bad parameters' + print '[ERR] missing parameters or wrong length' return None inp = [] @@ -265,8 +264,7 @@ # to avoid desynchronizing our USIM counter P2 = 0x80 if len(RAND) != 16: - if self.dbg: - print '[WNG] bad parameters' + print '[ERR] RAND has wrong length (%d, should be 16)' % len(RAND) return None # override input value for 2G authent inp = [len(RAND)] + RAND @@ -284,11 +282,14 @@ return values # not adapted to 2G context with Kc, RES: to be confirmed... if val[0] == 0xDB: - if P2 == 0x81 and self.dbg: - print '[+] Successful 3G authentication. ' \ - 'Get [RES, CK, IK(, Kc)]' - elif P2 == 0x84 and self.dbg: - print '[+] Successful GBA authentication. Get [RES]' + if self.dbg: + if P2 == 0x81: + print '[+] Successful 3G authentication. ' \ + 'Get [RES, CK, IK(, Kc)]' + elif P2 == 0x84: + print '[+] Successful GBA authentication. Get [RES]' + else: + print '[+] response: %s' % hex(val) values = LV_parser(val[1:]) # returned values can be (RES, CK, IK) or (RES, CK, IK, Kc) return values @@ -297,6 +298,8 @@ print '[+] Synchronization failure. Get [AUTS]' values = LV_parser(val[1:]) return values + elif self.dbg: + print '[+] response: %s' % hex(val) #else: if self.dbg: print '[+] authentication error: %s' % self.coms() @@ -398,5 +401,5 @@ #bf from MF, and recursively under each DF #bf from each AID and recursively under each DF in AID pass - +# vim: tabstop=4 shiftwidth=4 expandtab -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 12:05:06 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 12:05:06 +0000 Subject: [PATCH] openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2031 to look at the new patch set (#3). gsm_data_shared: add value strings for gsm_chreq Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data_shared.c 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/31/2031/3 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index e697cb8..9e51568 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -841,7 +841,7 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); - +const struct value_string gsm_chreq_descs[7]; const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; const char *gsm_pchan_name(enum gsm_phys_chan_config c); diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..5a524a3 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,16 @@ gsm_abis_mo_reset(mo); } +const struct value_string gsm_chreq_descs[] = { + { GSM_CHREQ_REASON_EMERG, "emergency call" }, + { GSM_CHREQ_REASON_PAG, "answer to paging" }, + { GSM_CHREQ_REASON_CALL, "call re-establishment" }, + { GSM_CHREQ_REASON_LOCATION_UPD,"Location updating" }, + { GSM_CHREQ_REASON_PDCH, "one phase packet access" }, + { GSM_CHREQ_REASON_OTHER, "other" }, + { 0, NULL } +}; + const struct value_string gsm_pchant_names[13] = { { GSM_PCHAN_NONE, "NONE" }, { GSM_PCHAN_CCCH, "CCCH" }, -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 12:39:28 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 12:39:28 +0000 Subject: [PATCH] libosmocore[master]: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ... In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1361 to look at the new patch set (#6). gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASE The previous version of this commit got reverted to avoid a breakage in openbsc. The problem is openbsc use an array of chreq_type with a manual defined size. This array is using enums as index which breaks if any elements got added into the middle, because the size of the array can't hold elements greater or equal than the size. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/1361/6 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index da17755..f395b85 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1464,6 +1464,8 @@ CHREQ_T_LMU, CHREQ_T_RESERVED_SDCCH, CHREQ_T_RESERVED_IGNORE, + CHREQ_T_PDCH_ONE_PHASE, + CHREQ_T_PDCH_TWO_PHASE, }; /* Chapter 11.3 */ -- To view, visit https://gerrit.osmocom.org/1361 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 12:47:49 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 12:47:49 +0000 Subject: [PATCH] libosmocore[master]: gsm_04_08: add _NUM_CHREQ_T to enum Message-ID: Review at https://gerrit.osmocom.org/2053 gsm_04_08: add _NUM_CHREQ_T to enum _NUM_CHREQ_T defines the last element of the enum Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134 --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/53/2053/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index f395b85..522015a 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1466,6 +1466,7 @@ CHREQ_T_RESERVED_IGNORE, CHREQ_T_PDCH_ONE_PHASE, CHREQ_T_PDCH_TWO_PHASE, + _NUM_CHREQ_T, }; /* Chapter 11.3 */ -- To view, visit https://gerrit.osmocom.org/2053 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 12:55:31 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 12:55:31 +0000 Subject: [PATCH] openbsc[master]: openbsc: use _NUM_CHREQ_T to define the size of ctype_by_chreq Message-ID: Review at https://gerrit.osmocom.org/2054 openbsc: use _NUM_CHREQ_T to define the size of ctype_by_chreq Make it future compatible for changes. Otherwise it will break when additional enums are adding to chreq in libosmocore. Change-Id: I2acab2af8d67bccb2bc495512c1f259ae649a832 --- M openbsc/include/openbsc/gsm_data.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/54/2054/1 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a36083a..01e9363 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -360,7 +360,7 @@ enum rrlp_mode mode; } rrlp; - enum gsm_chan_t ctype_by_chreq[16]; + enum gsm_chan_t ctype_by_chreq[_NUM_CHREQ_T]; /* Use a TCH for handling requests of type paging any */ int pag_any_tch; -- To view, visit https://gerrit.osmocom.org/2054 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2acab2af8d67bccb2bc495512c1f259ae649a832 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 12:55:59 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 12:55:59 +0000 Subject: openbsc[master]: openbsc: use _NUM_CHREQ_T to define the size of ctype_by_chreq In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 needs to wait for https://gerrit.osmocom.org/#/c/2053/ -- To view, visit https://gerrit.osmocom.org/2054 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2acab2af8d67bccb2bc495512c1f259ae649a832 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:23:16 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 13:23:16 +0000 Subject: [PATCH] openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1360 to look at the new patch set (#7). libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_PDCH_TWO_PHASE When using a BSC located PCU the BSC must understand PDCH requests. Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a --- M openbsc/include/openbsc/gsm_data.h M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/gsm_04_08_utils.c 3 files changed, 16 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/60/1360/7 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a36083a..e9ba173 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -360,7 +360,7 @@ enum rrlp_mode mode; } rrlp; - enum gsm_chan_t ctype_by_chreq[16]; + enum gsm_chan_t ctype_by_chreq[18]; /* Use a TCH for handling requests of type paging any */ int pag_any_tch; diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 7c469ee..e697cb8 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -46,6 +46,7 @@ GSM_CHREQ_REASON_CALL, GSM_CHREQ_REASON_LOCATION_UPD, GSM_CHREQ_REASON_OTHER, + GSM_CHREQ_REASON_PDCH, }; /* lchans 0..3 are SDCCH in combined channel configuration, diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 4a53b31..db9dabb 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -75,7 +75,11 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x70, 0xf8, CHREQ_T_PDCH_TWO_PHASE }, + { 0x78, 0xfc, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xfa, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xf9, CHREQ_T_PDCH_ONE_PHASE }, { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; @@ -92,7 +96,11 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x70, 0xf8, CHREQ_T_PDCH_TWO_PHASE }, + { 0x78, 0xfc, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xfa, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xf9, CHREQ_T_PDCH_ONE_PHASE }, { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; @@ -112,6 +120,8 @@ [CHREQ_T_PAG_R_TCH_FH] = GSM_LCHAN_TCH_F, [CHREQ_T_LMU] = GSM_LCHAN_SDCCH, [CHREQ_T_RESERVED_SDCCH] = GSM_LCHAN_SDCCH, + [CHREQ_T_PDCH_ONE_PHASE] = GSM_LCHAN_PDTCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_LCHAN_PDTCH, [CHREQ_T_RESERVED_IGNORE] = GSM_LCHAN_UNKNOWN, }; @@ -130,6 +140,8 @@ [CHREQ_T_PAG_R_TCH_F] = GSM_CHREQ_REASON_PAG, [CHREQ_T_PAG_R_TCH_FH] = GSM_CHREQ_REASON_PAG, [CHREQ_T_LMU] = GSM_CHREQ_REASON_OTHER, + [CHREQ_T_PDCH_ONE_PHASE] = GSM_CHREQ_REASON_PDCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_CHREQ_REASON_PDCH, [CHREQ_T_RESERVED_SDCCH] = GSM_CHREQ_REASON_OTHER, [CHREQ_T_RESERVED_IGNORE] = GSM_CHREQ_REASON_OTHER, }; -- To view, visit https://gerrit.osmocom.org/1360 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a Gerrit-PatchSet: 7 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From admin at opensuse.org Tue Mar 14 13:23:41 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 13:23:41 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c7eefdde1b4_6b63efc10806192@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 53s] /usr/bin/env: 'python3': No such file or directory [ 53s] Makefile:787: recipe for target 'auc_ts_55_205_test_sets.c' failed [ 53s] make[5]: *** [auc_ts_55_205_test_sets.c] Error 127 [ 53s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 53s] Makefile:513: recipe for target 'all-recursive' failed [ 53s] make[4]: *** [all-recursive] Error 1 [ 53s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 53s] Makefile:381: recipe for target 'all-recursive' failed [ 53s] make[3]: *** [all-recursive] Error 1 [ 53s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 53s] Makefile:405: recipe for target 'all-recursive' failed [ 53s] make[2]: *** [all-recursive] Error 1 [ 53s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 53s] Makefile:352: recipe for target 'all' failed [ 53s] make[1]: *** [all] Error 2 [ 53s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 53s] dh_auto_build: make -j1 returned exit code 2 [ 53s] debian/rules:7: recipe for target 'build' failed [ 53s] make: *** [build] Error 2 [ 53s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 53s] [ 53s] build72 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:34 UTC 2017. [ 53s] [ 53s] ### VM INTERACTION START ### [ 56s] [ 45.596214] reboot: Power down [ 56s] ### VM INTERACTION END ### [ 56s] [ 56s] build72 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:37 UTC 2017. [ 56s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 13:23:58 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 13:23:58 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58c7ef02252f1_6b63efc108067f4@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/Debian_8.0/i586 Package network:osmocom:nightly/OsmoHLR failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 93s] Makefile:774: recipe for target 'auc_ts_55_205_test_sets.c' failed [ 93s] make[5]: *** [auc_ts_55_205_test_sets.c] Error 127 [ 93s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 93s] Makefile:502: recipe for target 'all-recursive' failed [ 93s] make[4]: *** [all-recursive] Error 1 [ 93s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 93s] Makefile:369: recipe for target 'all-recursive' failed [ 93s] make[3]: *** [all-recursive] Error 1 [ 93s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 93s] Makefile:393: recipe for target 'all-recursive' failed [ 93s] make[2]: *** [all-recursive] Error 1 [ 93s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 93s] Makefile:339: recipe for target 'all' failed [ 93s] make[1]: *** [all] Error 2 [ 93s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 93s] dh_auto_build: make -j1 returned exit code 2 [ 93s] debian/rules:7: recipe for target 'build' failed [ 93s] make: *** [build] Error 2 [ 93s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 93s] [ 94s] lamb51 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:50 UTC 2017. [ 94s] [ 94s] ### VM INTERACTION START ### [ 95s] Powering off. [ 95s] [ 81.314188] reboot: Power down [ 95s] ### VM INTERACTION END ### [ 95s] [ 95s] lamb51 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:52 UTC 2017. [ 95s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 13:23:58 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 13:23:58 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c7eeff97c91_6b63efc108063de@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.10/i586 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 84s] /usr/bin/env: 'python3': No such file or directory [ 84s] Makefile:787: recipe for target 'auc_ts_55_205_test_sets.c' failed [ 84s] make[5]: *** [auc_ts_55_205_test_sets.c] Error 127 [ 84s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 84s] Makefile:513: recipe for target 'all-recursive' failed [ 84s] make[4]: *** [all-recursive] Error 1 [ 84s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 84s] Makefile:381: recipe for target 'all-recursive' failed [ 84s] make[3]: *** [all-recursive] Error 1 [ 84s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 84s] Makefile:405: recipe for target 'all-recursive' failed [ 84s] make[2]: *** [all-recursive] Error 1 [ 84s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 84s] Makefile:352: recipe for target 'all' failed [ 84s] make[1]: *** [all] Error 2 [ 84s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 84s] dh_auto_build: make -j1 returned exit code 2 [ 84s] debian/rules:7: recipe for target 'build' failed [ 84s] make: *** [build] Error 2 [ 84s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 84s] [ 84s] lamb02 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:39 UTC 2017. [ 84s] [ 84s] ### VM INTERACTION START ### [ 87s] [ 74.888134] reboot: Power down [ 87s] ### VM INTERACTION END ### [ 87s] [ 87s] lamb02 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:42 UTC 2017. [ 87s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 13:23:41 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 13:23:41 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in Debian_8.0/x86_64 In-Reply-To: References: Message-ID: <58c7eeff3ed94_6b63efc108062b7@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/Debian_8.0/x86_64 Package network:osmocom:nightly/OsmoHLR failed to build in Debian_8.0/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 66s] Makefile:774: recipe for target 'auc_ts_55_205_test_sets.c' failed [ 66s] make[5]: *** [auc_ts_55_205_test_sets.c] Error 127 [ 66s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 66s] Makefile:502: recipe for target 'all-recursive' failed [ 66s] make[4]: *** [all-recursive] Error 1 [ 66s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 66s] Makefile:369: recipe for target 'all-recursive' failed [ 66s] make[3]: *** [all-recursive] Error 1 [ 66s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 66s] Makefile:393: recipe for target 'all-recursive' failed [ 66s] make[2]: *** [all-recursive] Error 1 [ 66s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 66s] Makefile:339: recipe for target 'all' failed [ 66s] make[1]: *** [all] Error 2 [ 66s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 66s] dh_auto_build: make -j1 returned exit code 2 [ 66s] debian/rules:7: recipe for target 'build' failed [ 66s] make: *** [build] Error 2 [ 66s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 66s] [ 66s] build72 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:35 UTC 2017. [ 66s] [ 66s] ### VM INTERACTION START ### [ 67s] Powering off. [ 67s] [ 53.031583] reboot: Power down [ 67s] ### VM INTERACTION END ### [ 67s] [ 67s] build72 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:37 UTC 2017. [ 67s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:24:21 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 13:24:21 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/2031/3/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 844: const struct value_string gsm_chreq_descs[7]; is it here ok with the number? or sould we use "const struct value_string *gsm_chreq_descs" instead? -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From admin at opensuse.org Tue Mar 14 13:24:15 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 13:24:15 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58c7ef301b173_6aa3efc108332ec@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.04/i586 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 99s] /usr/bin/env: 'python3': No such file or directory [ 99s] Makefile:787: recipe for target 'auc_ts_55_205_test_sets.c' failed [ 99s] make[5]: *** [auc_ts_55_205_test_sets.c] Error 127 [ 99s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 99s] Makefile:513: recipe for target 'all-recursive' failed [ 99s] make[4]: *** [all-recursive] Error 1 [ 99s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 99s] Makefile:381: recipe for target 'all-recursive' failed [ 99s] make[3]: *** [all-recursive] Error 1 [ 99s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 99s] Makefile:405: recipe for target 'all-recursive' failed [ 99s] make[2]: *** [all-recursive] Error 1 [ 99s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 99s] Makefile:352: recipe for target 'all' failed [ 99s] make[1]: *** [all] Error 2 [ 99s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 99s] dh_auto_build: make -j1 returned exit code 2 [ 99s] debian/rules:7: recipe for target 'build' failed [ 99s] make: *** [build] Error 2 [ 99s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 99s] [ 99s] lamb06 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:23:56 UTC 2017. [ 99s] [ 99s] ### VM INTERACTION START ### [ 103s] [ 90.843630] reboot: Power down [ 103s] ### VM INTERACTION END ### [ 103s] [ 103s] lamb06 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:24:00 UTC 2017. [ 103s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Tue Mar 14 13:24:32 2017 From: admin at opensuse.org (OBS Notification) Date: Tue, 14 Mar 2017 13:24:32 +0000 Subject: Build failure of network:osmocom:nightly/OsmoHLR in xUbuntu_16.04/x86_64 In-Reply-To: References: Message-ID: <58c7ef33b8cfa_6aa3efc10833699@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/OsmoHLR/xUbuntu_16.04/x86_64 Package network:osmocom:nightly/OsmoHLR failed to build in xUbuntu_16.04/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly OsmoHLR Last lines of build log: [ 108s] /usr/bin/env: 'python3': No such file or directory [ 108s] Makefile:787: recipe for target 'auc_ts_55_205_test_sets.c' failed [ 108s] make[5]: *** [auc_ts_55_205_test_sets.c] Error 127 [ 108s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 108s] Makefile:513: recipe for target 'all-recursive' failed [ 108s] make[4]: *** [all-recursive] Error 1 [ 108s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests/auc' [ 108s] Makefile:381: recipe for target 'all-recursive' failed [ 108s] make[3]: *** [all-recursive] Error 1 [ 108s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 108s] Makefile:405: recipe for target 'all-recursive' failed [ 108s] make[2]: *** [all-recursive] Error 1 [ 108s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 108s] Makefile:352: recipe for target 'all' failed [ 108s] make[1]: *** [all] Error 2 [ 108s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 108s] dh_auto_build: make -j1 returned exit code 2 [ 108s] debian/rules:7: recipe for target 'build' failed [ 108s] make: *** [build] Error 2 [ 108s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 108s] [ 108s] lamb22 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:24:13 UTC 2017. [ 108s] [ 108s] ### VM INTERACTION START ### [ 111s] [ 97.675319] reboot: Power down [ 111s] ### VM INTERACTION END ### [ 111s] [ 111s] lamb22 failed "build osmo-hlr_0.0.1.dsc" at Tue Mar 14 13:24:16 UTC 2017. [ 111s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:32:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:32:14 +0000 Subject: libosmocore[master]: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ... In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1361 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:32:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:32:16 +0000 Subject: [MERGED] libosmocore[master]: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASE ...................................................................... gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASE The previous version of this commit got reverted to avoid a breakage in openbsc. The problem is openbsc use an array of chreq_type with a manual defined size. This array is using enums as index which breaks if any elements got added into the middle, because the size of the array can't hold elements greater or equal than the size. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index da17755..f395b85 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1464,6 +1464,8 @@ CHREQ_T_LMU, CHREQ_T_RESERVED_SDCCH, CHREQ_T_RESERVED_IGNORE, + CHREQ_T_PDCH_ONE_PHASE, + CHREQ_T_PDCH_TWO_PHASE, }; /* Chapter 11.3 */ -- To view, visit https://gerrit.osmocom.org/1361 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:32:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:32:20 +0000 Subject: libosmocore[master]: gsm_04_08: add _NUM_CHREQ_T to enum In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2053 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:32:21 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:32:21 +0000 Subject: [MERGED] libosmocore[master]: gsm_04_08: add _NUM_CHREQ_T to enum In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm_04_08: add _NUM_CHREQ_T to enum ...................................................................... gsm_04_08: add _NUM_CHREQ_T to enum _NUM_CHREQ_T defines the last element of the enum Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134 --- M include/osmocom/gsm/protocol/gsm_04_08.h 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index f395b85..522015a 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1466,6 +1466,7 @@ CHREQ_T_RESERVED_IGNORE, CHREQ_T_PDCH_ONE_PHASE, CHREQ_T_PDCH_TWO_PHASE, + _NUM_CHREQ_T, }; /* Chapter 11.3 */ -- To view, visit https://gerrit.osmocom.org/2053 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:33:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:33:13 +0000 Subject: openbsc[master]: openbsc: use _NUM_CHREQ_T to define the size of ctype_by_chreq In-Reply-To: References: Message-ID: Patch Set 2: weould be great to mention that this requires a certain (and which) Change-Id in libosmocore -- To view, visit https://gerrit.osmocom.org/2054 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2acab2af8d67bccb2bc495512c1f259ae649a832 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:34:07 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:34:07 +0000 Subject: openbsc[master]: gprs_sgsn.c: initialize ptmsi with 0xdeadbeef In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1749 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibc2d585c5db899e6af20104211e32faf3822633a Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:34:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:34:11 +0000 Subject: [MERGED] openbsc[master]: gprs_sgsn.c: initialize ptmsi with 0xdeadbeef In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gprs_sgsn.c: initialize ptmsi with 0xdeadbeef ...................................................................... gprs_sgsn.c: initialize ptmsi with 0xdeadbeef Fix uninitialized memory access warning. "Conditional jump or move depends on uninitialised value" Found by valgrind. Change-Id: Ibc2d585c5db899e6af20104211e32faf3822633a --- M openbsc/src/gprs/gprs_sgsn.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 727524e..5d9af78 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -611,7 +611,7 @@ uint32_t sgsn_alloc_ptmsi(void) { struct sgsn_mm_ctx *mm; - uint32_t ptmsi; + uint32_t ptmsi = 0xdeadbeef; int max_retries = 100; restart: -- To view, visit https://gerrit.osmocom.org/1749 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibc2d585c5db899e6af20104211e32faf3822633a Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:34:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:34:47 +0000 Subject: libosmocore[master]: milenage_test: cosmetic fix: shown value is not SEQ.MS In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2047 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:35:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:35:16 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:36:15 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 13:36:15 +0000 Subject: [PATCH] osmo-hlr[master]: deb: fix OBS build Message-ID: Review at https://gerrit.osmocom.org/2055 deb: fix OBS build Add explicit dependency on python3 which is necessary for 'make check' stage. While at it, add DH_VERBOSE option for debian/control to facilitate future troubleshooting. Change-Id: I0ed0bb0f889d4569c9229f3f12ad8bdb11cc1e7c Related: OS#1948 --- M debian/control M debian/rules 2 files changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/55/2055/1 diff --git a/debian/control b/debian/control index de7c5e5..766d015 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ dh-systemd (>= 1.5), autotools-dev, pkg-config, + python3, libosmocore-dev, libosmo-abis-dev, libosmo-netif-dev, diff --git a/debian/rules b/debian/rules index 8797d5a..d0ad702 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,6 @@ #!/usr/bin/make -f +#export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: -- To view, visit https://gerrit.osmocom.org/2055 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0ed0bb0f889d4569c9229f3f12ad8bdb11cc1e7c Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:37:31 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:37:31 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN increment In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2049/1/include/osmocom/crypt/auth.h File include/osmocom/crypt/auth.h: Line 42: unsigned int ind; /*!< nr of bits not in SEQ, only SQN */ I think ind and i are not very clearly separated and could easily be mistaken. Let's use num_ind_bits or ind_bit_width or ind_size or whatever you think is fit to cearly INDicate, we are talking about a size in bits, not just in the comments. -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:37:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:37:44 +0000 Subject: libosmocore[master]: milenage_test: enhance to verify new SQN increments In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:38:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:38:02 +0000 Subject: libosmocore[master]: milenage_test: cosmetic: verify AUTS in comments In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2051 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:38:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 13:38:22 +0000 Subject: osmo-hlr[master]: deb: fix OBS build In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2055 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0ed0bb0f889d4569c9229f3f12ad8bdb11cc1e7c Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 13:41:08 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 13:41:08 +0000 Subject: [MERGED] osmo-hlr[master]: deb: fix OBS build In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: deb: fix OBS build ...................................................................... deb: fix OBS build Add explicit dependency on python3 which is necessary for 'make check' stage. While at it, add DH_VERBOSE option for debian/control to facilitate future troubleshooting. Change-Id: I0ed0bb0f889d4569c9229f3f12ad8bdb11cc1e7c Related: OS#1948 --- M debian/control M debian/rules 2 files changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/control b/debian/control index de7c5e5..766d015 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ dh-systemd (>= 1.5), autotools-dev, pkg-config, + python3, libosmocore-dev, libosmo-abis-dev, libosmo-netif-dev, diff --git a/debian/rules b/debian/rules index 8797d5a..d0ad702 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,6 @@ #!/usr/bin/make -f +#export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: -- To view, visit https://gerrit.osmocom.org/2055 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0ed0bb0f889d4569c9229f3f12ad8bdb11cc1e7c Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:17:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 14:17:41 +0000 Subject: osmo-bts[master]: Check for suitable lchan type when detecting HO In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1960 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:17:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 14 Mar 2017 14:17:44 +0000 Subject: [MERGED] osmo-bts[master]: Check for suitable lchan type when detecting HO In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Check for suitable lchan type when detecting HO ...................................................................... Check for suitable lchan type when detecting HO Log error when handover RACH is detected on wrong channel: according to 3GPP TS 44.018 it can only be seen on SACCH and DCCH. Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Related: OS#1898 --- M src/common/handover.c M tests/handover/handover_test.c 2 files changed, 12 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/handover.c b/src/common/handover.c index 03433ea..45ed040 100644 --- a/src/common/handover.c +++ b/src/common/handover.c @@ -106,9 +106,17 @@ return; } + /* Ignore handover on channels other than DCCH and SACCH */ + if (lchan->type != GSM_LCHAN_SDCCH && lchan->type != GSM_LCHAN_TCH_H && + lchan->type != GSM_LCHAN_TCH_F) { + LOGP(DHO, LOGL_ERROR, "%s handover RACH received on %s?!\n", + gsm_lchan_name(lchan), gsm_lchant_name(lchan->type)); + return; + } + LOGP(DHO, LOGL_NOTICE, - "%s RACH on dedicated channel received with TA=%u\n", - gsm_lchan_name(lchan), acc_delay); + "%s RACH on dedicated channel type %s received with TA=%u, ref=%u\n", + gsm_lchan_name(lchan), gsm_lchant_name(lchan->type), acc_delay, ra); /* Set timing advance */ lchan->rqd_ta = acc_delay; diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index a7a66d0..611c441 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -103,8 +103,10 @@ /* create two lchans for handover */ lchan = &trx->ts[1].lchan[0]; + lchan->type = GSM_LCHAN_SDCCH; l1sap_chan_act(lchan->ts->trx, 0x09, NULL); lchan = &trx->ts[2].lchan[0]; + lchan->type = GSM_LCHAN_TCH_F; lchan->ho.active = HANDOVER_ENABLED; lchan->ho.ref = 23; l1sap_chan_act(lchan->ts->trx, 0x0a, NULL); -- To view, visit https://gerrit.osmocom.org/1960 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:34 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:34 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: add basic pcu interface support Message-ID: Review at https://gerrit.osmocom.org/2056 pcu_sock: add basic pcu interface support Adds a basic version of a pcu socket interface, similar to the one that can be found in osmo-bts. Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2 --- M openbsc/include/openbsc/Makefile.am M openbsc/include/openbsc/debug.h M openbsc/include/openbsc/gsm_data_shared.h A openbsc/include/openbsc/pcu_if.h A openbsc/include/openbsc/pcuif_proto.h M openbsc/src/libbsc/Makefile.am M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libbsc/bsc_init.c A openbsc/src/libbsc/pcu_sock.c M openbsc/src/libcommon/debug.c 10 files changed, 929 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/56/2056/1 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 7ddf323..3de974d 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -65,6 +65,8 @@ bsc_msc_data.h \ osmux.h \ paging.h \ + pcu_if.h \ + pcuif_proto.h \ rest_octets.h \ rrlp.h \ rs232.h \ diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 74db723..8a4247b 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -37,6 +37,7 @@ DRANAP, DSUA, DV42BIS, + DPCU, Debug_LastEntry, }; diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index acc5494..8b31dc1 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -830,6 +830,9 @@ struct amr_multirate_conf mr_full; struct amr_multirate_conf mr_half; + /* PCU socket state */ + struct pcu_sock_state *pcu_state; + #endif /* ROLE_BSC */ void *role; }; diff --git a/openbsc/include/openbsc/pcu_if.h b/openbsc/include/openbsc/pcu_if.h new file mode 100644 index 0000000..68d4174 --- /dev/null +++ b/openbsc/include/openbsc/pcu_if.h @@ -0,0 +1,33 @@ +#ifndef _PCU_IF_H +#define _PCU_IF_H + +#define PCU_SOCK_DEFAULT "/tmp/pcu_bts" + +#include + +extern int pcu_direct; + +struct pcu_sock_state { + struct gsm_network *net; + struct osmo_fd listen_bfd; /* fd for listen socket */ + struct osmo_fd conn_bfd; /* fd for connection to lcr */ + struct llist_head upqueue; /* queue for sending messages */ +}; + +/* PCU relevant information has changed; Inform PCU (if connected) */ +void pcu_info_update(struct gsm_bts *bts); + +/* Forward rach indication to PCU */ +int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn, + uint8_t is_11bit, enum ph_burst_type burst_type); + +/* Confirm the sending of an immediate assignment to the pcu */ +int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli); + +/* Open connection to PCU */ +int pcu_sock_init(const char *path, struct gsm_bts *bts); + +/* Close connection to PCU */ +void pcu_sock_exit(struct gsm_bts *bts); + +#endif /* _PCU_IF_H */ diff --git a/openbsc/include/openbsc/pcuif_proto.h b/openbsc/include/openbsc/pcuif_proto.h new file mode 100644 index 0000000..a52d896 --- /dev/null +++ b/openbsc/include/openbsc/pcuif_proto.h @@ -0,0 +1,158 @@ +#ifndef _PCUIF_PROTO_H +#define _PCUIF_PROTO_H + +#define PCU_IF_VERSION 0x07 + +/* msg_type */ +#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ +#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */ +#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */ +#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */ +#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */ +#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */ +#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ +#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ +#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ + +/* sapi */ +#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ +#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */ +#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */ +#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */ +#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */ +#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */ +#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */ + +/* flags */ +#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */ +#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */ +#define PCU_IF_FLAG_CS1 (1 << 16) +#define PCU_IF_FLAG_CS2 (1 << 17) +#define PCU_IF_FLAG_CS3 (1 << 18) +#define PCU_IF_FLAG_CS4 (1 << 19) +#define PCU_IF_FLAG_MCS1 (1 << 20) +#define PCU_IF_FLAG_MCS2 (1 << 21) +#define PCU_IF_FLAG_MCS3 (1 << 22) +#define PCU_IF_FLAG_MCS4 (1 << 23) +#define PCU_IF_FLAG_MCS5 (1 << 24) +#define PCU_IF_FLAG_MCS6 (1 << 25) +#define PCU_IF_FLAG_MCS7 (1 << 26) +#define PCU_IF_FLAG_MCS8 (1 << 27) +#define PCU_IF_FLAG_MCS9 (1 << 28) + +struct gsm_pcu_if_data { + uint8_t sapi; + uint8_t len; + uint8_t data[162]; + uint32_t fn; + uint16_t arfcn; + uint8_t trx_nr; + uint8_t ts_nr; + uint8_t block_nr; + int8_t rssi; + uint16_t ber10k; /*!< \brief BER in units of 0.01% */ + int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ + int16_t lqual_cb; /* !< \brief Link quality in centiBel */ +} __attribute__ ((packed)); + +struct gsm_pcu_if_rts_req { + uint8_t sapi; + uint8_t spare[3]; + uint32_t fn; + uint16_t arfcn; + uint8_t trx_nr; + uint8_t ts_nr; + uint8_t block_nr; +} __attribute__ ((packed)); + +struct gsm_pcu_if_rach_ind { + uint8_t sapi; + uint16_t ra; + int16_t qta; + uint32_t fn; + uint16_t arfcn; + uint8_t is_11bit; + uint8_t burst_type; +} __attribute__ ((packed)); + +struct gsm_pcu_if_info_trx { + uint16_t arfcn; + uint8_t pdch_mask; /* PDCH channels per TS */ + uint8_t spare; + uint8_t tsc[8]; /* TSC per channel */ + uint32_t hlayer1; +} __attribute__ ((packed)); + +struct gsm_pcu_if_info_ind { + uint32_t version; + uint32_t flags; + struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */ + uint8_t bsic; + /* RAI */ + uint16_t mcc, mnc, lac, rac; + /* NSE */ + uint16_t nsei; + uint8_t nse_timer[7]; + uint8_t cell_timer[11]; + /* cell */ + uint16_t cell_id; + uint16_t repeat_time; + uint8_t repeat_count; + uint16_t bvci; + uint8_t t3142; + uint8_t t3169; + uint8_t t3191; + uint8_t t3193_10ms; + uint8_t t3195; + uint8_t n3101; + uint8_t n3103; + uint8_t n3105; + uint8_t cv_countdown; + uint16_t dl_tbf_ext; + uint16_t ul_tbf_ext; + uint8_t initial_cs; + uint8_t initial_mcs; + /* NSVC */ + uint16_t nsvci[2]; + uint16_t local_port[2]; + uint16_t remote_port[2]; + uint32_t remote_ip[2]; +} __attribute__ ((packed)); + +struct gsm_pcu_if_act_req { + uint8_t activate; + uint8_t trx_nr; + uint8_t ts_nr; + uint8_t spare; +} __attribute__ ((packed)); + +struct gsm_pcu_if_time_ind { + uint32_t fn; +} __attribute__ ((packed)); + +struct gsm_pcu_if_pag_req { + uint8_t sapi; + uint8_t chan_needed; + uint8_t identity_lv[9]; +} __attribute__ ((packed)); + +struct gsm_pcu_if { + /* context based information */ + uint8_t msg_type; /* message type */ + uint8_t bts_nr; /* bts number */ + uint8_t spare[2]; + + union { + struct gsm_pcu_if_data data_req; + struct gsm_pcu_if_data data_cnf; + struct gsm_pcu_if_data data_ind; + struct gsm_pcu_if_rts_req rts_req; + struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_info_ind info_ind; + struct gsm_pcu_if_act_req act_req; + struct gsm_pcu_if_time_ind time_ind; + struct gsm_pcu_if_pag_req pag_req; + } u; +} __attribute__ ((packed)); + +#endif /* _PCUIF_PROTO_H */ diff --git a/openbsc/src/libbsc/Makefile.am b/openbsc/src/libbsc/Makefile.am index fd8f37a..e78bde6 100644 --- a/openbsc/src/libbsc/Makefile.am +++ b/openbsc/src/libbsc/Makefile.am @@ -36,6 +36,7 @@ handover_decision.c \ handover_logic.c \ meas_rep.c \ + pcu_sock.c \ rest_octets.c \ system_information.c \ e1_config.c \ diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index ef6c897..1ad28cf 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -44,6 +44,7 @@ #include #include #include +#include #define RSL_ALLOC_SIZE 1024 #define RSL_ALLOC_HEADROOM 128 @@ -1287,6 +1288,12 @@ send_lchan_signal(S_LCHAN_ACTIVATE_ACK, lchan, NULL); + /* Update bts attributes inside the PCU */ + if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH || + ts->pchan == GSM_PCHAN_TCH_F_PDCH || + ts->pchan == GSM_PCHAN_PDCH) + pcu_info_update(ts->trx->bts); + return 0; } @@ -1761,6 +1768,39 @@ return rsl_imm_assign_cmd(bts, sizeof(*iar), (uint8_t *) iar); } +/* Handle packet channel rach requests */ +static int rsl_rx_pchan_rqd(struct msgb *msg, struct gsm_bts *bts) +{ + struct gsm48_req_ref *rqd_ref; + struct abis_rsl_dchan_hdr *rqd_hdr = msgb_l2(msg); + rqd_ref = (struct gsm48_req_ref *) &rqd_hdr->data[1]; + uint8_t ra = rqd_ref->ra; + uint8_t t1, t2, t3; + uint32_t fn; + uint8_t rqd_ta; + uint8_t is_11bit; + + /* Process rach request and forward contained information to PCU */ + if (ra == 0x7F) { + is_11bit = 1; + + /* FIXME: Also handle 11 bit rach requests */ + LOGP(DRSL, LOGL_ERROR, "BTS %d eleven bit access burst not supported yet!\n",bts->nr); + return -EINVAL; + } else { + is_11bit = 0; + t1 = rqd_ref->t1; + t2 = rqd_ref->t2; + t3 = rqd_ref->t3_low | (rqd_ref->t3_high << 3); + fn = (51 * ((t3-t2) % 26) + t3 + 51 * 26 * t1); + + rqd_ta = rqd_hdr->data[sizeof(struct gsm48_req_ref)+2]; + } + + return pcu_tx_rach_ind(bts, rqd_ta, ra, fn, is_11bit, + GSM_L1_BURST_TYPE_ACCESS_0); +} + /* MS has requested a channel on the RACH */ static int rsl_rx_chan_rqd(struct msgb *msg) { @@ -1788,10 +1828,20 @@ return -EINVAL; rqd_ta = rqd_hdr->data[sizeof(struct gsm48_req_ref)+2]; + /* Determine channel request cause code */ + chreq_reason = get_reason_by_chreq(rqd_ref->ra, bts->network->neci); + LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: reason: %s (ra=0x%02x, neci=0x%02x, chreq_reason=0x%02x)\n", + msg->lchan->ts->trx->bts->nr, + get_value_string(gsm_chreq_descs, chreq_reason), + rqd_ref->ra, bts->network->neci, chreq_reason); + + /* Handle PDCH related rach requests (in case of BSC-co-located-PCU */ + if (chreq_reason == GSM_CHREQ_REASON_PDCH) + return rsl_rx_pchan_rqd(msg, bts); + /* determine channel type (SDCCH/TCH_F/TCH_H) based on * request reference RA */ lctype = get_ctype_by_chreq(bts->network, rqd_ref->ra); - chreq_reason = get_reason_by_chreq(rqd_ref->ra, bts->network->neci); rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL]); diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 35a456a..076747a 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include /* global pointer to the gsm network data structure */ extern struct gsm_network *bsc_gsmnet; @@ -190,6 +192,10 @@ if (rc < 0) return rc; } + + /* Make sure the PCU is aware (in case anything GPRS related has + * changed in SI */ + pcu_info_update(bts); return 0; err_out: @@ -480,6 +486,7 @@ int bsc_network_alloc(mncc_recv_cb_t mncc_recv) { + /* initialize our data structures */ bsc_gsmnet = bsc_network_init(tall_bsc_ctx, 1, 1, mncc_recv); if (!bsc_gsmnet) return -ENOMEM; @@ -494,6 +501,8 @@ { struct gsm_bts *bts; int rc; + char pcu_sock_path[PATH_MAX]; + char pcu_sock_path_ending[PATH_MAX]; rc = vty_read_config_file(config_file, NULL); if (rc < 0) { @@ -521,6 +530,19 @@ LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n"); return rc; } + + strcpy(pcu_sock_path, PCU_SOCK_DEFAULT); + sprintf(pcu_sock_path_ending,"_%i", bts->nr); + if (bts->nr > 0) + strcat(pcu_sock_path, pcu_sock_path_ending); + rc = pcu_sock_init(pcu_sock_path, bts); + + if (rc < 0) { + LOGP(DNM, LOGL_FATAL, + "PCU L1 socket failed for bts %i\n", bts->nr); + return rc; + } } + return 0; } diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c new file mode 100644 index 0000000..b2bc425 --- /dev/null +++ b/openbsc/src/libbsc/pcu_sock.c @@ -0,0 +1,653 @@ +/* pcu_sock.c: Connect from PCU via unix domain socket */ + +/* (C) 2008-2010 by Harald Welte + * (C) 2009-2012 by Andreas Eversberg + * (C) 2012 by Holger Hans Peter Freyther + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg); +uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx); +int pcu_direct = 0; + +static const char *sapi_string[] = { + [PCU_IF_SAPI_RACH] = "RACH", + [PCU_IF_SAPI_AGCH] = "AGCH", + [PCU_IF_SAPI_PCH] = "PCH", + [PCU_IF_SAPI_BCCH] = "BCCH", + [PCU_IF_SAPI_PDTCH] = "PDTCH", + [PCU_IF_SAPI_PRACH] = "PRACH", + [PCU_IF_SAPI_PTCCH] = "PTCCH", +}; + +static struct gsm_bts_trx *trx_by_nr(struct gsm_bts *bts, uint8_t trx_nr) +{ + struct gsm_bts_trx *trx; + + llist_for_each_entry(trx, &bts->trx_list, list) { + if (trx->nr == trx_nr) + return trx; + } + + return NULL; +} + +/* Check if BTS has a PCU connection */ +static bool pcu_connected(struct gsm_bts *bts) +{ + struct pcu_sock_state *state = bts->pcu_state; + + if (!state) + return false; + if (state->conn_bfd.fd <= 0) + return false; + return true; +} + +/* + * PCU messages + */ + +/* Set up an message buffer to package an pcu interface message */ +struct msgb *pcu_msgb_alloc(uint8_t msg_type, uint8_t bts_nr) +{ + struct msgb *msg; + struct gsm_pcu_if *pcu_prim; + + msg = msgb_alloc(sizeof(struct gsm_pcu_if), "pcu_sock_tx"); + if (!msg) + return NULL; + + msgb_put(msg, sizeof(struct gsm_pcu_if)); + pcu_prim = (struct gsm_pcu_if *) msg->data; + pcu_prim->msg_type = msg_type; + pcu_prim->bts_nr = bts_nr; + + return msg; +} + +/* Helper function exclusivly used by pcu_if_signal_cb() */ +static bool ts_should_be_pdch(struct gsm_bts_trx_ts *ts) { + if (ts->pchan == GSM_PCHAN_PDCH) + return true; + if (ts->pchan == GSM_PCHAN_TCH_F_PDCH) { + /* When we're busy deactivating the PDCH, we first set + * DEACT_PENDING, tell the PCU about it and wait for a + * response. So DEACT_PENDING means "no PDCH" to the PCU. + * Similarly, when we're activating PDCH, we set the + * ACT_PENDING and wait for an activation response from the + * PCU, so ACT_PENDING means "is PDCH". */ + if (ts->flags & TS_F_PDCH_ACTIVE) + return !(ts->flags & TS_F_PDCH_DEACT_PENDING); + else + return (ts->flags & TS_F_PDCH_ACT_PENDING); + } + if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { + /* + * When we're busy de-/activating the PDCH, we first set + * ts->dyn.pchan_want, tell the PCU about it and wait for a + * response. So only care about dyn.pchan_want here. + */ + return ts->dyn.pchan_want == GSM_PCHAN_PDCH; + } + return false; +} + +/* Send BTS properties to the PCU */ +static int pcu_tx_info_ind(struct gsm_bts *bts) +{ + struct msgb *msg; + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_info_ind *info_ind; + struct gprs_rlc_cfg *rlcc; + struct gsm_bts_gprs_nsvc *nsvc; + struct gsm_bts_trx *trx; + struct gsm_bts_trx_ts *ts; + int i, j; + + OSMO_ASSERT(bts); + OSMO_ASSERT(bts->network); + + LOGP(DPCU, LOGL_INFO, "Sending info for BTS %d\n",bts->nr); + + rlcc = &bts->gprs.cell.rlc_cfg; + + msg = pcu_msgb_alloc(PCU_IF_MSG_INFO_IND, bts->nr); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->data; + info_ind = &pcu_prim->u.info_ind; + info_ind->version = PCU_IF_VERSION; + info_ind->flags |= PCU_IF_FLAG_ACTIVE; + + if (pcu_direct) + info_ind->flags |= PCU_IF_FLAG_SYSMO; + + /* RAI */ + info_ind->mcc = bts->network->country_code; + info_ind->mnc = bts->network->network_code; + info_ind->lac = bts->location_area_code; + info_ind->rac = bts->gprs.rac; + + /* NSE */ + info_ind->nsei = bts->gprs.nse.nsei; + memcpy(info_ind->nse_timer, bts->gprs.nse.timer, 7); + memcpy(info_ind->cell_timer, bts->gprs.cell.timer, 11); + + /* cell attributes */ + info_ind->cell_id = bts->cell_identity; + info_ind->repeat_time = rlcc->paging.repeat_time; + info_ind->repeat_count = rlcc->paging.repeat_count; + info_ind->bvci = bts->gprs.cell.bvci; + info_ind->t3142 = rlcc->parameter[RLC_T3142]; + info_ind->t3169 = rlcc->parameter[RLC_T3169]; + info_ind->t3191 = rlcc->parameter[RLC_T3191]; + info_ind->t3193_10ms = rlcc->parameter[RLC_T3193]; + info_ind->t3195 = rlcc->parameter[RLC_T3195]; + info_ind->n3101 = rlcc->parameter[RLC_N3101]; + info_ind->n3103 = rlcc->parameter[RLC_N3103]; + info_ind->n3105 = rlcc->parameter[RLC_N3105]; + info_ind->cv_countdown = rlcc->parameter[CV_COUNTDOWN]; + if (rlcc->cs_mask & (1 << GPRS_CS1)) + info_ind->flags |= PCU_IF_FLAG_CS1; + if (rlcc->cs_mask & (1 << GPRS_CS2)) + info_ind->flags |= PCU_IF_FLAG_CS2; + if (rlcc->cs_mask & (1 << GPRS_CS3)) + info_ind->flags |= PCU_IF_FLAG_CS3; + if (rlcc->cs_mask & (1 << GPRS_CS4)) + info_ind->flags |= PCU_IF_FLAG_CS4; + if (bts->gprs.mode == BTS_GPRS_EGPRS) { + if (rlcc->cs_mask & (1 << GPRS_MCS1)) + info_ind->flags |= PCU_IF_FLAG_MCS1; + if (rlcc->cs_mask & (1 << GPRS_MCS2)) + info_ind->flags |= PCU_IF_FLAG_MCS2; + if (rlcc->cs_mask & (1 << GPRS_MCS3)) + info_ind->flags |= PCU_IF_FLAG_MCS3; + if (rlcc->cs_mask & (1 << GPRS_MCS4)) + info_ind->flags |= PCU_IF_FLAG_MCS4; + if (rlcc->cs_mask & (1 << GPRS_MCS5)) + info_ind->flags |= PCU_IF_FLAG_MCS5; + if (rlcc->cs_mask & (1 << GPRS_MCS6)) + info_ind->flags |= PCU_IF_FLAG_MCS6; + if (rlcc->cs_mask & (1 << GPRS_MCS7)) + info_ind->flags |= PCU_IF_FLAG_MCS7; + if (rlcc->cs_mask & (1 << GPRS_MCS8)) + info_ind->flags |= PCU_IF_FLAG_MCS8; + if (rlcc->cs_mask & (1 << GPRS_MCS9)) + info_ind->flags |= PCU_IF_FLAG_MCS9; + } +#warning "isn't dl_tbf_ext wrong?: * 10 and no ntohs" + info_ind->dl_tbf_ext = rlcc->parameter[T_DL_TBF_EXT]; +#warning "isn't ul_tbf_ext wrong?: * 10 and no ntohs" + info_ind->ul_tbf_ext = rlcc->parameter[T_UL_TBF_EXT]; + info_ind->initial_cs = rlcc->initial_cs; + info_ind->initial_mcs = rlcc->initial_mcs; + + /* NSVC */ + for (i = 0; i < 2; i++) { + nsvc = &bts->gprs.nsvc[i]; + info_ind->nsvci[i] = nsvc->nsvci; + info_ind->local_port[i] = nsvc->local_port; + info_ind->remote_port[i] = nsvc->remote_port; + info_ind->remote_ip[i] = nsvc->remote_ip; + } + + for (i = 0; i < 8; i++) { + trx = trx_by_nr(bts, i); + if (!trx) + break; + info_ind->trx[i].pdch_mask = 0; + info_ind->trx[i].arfcn = trx->arfcn; + for (j = 0; j < 8; j++) { + ts = &trx->ts[j]; + if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED + && ts_should_be_pdch(ts)) { + info_ind->trx[i].pdch_mask |= (1 << j); + info_ind->trx[i].tsc[j] = + (ts->tsc >= 0) ? ts->tsc : bts->bsic & 7; + LOGP(DPCU, LOGL_INFO, "trx=%d ts=%d: " + "available (tsc=%d arfcn=%d)\n", + trx->nr, ts->nr, + info_ind->trx[i].tsc[j], + info_ind->trx[i].arfcn); + } + } + } + + return pcu_sock_send(bts, msg); +} + +void pcu_info_update(struct gsm_bts *bts) +{ + if (pcu_connected(bts)) + pcu_tx_info_ind(bts); +} + +/* Forward rach indication to PCU */ +int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn, + uint8_t is_11bit, enum ph_burst_type burst_type) +{ + struct msgb *msg; + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_rach_ind *rach_ind; + + /* Bail if no PCU is connected */ + if (!pcu_connected(bts)) { + LOGP(DRSL, LOGL_ERROR, "BTS %d CHAN RQD(GPRS) but PCU not " + "connected!\n", bts->nr); + return -ENODEV; + } + + LOGP(DPCU, LOGL_INFO, "Sending RACH indication: qta=%d, ra=%d, " + "fn=%d\n", qta, ra, fn); + + msg = pcu_msgb_alloc(PCU_IF_MSG_RACH_IND, bts->nr); + if (!msg) + return -ENOMEM; + pcu_prim = (struct gsm_pcu_if *) msg->data; + rach_ind = &pcu_prim->u.rach_ind; + + rach_ind->sapi = PCU_IF_SAPI_RACH; + rach_ind->ra = ra; + rach_ind->qta = qta; + rach_ind->fn = fn; + rach_ind->is_11bit = is_11bit; + rach_ind->burst_type = burst_type; + + return pcu_sock_send(bts, msg); +} + +static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, + struct gsm_pcu_if_data *data_req) +{ + uint8_t is_ptcch; + struct gsm_bts_trx *trx; + struct gsm_bts_trx_ts *ts; + struct msgb *msg; + int rc = 0; + + LOGP(DPCU, LOGL_DEBUG, "Data request received: sapi=%s arfcn=%d " + "block=%d data=%s\n", sapi_string[data_req->sapi], + data_req->arfcn, data_req->block_nr, + osmo_hexdump(data_req->data, data_req->len)); + + switch (data_req->sapi) { + case PCU_IF_SAPI_PCH: + if (msg_type == PCU_IF_MSG_PAG_REQ) { + /* FIXME: Add function to schedule paging request. + * This might not be required, if PCU_IF_MSG_DATA_REQ + * is used instead. */ + } else { + struct gsm_bts_role_bts *btsb = bts->role; + + printf("paging_add_imm_ass(btsb->paging_state, data_req->data,data_req->len);\n"); + } + break; + case PCU_IF_SAPI_AGCH: + msg = msgb_alloc(data_req->len, "pcu_agch"); + if (!msg) { + rc = -ENOMEM; + break; + } + msg->l3h = msgb_put(msg, data_req->len); + memcpy(msg->l3h, data_req->data, data_req->len); + + if (rsl_imm_assign_cmd(bts, msg->len, msg->data)) { + msgb_free(msg); + rc = -EIO; + } + break; + default: + LOGP(DPCU, LOGL_ERROR, "Received PCU data request with " + "unsupported sapi %d\n", data_req->sapi); + rc = -EINVAL; + } + + return rc; +} + +static int pcu_rx(struct gsm_network *net, uint8_t msg_type, + struct gsm_pcu_if *pcu_prim) +{ + int rc = 0; + struct gsm_bts *bts; + + /* FIXME: allow multiple BTS */ + bts = llist_entry(net->bts_list.next, struct gsm_bts, list); + + switch (msg_type) { + case PCU_IF_MSG_DATA_REQ: + case PCU_IF_MSG_PAG_REQ: + rc = pcu_rx_data_req(bts, msg_type, &pcu_prim->u.data_req); + break; + default: + LOGP(DPCU, LOGL_ERROR, "Received unknwon PCU msg type %d\n", + msg_type); + rc = -EINVAL; + } + + return rc; +} + +/* + * PCU socket interface + */ + +static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg) +{ + struct pcu_sock_state *state = bts->pcu_state; + struct osmo_fd *conn_bfd; + struct gsm_pcu_if *pcu_prim = (struct gsm_pcu_if *) msg->data; + + if (!state) { + if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND) + LOGP(DPCU, LOGL_INFO, "PCU socket not created, " + "dropping message\n"); + msgb_free(msg); + return -EINVAL; + } + conn_bfd = &state->conn_bfd; + if (conn_bfd->fd <= 0) { + if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND) + LOGP(DPCU, LOGL_NOTICE, "PCU socket not connected, " + "dropping message\n"); + msgb_free(msg); + return -EIO; + } + msgb_enqueue(&state->upqueue, msg); + conn_bfd->when |= BSC_FD_WRITE; + + return 0; +} + +static void pcu_sock_close(struct pcu_sock_state *state) +{ + struct osmo_fd *bfd = &state->conn_bfd; + struct gsm_bts *bts; + struct gsm_bts_trx *trx; + struct gsm_bts_trx_ts *ts; + int i, j; + + /* FIXME: allow multiple BTS */ + bts = llist_entry(state->net->bts_list.next, struct gsm_bts, list); + + LOGP(DPCU, LOGL_NOTICE, "PCU socket has LOST connection\n"); + + close(bfd->fd); + bfd->fd = -1; + osmo_fd_unregister(bfd); + + /* re-enable the generation of ACCEPT for new connections */ + state->listen_bfd.when |= BSC_FD_READ; + +#if 0 + /* remove si13, ... */ + bts->si_valid &= ~(1 << SYSINFO_TYPE_13); + osmo_signal_dispatch(SS_GLOBAL, S_NEW_SYSINFO, bts); +#endif + + /* release PDCH */ + for (i = 0; i < 8; i++) { + trx = trx_by_nr(bts, i); + if (!trx) + break; + for (j = 0; j < 8; j++) { + ts = &trx->ts[j]; + if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED + && ts->pchan == GSM_PCHAN_PDCH) { + printf("l1sap_chan_rel(trx,gsm_lchan2chan_nr(ts->lchan));\n"); + } + } + } + + /* flush the queue */ + while (!llist_empty(&state->upqueue)) { + struct msgb *msg = msgb_dequeue(&state->upqueue); + msgb_free(msg); + } +} + +static int pcu_sock_read(struct osmo_fd *bfd) +{ + struct pcu_sock_state *state = (struct pcu_sock_state *)bfd->data; + struct gsm_pcu_if *pcu_prim; + struct msgb *msg; + int rc; + + msg = msgb_alloc(sizeof(*pcu_prim), "pcu_sock_rx"); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->tail; + + rc = recv(bfd->fd, msg->tail, msgb_tailroom(msg), 0); + if (rc == 0) + goto close; + + if (rc < 0) { + if (errno == EAGAIN) + return 0; + goto close; + } + + rc = pcu_rx(state->net, pcu_prim->msg_type, pcu_prim); + + /* as we always synchronously process the message in pcu_rx() and + * its callbacks, we can free the message here. */ + msgb_free(msg); + + return rc; + +close: + msgb_free(msg); + pcu_sock_close(state); + return -1; +} + +static int pcu_sock_write(struct osmo_fd *bfd) +{ + struct pcu_sock_state *state = bfd->data; + int rc; + + while (!llist_empty(&state->upqueue)) { + struct msgb *msg, *msg2; + struct gsm_pcu_if *pcu_prim; + + /* peek at the beginning of the queue */ + msg = llist_entry(state->upqueue.next, struct msgb, list); + pcu_prim = (struct gsm_pcu_if *)msg->data; + + bfd->when &= ~BSC_FD_WRITE; + + /* bug hunter 8-): maybe someone forgot msgb_put(...) ? */ + if (!msgb_length(msg)) { + LOGP(DPCU, LOGL_ERROR, "message type (%d) with ZERO " + "bytes!\n", pcu_prim->msg_type); + goto dontsend; + } + + /* try to send it over the socket */ + rc = write(bfd->fd, msgb_data(msg), msgb_length(msg)); + if (rc == 0) + goto close; + if (rc < 0) { + if (errno == EAGAIN) { + bfd->when |= BSC_FD_WRITE; + break; + } + goto close; + } + +dontsend: + /* _after_ we send it, we can deueue */ + msg2 = msgb_dequeue(&state->upqueue); + assert(msg == msg2); + msgb_free(msg); + } + return 0; + +close: + pcu_sock_close(state); + + return -1; +} + +static int pcu_sock_cb(struct osmo_fd *bfd, unsigned int flags) +{ + int rc = 0; + + if (flags & BSC_FD_READ) + rc = pcu_sock_read(bfd); + if (rc < 0) + return rc; + + if (flags & BSC_FD_WRITE) + rc = pcu_sock_write(bfd); + + return rc; +} + +/* accept connection comming from PCU */ +static int pcu_sock_accept(struct osmo_fd *bfd, unsigned int flags) +{ + struct pcu_sock_state *state = (struct pcu_sock_state *)bfd->data; + struct osmo_fd *conn_bfd = &state->conn_bfd; + struct sockaddr_un un_addr; + socklen_t len; + int rc; + + len = sizeof(un_addr); + rc = accept(bfd->fd, (struct sockaddr *) &un_addr, &len); + if (rc < 0) { + LOGP(DPCU, LOGL_ERROR, "Failed to accept a new connection\n"); + return -1; + } + + if (conn_bfd->fd >= 0) { + LOGP(DPCU, LOGL_NOTICE, "PCU connects but we already have " + "another active connection ?!?\n"); + /* We already have one PCU connected, this is all we support */ + state->listen_bfd.when &= ~BSC_FD_READ; + close(rc); + return 0; + } + + conn_bfd->fd = rc; + conn_bfd->when = BSC_FD_READ; + conn_bfd->cb = pcu_sock_cb; + conn_bfd->data = state; + + if (osmo_fd_register(conn_bfd) != 0) { + LOGP(DPCU, LOGL_ERROR, "Failed to register new connection " + "fd\n"); + close(conn_bfd->fd); + conn_bfd->fd = -1; + return -1; + } + + LOGP(DPCU, LOGL_NOTICE, "PCU socket connected to external PCU\n"); + + return 0; +} + +/* Open connection to PCU */ +int pcu_sock_init(const char *path, struct gsm_bts *bts) +{ + struct pcu_sock_state *state; + struct osmo_fd *bfd; + int rc; + + state = talloc_zero(NULL, struct pcu_sock_state); + if (!state) + return -ENOMEM; + + INIT_LLIST_HEAD(&state->upqueue); + state->net = bts->network; + state->conn_bfd.fd = -1; + + bfd = &state->listen_bfd; + + bfd->fd = osmo_sock_unix_init(SOCK_SEQPACKET, 0, path, + OSMO_SOCK_F_BIND); + if (bfd->fd < 0) { + LOGP(DPCU, LOGL_ERROR, "Could not create unix socket: %s\n", + strerror(errno)); + talloc_free(state); + return -1; + } + + bfd->when = BSC_FD_READ; + bfd->cb = pcu_sock_accept; + bfd->data = state; + + rc = osmo_fd_register(bfd); + if (rc < 0) { + LOGP(DPCU, LOGL_ERROR, "Could not register listen fd: %d\n", + rc); + close(bfd->fd); + talloc_free(state); + return rc; + } + + bts->pcu_state = state; + return 0; +} + +/* Close connection to PCU */ +void pcu_sock_exit(struct gsm_bts *bts) +{ + struct pcu_sock_state *state = bts->pcu_state; + struct osmo_fd *bfd, *conn_bfd; + + if (!state) + return; + + conn_bfd = &state->conn_bfd; + if (conn_bfd->fd > 0) + pcu_sock_close(state); + bfd = &state->listen_bfd; + close(bfd->fd); + osmo_fd_unregister(bfd); + talloc_free(state); + bts->pcu_state = NULL; +} + diff --git a/openbsc/src/libcommon/debug.c b/openbsc/src/libcommon/debug.c index 0f82211..f29f168 100644 --- a/openbsc/src/libcommon/debug.c +++ b/openbsc/src/libcommon/debug.c @@ -175,6 +175,11 @@ .description = "SCCP User Adaptation Protocol", .enabled = 1, .loglevel = LOGL_DEBUG, }, + [DPCU] = { + .name = "DPCU", + .description = "PCU Interface", + .enabled = 1, .loglevel = LOGL_DEBUG, + }, }; static int filter_fn(const struct log_context *ctx, struct log_target *tar) -- To view, visit https://gerrit.osmocom.org/2056 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:35 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:35 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: Don't re-implement core functionality like gsm_bts... Message-ID: Review at https://gerrit.osmocom.org/2057 pcu_sock: Don't re-implement core functionality like gsm_bts_trx_num() Change-Id: I5ea506c8240dac124ccf5522d02ba18e4f0cb90d --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 2 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/57/2057/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index b2bc425..0f3dc1b 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -58,18 +58,6 @@ [PCU_IF_SAPI_PTCCH] = "PTCCH", }; -static struct gsm_bts_trx *trx_by_nr(struct gsm_bts *bts, uint8_t trx_nr) -{ - struct gsm_bts_trx *trx; - - llist_for_each_entry(trx, &bts->trx_list, list) { - if (trx->nr == trx_nr) - return trx; - } - - return NULL; -} - /* Check if BTS has a PCU connection */ static bool pcu_connected(struct gsm_bts *bts) { @@ -232,7 +220,7 @@ } for (i = 0; i < 8; i++) { - trx = trx_by_nr(bts, i); + trx = gsm_bts_trx_num(bts, i); if (!trx) break; info_ind->trx[i].pdch_mask = 0; @@ -427,7 +415,7 @@ /* release PDCH */ for (i = 0; i < 8; i++) { - trx = trx_by_nr(bts, i); + trx = gsm_bts_trx_num(bts, i); if (!trx) break; for (j = 0; j < 8; j++) { -- To view, visit https://gerrit.osmocom.org/2057 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5ea506c8240dac124ccf5522d02ba18e4f0cb90d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:35 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:35 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for ... Message-ID: Review at https://gerrit.osmocom.org/2058 pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for array iteration Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29 --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/58/2058/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 0f3dc1b..e713b08 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -211,7 +211,7 @@ info_ind->initial_mcs = rlcc->initial_mcs; /* NSVC */ - for (i = 0; i < 2; i++) { + for (i = 0; i < ARRAY_SIZE(info_ind->nsvci); i++) { nsvc = &bts->gprs.nsvc[i]; info_ind->nsvci[i] = nsvc->nsvci; info_ind->local_port[i] = nsvc->local_port; @@ -219,13 +219,13 @@ info_ind->remote_ip[i] = nsvc->remote_ip; } - for (i = 0; i < 8; i++) { + for (i = 0; i < ARRAY_SIZE(info_ind->trx); i++) { trx = gsm_bts_trx_num(bts, i); if (!trx) break; info_ind->trx[i].pdch_mask = 0; info_ind->trx[i].arfcn = trx->arfcn; - for (j = 0; j < 8; j++) { + for (j = 0; j < ARRAY_SIZE(trx->ts); j++) { ts = &trx->ts[j]; if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED && ts_should_be_pdch(ts)) { -- To view, visit https://gerrit.osmocom.org/2058 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:35 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:35 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: Forward paging request from PCU via RSL to BTS Message-ID: Review at https://gerrit.osmocom.org/2059 pcu_sock: Forward paging request from PCU via RSL to BTS Change-Id: I28bf0995699618f3f5fa15fc8e1733beddfc482f --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 44 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/59/2059/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index e713b08..4555b31 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -284,6 +284,39 @@ return pcu_sock_send(bts, msg); } +/* we need to decode the raw RR paging messsage (see PCU code + * Encoding::write_paging_request) and extract the mobile identity + * (P-TMSI) from it */ +static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group, + const uint8_t *raw_rr_msg) +{ + struct gsm48_hdr *gsmh = (struct gsm48_hdr *) raw_rr_msg; + struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) gsmh; + uint8_t chan_needed; + unsigned int mi_len; + uint8_t *mi; + int rc; + + switch (gsmh->msg_type) { + case GSM48_MT_RR_PAG_REQ_1: + chan_needed = (p1->cneed2 << 2) | p1->cneed1; + mi_len = p1->data[0]; + mi = p1->data+1; + /* FIXME: why does rsl_paging_cmd add 2 to mi? */ + rc = rsl_paging_cmd(bts, paging_group, mi_len, mi, + chan_needed, true); + break; + case GSM48_MT_RR_PAG_REQ_2: + case GSM48_MT_RR_PAG_REQ_3: + LOGP(DPCU, LOGL_ERROR, "PCU Sends unsupported paging " + "request type\n"); + rc = -EINVAL; + break; + } + + return rc; +} + static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, struct gsm_pcu_if_data *data_req) { @@ -291,6 +324,8 @@ struct gsm_bts_trx *trx; struct gsm_bts_trx_ts *ts; struct msgb *msg; + char imsi_digit_buf[4]; + uint8_t pag_grp; int rc = 0; LOGP(DPCU, LOGL_DEBUG, "Data request received: sapi=%s arfcn=%d " @@ -300,15 +335,15 @@ switch (data_req->sapi) { case PCU_IF_SAPI_PCH: - if (msg_type == PCU_IF_MSG_PAG_REQ) { - /* FIXME: Add function to schedule paging request. - * This might not be required, if PCU_IF_MSG_DATA_REQ - * is used instead. */ - } else { - struct gsm_bts_role_bts *btsb = bts->role; - - printf("paging_add_imm_ass(btsb->paging_state, data_req->data,data_req->len);\n"); - } + /* the first three bytes are the last three digits of + * the IMSI, which we need to compute the paging group */ + imsi_digit_buf[0] = data_req->data[0]; + imsi_digit_buf[1] = data_req->data[1]; + imsi_digit_buf[2] = data_req->data[2]; + imsi_digit_buf[3] = '\0'; + pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, + str_to_imsi(imsi_digit_buf)); + pcu_rx_rr_paging(bts, pag_grp, data_req->data+3); break; case PCU_IF_SAPI_AGCH: msg = msgb_alloc(data_req->len, "pcu_agch"); -- To view, visit https://gerrit.osmocom.org/2059 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I28bf0995699618f3f5fa15fc8e1733beddfc482f Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:36 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:36 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: Send non-NULL hLayer1 to PCU Message-ID: Review at https://gerrit.osmocom.org/2060 pcu_sock: Send non-NULL hLayer1 to PCU The BSC-located PCU case looks to the PCU like a BTS-located PCU with "direct PHY" access, i.e. the data related primitives are communicated from the PCU directly towards the TRAU Frames or whatever transport method is used between CCU and PCU. In order to make the PCU believe that, we need to pass in a 'layer 1 handle'. As we don't use it, we can just pass any non-zero value and be happy. Change-Id: I8170bd4134904702b6b272e496100361ba473cbc --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/60/2060/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 4555b31..2186409 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -223,6 +223,7 @@ trx = gsm_bts_trx_num(bts, i); if (!trx) break; + info_ind->trx[i].hlayer1 = 0x2342; info_ind->trx[i].pdch_mask = 0; info_ind->trx[i].arfcn = trx->arfcn; for (j = 0; j < ARRAY_SIZE(trx->ts); j++) { -- To view, visit https://gerrit.osmocom.org/2060 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8170bd4134904702b6b272e496100361ba473cbc Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:37 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:37 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1 Message-ID: Review at https://gerrit.osmocom.org/2061 pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1 The use of PCU_IF_FLAG_SYSMO enable the PCU to use DIRECT_PHY code path. Change-Id: I1f5407264fc4f209456ffcb73d7853ff315aab86 --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/61/2061/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 2186409..0e904db 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -46,7 +46,7 @@ static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg); uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx); -int pcu_direct = 0; +int pcu_direct = 1; static const char *sapi_string[] = { [PCU_IF_SAPI_RACH] = "RACH", -- To view, visit https://gerrit.osmocom.org/2061 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1f5407264fc4f209456ffcb73d7853ff315aab86 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:38 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:38 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0 Message-ID: Review at https://gerrit.osmocom.org/2062 pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0 It would prevent using only e.g. TRX 1 when TRX 0 is disabled. Change-Id: I68dc5e837bd2a3602f7875063c85da4082196274 --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/62/2062/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 0e904db..7712878 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -222,7 +222,7 @@ for (i = 0; i < ARRAY_SIZE(info_ind->trx); i++) { trx = gsm_bts_trx_num(bts, i); if (!trx) - break; + continue; info_ind->trx[i].hlayer1 = 0x2342; info_ind->trx[i].pdch_mask = 0; info_ind->trx[i].arfcn = trx->arfcn; -- To view, visit https://gerrit.osmocom.org/2062 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I68dc5e837bd2a3602f7875063c85da4082196274 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:38 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:38 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: implement direct tlli on AGCH Message-ID: Review at https://gerrit.osmocom.org/2063 pcu_sock: implement direct tlli on AGCH Ericsson allows to attach a reference to immediate assignments. A confirmation of the transmission is then sent back, but only containing the reference, not the whole RLC packet. Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9 --- M openbsc/include/openbsc/pcuif_proto.h M openbsc/src/libbsc/pcu_sock.c 2 files changed, 33 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/63/2063/1 diff --git a/openbsc/include/openbsc/pcuif_proto.h b/openbsc/include/openbsc/pcuif_proto.h index a52d896..3fc500b 100644 --- a/openbsc/include/openbsc/pcuif_proto.h +++ b/openbsc/include/openbsc/pcuif_proto.h @@ -1,7 +1,7 @@ #ifndef _PCUIF_PROTO_H #define _PCUIF_PROTO_H -#define PCU_IF_VERSION 0x07 +#define PCU_IF_VERSION 0x08 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -22,6 +22,7 @@ #define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */ #define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */ #define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */ +#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */ /* flags */ #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */ diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 7712878..0ae3a03 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -56,6 +56,7 @@ [PCU_IF_SAPI_PDTCH] = "PDTCH", [PCU_IF_SAPI_PRACH] = "PRACH", [PCU_IF_SAPI_PTCCH] = "PTCCH", + [PCU_IF_SAPI_AGCH_DT] = "AGCH_DT", }; /* Check if BTS has a PCU connection */ @@ -326,6 +327,7 @@ struct gsm_bts_trx_ts *ts; struct msgb *msg; char imsi_digit_buf[4]; + uint32_t tlli = -1; uint8_t pag_grp; int rc = 0; @@ -342,6 +344,7 @@ imsi_digit_buf[1] = data_req->data[1]; imsi_digit_buf[2] = data_req->data[2]; imsi_digit_buf[3] = '\0'; + LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s", imsi_digit_buf); pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, str_to_imsi(imsi_digit_buf)); pcu_rx_rr_paging(bts, pag_grp, data_req->data+3); @@ -360,6 +363,34 @@ rc = -EIO; } break; + case PCU_IF_SAPI_AGCH_DT: + /* DT = direct tlli. A tlli is prefixed */ + + if (data_req->len < 5) { + LOGP(DPCU, LOGL_ERROR, "Received PCU data request with " + "invalid/small length %d\n", data_req->len); + break; + } + tlli = *((uint32_t *)data_req->data); + + msg = msgb_alloc(data_req->len - 4, "pcu_agch"); + if (!msg) { + rc = -ENOMEM; + break; + } + msg->l3h = msgb_put(msg, data_req->len - 4); + memcpy(msg->l3h, data_req->data + 4, data_req->len - 4); + + if (bts->type == GSM_BTS_TYPE_RBS2000) + rc = rsl_ericsson_imm_assign_cmd(bts, tlli, msg->len, msg->data); + else + rc = rsl_imm_assign_cmd(bts, msg->len, msg->data); + + if (rc) { + msgb_free(msg); + rc = -EIO; + } + break; default: LOGP(DPCU, LOGL_ERROR, "Received PCU data request with " "unsupported sapi %d\n", data_req->sapi); -- To view, visit https://gerrit.osmocom.org/2063 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:39 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:39 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: Forward imm.ass PCU originated messages Message-ID: Review at https://gerrit.osmocom.org/2064 pcu_sock: Forward imm.ass PCU originated messages The PCU sends imm.ass messages in response to a rach request. Those messages need to be forwarded to RSL in order to get them send. This commit introduces the required functionality for that Change-Id: Ice099c4ed7008200ed179e581aba1899c6c29455 --- M openbsc/include/openbsc/pcu_if.h M openbsc/include/openbsc/pcuif_proto.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libbsc/pcu_sock.c 4 files changed, 59 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/2064/1 diff --git a/openbsc/include/openbsc/pcu_if.h b/openbsc/include/openbsc/pcu_if.h index 68d4174..0c355b7 100644 --- a/openbsc/include/openbsc/pcu_if.h +++ b/openbsc/include/openbsc/pcu_if.h @@ -24,6 +24,10 @@ /* Confirm the sending of an immediate assignment to the pcu */ int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli); + +/* Confirm the sending of an immediate assignment to the pcu */ +int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli); + /* Open connection to PCU */ int pcu_sock_init(const char *path, struct gsm_bts *bts); diff --git a/openbsc/include/openbsc/pcuif_proto.h b/openbsc/include/openbsc/pcuif_proto.h index 3fc500b..eb28d66 100644 --- a/openbsc/include/openbsc/pcuif_proto.h +++ b/openbsc/include/openbsc/pcuif_proto.h @@ -7,6 +7,7 @@ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ #define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */ #define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */ +#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */ #define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */ #define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */ #define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */ @@ -54,6 +55,21 @@ uint16_t ber10k; /*!< \brief BER in units of 0.01% */ int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ int16_t lqual_cb; /* !< \brief Link quality in centiBel */ +} __attribute__ ((packed)); + +/* data confirmation with direct tlli (instead of raw mac block with tlli) */ +struct gsm_pcu_if_data_cnf_dt { + uint8_t sapi; + uint32_t tlli; + uint32_t fn; + uint16_t arfcn; + uint8_t trx_nr; + uint8_t ts_nr; + uint8_t block_nr; + int8_t rssi; + uint16_t ber10k; /*!< \brief BER in units of 0.01% */ + int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ + int16_t lqual_cb; /* !< \brief Link quality in centiBel */ } __attribute__ ((packed)); struct gsm_pcu_if_rts_req { @@ -146,6 +162,7 @@ union { struct gsm_pcu_if_data data_req; struct gsm_pcu_if_data data_cnf; + struct gsm_pcu_if_data_cnf_dt data_cnf_dt; struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 1ad28cf..72547e9 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1988,6 +1988,7 @@ struct e1inp_sign_link *sign_link = msg->dst; struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg); int rc = 0; + uint32_t tlli; msg->lchan = lchan_lookup(sign_link->trx, rslh->chan_nr, "Abis RSL rx CCHAN: "); @@ -2008,6 +2009,22 @@ LOGP(DRSL, LOGL_NOTICE, "Unimplemented Abis RSL TRX message " "type 0x%02x\n", rslh->c.msg_type); break; + case 0x10: /* Ericsson specific: Immediate Assign Sent */ + /* FIXME: Replace the messy message parsing below + * with proper TV parser */ + LOGP(DRSL, LOGL_INFO, "IMM.ass sent\n"); + if(msg->len < 8) + LOGP(DRSL, LOGL_ERROR, "short IMM.ass sent message!\n"); + else if(msg->data[4] != 0xf1) + LOGP(DRSL, LOGL_ERROR, "unsupported IMM.ass message format! (please fix)\n"); + else { + tlli = msg->data[8]; + tlli |= msg->data[7] << 8; + tlli |= msg->data[6] << 16; + tlli |= msg->data[5] << 24; + pcu_tx_imm_ass_sent(sign_link->trx->bts, tlli); + } + break; default: LOGP(DRSL, LOGL_NOTICE, "Unknown Abis RSL TRX message type " "0x%02x\n", rslh->c.msg_type); diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 0ae3a03..7e77797 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -286,6 +286,27 @@ return pcu_sock_send(bts, msg); } +/* Confirm the sending of an immediate assignment to the pcu */ +int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli) +{ + struct msgb *msg; + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_data_cnf_dt *data_cnf_dt; + + LOGP(DPCU, LOGL_INFO, "Sending PCH confirm with direct TLLI\n"); + + msg = pcu_msgb_alloc(PCU_IF_MSG_DATA_CNF_DT, bts->nr); + if (!msg) + return -ENOMEM; + pcu_prim = (struct gsm_pcu_if *) msg->data; + data_cnf_dt = &pcu_prim->u.data_cnf_dt; + + data_cnf_dt->sapi = PCU_IF_SAPI_PCH; + data_cnf_dt->tlli = tlli; + + return pcu_sock_send(bts, msg); +} + /* we need to decode the raw RR paging messsage (see PCU code * Encoding::write_paging_request) and extract the mobile identity * (P-TMSI) from it */ -- To view, visit https://gerrit.osmocom.org/2064 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice099c4ed7008200ed179e581aba1899c6c29455 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:40 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:40 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: Fix broken paging command Message-ID: Review at https://gerrit.osmocom.org/2065 pcu_sock: Fix broken paging command The pcu sends us an already made up MAC-Block that contains the paging request. pcu_sock.c is parsing this paging request wrongly and fails silently, which results into a dropping of the request. This commit fixes the parsing problems. Change-Id: Iefef08123bdc351afd8287d3f27ebf0ae58a6e7d --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 20 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/2065/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 7e77797..98e12fa 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -313,26 +313,39 @@ static int pcu_rx_rr_paging(struct gsm_bts *bts, uint8_t paging_group, const uint8_t *raw_rr_msg) { - struct gsm48_hdr *gsmh = (struct gsm48_hdr *) raw_rr_msg; - struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) gsmh; + struct gsm48_paging1 *p1 = (struct gsm48_paging1 *) raw_rr_msg; uint8_t chan_needed; unsigned int mi_len; uint8_t *mi; int rc; - switch (gsmh->msg_type) { + switch (p1->msg_type) { case GSM48_MT_RR_PAG_REQ_1: chan_needed = (p1->cneed2 << 2) | p1->cneed1; mi_len = p1->data[0]; mi = p1->data+1; - /* FIXME: why does rsl_paging_cmd add 2 to mi? */ - rc = rsl_paging_cmd(bts, paging_group, mi_len, mi, + LOGP(DPCU, LOGL_ERROR, "PCU Sends paging " + "request type %02x (chan_needed=%02x, mi_len=%u, mi=%s)\n", + p1->msg_type, chan_needed, mi_len, + osmo_hexdump_nospc(mi,mi_len)); + /* NOTE: We will have to add 2 to mi_len and subtract 2 from + * the mi pointer because rsl_paging_cmd() will perform the + * reverse operations. This is because rsl_paging_cmd() is + * normally expected to chop off the element identifier (0xC0) + * and the length field. In our parameter, we do not have + * those fields included. */ + rc = rsl_paging_cmd(bts, paging_group, mi_len+2, mi-2, chan_needed, true); break; case GSM48_MT_RR_PAG_REQ_2: case GSM48_MT_RR_PAG_REQ_3: LOGP(DPCU, LOGL_ERROR, "PCU Sends unsupported paging " - "request type\n"); + "request type %02x\n", p1->msg_type); + rc = -EINVAL; + break; + default: + LOGP(DPCU, LOGL_ERROR, "PCU Sends unknown paging " + "request type %02x\n", p1->msg_type); rc = -EINVAL; break; } @@ -365,7 +378,7 @@ imsi_digit_buf[1] = data_req->data[1]; imsi_digit_buf[2] = data_req->data[2]; imsi_digit_buf[3] = '\0'; - LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s", imsi_digit_buf); + LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s\n", imsi_digit_buf); pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, str_to_imsi(imsi_digit_buf)); pcu_rx_rr_paging(bts, pag_grp, data_req->data+3); -- To view, visit https://gerrit.osmocom.org/2065 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iefef08123bdc351afd8287d3f27ebf0ae58a6e7d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:40 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:40 +0000 Subject: [PATCH] openbsc[master]: abis-rsl: Send imm.ass messages via PCH Message-ID: Review at https://gerrit.osmocom.org/2066 abis-rsl: Send imm.ass messages via PCH It is possible to send immidiate assign messages through the paging channel. This commit adds the required functionality to the pcu socket interface and to the abis_rsl api Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5 --- M openbsc/include/openbsc/abis_rsl.h M openbsc/include/openbsc/pcuif_proto.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libbsc/pcu_sock.c 4 files changed, 61 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/2066/1 diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index e61d4ea..093935b 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -58,7 +58,11 @@ int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); /* Ericcson vendor specific RSL extensions */ -int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val); +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val, + uint32_t tlli); +int rsl_ericsson_imm_assign_via_pch_cmd(struct gsm_bts *bts, uint8_t len, + uint8_t *val, uint32_t tlli, + uint8_t pag_grp); /* Siemens vendor-specific RSL extensions */ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); diff --git a/openbsc/include/openbsc/pcuif_proto.h b/openbsc/include/openbsc/pcuif_proto.h index eb28d66..0dbb6c2 100644 --- a/openbsc/include/openbsc/pcuif_proto.h +++ b/openbsc/include/openbsc/pcuif_proto.h @@ -23,7 +23,7 @@ #define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */ #define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */ #define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */ -#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */ +#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on PCH or AGCH but with additional TLLI */ /* flags */ #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */ @@ -61,6 +61,7 @@ struct gsm_pcu_if_data_cnf_dt { uint8_t sapi; uint32_t tlli; + uint8_t imsi[3]; uint32_t fn; uint16_t arfcn; uint8_t trx_nr; diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 72547e9..ba52c09 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1084,17 +1084,42 @@ return abis_rsl_sendmsg(msg); } -/* Chapter 8.5.6 */ -int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val) +/* Append mobile idenitiy (tlli) to message buffer */ +static void rsl_ericsson_put_mi(struct msgb *msg, uint32_t tlli) +{ + /* NOTE: ericsson can handle a reference at the end of the message which is used in + * the confirm message. The confirm message is only sent if the trailer is present */ + msgb_put_u8(msg, 0xf1); + msgb_put_u32(msg, tlli); +} + +/* Chapter 8.5.6 (Ericcson vendor specific RSL extension) */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val, + uint32_t tlli) { struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); if (!msg) return 1; - /* ericsson can handle a reference at the end of the message which is used in - * the confirm message. The confirm message is only sent if the trailer is present */ - msgb_put_u8(msg, 0xf1); - msgb_put_u32(msg, tlli); + /* Append ericsson propritary mobile identity field */ + rsl_ericsson_put_mi(msg, tlli); + + return abis_rsl_sendmsg(msg); +} + +/* Chapter 8.5.6 (Ericcson vendor specific RSL extension) */ +int rsl_ericsson_imm_assign_via_pch_cmd(struct gsm_bts *bts, uint8_t len, + uint8_t *val, uint32_t tlli, + uint8_t pag_grp) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + + /* Append ericsson propritary paging group field */ + msgb_put_u8(msg, 0x0e); + msgb_put_u8(msg, pag_grp); + + /* Append ericsson propritary mobile identity field */ + rsl_ericsson_put_mi(msg, tlli); return abis_rsl_sendmsg(msg); } diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 98e12fa..7f9119f 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -325,9 +325,9 @@ mi_len = p1->data[0]; mi = p1->data+1; LOGP(DPCU, LOGL_ERROR, "PCU Sends paging " - "request type %02x (chan_needed=%02x, mi_len=%u, mi=%s)\n", + "request type %02x (chan_needed=0x%02x, mi_len=%u, mi=%s, paging_group=0x%02x)\n", p1->msg_type, chan_needed, mi_len, - osmo_hexdump_nospc(mi,mi_len)); + osmo_hexdump_nospc(mi,mi_len), paging_group); /* NOTE: We will have to add 2 to mi_len and subtract 2 from * the mi pointer because rsl_paging_cmd() will perform the * reverse operations. This is because rsl_paging_cmd() is @@ -392,6 +392,7 @@ msg->l3h = msgb_put(msg, data_req->len); memcpy(msg->l3h, data_req->data, data_req->len); + LOGP(DPCU, LOGL_DEBUG, "PCU Sends immediate assignment via AGCH\n"); if (rsl_imm_assign_cmd(bts, msg->len, msg->data)) { msgb_free(msg); rc = -EIO; @@ -407,18 +408,29 @@ } tlli = *((uint32_t *)data_req->data); - msg = msgb_alloc(data_req->len - 4, "pcu_agch"); + /* the first three bytes are the last three digits of + * the IMSI, which we need to compute the paging group */ + imsi_digit_buf[0] = data_req->data[4]; + imsi_digit_buf[1] = data_req->data[5]; + imsi_digit_buf[2] = data_req->data[6]; + imsi_digit_buf[3] = '\0'; + pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, + str_to_imsi(imsi_digit_buf)); + + msg = msgb_alloc(data_req->len - 7, "pcu_pch"); if (!msg) { rc = -ENOMEM; break; } - msg->l3h = msgb_put(msg, data_req->len - 4); - memcpy(msg->l3h, data_req->data + 4, data_req->len - 4); + msg->l3h = msgb_put(msg, data_req->len - 7); + memcpy(msg->l3h, data_req->data + 7, data_req->len - 7); - if (bts->type == GSM_BTS_TYPE_RBS2000) - rc = rsl_ericsson_imm_assign_cmd(bts, tlli, msg->len, msg->data); - else - rc = rsl_imm_assign_cmd(bts, msg->len, msg->data); + LOGP(DPCU, LOGL_DEBUG, "PCU Sends immediate assignment via PCH (tlli=0x%08x, pag_grp=0x%02x)\n", + tlli, pag_grp); + if (bts->type == GSM_BTS_TYPE_RBS2000) { + rc = rsl_ericsson_imm_assign_via_pch_cmd(bts, msg->len, msg->data, tlli, pag_grp); + } else + LOGP(DPCU, LOGL_ERROR, "This BTS does not support immediate via PCH, dropping message!\n"); if (rc) { msgb_free(msg); @@ -426,8 +438,8 @@ } break; default: - LOGP(DPCU, LOGL_ERROR, "Received PCU data request with " - "unsupported sapi %d\n", data_req->sapi); + LOGP(DPCU, LOGL_ERROR, "Received PCU data request for " + "unsupported channel (sapi=%d)\n", data_req->sapi); rc = -EINVAL; } -- To view, visit https://gerrit.osmocom.org/2066 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:40 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:40 +0000 Subject: [PATCH] openbsc[master]: pcu_sock: reorganize calculation of paging group Message-ID: Review at https://gerrit.osmocom.org/2067 pcu_sock: reorganize calculation of paging group pcu_sock.c:pcu_rx_data_req() needs to calculate the paging group at two positions, this commit adds a functions for that to avoid code duplication Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b --- M openbsc/src/libbsc/pcu_sock.c 1 file changed, 23 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/67/2067/1 diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index 7f9119f..ac14ba2 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -353,14 +353,30 @@ return rc; } +/* Helper function for pcu_rx_data_req() to extract paging group info */ +static uint8_t extract_paging_group(struct gsm_bts *bts, uint8_t *data) +{ + char imsi_digit_buf[4]; + uint8_t pag_grp; + + /* the first three bytes are the last three digits of + * the IMSI, which we need to compute the paging group */ + imsi_digit_buf[0] = data[0]; + imsi_digit_buf[1] = data[1]; + imsi_digit_buf[2] = data[2]; + imsi_digit_buf[3] = '\0'; + + pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, + str_to_imsi(imsi_digit_buf)); + + return pag_grp; +} + + static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type, struct gsm_pcu_if_data *data_req) { - uint8_t is_ptcch; - struct gsm_bts_trx *trx; - struct gsm_bts_trx_ts *ts; struct msgb *msg; - char imsi_digit_buf[4]; uint32_t tlli = -1; uint8_t pag_grp; int rc = 0; @@ -372,15 +388,7 @@ switch (data_req->sapi) { case PCU_IF_SAPI_PCH: - /* the first three bytes are the last three digits of - * the IMSI, which we need to compute the paging group */ - imsi_digit_buf[0] = data_req->data[0]; - imsi_digit_buf[1] = data_req->data[1]; - imsi_digit_buf[2] = data_req->data[2]; - imsi_digit_buf[3] = '\0'; - LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s\n", imsi_digit_buf); - pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, - str_to_imsi(imsi_digit_buf)); + pag_grp = extract_paging_group(bts,data_req->data); pcu_rx_rr_paging(bts, pag_grp, data_req->data+3); break; case PCU_IF_SAPI_AGCH: @@ -406,16 +414,9 @@ "invalid/small length %d\n", data_req->len); break; } - tlli = *((uint32_t *)data_req->data); - /* the first three bytes are the last three digits of - * the IMSI, which we need to compute the paging group */ - imsi_digit_buf[0] = data_req->data[4]; - imsi_digit_buf[1] = data_req->data[5]; - imsi_digit_buf[2] = data_req->data[6]; - imsi_digit_buf[3] = '\0'; - pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc, - str_to_imsi(imsi_digit_buf)); + memcpy(&tlli, data_req->data, sizeof(tlli)); + pag_grp = extract_paging_group(bts,data_req->data+4); msg = msgb_alloc(data_req->len - 7, "pcu_pch"); if (!msg) { -- To view, visit https://gerrit.osmocom.org/2067 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:41 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:41 +0000 Subject: [PATCH] openbsc[master]: abis_rsl: fix off-by-one length check when parsing ericson t... Message-ID: Review at https://gerrit.osmocom.org/2068 abis_rsl: fix off-by-one length check when parsing ericson tlli field Change-Id: I658f6d82a67944345ddda5534fa996dca9e990ab --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/68/2068/1 diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index ba52c09..e494229 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -2038,7 +2038,7 @@ /* FIXME: Replace the messy message parsing below * with proper TV parser */ LOGP(DRSL, LOGL_INFO, "IMM.ass sent\n"); - if(msg->len < 8) + if(msg->len < 9) LOGP(DRSL, LOGL_ERROR, "short IMM.ass sent message!\n"); else if(msg->data[4] != 0xf1) LOGP(DRSL, LOGL_ERROR, "unsupported IMM.ass message format! (please fix)\n"); -- To view, visit https://gerrit.osmocom.org/2068 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I658f6d82a67944345ddda5534fa996dca9e990ab Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 14:41:41 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Tue, 14 Mar 2017 14:41:41 +0000 Subject: [PATCH] openbsc[master]: abis_rsl: use msgb_pull to parse tlli from msg Message-ID: Review at https://gerrit.osmocom.org/2069 abis_rsl: use msgb_pull to parse tlli from msg Change-Id: I971bf6c8821689f9d8a1294a9b3bf1af9c4091f7 --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 2 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/69/2069/1 diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index e494229..52c231d 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -2043,10 +2043,8 @@ else if(msg->data[4] != 0xf1) LOGP(DRSL, LOGL_ERROR, "unsupported IMM.ass message format! (please fix)\n"); else { - tlli = msg->data[8]; - tlli |= msg->data[7] << 8; - tlli |= msg->data[6] << 16; - tlli |= msg->data[5] << 24; + msgb_pull(msg, 5); /* drop previous data to use msg_pull_u32 */ + tlli = msgb_pull_u32(msg); pcu_tx_imm_ass_sent(sign_link->trx->bts, tlli); } break; -- To view, visit https://gerrit.osmocom.org/2069 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I971bf6c8821689f9d8a1294a9b3bf1af9c4091f7 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:02:36 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:02:36 +0000 Subject: [PATCH] openbsc[master]: Install shared headers Message-ID: Review at https://gerrit.osmocom.org/2070 Install shared headers Both our CI scripts and .deb packaging takes special care to install shared headers which are marked as noinst. Let's just install them as part of "make install" to make it more straightforward. Change-Id: Ib76033b1d9f5faf7a00e4b926ce309528ed53dd7 --- M openbsc/include/openbsc/Makefile.am 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/70/2070/1 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 7ddf323..4ac0845 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -15,7 +15,6 @@ bts_ipaccess_nanobts_omlattr.h \ chan_alloc.h \ common_bsc.h \ - common_cs.h \ crc24.h \ ctrl.h \ db.h \ @@ -38,7 +37,6 @@ gsm_04_11.h \ gsm_04_80.h \ gsm_data.h \ - gsm_data_shared.h \ gsm_subscriber.h \ gsup_client.h \ gtphub.h \ @@ -89,6 +87,8 @@ openbsc_HEADERS = \ bsc_api.h \ + gsm_data_shared.h \ + common_cs.h \ gsm_04_08.h \ meas_rep.h \ $(NULL) -- To view, visit https://gerrit.osmocom.org/2070 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib76033b1d9f5faf7a00e4b926ce309528ed53dd7 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:03:32 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:03:32 +0000 Subject: [PATCH] osmo-pcu[master]: Add support for sending OML Alerts via BTS Message-ID: Review at https://gerrit.osmocom.org/2071 Add support for sending OML Alerts via BTS * extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 --- M include/osmocom/pcu/pcuif_proto.h M src/encoding.cpp M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_l1_if.h 5 files changed, 57 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/71/2071/1 diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h index 944f364..5ed7f1a 100644 --- a/include/osmocom/pcu/pcuif_proto.h +++ b/include/osmocom/pcu/pcuif_proto.h @@ -3,7 +3,8 @@ #include -#define PCU_IF_VERSION 0x07 +#define PCU_IF_VERSION 0x08 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -15,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -41,6 +43,16 @@ #define PCU_IF_FLAG_MCS7 (1 << 26) #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) + +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); struct gsm_pcu_if_data { uint8_t sapi; @@ -150,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; diff --git a/src/encoding.cpp b/src/encoding.cpp index ea38b77..b07e8e7 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -377,6 +377,8 @@ if ((wp % 8)) { LOGP(DRLCMACUL, LOGL_ERROR, "Length of IMM.ASS without rest " "octets is not multiple of 8 bits, PLEASE FIX!\n"); + pcu_tx_txt_ind(PCU_OML_ALERT, "PCU: length of IMM.ASS without " + "rest octets is not multiple of 8 bits, exiting."); exit (0); } plen = wp / 8; @@ -621,6 +623,8 @@ if ((wp % 8)) { LOGP(DRLCMACUL, LOGL_ERROR, "Length of PAG.REQ without rest " "octets is not multiple of 8 bits, PLEASE FIX!\n"); + pcu_tx_txt_ind(PCU_OML_ALERT, "PCU: length of PAG.REQ without " + "rest octets is not multiple of 8 bits, exiting."); exit (0); } plen = wp / 8; diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index d542b66..9efd7d0 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -287,6 +287,9 @@ pcu_sock_state = state; + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_OML_ALERT, "PCU: version %s", PACKAGE_VERSION); + return 0; } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index b892597..da66e32 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -73,6 +73,39 @@ return msg; } +const struct value_string gsm_pcu_if_text_type_names[] = { + OSMO_VALUE_STRING(PCU_VERSION), + OSMO_VALUE_STRING(PCU_OML_ALERT), + { 0, NULL } +}; + +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...) +{ + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_txt_ind *txt; + va_list ap; + char *rep; + struct msgb *msg = pcu_msgb_alloc(PCU_IF_MSG_TXT_IND, 0); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->data; + txt = &pcu_prim->u.txt_ind; + txt->type = t; + + va_start(ap, fmt); + rep = talloc_vasprintf(tall_pcu_ctx, fmt, ap); + va_end(ap); + + osmo_strlcpy(txt->text, rep, TXT_MAX_LEN); + talloc_free(rep); + + LOGP(DL1IF, LOGL_INFO, "Sending %s TXT as %s to BTS\n", txt->text, + get_value_string(gsm_pcu_if_text_type_names, t)); + + return pcu_sock_send(msg); +} + static int pcu_tx_act_req(uint8_t trx, uint8_t ts, uint8_t activate) { struct msgb *msg; diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index eaa0143..1618260 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef __cplusplus } #endif @@ -131,6 +132,8 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi); +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...); + int pcu_l1if_open(void); void pcu_l1if_close(void); -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:17:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:17:58 +0000 Subject: [PATCH] openbsc[master]: examples: remove logging level * everything Message-ID: Review at https://gerrit.osmocom.org/2072 examples: remove logging level * everything Option "logging level ... everything" is broken for quite some time and might be deprecated in future. Replace it with "logging level ... debug" in config examples. Change-Id: I828ef7671b4fb38717526a18ff8e9a5428cd511e Related: OS#71 --- M openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg M openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg 2 files changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/72/2072/1 diff --git a/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg b/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg index 2e00bc2..6b48e97 100644 --- a/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg +++ b/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg @@ -6,7 +6,7 @@ logging filter all 1 logging color 1 logging timestamp 0 - logging level all everything + logging level all debug logging level rll notice logging level cc notice logging level mm notice @@ -22,14 +22,14 @@ logging level ho notice logging level db notice logging level ref notice - logging level gprs everything + logging level gprs debug logging level ns info - logging level bssgp everything - logging level llc everything - logging level sndcp everything + logging level bssgp debug + logging level llc debug + logging level sndcp debug logging level nat notice logging level ctrl notice - logging level smpp everything + logging level smpp debug logging level lglobal notice logging level llapd notice logging level linp notice diff --git a/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg b/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg index 566258e..15fd74a 100644 --- a/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg +++ b/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg @@ -6,7 +6,7 @@ logging filter all 1 logging color 1 logging timestamp 0 - logging level all everything + logging level all debug logging level gprs debug logging level ns info logging level bssgp debug -- To view, visit https://gerrit.osmocom.org/2072 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I828ef7671b4fb38717526a18ff8e9a5428cd511e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:20:23 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:20:23 +0000 Subject: openbsc[master]: pcu_sock: Send non-NULL hLayer1 to PCU In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2060/1/openbsc/src/libbsc/pcu_sock.c File openbsc/src/libbsc/pcu_sock.c: Line 226: info_ind->trx[i].hlayer1 = 0x2342; I think this deserves detailed comment next to it, otherwise it looks like confusing magic number out of nowhere. -- To view, visit https://gerrit.osmocom.org/2060 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8170bd4134904702b6b272e496100361ba473cbc Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:23:03 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:23:03 +0000 Subject: openbsc[master]: pcu_sock: add basic pcu interface support In-Reply-To: References: Message-ID: Patch Set 1: Can we use shared header installed by osmo-pcu similar to #1258? -- To view, visit https://gerrit.osmocom.org/2056 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:45:05 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 15:45:05 +0000 Subject: [PATCH] osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Hello Max, Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2023 to look at the new patch set (#2). l1sap: fix rach reason (ra) parsing The ra parameter indicates the reason for the received rach request. osmo-bts uses the ra parameter to determine if the received rach request is packet access related. If yes, osmo-bts will forward the request to the PCU. In order to determine if the ra is packet related or not, the higher 4 bits must be equel to 0x7 and at least one of the lower 4 bits must be zero. The current method lacks checking of the lower 4 bits. It would also accept 0b01111111, which is reserved for future use. This commit extends the check to take also the last 4 bits into accound. See also: 3GPP TS 04.08, Table 9.9 Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 --- M include/osmo-bts/l1sap.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/23/2023/2 diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index dcebc1d..0e56406 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -24,7 +24,7 @@ #define L1SAP_IS_CHAN_AGCH_PCH(chan_nr) ((chan_nr & 0xf8) == 0x90) /* rach type from ra */ -#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70) +#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70 && (ra & 0x0f) != 0x0f) /* CCCH block from frame number */ #define L1SAP_FN2CCCHBLOCK(fn) ((fn % 51) / 5 - 1) -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:48:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:48:58 +0000 Subject: openbsc[master]: pcu_sock: Don't re-implement core functionality like gsm_bts... In-Reply-To: References: Message-ID: Patch Set 1: Corresponding commit in OsmoBTS is a1b891aab4a250ef12ed6c1cd2a331a272b4d65c. Is there any way we could share more code between those? Maybe the same way gsm_data_shared.* is used by OsmoBTS? -- To view, visit https://gerrit.osmocom.org/2057 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5ea506c8240dac124ccf5522d02ba18e4f0cb90d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 15:52:23 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 15:52:23 +0000 Subject: osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 16:08:25 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 16:08:25 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: fix arrow tips in flow diagrams In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2022 to look at the new patch set (#3). osmo-sgsn: fix arrow tips in flow diagrams Change-Id: I7faa0c97ee3705a64289a47bc63f311d05f988b3 --- M OsmoSGSN/chapters/gsup.adoc 1 file changed, 37 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/22/2022/3 diff --git a/OsmoSGSN/chapters/gsup.adoc b/OsmoSGSN/chapters/gsup.adoc index 45c0e1d..f496b84 100644 --- a/OsmoSGSN/chapters/gsup.adoc +++ b/OsmoSGSN/chapters/gsup.adoc @@ -65,8 +65,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; - Peer -> SGSN [label="SEND AUTHENTICATION INFO RESPONSE (Tuples)"]; + SGSN => Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; + Peer => SGSN [label="SEND AUTHENTICATION INFO RESPONSE (Tuples)"]; } ---- @@ -77,8 +77,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; - Peer -> SGSN [label="SEND AUTHENTICATION INFO ERROR (Cause)"]; + SGSN => Peer [label="SEND AUTHENTICATION INFO REQUEST (IMSI)"]; + Peer => SGSN [label="SEND AUTHENTICATION INFO ERROR (Cause)"]; } ---- @@ -94,7 +94,7 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="AUTHENTICATION FAILURE REPORT (IMSI)"]; + SGSN => Peer [label="AUTHENTICATION FAILURE REPORT (IMSI)"]; } ---- @@ -115,10 +115,10 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; - Peer -> SGSN [label="INSERT SUBSCRIBER DATA"]; - SGSN -> Peer [label="INSERT SUBSCRIBER DATA ACK"]; - Peer -> SGSN [label="UPDATE LOCATTION RESULT"]; + SGSN => Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; + Peer => SGSN [label="INSERT SUBSCRIBER DATA"]; + SGSN => Peer [label="INSERT SUBSCRIBER DATA ACK"]; + Peer => SGSN [label="UPDATE LOCATTION RESULT"]; } ---- @@ -129,8 +129,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; - Peer -> SGSN [label="UPDATE LOCATTION ERROR (Cause)"]; + SGSN => Peer [label="UPDATE LOCATION REQUEST (IMSI)"]; + Peer => SGSN [label="UPDATE LOCATTION ERROR (Cause)"]; } ---- @@ -146,8 +146,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - Peer -> SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; - SGSN -> Peer [label="CANCEL LOCATION RESULT"]; + Peer => SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; + SGSN => Peer [label="CANCEL LOCATION RESULT"]; } ---- @@ -158,8 +158,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - Peer -> SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; - SGSN -> Peer [label="CANCEL LOCATION ERROR (Cause)"]; + Peer => SGSN [label="CANCEL LOCATION REQUEST (IMSI)"]; + SGSN => Peer [label="CANCEL LOCATION ERROR (Cause)"]; } ---- @@ -176,8 +176,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - SGSN -> Peer [label="PURGE MS REQUEST (IMSI)"]; - Peer -> SGSN [label="PURGE MS RESULT"]; + SGSN => Peer [label="PURGE MS REQUEST (IMSI)"]; + Peer => SGSN [label="PURGE MS RESULT"]; } ---- @@ -195,8 +195,8 @@ hscale="1.5"; SGSN [label="SGSN"], Peer [label="Network Peer (HLR)"]; - Peer -> SGSN [label="DELETE SUBSCRIBER DATA REQUEST (IMSI)"]; - SGSN -> Peer [label="DELETE SUBSCRIBER DATA RESULT"]; + Peer => SGSN [label="DELETE SUBSCRIBER DATA REQUEST (IMSI)"]; + SGSN => Peer [label="DELETE SUBSCRIBER DATA RESULT"]; } ---- @@ -221,7 +221,7 @@ ==== Send Authentication Info Request -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -239,7 +239,7 @@ ==== Send Authentication Info Error -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -251,7 +251,7 @@ ==== Send Authentication Info Response -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -263,7 +263,7 @@ ==== Authentication Failure Report -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -275,7 +275,7 @@ ==== Update Location Request -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -287,7 +287,7 @@ ==== Update Location Error -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -299,7 +299,7 @@ ==== Update Location Result -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -316,7 +316,7 @@ ==== Location Cancellation Request -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -329,7 +329,7 @@ ==== Location Cancellation Result -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -341,7 +341,7 @@ ==== Purge MS Request -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -354,7 +354,7 @@ ==== Purge MS Error -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -366,7 +366,7 @@ ==== Purge MS Result -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -378,7 +378,7 @@ ==== Insert Subscriber Data Request -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -396,7 +396,7 @@ ==== Insert Subscriber Data Error -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -408,7 +408,7 @@ ==== Insert Subscriber Data Result -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -419,7 +419,7 @@ ==== Delete Subscriber Data Request -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -432,7 +432,7 @@ ==== Delete Subscriber Data Error -Direction: SGSN -> Network peer +Direction: SGSN => Network peer [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== @@ -444,7 +444,7 @@ ==== Delete Subscriber Data Result -Direction: Network peer -> SGSN +Direction: Network peer => SGSN [options="header",cols="5%,20%,45%,10%,10%,10%"] |=== -- To view, visit https://gerrit.osmocom.org/2022 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7faa0c97ee3705a64289a47bc63f311d05f988b3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 16:24:59 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 16:24:59 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: Explain TCP/IP header compression In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2020 to look at the new patch set (#3). osmo-sgsn: Explain TCP/IP header compression The does not mention TCP/IP header compression yet. This commit adds some info about it Change-Id: I98408e72020a474d378e39263a933eb7567de146 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 80 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/20/2020/3 diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index 9551267..22d28dd 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -223,3 +223,83 @@ |pdp-terminate|Forced PDP context termination during MM context release |pdp-free|Release of the PDP context memory |=== + + +=== User traffic compression + +In order to save optimize GPRS bandwith, OsmoSGSN implements header and data +compression schemes. The compression will reduce the packet length in order +to save radio bandwith. + +==== Header compression + +On TCP/IP connections, each packet is prepended with a fairly long TCP/IP +header. The header contains a lot of static information that never changes +throughout the connection. (source and destination address, port numbers etc.) +OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also +known as SLHC. This type of header compression removes the TCP/IP header +entirely and replaces it with a shorter version, that only contains the +information that is absolutely necessary to identify and check the packet. +The receiving part then restores the original header and forwards it to higher +layers. + +*compression rfc1144 passive*:: +TCP/IP header compression has to be actively requested by the modem. The +network will not promote compression by itself. This is the recommended mode +of operation. + +*compression rfc1144 active slots <1-256>*:: +TCP/IP header compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The number of slots is the maximum number +of packet headers per subscriber that can be stored in the codebook. + +.Example: Accept compression if requested: +---- +sgsn + compression rfc1144 passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression rfc1144 active slots 8 +---- + +NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression +scheme. TCP/IP options may render RFC1144 ineffective if variable data is +encoded into the option section of the TCP/IP packet. (e.g. TCP option 8, +Timestamp) + + +==== Data compression + +Data compression works on the raw packet data, including the header part of the +packet. If enabled, header compression is applied before first data compression +is applied. OsmoSGSN implements the V.42bis data compression scheme. + +*compression rfc1144 passive*:: +V42bis data compression has to be actively requested by the modem. The network +will not promote compression by itself. This is the recommended mode of +operation. + +*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*:: +V42bis data compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The direction configures which sides are +allowed to send compressed packets. For most cases, compressing 'both' +directions will be the preferred option. The following to parameters configure +the codebook size by the maxium number ('codewords') and size ('strlen') of +entries. + +.Example: Accept compression if requested: +---- +sgsn + compression v42bis passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression v42bis active direction both codewords 512 strlen 20 +---- -- To view, visit https://gerrit.osmocom.org/2020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I98408e72020a474d378e39263a933eb7567de146 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 16:34:24 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 16:34:24 +0000 Subject: [PATCH] openbsc[master]: cosmetic: Add commandline option to display version Message-ID: Review at https://gerrit.osmocom.org/2073 cosmetic: Add commandline option to display version The -V option to display the Version and the copyright info is missing. Change-Id: I0c848fd42c13f473807caf3478d32c6ce5e43e31 --- M openbsc/src/gprs/sgsn_main.c 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/73/2073/1 diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index 5cdfb31..04f2825 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -195,11 +195,12 @@ {"config-file", 1, 0, 'c'}, {"disable-color", 0, 0, 's'}, {"timestamp", 0, 0, 'T'}, + { "version", 0, 0, 'V' }, {"log-level", 1, 0, 'e'}, {NULL, 0, 0, 0} }; - c = getopt_long(argc, argv, "hd:Dc:sTe:", + c = getopt_long(argc, argv, "hd:Dc:sTVe:", long_options, &option_index); if (c == -1) break; @@ -224,6 +225,10 @@ case 'T': log_set_print_timestamp(osmo_stderr_target, 1); break; + case 'V': + print_version(1); + exit(0); + break; case 'e': log_set_log_level(osmo_stderr_target, atoi(optarg)); break; -- To view, visit https://gerrit.osmocom.org/2073 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0c848fd42c13f473807caf3478d32c6ce5e43e31 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 16:36:19 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 16:36:19 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Remove cut+paste error In-Reply-To: References: Message-ID: Patch Set 3: > hmm, just to mark it for discussion, let me -1 although the patch > in itself is correct and +2able in the current situation. You are right, lets fix it properly. I submitted a patch that adds the -V option to osmo-sgsn. -- To view, visit https://gerrit.osmocom.org/2021 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73b0d042620792b8f2d58572f801410aa964aa25 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 16:36:36 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 16:36:36 +0000 Subject: [ABANDON] osmo-gsm-manuals[master]: osmo-sgsn: Remove cut+paste error In-Reply-To: References: Message-ID: dexter has abandoned this change. Change subject: osmo-sgsn: Remove cut+paste error ...................................................................... Abandoned Fix this properly by adding the -V option to osmo-sgsn -- To view, visit https://gerrit.osmocom.org/2021 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I73b0d042620792b8f2d58572f801410aa964aa25 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 17:19:25 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 17:19:25 +0000 Subject: [MERGED] openbsc[master]: cosmetic: add copyright header to bsc_control.py In-Reply-To: References: Message-ID: dexter has submitted this change and it was merged. Change subject: cosmetic: add copyright header to bsc_control.py ...................................................................... cosmetic: add copyright header to bsc_control.py bsc_control.py lacks a copyright header. This commit adds the copyright header from ipa.py to bsc_control.py. Change-Id: Ie70bf686ee9bb157198e02bf8d946abf56adc82a --- M openbsc/contrib/bsc_control.py 1 file changed, 21 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index 3a7964d..c1b09ce 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,5 +1,26 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- +""" +/* + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +""" from optparse import OptionParser from ipa import Ctrl -- To view, visit https://gerrit.osmocom.org/1893 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie70bf686ee9bb157198e02bf8d946abf56adc82a Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Tue Mar 14 17:37:34 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 17:37:34 +0000 Subject: [PATCH] libosmo-abis[master]: lapd: Reduce N200 (SABM retransmission count) In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2010 to look at the new patch set (#2). lapd: Reduce N200 (SABM retransmission count) N200, which controls the maxium number of LAPD retransmissions, is set to 300. This will cause a long waiting time until LAPD detects a failed link. This commit reduces the retransmission count to 50 in order to get a faster link re-establishment in case of link failure. This patch will only affect the ericsson LAPD profile, all other lapd profiles will not be touched. Change-Id: I4f56f9d00520adc0c0a4497547762cd054030867 --- M src/input/lapd.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/10/2010/2 diff --git a/src/input/lapd.c b/src/input/lapd.c index f5909b4..370697d 100644 --- a/src/input/lapd.c +++ b/src/input/lapd.c @@ -101,12 +101,12 @@ * periodically scanning through all timeslots to find the timeslot * where the bsc is transmitting its sabm frames the normal maximum * retransmission (n200) of 3 is not enough. In order not to miss - * the bts, n200 has been increased to 300, which is an educated + * the bts, n200 has been increased to 50, which is an educated * guess. */ const struct lapd_profile lapd_profile_abis_ericsson = { .k = LAPD_SET_K(2,1), - .n200 = 300, + .n200 = 50, .n201 = 260, .n202 = 0, /* infinite */ .t200_sec = 0, .t200_usec = 300000, -- To view, visit https://gerrit.osmocom.org/2010 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4f56f9d00520adc0c0a4497547762cd054030867 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 17:44:54 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 17:44:54 +0000 Subject: [PATCH] osmo-trx[master]: Add autoconf-archive to dependencies Message-ID: Review at https://gerrit.osmocom.org/2074 Add autoconf-archive to dependencies We use AX_EXT in ./configure for checking CPU features anyway, so it's better to add it as explicit dependency. Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b --- M debian/control 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/74/2074/1 diff --git a/debian/control b/debian/control index d016afa..151aa92 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Maintainer: Ivan Klyuchnikov Build-Depends: debhelper (>= 9), autotools-dev, + autoconf-archive, libdbd-sqlite3, libsqlite3-dev, pkg-config, -- To view, visit https://gerrit.osmocom.org/2074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 14 17:50:31 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 14 Mar 2017 17:50:31 +0000 Subject: [PATCH] osmo-trx[master]: Add autoconf-archive to dependencies In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2074 to look at the new patch set (#2). Add autoconf-archive to dependencies We use AX_EXT in ./configure for checking CPU features anyway, so it's better to add it as explicit dependency. Related: OS#1923 Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b --- M debian/control 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/74/2074/2 diff --git a/debian/control b/debian/control index d016afa..151aa92 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Maintainer: Ivan Klyuchnikov Build-Depends: debhelper (>= 9), autotools-dev, + autoconf-archive, libdbd-sqlite3, libsqlite3-dev, pkg-config, -- To view, visit https://gerrit.osmocom.org/2074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 14 17:57:54 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Tue, 14 Mar 2017 17:57:54 +0000 Subject: [PATCH] libosmo-abis[master]: lapd: log pointer addresses In-Reply-To: References: Message-ID: Hello Max, Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2011 to look at the new patch set (#2). lapd: log pointer addresses Add pointer address output to the sap alloc/free functions in order to track the objects later in the debug output (we have three of them) Change-Id: I9b961d5e36967cfd953551b24696849541257a1c --- M src/input/lapd.c 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/11/2011/2 diff --git a/src/input/lapd.c b/src/input/lapd.c index f5909b4..6d7f426 100644 --- a/src/input/lapd.c +++ b/src/input/lapd.c @@ -229,8 +229,9 @@ if (!sap) return NULL; - LOGP(DLLAPD, LOGL_NOTICE, "LAPD Allocating SAP for SAPI=%u / TEI=%u\n", - sapi, teip->tei); + LOGP(DLLAPD, LOGL_NOTICE, + "LAPD Allocating SAP for SAPI=%u / TEI=%u (dl=%p, sap=%p)\n", + sapi, teip->tei, &sap->dl, sap); sap->sapi = sapi; sap->tei = teip; @@ -266,6 +267,10 @@ /* Free SAP instance, including the datalink */ static void lapd_sap_free(struct lapd_sap *sap) { + LOGP(DLLAPD, LOGL_NOTICE, + "LAPD Freeing SAP for SAPI=%u / TEI=%u (dl=%p, sap=%p)\n", + sap->sapi, sap->tei->tei, &sap->dl, sap); + /* free datalink structures and timers */ lapd_dl_exit(&sap->dl); -- To view, visit https://gerrit.osmocom.org/2011 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9b961d5e36967cfd953551b24696849541257a1c Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Tue Mar 14 18:22:15 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Tue, 14 Mar 2017 18:22:15 +0000 Subject: osmo-trx[master]: Add autoconf-archive to dependencies In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 18:27:25 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Tue, 14 Mar 2017 18:27:25 +0000 Subject: libosmocore[master]: fix wrong return code In-Reply-To: References: Message-ID: Patch Set 1: > Interesting. Does this happen in "real life" scenarios? Can we test > whether this improves a particular use case? It would happen if one calls osmo_daemonize() several times. Up to now I couldn't find any osmocom software that is in danger of doing this. It would also happen if systemd directly starts the daemon, but this is pretty much academical. -- To view, visit https://gerrit.osmocom.org/2046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Thorsten Alteholz Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 18:30:44 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Tue, 14 Mar 2017 18:30:44 +0000 Subject: [PATCH] libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Hello Max, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1628 to look at the new patch set (#4). tests/conv: add GSM 05.03 specific test This change extends the convolutional code test coverage, adding the GSM 05.03 specific test vectors, generated by the conv_gen.py. Inspired by Tom's patch: http://lists.osmocom.org/pipermail/openbsc/2014-April/007364.html Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a --- M .gitignore M tests/Makefile.am A tests/conv/conv_gsm0503_test.c A tests/conv/conv_gsm0503_test.ok M tests/testsuite.at 5 files changed, 229 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/28/1628/4 diff --git a/.gitignore b/.gitignore index ecbcedd..4b198d9 100644 --- a/.gitignore +++ b/.gitignore @@ -121,6 +121,7 @@ include/osmocom/core/crc*gen.h include/osmocom/core/bit*gen.h include/osmocom/gsm/gsm0503.h +tests/conv/gsm0503_test_vectors.c # vi files *.sw? diff --git a/tests/Makefile.am b/tests/Makefile.am index 69e23b1..75c9571 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -15,7 +15,7 @@ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test socket/socket_test \ - coding/coding_test + coding/coding_test conv/conv_gsm0503_test if ENABLE_MSGFILE check_PROGRAMS += msgfile/msgfile_test @@ -60,6 +60,9 @@ conv_conv_test_SOURCES = conv/conv_test.c conv/conv.c conv_conv_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la + +conv_conv_gsm0503_test_SOURCES = conv/conv_gsm0503_test.c conv/conv.c conv/gsm0503_test_vectors.c +conv_conv_gsm0503_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la gsm0808_gsm0808_test_SOURCES = gsm0808/gsm0808_test.c gsm0808_gsm0808_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la @@ -192,9 +195,11 @@ gsup/gsup_test.ok gsup/gsup_test.err \ oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ write_queue/wqueue_test.ok socket/socket_test.ok \ - socket/socket_test.err coding/coding_test.ok + socket/socket_test.err coding/coding_test.ok \ + conv/conv_gsm0503_test.ok -DISTCLEANFILES = atconfig atlocal +DISTCLEANFILES = atconfig atlocal conv/gsm0503_test_vectors.c +BUILT_SOURCES = conv/gsm0503_test_vectors.c TESTSUITE = $(srcdir)/testsuite @@ -214,3 +219,7 @@ $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at mv $@.tmp $@ + +conv/gsm0503_test_vectors.c: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py + $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_vectors gsm \ + --target-path $(builddir)/conv diff --git a/tests/conv/conv_gsm0503_test.c b/tests/conv/conv_gsm0503_test.c new file mode 100644 index 0000000..1b0a724 --- /dev/null +++ b/tests/conv/conv_gsm0503_test.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Forward declaration of GSM 05.03 specific test vectors */ +extern const struct conv_test_vector gsm0503_vectors[]; +extern const int gsm0503_vectors_len; + +int main(int argc, char *argv[]) +{ + int rc, i; + + for (i = 0; i < gsm0503_vectors_len; i++) { + rc = do_check(&gsm0503_vectors[i]); + if (rc) + return rc; + } + + return 0; +} diff --git a/tests/conv/conv_gsm0503_test.ok b/tests/conv/conv_gsm0503_test.ok new file mode 100644 index 0000000..05761f2 --- /dev/null +++ b/tests/conv/conv_gsm0503_test.ok @@ -0,0 +1,183 @@ +[+] Testing: gsm0503_xcch +[.] Input length : ret = 224 exp = 224 -> OK +[.] Output length : ret = 456 exp = 456 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_rach +[.] Input length : ret = 14 exp = 14 -> OK +[.] Output length : ret = 36 exp = 36 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_sch +[.] Input length : ret = 35 exp = 35 -> OK +[.] Output length : ret = 78 exp = 78 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_cs2 +[.] Input length : ret = 290 exp = 290 -> OK +[.] Output length : ret = 456 exp = 456 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_cs3 +[.] Input length : ret = 334 exp = 334 -> OK +[.] Output length : ret = 456 exp = 456 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_12_2 +[.] Input length : ret = 250 exp = 250 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_10_2 +[.] Input length : ret = 210 exp = 210 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_7_95 +[.] Input length : ret = 165 exp = 165 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_7_4 +[.] Input length : ret = 154 exp = 154 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_6_7 +[.] Input length : ret = 140 exp = 140 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_5_9 +[.] Input length : ret = 124 exp = 124 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_5_15 +[.] Input length : ret = 109 exp = 109 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_4_75 +[.] Input length : ret = 101 exp = 101 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_fr +[.] Input length : ret = 185 exp = 185 -> OK +[.] Output length : ret = 378 exp = 378 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_hr +[.] Input length : ret = 98 exp = 98 -> OK +[.] Output length : ret = 211 exp = 211 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_7_95 +[.] Input length : ret = 129 exp = 129 -> OK +[.] Output length : ret = 188 exp = 188 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_7_4 +[.] Input length : ret = 126 exp = 126 -> OK +[.] Output length : ret = 196 exp = 196 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_6_7 +[.] Input length : ret = 116 exp = 116 -> OK +[.] Output length : ret = 200 exp = 200 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_5_9 +[.] Input length : ret = 108 exp = 108 -> OK +[.] Output length : ret = 208 exp = 208 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_5_15 +[.] Input length : ret = 97 exp = 97 -> OK +[.] Output length : ret = 212 exp = 212 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_4_75 +[.] Input length : ret = 89 exp = 89 -> OK +[.] Output length : ret = 212 exp = 212 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_mcs1_dl_hdr +[.] Input length : ret = 36 exp = 36 -> OK +[.] Output length : ret = 108 exp = 108 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_mcs1_ul_hdr +[.] Input length : ret = 39 exp = 39 -> OK +[.] Output length : ret = 117 exp = 117 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK diff --git a/tests/testsuite.at b/tests/testsuite.at index 51050f0..b6d1c71 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -45,6 +45,12 @@ AT_CHECK([$abs_top_builddir/tests/conv/conv_test], [0], [expout]) AT_CLEANUP +AT_SETUP([conv_gsm0503]) +AT_KEYWORDS([conv_gsm0503]) +cat $abs_srcdir/conv/conv_gsm0503_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/conv/conv_gsm0503_test], [0], [expout]) +AT_CLEANUP + AT_SETUP([coding]) AT_KEYWORDS([coding]) cat $abs_srcdir/coding/coding_test.ok > expout -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Tue Mar 14 18:30:45 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Tue, 14 Mar 2017 18:30:45 +0000 Subject: [PATCH] libosmocore[master]: tests/conv: move conv.h to the global include dir Message-ID: Review at https://gerrit.osmocom.org/2075 tests/conv: move conv.h to the global include dir Build from different directory will fail, if there are any generated files, which include the 'conv.h'. So, this change separates headers from sources, allowing to include them from any place. Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 --- M include/Makefile.am R include/osmocom/tests/conv.h M tests/Makefile.am M tests/conv/conv.c M tests/conv/conv_test.c M utils/conv_gen.py 6 files changed, 5 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/2075/1 diff --git a/include/Makefile.am b/include/Makefile.am index f8b1f8f..0609f05 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -139,7 +139,8 @@ noinst_HEADERS = \ osmocom/core/timer_compat.h \ - osmocom/gsm/kasumi.h osmocom/gsm/gea.h + osmocom/gsm/kasumi.h osmocom/gsm/gea.h \ + osmocom/tests/conv.h osmocom/core/bit%gen.h: osmocom/core/bitXXgen.h.tpl $(AM_V_GEN)$(MKDIR_P) $(dir $@) diff --git a/tests/conv/conv.h b/include/osmocom/tests/conv.h similarity index 100% rename from tests/conv/conv.h rename to include/osmocom/tests/conv.h diff --git a/tests/Makefile.am b/tests/Makefile.am index 496ed65..69e23b1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -195,7 +195,6 @@ socket/socket_test.err coding/coding_test.ok DISTCLEANFILES = atconfig atlocal -noinst_HEADERS = conv/conv.h TESTSUITE = $(srcdir)/testsuite diff --git a/tests/conv/conv.c b/tests/conv/conv.c index 7dac155..f192863 100644 --- a/tests/conv/conv.c +++ b/tests/conv/conv.c @@ -6,8 +6,7 @@ #include #include #include - -#include "conv.h" +#include static void fill_random(ubit_t *b, int n) { diff --git a/tests/conv/conv_test.c b/tests/conv/conv_test.c index 131b459..5bb3ff8 100644 --- a/tests/conv/conv_test.c +++ b/tests/conv/conv_test.c @@ -3,8 +3,7 @@ #include #include - -#include "conv.h" +#include /* ------------------------------------------------------------------------ */ /* Test codes */ diff --git a/utils/conv_gen.py b/utils/conv_gen.py index 1ffeb3f..ea804c6 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -343,7 +343,7 @@ for item in inc: f.write("%s\n" % item) f.write("#include \n") - f.write("#include \"conv.h\"\n\n") + f.write("#include \n\n") sys.stderr.write("Generating test vectors...\n") -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Tue Mar 14 18:36:58 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Tue, 14 Mar 2017 18:36:58 +0000 Subject: libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Patch Set 4: > Vadim, can you rebase this to latest master? Done, including (I hope) all notes mentioned by Neels: http://lists.osmocom.org/pipermail/openbsc/2017-March/010396.html -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 21:51:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 21:51:37 +0000 Subject: [PATCH] libosmocore[master]: linuxlist.h: add llist_first/last_entry macros Message-ID: Review at https://gerrit.osmocom.org/2076 linuxlist.h: add llist_first/last_entry macros Copy list_first_entry, list_first_entry_or_null and list_last_entry from current linux kernel's tools/include/linux/list.h and rename to llist_*. Slightly adjust API doc but stay as close to the source as possible. This can replace similar implementations in osmo-bts-octphy's l1_if.c, in openbsc's gtphub.c and in osmo-hlr's gsup_server.c. Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453 --- M include/osmocom/core/linuxlist.h 1 file changed, 30 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/2076/1 diff --git a/include/osmocom/core/linuxlist.h b/include/osmocom/core/linuxlist.h index affa827..7d85077 100644 --- a/include/osmocom/core/linuxlist.h +++ b/include/osmocom/core/linuxlist.h @@ -215,6 +215,36 @@ #define llist_entry(ptr, type, member) \ container_of(ptr, type, member) +/*! \brief Get the first element from a list + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the list_head within the struct. + * + * Note, that list is expected to be not empty. + */ +#define llist_first_entry(ptr, type, member) \ + llist_entry((ptr)->next, type, member) + +/*! \brief Get the last element from a list + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the llist_head within the struct. + * + * Note, that list is expected to be not empty. + */ +#define llist_last_entry(ptr, type, member) \ + llist_entry((ptr)->prev, type, member) + +/*! \brief Get the first element from a list, or NULL + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the list_head within the struct. + * + * Note that if the list is empty, it returns NULL. + */ +#define llist_first_entry_or_null(ptr, type, member) \ + (!llist_empty(ptr) ? llist_first_entry(ptr, type, member) : NULL) + /*! \brief Iterate over a linked list * \param pos The \ref llist_head to use as a loop counter * \param head The head of the list over which to iterate -- To view, visit https://gerrit.osmocom.org/2076 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 14 23:40:33 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 23:40:33 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 please don't merge yet, this *is* the way to go, but in effect this will break some tests (at least in osmo-hlr) and change behavior that might need some patches first to be ready. -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 23:41:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 23:41:08 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-2 (looks like i have to -2 to stop the merge button from going blue.) -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 23:47:20 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 23:47:20 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN increment In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 My intent was to stick with the name from 33.102. My impression was that IND there means the number of bits ... but let me take another look: INDeed, quoting In its binary representation, the sequence number consists of two concatenated parts SQN = SEQ || IND. IND is an index so IND should be the name for the index rather than its size. Thanks for noticing... (marking -1 until next patch set) -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 14 23:48:35 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 14 Mar 2017 23:48:35 +0000 Subject: libosmocore[master]: milenage_test: enhance to verify new SQN increments In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 note to self to adjust naming in the commit log -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:42 +0000 Subject: [PATCH] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2048 to look at the new patch set (#2). osmo_auth_gen_vec: UMTS auth: store last used SQN, not next Prepare for the implementation of splitting SQN increments in SEQ and an IND part; particularly to clearly show where the changes in auth/milenage_test's expectations originate. Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically stores the last used SQN, not the next one to be used. Particularly with the upcoming fix of the SQN scheme, this change is important: the next SQN will depend on which entity asks for it, because each auth consumer may have a particular slot in the IND part of SQN. It does not make sense to store the next SQN, because we will not know which consumer that will be for. The milenage_test has always calculated a tuple for SQN == 34. To account for the increment now happening before calculating a tuple, lower the test_aud->sqn by one to 0x21 == 33, so that it is still calculating for SQN == 34. Because we are no longer incrementing SQN after the tuple is generated, milenage_test's expected output after doing an AUTS resync to 31 changes to the next SQN = 32, the SQN used for the generated tuple. (BTW, a subsequent patch will illustrate AUTS in detail.) osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN will be incremented befor generating the auth vector. Also the SQN remains the same after generating, so SQN output needs less decrementing. Note that the expected output for osmo-auc-gen_test remains unchanged, hence the same input arguments (particularly -s and -A ) still produce the same results. Note: osmo-hlr regression tests will require adjustments when this patch is merged, because it must now pass desired_sqn - 1 instead of just desired_sqn. See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 . Related: OS#1968 Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 --- M src/gsm/auth_milenage.c M tests/auth/milenage_test.c M tests/auth/milenage_test.ok M utils/osmo-auc-gen.c 4 files changed, 18 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/2048/2 diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index 1635ac6..e180762 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -30,10 +30,14 @@ const uint8_t *_rand) { size_t res_len = sizeof(vec->res); + uint64_t next_sqn; uint8_t sqn[6]; int rc; - osmo_store64be_ext(aud->u.umts.sqn, sqn, 6); + /* keep the incremented SQN local until gsm_milenage() succeeded. */ + next_sqn = aud->u.umts.sqn + 1; + + osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, sqn, _rand, vec->autn, vec->ik, vec->ck, vec->res, &res_len); @@ -43,7 +47,9 @@ return rc; vec->auth_types = OSMO_AUTH_TYPE_UMTS | OSMO_AUTH_TYPE_GSM; - aud->u.umts.sqn++; + + /* for storage in the caller's AUC database */ + aud->u.umts.sqn = next_sqn; return 0; } @@ -72,7 +78,7 @@ if (rc < 0) return rc; - aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16); + aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); } diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 187b9ad..405da65 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -36,7 +36,7 @@ .k = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, - .sqn = 0x22, + .sqn = 0x21, }, }; diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 20c47c6..b0eb44b 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: tuple generated with SQN = 33 +AUTS success: tuple generated with SQN = 32 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index 6fa7cec..4e2456a 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -198,6 +198,10 @@ } ul = strtoul(optarg, 0, 10); test_aud.u.umts.sqn = ul; + /* Before calculating the UMTS auth vector, + * osmo_auth_gen_vec() increments the SQN. SQN-1 here + * to end up with the SQN the user requested. */ + test_aud.u.umts.sqn--; break; case 'r': rc = osmo_hexparse(optarg, _rand, sizeof(_rand)); @@ -260,16 +264,14 @@ else { dump_auth_vec(vec); if (test_aud.type == OSMO_AUTH_TYPE_UMTS) - /* After generating, SQN is incremented, so -1 */ - printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn - 1); + printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn); } /* After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does - * aud->u.umts.sqn++, and after vector generation milenage_gen_vec() - * does another ++, so to show SQN.MS we need to -2 */ + * aud->u.umts.sqn++, so to show SQN.MS we need to -1 */ if (auts_is_set) printf("AUTS success: SQN.MS = %" PRIu64 "\n", - test_aud.u.umts.sqn - 2); + test_aud.u.umts.sqn - 1); exit(0); } -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:42 +0000 Subject: [PATCH] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2049 to look at the new patch set (#2). osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf --- M include/osmocom/crypt/auth.h M src/gsm/auth_milenage.c M tests/auth/milenage_test.c 3 files changed, 74 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/2049/2 diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h index 7c6072b..7a27f3b 100644 --- a/include/osmocom/crypt/auth.h +++ b/include/osmocom/crypt/auth.h @@ -39,6 +39,8 @@ uint8_t amf[2]; uint64_t sqn; /*!< sequence number */ int opc_is_op; /*!< is the OPC field OPC (0) or OP (1) ? */ + unsigned int ind_bitlen; /*!< nr of bits not in SEQ, only SQN */ + unsigned int ind; /*!< SQN slot, i.e. (SEQ << ind_bitlen) + ind */ } umts; struct { uint8_t ki[16]; /*!< secret key */ diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index e180762..f151c5e 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -32,10 +32,73 @@ size_t res_len = sizeof(vec->res); uint64_t next_sqn; uint8_t sqn[6]; + uint64_t ind_mask; + uint64_t seq_1; int rc; + /* Determine next SQN, according to 3GPP TS 33.102: + * SQN consists of SEQ and a lower significant part of IND bits: + * + * |----------SEQ------------| + * |------------------------SQN-----------| + * |-----IND----| + * + * The IND part is used as "slots": e.g. a given HLR client will always + * get the same IND part, called ind here, with incrementing SEQ. In + * the USIM, each IND slot enforces that its SEQ are used in ascending + * order -- as long as that constraint is satisfied, the SQN may jump + * forwards and backwards. For example, for ind_bitlen == 5, asking the + * USIM for SQN = 32, 64, 33 is allowed, because 32 and 64 are + * SEQ || (ind == 0), and though 33 is below 64, it is ind == 1 and + * allowed. Not allowed would be 32, 96, 64, because 64 would go + * backwards after 96, both being ind == 0. + * + * From the last used SQN, we want to increment SEQ + 1, and then pick + * the matching IND part. + * + * IND size is suggested in TS 33.102 as 5 bits. SQN is 48 bits long. + * If ind_bitlen is passed too large here, the algorithms will break + * down. But at which point should we return an error? A sane limit + * seems to be ind_bitlen == 10, but to protect against failure, + * limiting ind_bitlen to 28 is enough, 28 being the number of bits + * suggested for the delta in 33.102, which is discussed to still + * require 2^15 > 32000 authentications to wrap the SQN back to the + * start. + * + * Note that if a caller with ind == 1 generates N vectors, the SQN + * stored after this will reflect SEQ + N. If then another caller with + * ind == 2 generates another N vectors, this will then use SEQ + N + * onwards and end up with SEQ + N + N. In other words, most of each + * SEQ's IND slots will remain unused. When looking at SQN being 48 + * bits wide, after dropping ind_bitlen (say 5) from it, we will still + * have a sequence range of 2^43 = 8.8e12, eight trillion sequences, + * which is large enough to not bother further. With the maximum + * ind_bitlen of 28 enforced below, we still get more than 1 million + * sequences, which is also sufficiently large. + * + * An ind_bitlen of zero may be passed from legacy callers that are not + * aware of the IND extension. For these, below algorithm works out as + * before, simply incrementing SQN by 1. + * + * This is also a mechanism for tools like the osmo-auc-gen to directly + * request a given SQN to be used. With ind_bitlen == 0 the caller can + * be sure that this code will increment SQN by exactly one before + * generating a tuple, thus a caller would simply pass + * { .ind_bitlen = 0, .ind = 0, .sqn = (desired_sqn - 1) } + */ + + if (aud->u.umts.ind_bitlen > 28) + return -2; + + seq_1 = 1LL << aud->u.umts.ind_bitlen; + ind_mask = ~(seq_1 - 1); + + /* the ind index must not affect the SEQ part */ + if (aud->u.umts.ind > seq_1) + return -3; + /* keep the incremented SQN local until gsm_milenage() succeeded. */ - next_sqn = aud->u.umts.sqn + 1; + next_sqn = ((aud->u.umts.sqn + seq_1) & ind_mask) + aud->u.umts.ind; osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, @@ -78,6 +141,8 @@ if (rc < 0) return rc; + /* Update our "largest used SQN" from the USIM -- milenage_gen_vec() + * below will increment SQN. */ aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 405da65..d90ef96 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -37,6 +37,8 @@ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, .sqn = 0x21, + .ind_bitlen = 0, + .ind = 0, }, }; @@ -79,6 +81,9 @@ #endif memset(vec, 0, sizeof(*vec)); + /* With IND == 0, this is the legacy mode of incrementing SQN by 1. + * sqn == 0x21 == 33, so the SQN used to generate the vector is + * sqn + 1 == 34. */ rc = osmo_auth_gen_vec(vec, &test_aud, _rand); if (rc < 0) { fprintf(stderr, "error generating auth vector\n"); @@ -90,6 +95,7 @@ const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; + /* Invoking with IND == 0, the next SQN after 31 is 32. */ rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); if (rc < 0) { printf("AUTS failed\n"); -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:42 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: enhance to verify new SQN increments In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2050 to look at the new patch set (#3). milenage_test: enhance to verify new SQN increments After the legacy mode incrementing with ind_bitlen == 0 is through, do another AUTS run with sensible ind_bitlen and ind, and then two more normal vector generations to verify proper SQN increments. Related: OS#1968 Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 31 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/2050/3 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index d90ef96..35d4889 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -104,6 +104,34 @@ test_aud.u.umts.sqn); } + /* Now test SQN incrementing scheme using SEQ and IND parts: + * with ind_bitlen == 5 and ind == 10, the next SQN after 31 is + * 32 + 10 == 42. */ + test_aud.u.umts.ind_bitlen = 5; + test_aud.u.umts.ind = 10; + rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); + if (rc < 0) + printf("AUTS failed\n"); + else + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after that is 64 + 10 == 74 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after *that* is 96 + 10 == 106 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + opc_test(&test_aud); exit(0); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index b0eb44b..5a0a602 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -6,6 +6,9 @@ SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 AUTS success: tuple generated with SQN = 32 +AUTS success: tuple generated with SQN = 42 +tuple generated with SQN = 74 +tuple generated with SQN = 106 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:42 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: cosmetic: verify AUTS in comments In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2051 to look at the new patch set (#3). milenage_test: cosmetic: verify AUTS in comments In a comment and by code #if'd away, illustrate that the AUTS used in the unit test is accurate. Related: OS#1968 Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 --- M tests/auth/milenage_test.c 1 file changed, 56 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/2051/3 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 35d4889..abc4755 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -63,6 +63,15 @@ return rc; } +#define RECALC_AUTS 0 +#if RECALC_AUTS +typedef uint8_t u8; +extern int milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand, + u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar); +extern int milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand, + const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s); +#endif + int main(int argc, char **argv) { struct osmo_auth_vector _vec; @@ -92,6 +101,53 @@ dump_auth_vec(vec); + /* The USIM generates an AUTS to tell us it is at SQN == 31: + * + * SQN_MS = 00000000001f + * + * AUTS = Conc(SQN_MS) || MAC-S + * Conc(SQN_MS) = SQN_MS ? f5*[K](RAND) + * MAC-S = f1*[K] (SQN MS || RAND || AMF) + * + * K = 000102030405060708090a0b0c0d0e0f + * RAND = 00000000000000000000000000000000 + * + * f5*--> Conc(SQN_MS) = SQN_MS ^ f5*(K,RAND) + * = 00000000001f ^ 8711a0ec9e09 + * = 8711a0ec9e16 + * AMF = 0000 (TS 33.102 v7.0.0, 6.3.3) + * MAC-S = f1*[K] (SQN MS || RAND || AMF) + * = f1*[K] (00000000001f || 00000000000000000000000000000000 || 0000) + * = 37df17f80b384ee4 + * + * AUTS = 8711a0ec9e16 || 37df17f80b384ee4 + */ +#if RECALC_AUTS + uint8_t ak[6]; + uint8_t akstar[6]; + uint8_t opc[16]; + uint8_t k[16]; + uint8_t rand[16]; + osmo_hexparse("000102030405060708090a0b0c0d0e0f", k, sizeof(k)); + osmo_hexparse("000102030405060708090a0b0c0d0e0f", opc, sizeof(opc)); + osmo_hexparse("00000000000000000000000000000000", rand, sizeof(rand)); + milenage_f2345(opc, k, rand, NULL, NULL, NULL, ak, akstar); + printf("ak = %s\n", osmo_hexdump_nospc(ak, sizeof(ak))); + printf("akstar = %s\n", osmo_hexdump_nospc(akstar, sizeof(akstar))); + + uint8_t sqn_ms[6] = { 0, 0, 0, 0, 0, 31 }; + uint8_t amf[2] = {}; + uint8_t mac_s[8]; + milenage_f1(opc, k, rand, sqn_ms, amf, NULL, mac_s); + printf("mac_s = %s\n", osmo_hexdump_nospc(mac_s, sizeof(mac_s))); + /* verify valid AUTS resulting in SQN 31 with: + osmo-auc-gen -3 -a milenage -k 000102030405060708090a0b0c0d0e0f \ + -o 000102030405060708090a0b0c0d0e0f \ + -r 00000000000000000000000000000000 \ + -A 8711a0ec9e1637df17f80b384ee4 + */ +#endif + const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; -- To view, visit https://gerrit.osmocom.org/2051 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:42 +0000 Subject: [PATCH] libosmocore[master]: milenage_test: cosmetic fix: shown value is not SEQ.MS In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2047 to look at the new patch set (#2). milenage_test: cosmetic fix: shown value is not SEQ.MS In the milenage_test, the console output printed "SEQ.MS = 33", but 33 is a) the SQN, not SEQ; b) the SQN *after* the next auth generation, i.e. SQN.MS would have been 31. While at it also use the proper PRIu64 from inttypes.h to output the sqn value. This prepares for upcoming sparation of SQN incrementing by SEQ and IND, particularly to clearly show where the changes in auth/milenage_test's expectations originate. Related: OS#1968 Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/2047/2 diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 473be92..187b9ad 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,8 @@ if (rc < 0) { printf("AUTS failed\n"); } else { - printf("AUTS success: SEQ.MS = %llu\n", (unsigned long long)test_aud.u.umts.sqn); + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); } opc_test(&test_aud); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 49146a5..20c47c6 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: SEQ.MS = 33 +AUTS success: tuple generated with SQN = 33 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2047 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:44 +0000 Subject: [PATCH] libosmocore[master]: add osmo-auc-gen_test Message-ID: Review at https://gerrit.osmocom.org/2077 add osmo-auc-gen_test Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN increment scheme changes. The test comprises of a shell script that invokes the osmo-auc-gen binary with various milenage parameters, of which the stdout/stderr are verified. More osmo-auc-gen invocations could be added, but my main focus is on the SEQ changes. Instead of manually testing that it still works for each SQN patch, I want this test to do it for me. Related: OS#1968 Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec --- A tests/osmo-auc-gen/osmo-auc-gen_test.err A tests/osmo-auc-gen/osmo-auc-gen_test.ok A tests/osmo-auc-gen/osmo-auc-gen_test.sh M tests/testsuite.at 4 files changed, 129 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/2077/1 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.err b/tests/osmo-auc-gen/osmo-auc-gen_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.err diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok new file mode 100644 index 0000000..9c2e462 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -0,0 +1,92 @@ + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 0 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47b0000716ce00883bc39e1 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47a000058508ab3864e26a0 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c46c0000e74d796ec095dbee +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 1dc4f974325cce611e54f516dc1fec56 +AUTN: 434a46a71aeb0000fedc563f27a0916c +IK: d7213dd74860ccb8c14e54c0c4abc91c +CK: c350653d72f7a5bac3a27422e5186019 +RES: 912cdfaadd7b0154 +SRES: 4c57defe +Kc: 169d78081b24c007 + + +> osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 2a48162ff3edca4adf0b7b5e527d6c16 +AUTN: bfbf3332c91e0000d6199cad31d15f26 +IK: 191a93c4396113bff6939d4f98e169a6 +CK: 9c38d9089265ed5ea164e190a65c200d +RES: fd40205be2c9c7b2 +SRES: 1f89e7e9 +Kc: d2d5361395b9b74a + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: afb993e4f4b8000069cdeebb4a4b5b58 +IK: c348c2fe2f3e1fb37a7ae1638163bd98 +CK: e740c156278705a14e1a99ba6d31334f +RES: 7c04e86a67967fcd +SRES: 1b9297a7 +Kc: 10687b71e4eb94c5 + + +> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 39fa2f4e3d523d8619a73b4f65c3e14d +AUTN: 8704f5ba55eb0000d7fc4f7f19cfc180 +IK: 27497388b6cb044648f396aa155b95ef +CK: f64735036e5871319c679f4742a75ea1 +RES: e229c19e791f2e41 +SRES: 9b36efdf +Kc: 059a4f668f6fbe39 +AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh new file mode 100755 index 0000000..7842638 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh @@ -0,0 +1,30 @@ +#!/bin/sh +osmo_auc_gen="$1" + +set -e + +# run the osmo-auc-gen binary verbosely without showing its absolute path +# for identical expected output everywhere. +invoke() { + echo + echo + echo '>' osmo-auc-gen $@ + $osmo_auc_gen $@ +} + +bytes1="6a61050765caa32c90371370e5d6dc2d" +bytes2="1dc4f974325cce611e54f516dc1fec56" +bytes3="2a48162ff3edca4adf0b7b5e527d6c16" + +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 0 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 1 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 23 +invoke -3 -a milenage -r $bytes2 -k $bytes3 -o $bytes1 -s 42 +invoke -3 -a milenage -r $bytes3 -k $bytes1 -o $bytes2 -s 99 +invoke -3 -a milenage -r $bytes1 -k $bytes3 -o $bytes2 -s 281474976710655 + +k="EB215756028D60E3275E613320AEC880" +opc="FB2A3D1B360F599ABAB99DB8669F8308" +rand="39fa2f4e3d523d8619a73b4f65c3e14d" +auts="979498b1f72d3e28c59fa2e72f9c" +invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts diff --git a/tests/testsuite.at b/tests/testsuite.at index 51050f0..64df724 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -249,3 +249,10 @@ touch experr AT_CHECK([$abs_top_builddir/tests/socket/socket_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([osmo-auc-gen]) +AT_KEYWORDS([osmo-auc-gen]) +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.ok > expout +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.err > experr +AT_CHECK([$abs_top_srcdir/tests/osmo-auc-gen/osmo-auc-gen_test.sh $abs_top_builddir/utils/osmo-auc-gen], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2077 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:37:45 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:37:45 +0000 Subject: [PATCH] libosmocore[master]: osmo-auc-gen: clarify SQN output, prepare for SQN changes Message-ID: Review at https://gerrit.osmocom.org/2078 osmo-auc-gen: clarify SQN output, prepare for SQN changes Upcoming patches will change the way SQN are incremented. Change the SQN related output by osmo-auc-gen so that it also makes sense after these changes, and so that its output is proven to remain unchanged for the same arguments: Always show the SQN used for vector generation when a UMTS vector was generated. Don't show the next SQN, it will not make sense anymore (see later patches). The adjustments of expected output of osmo-auc-gen_test illustrates how the output changes. Related: OS#1968 Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c --- M tests/osmo-auc-gen/osmo-auc-gen_test.ok M utils/osmo-auc-gen.c 2 files changed, 18 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/2078/1 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok index 9c2e462..fb7998f 100644 --- a/tests/osmo-auc-gen/osmo-auc-gen_test.ok +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -11,6 +11,7 @@ RES: f511d3a7f06e6a30 SRES: 057fb997 Kc: 60524000cc5e5407 +SQN: 0 > osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1 @@ -24,6 +25,7 @@ RES: f511d3a7f06e6a30 SRES: 057fb997 Kc: 60524000cc5e5407 +SQN: 1 > osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23 @@ -37,6 +39,7 @@ RES: f511d3a7f06e6a30 SRES: 057fb997 Kc: 60524000cc5e5407 +SQN: 23 > osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42 @@ -50,6 +53,7 @@ RES: 912cdfaadd7b0154 SRES: 4c57defe Kc: 169d78081b24c007 +SQN: 42 > osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99 @@ -63,6 +67,7 @@ RES: fd40205be2c9c7b2 SRES: 1f89e7e9 Kc: d2d5361395b9b74a +SQN: 99 > osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655 @@ -76,6 +81,7 @@ RES: 7c04e86a67967fcd SRES: 1b9297a7 Kc: 10687b71e4eb94c5 +SQN: 281474976710655 > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c @@ -89,4 +95,5 @@ RES: e229c19e791f2e41 SRES: 9b36efdf Kc: 059a4f668f6fbe39 -AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 +SQN: 24 +AUTS success: SQN.MS = 23 diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index f0cfa79..6fa7cec 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -257,24 +257,19 @@ if (fmt_triplets_dat) dump_triplets_dat(vec); - else + else { dump_auth_vec(vec); + if (test_aud.type == OSMO_AUTH_TYPE_UMTS) + /* After generating, SQN is incremented, so -1 */ + printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn - 1); + } - /* Print SQN from AUTS. It makes sense to print actually three SQN - * to clarify: - * After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does: - * aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16); - * Then calls milenage_gen_vec(), which, after it is done, does: - * aud->u.umts.sqn++; - */ + /* After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does + * aud->u.umts.sqn++, and after vector generation milenage_gen_vec() + * does another ++, so to show SQN.MS we need to -2 */ if (auts_is_set) - printf("AUTS success: SQN.MS = %" PRIu64 - ", generated vector with SQN = %" PRIu64 - ", next SQN = %" PRIu64 "\n", - test_aud.u.umts.sqn - 2, - test_aud.u.umts.sqn - 1, - test_aud.u.umts.sqn - ); + printf("AUTS success: SQN.MS = %" PRIu64 "\n", + test_aud.u.umts.sqn - 2); exit(0); } -- To view, visit https://gerrit.osmocom.org/2078 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:39:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:39:53 +0000 Subject: [PATCH] osmo-hlr[master]: auc tests: adjust cosmetically to prepare for SQN changes Message-ID: Review at https://gerrit.osmocom.org/2079 auc tests: adjust cosmetically to prepare for SQN changes The current auc tests test a lot with SQN == 0. An upcoming change in the SQN algorithms from libosmocore [1] will require us to pass desired_sqn - 1, because the tuple generation will increment the SQN before calculating. Later on [2] we will also want to employ ind_bits and ind in the test. In order to have some room in the number range, cosmetically adjust the current SQN tested for from 0 to 32, changing the generated AUTN. The upcoming adjustment to the new situation will then be able to show that only the SQN values before and after vector generation change while the auth tuples as well as the SQNs used for generation remain the same (without having to trick around with wrapping SQN past its maximum value). Note that the TS 55.205 test sets include neither SQN nor AUTN. While AUTN changes with changing SQN, all the other values are invariant of the SQN used. So we can simply choose a different SQN and ignore the difference in the AUTN. [1] change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 "store last sqn" [2] change-id Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf "fix SQN increment" Related: OS#1969 Change-Id: I45d1866cde1b3e777460df76100af2fe4767c678 --- M tests/auc/Makefile.am M tests/auc/auc_test.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err M tests/auc/gen_ts_55_205_test_sets/func_template.c 5 files changed, 118 insertions(+), 93 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/79/2079/1 diff --git a/tests/auc/Makefile.am b/tests/auc/Makefile.am index b3c20f2..88532bf 100644 --- a/tests/auc/Makefile.am +++ b/tests/auc/Makefile.am @@ -53,3 +53,7 @@ auc_ts_55_205_test_sets.c: $(top_srcdir)/tests/auc/gen_ts_55_205_test_sets/* $(top_srcdir)/tests/auc/gen_ts_55_205_test_sets/pdftxt_2_c.py > $@ +.PHONY: update_exp +update_exp: + $(builddir)/auc_test >"$(srcdir)/auc_test.ok" 2>"$(srcdir)/auc_test.err" + $(builddir)/auc_ts_55_205_test_sets >"$(srcdir)/auc_ts_55_205_test_sets.ok" 2>"$(srcdir)/auc_ts_55_205_test_sets.err" diff --git a/tests/auc/auc_test.c b/tests/auc/auc_test.c index 16c87f7..e507c29 100644 --- a/tests/auc/auc_test.c +++ b/tests/auc/auc_test.c @@ -194,6 +194,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, + .u.umts.sqn = 32, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -203,13 +204,14 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -219,19 +221,17 @@ " auth_types: 03000000\n" ); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); - /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 0; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + aud3g.u.umts.sqn = 32; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -301,6 +301,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, + .u.umts.sqn = 32, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -310,13 +311,14 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -336,19 +338,17 @@ * hence expecting kc: 059a4f668f6fbe39 */ - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); - /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 0; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + aud3g.u.umts.sqn = 32; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -361,8 +361,8 @@ fprintf(stderr, "- test AUTS resync\n"); vec = (struct osmo_auth_vector){}; - aud3g.u.umts.sqn = 0; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + aud3g.u.umts.sqn = 32; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); /* The AUTN sent was 8704f5ba55f30000d2ee44b22c8ea919 * with the first 6 bytes being SQN ^ AK. diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index aff96c9..51f176c 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -22,14 +22,14 @@ ===== test_gen_vectors_2g_plus_3g -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -39,16 +39,16 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations -aud3g.u.umts.sqn == 1 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -58,19 +58,19 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_gen_vectors_2g_plus_3g: SUCCESS ===== test_gen_vectors_3g_only -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -79,15 +79,15 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations -aud3g.u.umts.sqn == 1 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -96,10 +96,10 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 1 +aud3g.u.umts.sqn == 33 vector matches expectations - test AUTS resync -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 8bedf46..9a9aaf5 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -1,12 +1,12 @@ ===== test_set_1 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = aa689c64837000000eed35e2ae9e21c0 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 DAUC vector [0]: res = a54211d5e3ba50bf0000000000000000 @@ -15,18 +15,19 @@ DAUC vector [0]: sres = 46f8416a DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_1: SUCCESS ===== test_set_2 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 33484dc2136b00009abcd7740cfa799c +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b DAUC vector [0]: res = 8011c48c0c214ed20000000000000000 @@ -35,18 +36,19 @@ DAUC vector [0]: sres = 8c308a5e DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_2: SUCCESS ===== test_set_3 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = f0b9c08ad02e00001b5ca3e1240212be +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b DAUC vector [0]: res = f365cd683cd92e960000000000000000 @@ -55,18 +57,19 @@ DAUC vector [0]: sres = cfbce3fe DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_3: SUCCESS ===== test_set_4 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 31e11a6091180000f55f5c8adb793014 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 DAUC vector [0]: res = 5860fc1bce351e7e0000000000000000 @@ -75,18 +78,19 @@ DAUC vector [0]: sres = 9655e265 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_4: SUCCESS ===== test_set_5 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 45b0f69ab06c0000a161b2de788f3b3f +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 DAUC vector [0]: res = 16c8233f05a0ac280000000000000000 @@ -95,18 +99,19 @@ DAUC vector [0]: sres = 13688f17 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_5: SUCCESS ===== test_set_6 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 7e6455f34cf3000040dc9568192ab1c0 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 DAUC vector [0]: res = 8c25a16cd918a1df0000000000000000 @@ -115,18 +120,19 @@ DAUC vector [0]: sres = 553d00b3 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_6: SUCCESS ===== test_set_7 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 88196c47986f000075c2ba7455852c2a +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 DAUC vector [0]: res = a63241e1ffc3e5ab0000000000000000 @@ -135,18 +141,19 @@ DAUC vector [0]: sres = 59f1a44a DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_7: SUCCESS ===== test_set_8 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 82a0f5287a71000023563512500d75d9 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e DAUC vector [0]: res = 4a90b2171ac83a760000000000000000 @@ -155,18 +162,19 @@ DAUC vector [0]: sres = 50588861 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_8: SUCCESS ===== test_set_9 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = a2f858aa9e5d0000bdd79d9f7c269d1c +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 DAUC vector [0]: res = 4bc2212d8624910a0000000000000000 @@ -175,18 +183,19 @@ DAUC vector [0]: sres = cde6b027 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_9: SUCCESS ===== test_set_10 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 4c539a26e1fa000059e7ec99b51f33f3 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd DAUC vector [0]: res = 6fc30fee6d1235230000000000000000 @@ -195,18 +204,19 @@ DAUC vector [0]: sres = 02d13acd DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_10: SUCCESS ===== test_set_11 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 30ff25cdadf600003991f8e7e72a5948 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 DAUC vector [0]: res = aefa357beac2a87a0000000000000000 @@ -215,18 +225,19 @@ DAUC vector [0]: sres = 44389d01 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_11: SUCCESS ===== test_set_12 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 5380d158cfe30000fd10b1f261e825c3 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 DAUC vector [0]: res = 98dbbd099b3b408d0000000000000000 @@ -235,18 +246,19 @@ DAUC vector [0]: sres = 03e0fd84 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_12: SUCCESS ===== test_set_13 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 217af49272ad0000cc1d4642c4476641 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 217af492728d00003bd338249751de80 DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a DAUC vector [0]: res = af4a411e1139f2c20000000000000000 @@ -255,18 +267,19 @@ DAUC vector [0]: sres = be73b3dc DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_13: SUCCESS ===== test_set_14 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 837fd7b744190000e4ae3648e1c7770b +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 DAUC vector [0]: res = 7bffa5c2f41fbc050000000000000000 @@ -275,18 +288,19 @@ DAUC vector [0]: sres = 8fe019c7 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_14: SUCCESS ===== test_set_15 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 5be11495525d00008538a96619c04b01 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 DAUC vector [0]: res = 7e3f44c7591f6f450000000000000000 @@ -295,18 +309,19 @@ DAUC vector [0]: sres = 27202b82 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_15: SUCCESS ===== test_set_16 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 1c408a858b3e0000956596c6cd632f0f +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 DAUC vector [0]: res = 70f6bdb9ad21525f0000000000000000 @@ -315,18 +330,19 @@ DAUC vector [0]: sres = ddd7efe6 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_16: SUCCESS ===== test_set_17 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = aefdaa5ddd9900003bf0fbdbbc9d8ecc +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 DAUC vector [0]: res = 479dd25c20792d630000000000000000 @@ -335,18 +351,19 @@ DAUC vector [0]: sres = 67e4ff3f DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_17: SUCCESS ===== test_set_18 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = ada15aeb7bb80000f141568691cccaec +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a DAUC vector [0]: res = 28d7b0f2a2ec3de50000000000000000 @@ -355,18 +372,19 @@ DAUC vector [0]: sres = 8a3b8d17 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_18: SUCCESS ===== test_set_19 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 83cfd54db9130000eb5e0ab0a7c030e6 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef DAUC vector [0]: res = a95100e2760952cd0000000000000000 @@ -375,6 +393,7 @@ DAUC vector [0]: sres = df58522f DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_19: SUCCESS diff --git a/tests/auc/gen_ts_55_205_test_sets/func_template.c b/tests/auc/gen_ts_55_205_test_sets/func_template.c index 36926eb..83c5826 100644 --- a/tests/auc/gen_ts_55_205_test_sets/func_template.c +++ b/tests/auc/gen_ts_55_205_test_sets/func_template.c @@ -36,6 +36,7 @@ aud3g = (struct osmo_sub_auth_data){{ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, + .u.umts.sqn = 32, }}; osmo_hexparse("{Ki}", @@ -47,9 +48,10 @@ fake_rand, sizeof(fake_rand)); vec = (struct osmo_auth_vector){{ {{0}} }}; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: {RAND}\n" -- To view, visit https://gerrit.osmocom.org/2079 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I45d1866cde1b3e777460df76100af2fe4767c678 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:39:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:39:53 +0000 Subject: [PATCH] osmo-hlr[master]: auc tests: fix after SQN scheme changes from libosmocore Message-ID: Review at https://gerrit.osmocom.org/2080 auc tests: fix after SQN scheme changes from libosmocore In change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3, libosmocore changes from incrementing SQN after tuple generation to incrementing SQN before tuple generation. Thus we now need to pass desired_sqn - 1 to get the same tuples. Adjust all regression tests, showing that the tuples as well as the SQNs used to generate the tuples remain unchanged, and only the SQN before and after generating reflect different values. Related: OS#1968 OS#1969 Change-Id: I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 --- M tests/auc/auc_test.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err M tests/auc/gen_ts_55_205_test_sets/func_template.c 4 files changed, 106 insertions(+), 107 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/80/2080/1 diff --git a/tests/auc/auc_test.c b/tests/auc/auc_test.c index e507c29..f047a97 100644 --- a/tests/auc/auc_test.c +++ b/tests/auc/auc_test.c @@ -194,7 +194,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, - .u.umts.sqn = 32, + .u.umts.sqn = 31, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -204,10 +204,10 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -223,11 +223,11 @@ /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 32; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + aud3g.u.umts.sqn = 31; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -301,7 +301,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, - .u.umts.sqn = 32, + .u.umts.sqn = 31, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -311,10 +311,10 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -340,11 +340,11 @@ /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 32; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + aud3g.u.umts.sqn = 31; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -361,8 +361,8 @@ fprintf(stderr, "- test AUTS resync\n"); vec = (struct osmo_auth_vector){}; - aud3g.u.umts.sqn = 32; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + aud3g.u.umts.sqn = 31; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); /* The AUTN sent was 8704f5ba55f30000d2ee44b22c8ea919 * with the first 6 bytes being SQN ^ AK. @@ -409,9 +409,8 @@ next_rand("897210a0f7de278f0b8213098e098a3f", true); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, rand_auts, auts); VERBOSE_ASSERT(rc, == 1, "%d"); - /* The USIM's last sqn was 23, the calculated vector was 24, hence the - * next one stored should be 25. */ - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 25, "%"PRIu64); + /* The USIM's last sqn was 23, the calculated vector was 24 */ + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 24, "%"PRIu64); VEC_IS(&vec, " rand: 897210a0f7de278f0b8213098e098a3f\n" @@ -428,19 +427,19 @@ fprintf(stderr, "- verify N vectors with AUTS resync" " == N vectors without AUTS\n" - "First just set rand and sqn = 24, and compute 3 vectors\n"); + "First just set rand and sqn = 23, and compute 3 vectors\n"); next_rand("897210a0f7de278f0b8213098e098a3f", false); - aud3g.u.umts.sqn = 24; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 24, "%"PRIu64); + aud3g.u.umts.sqn = 23; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 23, "%"PRIu64); memset(vecs, 0, sizeof(vecs)); rc = auc_compute_vectors(vecs, 3, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 3, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 27, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 26, "%"PRIu64); _test_gen_vectors_3g_only__expect_vecs(vecs); - fprintf(stderr, "Now reach sqn = 24 with AUTS and expect the same\n"); + fprintf(stderr, "Now reach sqn = 23 with AUTS and expect the same\n"); /* AUTS response by USIM */ osmo_hexparse("979498b1f72d3e28c59fa2e72f9c", auts, sizeof(auts)); diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index 51f176c..bfc046f 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -22,13 +22,13 @@ ===== test_gen_vectors_2g_plus_3g -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -39,15 +39,15 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -58,18 +58,18 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_gen_vectors_2g_plus_3g: SUCCESS ===== test_gen_vectors_3g_only -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -79,14 +79,14 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -96,17 +96,17 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations - test AUTS resync -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 24 +DAUC vector [0]: resync: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -116,16 +116,16 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 25 +aud3g.u.umts.sqn == 24 vector matches expectations - verify N vectors with AUTS resync == N vectors without AUTS -First just set rand and sqn = 24, and compute 3 vectors -aud3g.u.umts.sqn == 24 +First just set rand and sqn = 23, and compute 3 vectors +aud3g.u.umts.sqn == 23 DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f -DAUC vector [0]: sqn = 24 +DAUC vector [0]: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -135,7 +135,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 25 +DAUC vector [1]: sqn = 24 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -145,7 +145,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 26 +DAUC vector [2]: sqn = 25 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 @@ -155,18 +155,18 @@ DAUC vector [2]: sres = cd6f0df5 DAUC vector [2]: auth_types = 0x3 rc == 3 -aud3g.u.umts.sqn == 27 +aud3g.u.umts.sqn == 26 [0]: vector matches expectations [1]: vector matches expectations [2]: vector matches expectations -Now reach sqn = 24 with AUTS and expect the same +Now reach sqn = 23 with AUTS and expect the same DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 24 +DAUC vector [0]: resync: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -176,7 +176,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 25 +DAUC vector [1]: sqn = 24 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -186,7 +186,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 26 +DAUC vector [2]: sqn = 25 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 9a9aaf5..59ba22d 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -1,11 +1,11 @@ ===== test_set_1 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 @@ -15,18 +15,18 @@ DAUC vector [0]: sres = 46f8416a DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_1: SUCCESS ===== test_set_2 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b @@ -36,18 +36,18 @@ DAUC vector [0]: sres = 8c308a5e DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_2: SUCCESS ===== test_set_3 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b @@ -57,18 +57,18 @@ DAUC vector [0]: sres = cfbce3fe DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_3: SUCCESS ===== test_set_4 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 @@ -78,18 +78,18 @@ DAUC vector [0]: sres = 9655e265 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_4: SUCCESS ===== test_set_5 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 @@ -99,18 +99,18 @@ DAUC vector [0]: sres = 13688f17 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_5: SUCCESS ===== test_set_6 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 @@ -120,18 +120,18 @@ DAUC vector [0]: sres = 553d00b3 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_6: SUCCESS ===== test_set_7 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 @@ -141,18 +141,18 @@ DAUC vector [0]: sres = 59f1a44a DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_7: SUCCESS ===== test_set_8 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e @@ -162,18 +162,18 @@ DAUC vector [0]: sres = 50588861 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_8: SUCCESS ===== test_set_9 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 @@ -183,18 +183,18 @@ DAUC vector [0]: sres = cde6b027 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_9: SUCCESS ===== test_set_10 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd @@ -204,18 +204,18 @@ DAUC vector [0]: sres = 02d13acd DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_10: SUCCESS ===== test_set_11 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 @@ -225,18 +225,18 @@ DAUC vector [0]: sres = 44389d01 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_11: SUCCESS ===== test_set_12 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 @@ -246,18 +246,18 @@ DAUC vector [0]: sres = 03e0fd84 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_12: SUCCESS ===== test_set_13 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 217af492728d00003bd338249751de80 DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a @@ -267,18 +267,18 @@ DAUC vector [0]: sres = be73b3dc DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_13: SUCCESS ===== test_set_14 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 @@ -288,18 +288,18 @@ DAUC vector [0]: sres = 8fe019c7 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_14: SUCCESS ===== test_set_15 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 @@ -309,18 +309,18 @@ DAUC vector [0]: sres = 27202b82 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_15: SUCCESS ===== test_set_16 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 @@ -330,18 +330,18 @@ DAUC vector [0]: sres = ddd7efe6 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_16: SUCCESS ===== test_set_17 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 @@ -351,18 +351,18 @@ DAUC vector [0]: sres = 67e4ff3f DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_17: SUCCESS ===== test_set_18 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a @@ -372,18 +372,18 @@ DAUC vector [0]: sres = 8a3b8d17 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_18: SUCCESS ===== test_set_19 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef @@ -393,7 +393,7 @@ DAUC vector [0]: sres = df58522f DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_19: SUCCESS diff --git a/tests/auc/gen_ts_55_205_test_sets/func_template.c b/tests/auc/gen_ts_55_205_test_sets/func_template.c index 83c5826..0865432 100644 --- a/tests/auc/gen_ts_55_205_test_sets/func_template.c +++ b/tests/auc/gen_ts_55_205_test_sets/func_template.c @@ -36,7 +36,7 @@ aud3g = (struct osmo_sub_auth_data){{ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, - .u.umts.sqn = 32, + .u.umts.sqn = 31, }}; osmo_hexparse("{Ki}", @@ -48,10 +48,10 @@ fake_rand, sizeof(fake_rand)); vec = (struct osmo_auth_vector){{ {{0}} }}; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: {RAND}\n" -- To view, visit https://gerrit.osmocom.org/2080 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:39:53 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:39:53 +0000 Subject: [PATCH] osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND Message-ID: Review at https://gerrit.osmocom.org/2081 UMTS AKA: implement SQN increment according to SEQ and IND Add ind_bitlen column to auc_3g to record each USIM's IND size according to 3GPP TS 33.102 -- default is 5 bits, as suggested by the spec. Introduce auc_3g_ind to each connecting GSUP client to use as IND index for generating auth tuples sent to this client. With osmo_gsup_server_add_conn(), implement a scheme where clients receive fixed auc_3g_ind indexes based on the order in which they connect; each new connection takes the lowest unused auc_3g_ind, so in case one of the clients restarts, it will most likely receive the same auc_3g_ind, and if one client disconnects, no other clients' auc_3g_ind are affected. Add gsup_server_test.c to test the auc_3g_ind index distribution scheme. Related: OS#1969 Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 --- M configure.ac M sql/hlr.sql M src/db.c M src/db.h M src/db_auc.c M src/db_test.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M tests/Makefile.am A tests/gsup_server/Makefile.am A tests/gsup_server/gsup_server_test.c A tests/gsup_server/gsup_server_test.err A tests/gsup_server/gsup_server_test.ok M tests/testsuite.at 15 files changed, 357 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/81/2081/1 diff --git a/configure.ac b/configure.ac index a04185f..958b48b 100644 --- a/configure.ac +++ b/configure.ac @@ -50,4 +50,5 @@ tests/Makefile tests/auc/Makefile tests/auc/gen_ts_55_205_test_sets/Makefile + tests/gsup_server/Makefile ) diff --git a/sql/hlr.sql b/sql/hlr.sql index 9238871..7dab593 100644 --- a/sql/hlr.sql +++ b/sql/hlr.sql @@ -64,6 +64,7 @@ op VARCHAR(32), -- hex string: operator's secret key (128bit) opc VARCHAR(32), -- hex string: derived from OP and K (128bit) sqn INTEGER NOT NULL DEFAULT 0 -- sequence number of key usage + ind_bitlen INTEGER NOT NULL DEFAULT 5 -- nr of index bits at lower SQN end ); CREATE UNIQUE INDEX IF NOT EXISTS idx_subscr_imsi ON subscriber (imsi); diff --git a/src/db.c b/src/db.c index aa4726c..aaf6fe2 100644 --- a/src/db.c +++ b/src/db.c @@ -29,7 +29,7 @@ [SEL_BY_IMSI] = "SELECT id,imsi,msisdn,vlr_number,sgsn_number,sgsn_address,periodic_lu_tmr,periodic_rau_tau_tmr,nam_cs,nam_ps,lmsi,ms_purged_cs,ms_purged_ps FROM subscriber WHERE imsi = ?", [UPD_VLR_BY_ID] = "UPDATE subscriber SET vlr_number = ? WHERE id = ?", [UPD_SGSN_BY_ID] = "UPDATE subscriber SET sgsn_number = ? WHERE id = ?", - [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", + [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn, ind_bitlen FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", [AUC_UPD_SQN] = "UPDATE auc_3g SET sqn = ? WHERE subscriber_id = ?", [UPD_PURGE_CS_BY_IMSI] = "UPDATE subscriber SET ms_purged_cs=1 WHERE imsi = ?", [UPD_PURGE_PS_BY_IMSI] = "UPDATE subscriber SET ms_purged_ps=1 WHERE imsi = ?", diff --git a/src/db.h b/src/db.h index 0b3df88..a60cf62 100644 --- a/src/db.h +++ b/src/db.h @@ -39,8 +39,9 @@ uint64_t new_sqn); int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts); + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts); #include #include diff --git a/src/db_auc.c b/src/db_auc.c index a24f27e..3a888bb 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -158,6 +158,7 @@ aud3g->u.umts.opc_is_op = 1; } aud3g->u.umts.sqn = sqlite3_column_int64(stmt, 7); + aud3g->u.umts.ind_bitlen = sqlite3_column_int(stmt, 8); /* FIXME: amf? */ aud3g->type = OSMO_AUTH_TYPE_UMTS; } else @@ -185,8 +186,9 @@ /* return -1 in case of error, 0 for unknown imsi, positive for number * of vectors generated */ int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts) + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts) { struct osmo_sub_auth_data aud2g, aud3g; uint64_t subscr_id; @@ -197,6 +199,16 @@ if (rc <= 0) return rc; + aud3g.u.umts.ind = auc_3g_ind; + if (aud3g.type == OSMO_AUTH_TYPE_UMTS + && aud3g.u.umts.ind >= (1U << aud3g.u.umts.ind_bitlen)) { + LOGAUC(imsi, LOGL_NOTICE, "3G auth: SQN's IND bitlen %u is" + " too small to hold an index of %u. Truncating. This" + " may cause numerous additional AUTS resyncing.\n", + aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind); + aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1; + } + LOGAUC(imsi, LOGL_DEBUG, "Calling to generate %u vectors\n", num_vec); rc = auc_compute_vectors(vec, num_vec, &aud2g, &aud3g, rand_auts, auts); if (rc < 0) { diff --git a/src/db_test.c b/src/db_test.c index 998a37a..0e823f9 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -20,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, 0, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index b0e1858..8796135 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -211,6 +211,50 @@ return 0; } +/* being added to libosmocore in https://gerrit.osmocom.org/2076, + * so long use this local copy. */ +#define _llist_first_entry(ptr, type, member) \ + llist_entry((ptr)->next, type, member) +#define _llist_first_entry_or_null(ptr, type, member) \ + (!llist_empty(ptr) ? _llist_first_entry(ptr, type, member) : NULL) + +/* Add conn to the clients list in a way that conn->auc_3g_ind takes the lowest + * unused integer and the list of clients remains sorted by auc_3g_ind. + * Keep this function non-static to allow linking in a unit test. */ +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn) +{ + struct osmo_gsup_conn *c; + struct osmo_gsup_conn *prev_conn; + + c = _llist_first_entry_or_null(clients, struct osmo_gsup_conn, list); + + /* Is the first index, 0, unused? */ + if (!c || c->auc_3g_ind > 0) { + conn->auc_3g_ind = 0; + llist_add(&conn->list, clients); + return; + } + + /* Look for a gap later on */ + prev_conn = NULL; + llist_for_each_entry(c, clients, list) { + /* skip first item, we know it has auc_3g_ind == 0. */ + if (!prev_conn) { + prev_conn = c; + continue; + } + if (c->auc_3g_ind > prev_conn->auc_3g_ind + 1) + break; + prev_conn = c; + } + + OSMO_ASSERT(prev_conn); + + conn->auc_3g_ind = prev_conn->auc_3g_ind + 1; + llist_add(&conn->list, &prev_conn->list); +} + /* a client has connected to the server socket and we have accept()ed it */ static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd) { @@ -225,8 +269,8 @@ conn->conn = ipa_server_conn_create(gsups, link, fd, osmo_gsup_server_read_cb, osmo_gsup_server_closed_cb, conn); - conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; OSMO_ASSERT(conn->conn); + conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; /* link data structure with server structure */ conn->server = gsups; diff --git a/src/gsup_server.h b/src/gsup_server.h index 885fe52..74062d4 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -31,6 +31,8 @@ struct ipa_server_conn *conn; //struct oap_state oap_state; struct tlv_parsed ccm; + + unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */ }; diff --git a/src/hlr.c b/src/hlr.c index 00a6459..b5777e2 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -63,7 +63,8 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, conn->auc_3g_ind, + gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 21c0e21..0bd0820 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = \ auc \ + gsup_server \ $(NULL) # The `:;' works around a Bash 3.2 bug when the output is not writeable. diff --git a/tests/gsup_server/Makefile.am b/tests/gsup_server/Makefile.am new file mode 100644 index 0000000..fee60f5 --- /dev/null +++ b/tests/gsup_server/Makefile.am @@ -0,0 +1,40 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/src \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(NULL) + +EXTRA_DIST = \ + gsup_server_test.ok \ + gsup_server_test.err \ + $(NULL) + +noinst_PROGRAMS = \ + gsup_server_test \ + $(NULL) + +gsup_server_test_SOURCES = \ + gsup_server_test.c \ + $(NULL) + +gsup_server_test_LDADD = \ + $(top_srcdir)/src/gsup_server.c \ + $(top_srcdir)/src/gsup_router.c \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(NULL) + +.PHONY: update_exp +update_exp: + $(builddir)/gsup_server_test >"$(srcdir)/gsup_server_test.ok" 2>"$(srcdir)/gsup_server_test.err" diff --git a/tests/gsup_server/gsup_server_test.c b/tests/gsup_server/gsup_server_test.c new file mode 100644 index 0000000..cc475be --- /dev/null +++ b/tests/gsup_server/gsup_server_test.c @@ -0,0 +1,145 @@ +/* (C) 2017 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * 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 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 . + * + */ + +#include +#include +#include "gsup_server.h" + +#define comment_start() printf("\n===== %s\n", __func__) +#define comment_end() printf("===== %s: SUCCESS\n\n", __func__) +#define btw(fmt, args...) printf("\n" fmt "\n", ## args) + +#define VERBOSE_ASSERT(val, expect_op, fmt) \ + do { \ + printf(#val " == " fmt "\n", (val)); \ + OSMO_ASSERT((val) expect_op); \ + } while (0) + +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn); + +static void test_add_conn(void) +{ + struct llist_head _list; + struct llist_head *clients = &_list; + struct osmo_gsup_conn conn_inst[23] = {}; + struct osmo_gsup_conn *conn; + unsigned int i; + + comment_start(); + + INIT_LLIST_HEAD(clients); + + btw("Add 10 items"); + for (i = 0; i < 10; i++) { + osmo_gsup_server_add_conn(clients, &conn_inst[i]); + printf("conn_inst[%u].auc_3g_ind == %u\n", i, conn_inst[i].auc_3g_ind); + OSMO_ASSERT(clients->next == &conn_inst[0].list); + } + + btw("Expecting a list of 0..9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + OSMO_ASSERT(conn == &conn_inst[i]); + i++; + } + + btw("Punch two holes in the sequence in arbitrary order," + " a larger one from 2..4 and a single one at 7."); + llist_del(&conn_inst[4].list); + llist_del(&conn_inst[2].list); + llist_del(&conn_inst[3].list); + llist_del(&conn_inst[7].list); + + btw("Expecting a list of 0,1, 5,6, 8,9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + i++; + } + + btw("Add conns, expecting them to take the open slots"); + osmo_gsup_server_add_conn(clients, &conn_inst[12]); + VERBOSE_ASSERT(conn_inst[12].auc_3g_ind, == 2, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[13]); + VERBOSE_ASSERT(conn_inst[13].auc_3g_ind, == 3, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[14]); + VERBOSE_ASSERT(conn_inst[14].auc_3g_ind, == 4, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[17]); + VERBOSE_ASSERT(conn_inst[17].auc_3g_ind, == 7, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[18]); + VERBOSE_ASSERT(conn_inst[18].auc_3g_ind, == 10, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("Does it also work for the first item?"); + llist_del(&conn_inst[0].list); + + btw("Expecting a list of 1..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i + 1); + i++; + } + + btw("Add another conn, should take auc_3g_ind == 0"); + osmo_gsup_server_add_conn(clients, &conn_inst[20]); + VERBOSE_ASSERT(conn_inst[20].auc_3g_ind, == 0, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("If a client reconnects, it will (likely) get the same auc_3g_ind"); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + llist_del(&conn_inst[5].list); + conn_inst[5].auc_3g_ind = 423; + osmo_gsup_server_add_conn(clients, &conn_inst[5]); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + + comment_end(); +} + +int main(int argc, char **argv) +{ + printf("test_gsup_server.c\n"); + + test_add_conn(); + + printf("Done\n"); + return 0; +} diff --git a/tests/gsup_server/gsup_server_test.err b/tests/gsup_server/gsup_server_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gsup_server/gsup_server_test.err diff --git a/tests/gsup_server/gsup_server_test.ok b/tests/gsup_server/gsup_server_test.ok new file mode 100644 index 0000000..80d944c --- /dev/null +++ b/tests/gsup_server/gsup_server_test.ok @@ -0,0 +1,94 @@ +test_gsup_server.c + +===== test_add_conn + +Add 10 items +conn_inst[0].auc_3g_ind == 0 +conn_inst[1].auc_3g_ind == 1 +conn_inst[2].auc_3g_ind == 2 +conn_inst[3].auc_3g_ind == 3 +conn_inst[4].auc_3g_ind == 4 +conn_inst[5].auc_3g_ind == 5 +conn_inst[6].auc_3g_ind == 6 +conn_inst[7].auc_3g_ind == 7 +conn_inst[8].auc_3g_ind == 8 +conn_inst[9].auc_3g_ind == 9 + +Expecting a list of 0..9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 + +Punch two holes in the sequence in arbitrary order, a larger one from 2..4 and a single one at 7. + +Expecting a list of 0,1, 5,6, 8,9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 5 +conn[3].auc_3g_ind == 6 +conn[4].auc_3g_ind == 8 +conn[5].auc_3g_ind == 9 + +Add conns, expecting them to take the open slots +conn_inst[12].auc_3g_ind == 2 +conn_inst[13].auc_3g_ind == 3 +conn_inst[14].auc_3g_ind == 4 +conn_inst[17].auc_3g_ind == 7 +conn_inst[18].auc_3g_ind == 10 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +Does it also work for the first item? + +Expecting a list of 1..10 +conn[0].auc_3g_ind == 1 +conn[1].auc_3g_ind == 2 +conn[2].auc_3g_ind == 3 +conn[3].auc_3g_ind == 4 +conn[4].auc_3g_ind == 5 +conn[5].auc_3g_ind == 6 +conn[6].auc_3g_ind == 7 +conn[7].auc_3g_ind == 8 +conn[8].auc_3g_ind == 9 +conn[9].auc_3g_ind == 10 + +Add another conn, should take auc_3g_ind == 0 +conn_inst[20].auc_3g_ind == 0 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +If a client reconnects, it will (likely) get the same auc_3g_ind +conn_inst[5].auc_3g_ind == 5 +conn_inst[5].auc_3g_ind == 5 +===== test_add_conn: SUCCESS + +Done diff --git a/tests/testsuite.at b/tests/testsuite.at index 46d1456..a969082 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -14,3 +14,10 @@ cat $abs_srcdir/auc/auc_ts_55_205_test_sets.err > experr AT_CHECK([$abs_top_builddir/tests/auc/auc_ts_55_205_test_sets], [], [expout], [experr]) AT_CLEANUP + +AT_SETUP([gsup_server]) +AT_KEYWORDS([gsup_server]) +cat $abs_srcdir/gsup_server/gsup_server_test.ok > expout +cat $abs_srcdir/gsup_server/gsup_server_test.err > experr +AT_CHECK([$abs_top_builddir/tests/gsup_server/gsup_server_test], [], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:48:00 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:48:00 +0000 Subject: libosmocore[master]: add osmo-auc-gen_test In-Reply-To: References: Message-ID: Patch Set 1: Why is osmo-auc-gen not built by jenkins?!? -- To view, visit https://gerrit.osmocom.org/2077 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:50:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:50:48 +0000 Subject: [PATCH] libosmocore[master]: add osmo-auc-gen_test In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2077 to look at the new patch set (#2). add osmo-auc-gen_test Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN increment scheme changes. The test comprises of a shell script that invokes the osmo-auc-gen binary with various milenage parameters, of which the stdout/stderr are verified. More osmo-auc-gen invocations could be added, but my main focus is on the SEQ changes. Instead of manually testing that it still works for each SQN patch, I want this test to do it for me. To make sure that osmo-auc-gen is build before the tests are launched, place 'utils' before 'tests' in the root Makefile.am. Related: OS#1968 Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec --- M Makefile.am A tests/osmo-auc-gen/osmo-auc-gen_test.err A tests/osmo-auc-gen/osmo-auc-gen_test.ok A tests/osmo-auc-gen/osmo-auc-gen_test.sh M tests/testsuite.at 5 files changed, 130 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/2077/2 diff --git a/Makefile.am b/Makefile.am index 1d17da5..e5639d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim tests utils +SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim utils tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \ diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.err b/tests/osmo-auc-gen/osmo-auc-gen_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.err diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok new file mode 100644 index 0000000..9c2e462 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -0,0 +1,92 @@ + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 0 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47b0000716ce00883bc39e1 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47a000058508ab3864e26a0 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c46c0000e74d796ec095dbee +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 1dc4f974325cce611e54f516dc1fec56 +AUTN: 434a46a71aeb0000fedc563f27a0916c +IK: d7213dd74860ccb8c14e54c0c4abc91c +CK: c350653d72f7a5bac3a27422e5186019 +RES: 912cdfaadd7b0154 +SRES: 4c57defe +Kc: 169d78081b24c007 + + +> osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 2a48162ff3edca4adf0b7b5e527d6c16 +AUTN: bfbf3332c91e0000d6199cad31d15f26 +IK: 191a93c4396113bff6939d4f98e169a6 +CK: 9c38d9089265ed5ea164e190a65c200d +RES: fd40205be2c9c7b2 +SRES: 1f89e7e9 +Kc: d2d5361395b9b74a + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: afb993e4f4b8000069cdeebb4a4b5b58 +IK: c348c2fe2f3e1fb37a7ae1638163bd98 +CK: e740c156278705a14e1a99ba6d31334f +RES: 7c04e86a67967fcd +SRES: 1b9297a7 +Kc: 10687b71e4eb94c5 + + +> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 39fa2f4e3d523d8619a73b4f65c3e14d +AUTN: 8704f5ba55eb0000d7fc4f7f19cfc180 +IK: 27497388b6cb044648f396aa155b95ef +CK: f64735036e5871319c679f4742a75ea1 +RES: e229c19e791f2e41 +SRES: 9b36efdf +Kc: 059a4f668f6fbe39 +AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh new file mode 100755 index 0000000..7842638 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh @@ -0,0 +1,30 @@ +#!/bin/sh +osmo_auc_gen="$1" + +set -e + +# run the osmo-auc-gen binary verbosely without showing its absolute path +# for identical expected output everywhere. +invoke() { + echo + echo + echo '>' osmo-auc-gen $@ + $osmo_auc_gen $@ +} + +bytes1="6a61050765caa32c90371370e5d6dc2d" +bytes2="1dc4f974325cce611e54f516dc1fec56" +bytes3="2a48162ff3edca4adf0b7b5e527d6c16" + +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 0 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 1 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 23 +invoke -3 -a milenage -r $bytes2 -k $bytes3 -o $bytes1 -s 42 +invoke -3 -a milenage -r $bytes3 -k $bytes1 -o $bytes2 -s 99 +invoke -3 -a milenage -r $bytes1 -k $bytes3 -o $bytes2 -s 281474976710655 + +k="EB215756028D60E3275E613320AEC880" +opc="FB2A3D1B360F599ABAB99DB8669F8308" +rand="39fa2f4e3d523d8619a73b4f65c3e14d" +auts="979498b1f72d3e28c59fa2e72f9c" +invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts diff --git a/tests/testsuite.at b/tests/testsuite.at index 51050f0..64df724 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -249,3 +249,10 @@ touch experr AT_CHECK([$abs_top_builddir/tests/socket/socket_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([osmo-auc-gen]) +AT_KEYWORDS([osmo-auc-gen]) +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.ok > expout +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.err > experr +AT_CHECK([$abs_top_srcdir/tests/osmo-auc-gen/osmo-auc-gen_test.sh $abs_top_builddir/utils/osmo-auc-gen], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2077 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 02:51:18 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 02:51:18 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Patch Set 3: -Code-Review -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 03:03:28 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 03:03:28 +0000 Subject: [PATCH] libosmocore[master]: add osmo-auc-gen_test In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2077 to look at the new patch set (#3). add osmo-auc-gen_test Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN increment scheme changes. The test comprises of a shell script that invokes the osmo-auc-gen binary with various milenage parameters, of which the stdout/stderr are verified. More osmo-auc-gen invocations could be added, but my main focus is on the SEQ changes. Instead of manually testing that it still works for each SQN patch, I want this test to do it for me. To make sure that osmo-auc-gen is build before the tests are launched, place 'utils' before 'tests' in the root Makefile.am. Related: OS#1968 Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec --- M Makefile.am M tests/Makefile.am A tests/osmo-auc-gen/osmo-auc-gen_test.err A tests/osmo-auc-gen/osmo-auc-gen_test.ok A tests/osmo-auc-gen/osmo-auc-gen_test.sh M tests/testsuite.at 6 files changed, 134 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/2077/3 diff --git a/Makefile.am b/Makefile.am index 1d17da5..e5639d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim tests utils +SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim utils tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 496ed65..352b5a7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -192,7 +192,10 @@ gsup/gsup_test.ok gsup/gsup_test.err \ oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ write_queue/wqueue_test.ok socket/socket_test.ok \ - socket/socket_test.err coding/coding_test.ok + socket/socket_test.err coding/coding_test.ok \ + osmo-auc-gen/osmo-auc-gen_test.sh \ + osmo-auc-gen/osmo-auc-gen_test.ok \ + osmo-auc-gen/osmo-auc-gen_test.err DISTCLEANFILES = atconfig atlocal noinst_HEADERS = conv/conv.h diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.err b/tests/osmo-auc-gen/osmo-auc-gen_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.err diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok new file mode 100644 index 0000000..9c2e462 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -0,0 +1,92 @@ + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 0 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47b0000716ce00883bc39e1 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47a000058508ab3864e26a0 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c46c0000e74d796ec095dbee +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 1dc4f974325cce611e54f516dc1fec56 +AUTN: 434a46a71aeb0000fedc563f27a0916c +IK: d7213dd74860ccb8c14e54c0c4abc91c +CK: c350653d72f7a5bac3a27422e5186019 +RES: 912cdfaadd7b0154 +SRES: 4c57defe +Kc: 169d78081b24c007 + + +> osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 2a48162ff3edca4adf0b7b5e527d6c16 +AUTN: bfbf3332c91e0000d6199cad31d15f26 +IK: 191a93c4396113bff6939d4f98e169a6 +CK: 9c38d9089265ed5ea164e190a65c200d +RES: fd40205be2c9c7b2 +SRES: 1f89e7e9 +Kc: d2d5361395b9b74a + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: afb993e4f4b8000069cdeebb4a4b5b58 +IK: c348c2fe2f3e1fb37a7ae1638163bd98 +CK: e740c156278705a14e1a99ba6d31334f +RES: 7c04e86a67967fcd +SRES: 1b9297a7 +Kc: 10687b71e4eb94c5 + + +> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 39fa2f4e3d523d8619a73b4f65c3e14d +AUTN: 8704f5ba55eb0000d7fc4f7f19cfc180 +IK: 27497388b6cb044648f396aa155b95ef +CK: f64735036e5871319c679f4742a75ea1 +RES: e229c19e791f2e41 +SRES: 9b36efdf +Kc: 059a4f668f6fbe39 +AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh new file mode 100755 index 0000000..7842638 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh @@ -0,0 +1,30 @@ +#!/bin/sh +osmo_auc_gen="$1" + +set -e + +# run the osmo-auc-gen binary verbosely without showing its absolute path +# for identical expected output everywhere. +invoke() { + echo + echo + echo '>' osmo-auc-gen $@ + $osmo_auc_gen $@ +} + +bytes1="6a61050765caa32c90371370e5d6dc2d" +bytes2="1dc4f974325cce611e54f516dc1fec56" +bytes3="2a48162ff3edca4adf0b7b5e527d6c16" + +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 0 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 1 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 23 +invoke -3 -a milenage -r $bytes2 -k $bytes3 -o $bytes1 -s 42 +invoke -3 -a milenage -r $bytes3 -k $bytes1 -o $bytes2 -s 99 +invoke -3 -a milenage -r $bytes1 -k $bytes3 -o $bytes2 -s 281474976710655 + +k="EB215756028D60E3275E613320AEC880" +opc="FB2A3D1B360F599ABAB99DB8669F8308" +rand="39fa2f4e3d523d8619a73b4f65c3e14d" +auts="979498b1f72d3e28c59fa2e72f9c" +invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts diff --git a/tests/testsuite.at b/tests/testsuite.at index 51050f0..64df724 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -249,3 +249,10 @@ touch experr AT_CHECK([$abs_top_builddir/tests/socket/socket_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([osmo-auc-gen]) +AT_KEYWORDS([osmo-auc-gen]) +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.ok > expout +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.err > experr +AT_CHECK([$abs_top_srcdir/tests/osmo-auc-gen/osmo-auc-gen_test.sh $abs_top_builddir/utils/osmo-auc-gen], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2077 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 03:15:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 03:15:34 +0000 Subject: libosmocore[master]: milenage_test: cosmetic fix: shown value is not SEQ.MS In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 re-adding +2 lost due to commit log tweak -- To view, visit https://gerrit.osmocom.org/2047 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 03:21:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 03:21:48 +0000 Subject: [PATCH] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2049 to look at the new patch set (#5). osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf --- M include/osmocom/crypt/auth.h M src/gsm/auth_milenage.c M tests/auth/milenage_test.c 3 files changed, 74 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/2049/5 diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h index 7c6072b..7a27f3b 100644 --- a/include/osmocom/crypt/auth.h +++ b/include/osmocom/crypt/auth.h @@ -39,6 +39,8 @@ uint8_t amf[2]; uint64_t sqn; /*!< sequence number */ int opc_is_op; /*!< is the OPC field OPC (0) or OP (1) ? */ + unsigned int ind_bitlen; /*!< nr of bits not in SEQ, only SQN */ + unsigned int ind; /*!< SQN slot, i.e. (SEQ << ind_bitlen) + ind */ } umts; struct { uint8_t ki[16]; /*!< secret key */ diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index e180762..f151c5e 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -32,10 +32,73 @@ size_t res_len = sizeof(vec->res); uint64_t next_sqn; uint8_t sqn[6]; + uint64_t ind_mask; + uint64_t seq_1; int rc; + /* Determine next SQN, according to 3GPP TS 33.102: + * SQN consists of SEQ and a lower significant part of IND bits: + * + * |----------SEQ------------| + * |------------------------SQN-----------| + * |-----IND----| + * + * The IND part is used as "slots": e.g. a given HLR client will always + * get the same IND part, called ind here, with incrementing SEQ. In + * the USIM, each IND slot enforces that its SEQ are used in ascending + * order -- as long as that constraint is satisfied, the SQN may jump + * forwards and backwards. For example, for ind_bitlen == 5, asking the + * USIM for SQN = 32, 64, 33 is allowed, because 32 and 64 are + * SEQ || (ind == 0), and though 33 is below 64, it is ind == 1 and + * allowed. Not allowed would be 32, 96, 64, because 64 would go + * backwards after 96, both being ind == 0. + * + * From the last used SQN, we want to increment SEQ + 1, and then pick + * the matching IND part. + * + * IND size is suggested in TS 33.102 as 5 bits. SQN is 48 bits long. + * If ind_bitlen is passed too large here, the algorithms will break + * down. But at which point should we return an error? A sane limit + * seems to be ind_bitlen == 10, but to protect against failure, + * limiting ind_bitlen to 28 is enough, 28 being the number of bits + * suggested for the delta in 33.102, which is discussed to still + * require 2^15 > 32000 authentications to wrap the SQN back to the + * start. + * + * Note that if a caller with ind == 1 generates N vectors, the SQN + * stored after this will reflect SEQ + N. If then another caller with + * ind == 2 generates another N vectors, this will then use SEQ + N + * onwards and end up with SEQ + N + N. In other words, most of each + * SEQ's IND slots will remain unused. When looking at SQN being 48 + * bits wide, after dropping ind_bitlen (say 5) from it, we will still + * have a sequence range of 2^43 = 8.8e12, eight trillion sequences, + * which is large enough to not bother further. With the maximum + * ind_bitlen of 28 enforced below, we still get more than 1 million + * sequences, which is also sufficiently large. + * + * An ind_bitlen of zero may be passed from legacy callers that are not + * aware of the IND extension. For these, below algorithm works out as + * before, simply incrementing SQN by 1. + * + * This is also a mechanism for tools like the osmo-auc-gen to directly + * request a given SQN to be used. With ind_bitlen == 0 the caller can + * be sure that this code will increment SQN by exactly one before + * generating a tuple, thus a caller would simply pass + * { .ind_bitlen = 0, .ind = 0, .sqn = (desired_sqn - 1) } + */ + + if (aud->u.umts.ind_bitlen > 28) + return -2; + + seq_1 = 1LL << aud->u.umts.ind_bitlen; + ind_mask = ~(seq_1 - 1); + + /* the ind index must not affect the SEQ part */ + if (aud->u.umts.ind > seq_1) + return -3; + /* keep the incremented SQN local until gsm_milenage() succeeded. */ - next_sqn = aud->u.umts.sqn + 1; + next_sqn = ((aud->u.umts.sqn + seq_1) & ind_mask) + aud->u.umts.ind; osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, @@ -78,6 +141,8 @@ if (rc < 0) return rc; + /* Update our "largest used SQN" from the USIM -- milenage_gen_vec() + * below will increment SQN. */ aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 405da65..7aada36 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -37,6 +37,8 @@ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, .sqn = 0x21, + .ind_bitlen = 0, + .ind = 0, }, }; @@ -79,6 +81,9 @@ #endif memset(vec, 0, sizeof(*vec)); + /* ind_bitlen == 0 uses the legacy mode of incrementing SQN by 1. + * sqn == 0x21 == 33, so the SQN used to generate the vector is + * sqn + 1 == 34. */ rc = osmo_auth_gen_vec(vec, &test_aud, _rand); if (rc < 0) { fprintf(stderr, "error generating auth vector\n"); @@ -90,6 +95,7 @@ const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; + /* Invoking with ind_bitlen == 0, the next SQN after 31 is 32. */ rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); if (rc < 0) { printf("AUTS failed\n"); -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 03:23:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 03:23:30 +0000 Subject: libosmocore[master]: milenage_test: enhance to verify new SQN increments In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 re-add +2 lost due to commit log tweak -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 03:23:39 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 03:23:39 +0000 Subject: libosmocore[master]: milenage_test: cosmetic: verify AUTS in comments In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 re-add +2 lost due to commit log tweak -- To view, visit https://gerrit.osmocom.org/2051 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 09:13:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 09:13:37 +0000 Subject: libosmocore[master]: Doxygen: exclude osmocom/core/gsm/protocol/* In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2006 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I231f78972a015902e4085aa80fcbc04009ae9f13 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 09:13:38 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 09:13:38 +0000 Subject: [MERGED] libosmocore[master]: Doxygen: exclude osmocom/core/gsm/protocol/* In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Doxygen: exclude osmocom/core/gsm/protocol/* ...................................................................... Doxygen: exclude osmocom/core/gsm/protocol/* We don't document the header files that define structs/enums/types that are taken 1:1 from the relevant GSM specifications. So let's avoid having doxygen generate tons of warnings for related undocumented members. Change-Id: I231f78972a015902e4085aa80fcbc04009ae9f13 --- M Doxyfile.gsm.in 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Doxyfile.gsm.in b/Doxyfile.gsm.in index ed4ff47..1dae2b5 100644 --- a/Doxyfile.gsm.in +++ b/Doxyfile.gsm.in @@ -654,7 +654,7 @@ # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = */include/osmocom/gsm/protocol/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the -- To view, visit https://gerrit.osmocom.org/2006 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I231f78972a015902e4085aa80fcbc04009ae9f13 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 09:24:35 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 09:24:35 +0000 Subject: [PATCH] libosmocore[master]: lapd_core: Use 'struct value_string' for LAPD state names Message-ID: Review at https://gerrit.osmocom.org/2082 lapd_core: Use 'struct value_string' for LAPD state names We don't really use state numbers without bounds check into string tables since March 2010, when value_string became part of libosmocore. It's time to catch up, 7 years later... Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63 --- M src/gsm/lapd_core.c 1 file changed, 33 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/2082/1 diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 5ee88a4..0cc28a6 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -180,18 +180,23 @@ } /* Figure B.2/Q.921 */ -const char *lapd_state_names[] = { - "LAPD_STATE_NULL", - "LAPD_STATE_TEI_UNASS", - "LAPD_STATE_ASS_TEI_WAIT", - "LAPD_STATE_EST_TEI_WAIT", - "LAPD_STATE_IDLE", - "LAPD_STATE_SABM_SENT", - "LAPD_STATE_DISC_SENT", - "LAPD_STATE_MF_EST", - "LAPD_STATE_TIMER_RECOV", - +const struct value_string lapd_state_names[] = { + OSMO_VALUE_STRING(LAPD_STATE_NULL), + OSMO_VALUE_STRING(LAPD_STATE_TEI_UNASS), + OSMO_VALUE_STRING(LAPD_STATE_ASS_TEI_WAIT), + OSMO_VALUE_STRING(LAPD_STATE_EST_TEI_WAIT), + OSMO_VALUE_STRING(LAPD_STATE_IDLE), + OSMO_VALUE_STRING(LAPD_STATE_SABM_SENT), + OSMO_VALUE_STRING(LAPD_STATE_DISC_SENT), + OSMO_VALUE_STRING(LAPD_STATE_MF_EST), + OSMO_VALUE_STRING(LAPD_STATE_TIMER_RECOV), + { 0, NULL } }; + +static inline const char *lapd_state_name(enum lapd_state state) +{ + return get_value_string(lapd_state_names, state); +} static void lapd_start_t200(struct lapd_datalink *dl) { @@ -228,7 +233,7 @@ static void lapd_dl_newstate(struct lapd_datalink *dl, uint32_t state) { LOGP(DLLAPD, LOGL_INFO, "new state %s -> %s (dl=%p)\n", - lapd_state_names[dl->state], lapd_state_names[state], dl); + lapd_state_name(dl->state), lapd_state_name(state), dl); if (state != LAPD_STATE_MF_EST && dl->state == LAPD_STATE_MF_EST) { /* stop T203 on leaving MF EST state, if running */ @@ -381,7 +386,7 @@ LOGP(DLLAPD, LOGL_NOTICE, "sending MDL-ERROR-IND cause %d from state %s (dl=%p)\n", - cause, lapd_state_names[dl->state], dl); + cause, lapd_state_name(dl->state), dl); osmo_prim_init(&dp.oph, 0, PRIM_MDL_ERROR, PRIM_OP_INDICATION, NULL); dp.u.error_ind.cause = cause; return dl->send_dlsap(&dp, lctx); @@ -550,7 +555,7 @@ struct lapd_datalink *dl = data; LOGP(DLLAPD, LOGL_INFO, "Timeout T200 state=%s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); switch (dl->state) { case LAPD_STATE_SABM_SENT: @@ -669,7 +674,7 @@ break; default: LOGP(DLLAPD, LOGL_INFO, "T200 expired in unexpected " - "dl->state %s (dl=%p)\n", lapd_state_names[dl->state], dl); + "dl->state %s (dl=%p)\n", lapd_state_name(dl->state), dl); } } @@ -679,7 +684,7 @@ struct lapd_datalink *dl = data; LOGP(DLLAPD, LOGL_INFO, "Timeout T203 state=%s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); if (dl->state != LAPD_STATE_MF_EST) { LOGP(DLLAPD, LOGL_ERROR, "T203 fired outside MF EST state, " @@ -796,7 +801,7 @@ op = PRIM_OP_INDICATION; LOGP(DLLAPD, LOGL_INFO, "SABM(E) received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.7.1 */ dl->seq_err_cond = 0; /* G.2.2 Wrong value of the C/R bit */ @@ -843,7 +848,7 @@ if (!dl->cont_res) { LOGP(DLLAPD, LOGL_INFO, "SABM command not " "allowed in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); mdl_error(MDL_CAUSE_SABM_MF, lctx); msgb_free(msg); return 0; @@ -881,7 +886,7 @@ if (dl->tx_hist[0].msg && dl->tx_hist[0].msg->len) { LOGP(DLLAPD, LOGL_NOTICE, "SABM not allowed " "during contention resolution (state=%s, dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); mdl_error(MDL_CAUSE_SABM_INFO_NOTALL, lctx); } lapd_send_ua(lctx, length, msg->l3h); @@ -923,7 +928,7 @@ break; case LAPD_U_DM: LOGP(DLLAPD, LOGL_INFO, "DM received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* G.2.2 Wrong value of the C/R bit */ if (lctx->cr == dl->cr.rem2loc.cmd) { LOGP(DLLAPD, LOGL_ERROR, @@ -1046,7 +1051,7 @@ op = PRIM_OP_INDICATION; LOGP(DLLAPD, LOGL_INFO, "DISC received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* flush tx and send buffers */ lapd_dl_flush_tx(dl); lapd_dl_flush_send(dl); @@ -1119,7 +1124,7 @@ break; case LAPD_U_UA: LOGP(DLLAPD, LOGL_INFO, "UA received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* G.2.2 Wrong value of the C/R bit */ if (lctx->cr == dl->cr.rem2loc.cmd) { LOGP(DLLAPD, LOGL_ERROR, "UA indicates command " @@ -1279,7 +1284,7 @@ switch (lctx->s_u) { case LAPD_S_RR: LOGP(DLLAPD, LOGL_INFO, "RR received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */ lapd_acknowledge(lctx); @@ -1323,7 +1328,7 @@ break; case LAPD_S_RNR: LOGP(DLLAPD, LOGL_INFO, "RNR received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */ lapd_acknowledge(lctx); @@ -1367,7 +1372,7 @@ break; case LAPD_S_REJ: LOGP(DLLAPD, LOGL_INFO, "REJ received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */ lapd_acknowledge(lctx); @@ -1491,7 +1496,7 @@ int rc; LOGP(DLLAPD, LOGL_INFO, "I received in state %s on SAPI(%u) (dl=%p)\n", - lapd_state_names[dl->state], lctx->sapi, dl); + lapd_state_name(dl->state), lctx->sapi, dl); /* G.2.2 Wrong value of the C/R bit */ if (lctx->cr == dl->cr.rem2loc.resp) { @@ -2223,13 +2228,13 @@ if (i == L2DOWNSLLEN) { LOGP(DLLAPD, LOGL_NOTICE, "Message %u/%u unhandled at this " "state %s. (dl=%p)\n", dp->oph.primitive, - dp->oph.operation, lapd_state_names[dl->state], dl); + dp->oph.operation, lapd_state_name(dl->state), dl); msgb_free(msg); return 0; } LOGP(DLLAPD, LOGL_INFO, "Message %s received in state %s (dl=%p)\n", - l2downstatelist[i].name, lapd_state_names[dl->state], dl); + l2downstatelist[i].name, lapd_state_name(dl->state), dl); rc = l2downstatelist[i].rout(dp, lctx); -- To view, visit https://gerrit.osmocom.org/2082 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Wed Mar 15 11:11:52 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 11:11:52 +0000 Subject: [PATCH] libosmocore[master]: Add support for PCU version report Message-ID: Review at https://gerrit.osmocom.org/2083 Add support for PCU version report Expand 3GPP TS 52.021 ?9.4.43 Probable Cause with Osmocom-specific value for PCU version reporting to enable sending it via OML alarms. Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c 2 files changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/83/2083/1 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index d6e8c11..f7ed507 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -277,6 +277,7 @@ OSMO_EVT_WARN_SW_WARN = 0x0001, /* External causes */ OSMO_EVT_EXT_ALARM = 0xfeed, + OSMO_EVT_PCU_VERS = 0xface, }; extern const struct value_string abis_mm_event_cause_names[]; diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 155084a..a8a1ccb 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -162,6 +162,7 @@ { OSMO_EVT_MIN_PAG_TAB_FULL, "Paging table full" }, { OSMO_EVT_WARN_SW_WARN, "Software warning" }, { OSMO_EVT_EXT_ALARM, "External alarm" }, + { OSMO_EVT_PCU_VERS, "PCU version report" }, { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/2083 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:14:41 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 12:14:41 +0000 Subject: libosmocore[master]: vty: fix "logging level ... everything" option In-Reply-To: References: Message-ID: Patch Set 10: Let's get back to the drawing board than - OS#71. -- To view, visit https://gerrit.osmocom.org/1582 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib51987fb2f64a70fca130f3799dc8fd71cc7085c Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:32:24 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 12:32:24 +0000 Subject: [PATCH] libosmocore[master]: vty: cleanup logging functions Message-ID: Review at https://gerrit.osmocom.org/2084 vty: cleanup logging functions * remove unused parameter from logging_vty_add_cmds() * mark log level descriptors static * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * deprecate log_vty_command_*() from public API as it should only be used by logging_vty_add_cmds() Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Related: OS#71 --- M include/osmocom/core/logging.h M include/osmocom/vty/logging.h M src/logging.c M src/vty/logging_vty.c M tests/vty/vty_test.c 5 files changed, 19 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/2084/1 diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 7b28b2c..d1bab68 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -328,8 +328,8 @@ void log_del_target(struct log_target *target); /* Generate command string for VTY use */ -const char *log_vty_command_string(const struct log_info *info); -const char *log_vty_command_description(const struct log_info *info); +const char *log_vty_command_string() OSMO_DEPRECATED("For internal use inside libosmocore only."); +const char *log_vty_command_description() OSMO_DEPRECATED("For internal use inside libosmocore only."); struct log_target *log_target_find(int type, const char *fname); extern struct llist_head osmo_log_target_list; diff --git a/include/osmocom/vty/logging.h b/include/osmocom/vty/logging.h index 9e4b98f..544d117 100644 --- a/include/osmocom/vty/logging.h +++ b/include/osmocom/vty/logging.h @@ -4,6 +4,6 @@ #define FILTER_STR "Filter log messages\n" struct log_info; -void logging_vty_add_cmds(const struct log_info *cat); +void logging_vty_add_cmds(); struct vty; struct log_target *osmo_log_vty2tgt(struct vty *vty); diff --git a/src/logging.c b/src/logging.c index 6a1e929..8ceb2f3 100644 --- a/src/logging.c +++ b/src/logging.c @@ -144,7 +144,7 @@ /*! \brief descriptive string for each log level */ /* You have to keep this in sync with the structure loglevel_strs. */ -const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { +static const char *loglevel_descriptions[LOGLEVEL_DEFS+1] = { "Don't use. It doesn't log anything", "Log debug messages and higher levels", "Log informational messages and higher levels", @@ -359,7 +359,8 @@ return subsys; } -static inline int check_log_to_target(struct log_target *tar, int subsys, int level) +static inline bool should_log_to_target(struct log_target *tar, int subsys, + int level) { struct log_category *category; @@ -367,28 +368,28 @@ /* subsystem is not supposed to be logged */ if (!category->enabled) - return 0; + return false; /* Check the global log level */ if (tar->loglevel != 0 && level < tar->loglevel) - return 0; + return false; /* Check the category log level */ if (tar->loglevel == 0 && category->loglevel != 0 && level < category->loglevel) - return 0; + return false; /* Apply filters here... if that becomes messy we will * need to put filters in a list and each filter will * say stop, continue, output */ if ((tar->filter_map & (1 << LOG_FLT_ALL)) != 0) - return 1; + return true; if (osmo_log_info->filter_fn) return osmo_log_info->filter_fn(&log_context, tar); /* TODO: Check the filter/selector too? */ - return 1; + return true; } /*! \brief vararg version of logging function @@ -409,7 +410,7 @@ llist_for_each_entry(tar, &osmo_log_target_list, entry) { va_list bp; - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* According to the manpage, vsnprintf leaves the value of ap @@ -776,7 +777,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns vty command string for use by VTY command node */ -const char *log_vty_command_string(const struct log_info *unused_info) +const char *log_vty_command_string() { struct log_info *info = osmo_log_info; int len = 0, offset = 0, ret, i, rem; @@ -854,7 +855,7 @@ * \param[in] unused_info Deprecated parameter, no longer used! * \returns logging command description for use by VTY command node */ -const char *log_vty_command_description(const struct log_info *unused_info) +const char *log_vty_command_description() { struct log_info *info = osmo_log_info; char *str; @@ -985,7 +986,7 @@ /* TODO: The following could/should be cached (update on config) */ llist_for_each_entry(tar, &osmo_log_target_list, entry) { - if (!check_log_to_target(tar, subsys, level)) + if (!should_log_to_target(tar, subsys, level)) continue; /* This might get logged (ignoring filters) */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index aabcaa7..12cc2ee 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -737,7 +737,7 @@ return 1; } -void logging_vty_add_cmds(const struct log_info *cat) +void logging_vty_add_cmds() { install_element_ve(&enable_logging_cmd); install_element_ve(&disable_logging_cmd); @@ -750,8 +750,8 @@ install_element_ve(&logging_set_category_mask_old_cmd); /* Logging level strings are generated dynamically. */ - logging_level_cmd.string = log_vty_command_string(cat); - logging_level_cmd.doc = log_vty_command_description(cat); + logging_level_cmd.string = log_vty_command_string(); + logging_level_cmd.doc = log_vty_command_description(); install_element_ve(&logging_level_cmd); install_element_ve(&show_logging_vty_cmd); install_element_ve(&show_alarms_cmd); diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c index 865c93e..1e1b495 100644 --- a/tests/vty/vty_test.c +++ b/tests/vty/vty_test.c @@ -318,7 +318,7 @@ vty_init(&vty_info); /* Setup VTY commands */ - logging_vty_add_cmds(&log_info); + logging_vty_add_cmds(); osmo_stats_vty_add_cmds(); test_cmd_string_from_valstr(); -- To view, visit https://gerrit.osmocom.org/2084 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:42:07 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:42:07 +0000 Subject: libosmocore[master]: lapd_core: Use 'struct value_string' for LAPD state names In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2082 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:42:09 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:42:09 +0000 Subject: [MERGED] libosmocore[master]: lapd_core: Use 'struct value_string' for LAPD state names In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: lapd_core: Use 'struct value_string' for LAPD state names ...................................................................... lapd_core: Use 'struct value_string' for LAPD state names We don't really use state numbers without bounds check into string tables since March 2010, when value_string became part of libosmocore. It's time to catch up, 7 years later... Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63 --- M src/gsm/lapd_core.c 1 file changed, 33 insertions(+), 28 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 5ee88a4..0cc28a6 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -180,18 +180,23 @@ } /* Figure B.2/Q.921 */ -const char *lapd_state_names[] = { - "LAPD_STATE_NULL", - "LAPD_STATE_TEI_UNASS", - "LAPD_STATE_ASS_TEI_WAIT", - "LAPD_STATE_EST_TEI_WAIT", - "LAPD_STATE_IDLE", - "LAPD_STATE_SABM_SENT", - "LAPD_STATE_DISC_SENT", - "LAPD_STATE_MF_EST", - "LAPD_STATE_TIMER_RECOV", - +const struct value_string lapd_state_names[] = { + OSMO_VALUE_STRING(LAPD_STATE_NULL), + OSMO_VALUE_STRING(LAPD_STATE_TEI_UNASS), + OSMO_VALUE_STRING(LAPD_STATE_ASS_TEI_WAIT), + OSMO_VALUE_STRING(LAPD_STATE_EST_TEI_WAIT), + OSMO_VALUE_STRING(LAPD_STATE_IDLE), + OSMO_VALUE_STRING(LAPD_STATE_SABM_SENT), + OSMO_VALUE_STRING(LAPD_STATE_DISC_SENT), + OSMO_VALUE_STRING(LAPD_STATE_MF_EST), + OSMO_VALUE_STRING(LAPD_STATE_TIMER_RECOV), + { 0, NULL } }; + +static inline const char *lapd_state_name(enum lapd_state state) +{ + return get_value_string(lapd_state_names, state); +} static void lapd_start_t200(struct lapd_datalink *dl) { @@ -228,7 +233,7 @@ static void lapd_dl_newstate(struct lapd_datalink *dl, uint32_t state) { LOGP(DLLAPD, LOGL_INFO, "new state %s -> %s (dl=%p)\n", - lapd_state_names[dl->state], lapd_state_names[state], dl); + lapd_state_name(dl->state), lapd_state_name(state), dl); if (state != LAPD_STATE_MF_EST && dl->state == LAPD_STATE_MF_EST) { /* stop T203 on leaving MF EST state, if running */ @@ -381,7 +386,7 @@ LOGP(DLLAPD, LOGL_NOTICE, "sending MDL-ERROR-IND cause %d from state %s (dl=%p)\n", - cause, lapd_state_names[dl->state], dl); + cause, lapd_state_name(dl->state), dl); osmo_prim_init(&dp.oph, 0, PRIM_MDL_ERROR, PRIM_OP_INDICATION, NULL); dp.u.error_ind.cause = cause; return dl->send_dlsap(&dp, lctx); @@ -550,7 +555,7 @@ struct lapd_datalink *dl = data; LOGP(DLLAPD, LOGL_INFO, "Timeout T200 state=%s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); switch (dl->state) { case LAPD_STATE_SABM_SENT: @@ -669,7 +674,7 @@ break; default: LOGP(DLLAPD, LOGL_INFO, "T200 expired in unexpected " - "dl->state %s (dl=%p)\n", lapd_state_names[dl->state], dl); + "dl->state %s (dl=%p)\n", lapd_state_name(dl->state), dl); } } @@ -679,7 +684,7 @@ struct lapd_datalink *dl = data; LOGP(DLLAPD, LOGL_INFO, "Timeout T203 state=%s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); if (dl->state != LAPD_STATE_MF_EST) { LOGP(DLLAPD, LOGL_ERROR, "T203 fired outside MF EST state, " @@ -796,7 +801,7 @@ op = PRIM_OP_INDICATION; LOGP(DLLAPD, LOGL_INFO, "SABM(E) received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.7.1 */ dl->seq_err_cond = 0; /* G.2.2 Wrong value of the C/R bit */ @@ -843,7 +848,7 @@ if (!dl->cont_res) { LOGP(DLLAPD, LOGL_INFO, "SABM command not " "allowed in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); mdl_error(MDL_CAUSE_SABM_MF, lctx); msgb_free(msg); return 0; @@ -881,7 +886,7 @@ if (dl->tx_hist[0].msg && dl->tx_hist[0].msg->len) { LOGP(DLLAPD, LOGL_NOTICE, "SABM not allowed " "during contention resolution (state=%s, dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); mdl_error(MDL_CAUSE_SABM_INFO_NOTALL, lctx); } lapd_send_ua(lctx, length, msg->l3h); @@ -923,7 +928,7 @@ break; case LAPD_U_DM: LOGP(DLLAPD, LOGL_INFO, "DM received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* G.2.2 Wrong value of the C/R bit */ if (lctx->cr == dl->cr.rem2loc.cmd) { LOGP(DLLAPD, LOGL_ERROR, @@ -1046,7 +1051,7 @@ op = PRIM_OP_INDICATION; LOGP(DLLAPD, LOGL_INFO, "DISC received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* flush tx and send buffers */ lapd_dl_flush_tx(dl); lapd_dl_flush_send(dl); @@ -1119,7 +1124,7 @@ break; case LAPD_U_UA: LOGP(DLLAPD, LOGL_INFO, "UA received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* G.2.2 Wrong value of the C/R bit */ if (lctx->cr == dl->cr.rem2loc.cmd) { LOGP(DLLAPD, LOGL_ERROR, "UA indicates command " @@ -1279,7 +1284,7 @@ switch (lctx->s_u) { case LAPD_S_RR: LOGP(DLLAPD, LOGL_INFO, "RR received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */ lapd_acknowledge(lctx); @@ -1323,7 +1328,7 @@ break; case LAPD_S_RNR: LOGP(DLLAPD, LOGL_INFO, "RNR received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */ lapd_acknowledge(lctx); @@ -1367,7 +1372,7 @@ break; case LAPD_S_REJ: LOGP(DLLAPD, LOGL_INFO, "REJ received in state %s (dl=%p)\n", - lapd_state_names[dl->state], dl); + lapd_state_name(dl->state), dl); /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */ lapd_acknowledge(lctx); @@ -1491,7 +1496,7 @@ int rc; LOGP(DLLAPD, LOGL_INFO, "I received in state %s on SAPI(%u) (dl=%p)\n", - lapd_state_names[dl->state], lctx->sapi, dl); + lapd_state_name(dl->state), lctx->sapi, dl); /* G.2.2 Wrong value of the C/R bit */ if (lctx->cr == dl->cr.rem2loc.resp) { @@ -2223,13 +2228,13 @@ if (i == L2DOWNSLLEN) { LOGP(DLLAPD, LOGL_NOTICE, "Message %u/%u unhandled at this " "state %s. (dl=%p)\n", dp->oph.primitive, - dp->oph.operation, lapd_state_names[dl->state], dl); + dp->oph.operation, lapd_state_name(dl->state), dl); msgb_free(msg); return 0; } LOGP(DLLAPD, LOGL_INFO, "Message %s received in state %s (dl=%p)\n", - l2downstatelist[i].name, lapd_state_names[dl->state], dl); + l2downstatelist[i].name, lapd_state_name(dl->state), dl); rc = l2downstatelist[i].rout(dp, lctx); -- To view, visit https://gerrit.osmocom.org/2082 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1dac7b4cb441a1119cc167112521e8b8aae62e63 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:44:12 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:44:12 +0000 Subject: libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Patch Set 4: the address sanitizer bug will have to be resolved first, befor the patch is verified and can be merged: +================================================================= +==23280==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61500000d700 at pc 0x7f490faf014e bp 0x7fff5635a060 sp 0x7fff5635a058 +WRITE of size 1 at 0x61500000d700 thread T0 + #0 0x7f490faf014d in _conv_encode_do_output /home/osmocom-build/jenkins/workspace/libosmocore-gerrit/label/linux_amd64_debian8/src/conv.c:130 + #1 0x7f490faf014d in osmo_conv_encode_raw /home/osmocom-build/jenkins/workspace/libosmocore-gerrit/label/linux_amd64_debian8/src/conv.c:156 + #2 0x7f490faf16fb in osmo_conv_encode /home/osmocom-build/jenkins/workspace/libosmocore-gerrit/label/linux_amd64_debian8/src/conv.c:226 + #3 0x401608 in do_check conv/conv.c:109 + #4 0x400ed7 in main conv/conv_gsm0503_test.c:21 + #5 0x7f490e603b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44) + #6 0x400fb6 (/home/osmocom-build/jenkins/workspace/libosmocore-gerrit/label/linux_amd64_debian8/tests/conv/.libs/lt-conv_gsm0503_test+0x400fb6) + +0x61500000d700 is located 0 bytes to the right of 512-byte region [0x61500000d500,0x61500000d700) +allocated by thread T0 here: + #0 0x7f490fdd173f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f) + #1 0x4010b7 in do_check conv/conv.c:26 + +SUMMARY: AddressSanitizer: heap-buffer-overflow /home/osmocom-build/jenkins/workspace/libosmocore-gerrit/label/linux_amd64_debian8/src/conv.c:130 _conv_encode_do_output More details see http://jenkins.osmocom.org/jenkins/job/libosmocore-gerrit/851/label=linux_amd64_debian8/console -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:45:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:45:02 +0000 Subject: libosmocore[master]: add osmo-auc-gen_test In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2077 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:45:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:45:20 +0000 Subject: libosmocore[master]: osmo-auc-gen: clarify SQN output, prepare for SQN changes In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2078 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:45:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:45:41 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:45:56 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:45:56 +0000 Subject: libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:46:09 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:46:09 +0000 Subject: [MERGED] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND ...................................................................... osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf --- M include/osmocom/crypt/auth.h M src/gsm/auth_milenage.c M tests/auth/milenage_test.c 3 files changed, 74 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h index 7c6072b..7a27f3b 100644 --- a/include/osmocom/crypt/auth.h +++ b/include/osmocom/crypt/auth.h @@ -39,6 +39,8 @@ uint8_t amf[2]; uint64_t sqn; /*!< sequence number */ int opc_is_op; /*!< is the OPC field OPC (0) or OP (1) ? */ + unsigned int ind_bitlen; /*!< nr of bits not in SEQ, only SQN */ + unsigned int ind; /*!< SQN slot, i.e. (SEQ << ind_bitlen) + ind */ } umts; struct { uint8_t ki[16]; /*!< secret key */ diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index e180762..f151c5e 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -32,10 +32,73 @@ size_t res_len = sizeof(vec->res); uint64_t next_sqn; uint8_t sqn[6]; + uint64_t ind_mask; + uint64_t seq_1; int rc; + /* Determine next SQN, according to 3GPP TS 33.102: + * SQN consists of SEQ and a lower significant part of IND bits: + * + * |----------SEQ------------| + * |------------------------SQN-----------| + * |-----IND----| + * + * The IND part is used as "slots": e.g. a given HLR client will always + * get the same IND part, called ind here, with incrementing SEQ. In + * the USIM, each IND slot enforces that its SEQ are used in ascending + * order -- as long as that constraint is satisfied, the SQN may jump + * forwards and backwards. For example, for ind_bitlen == 5, asking the + * USIM for SQN = 32, 64, 33 is allowed, because 32 and 64 are + * SEQ || (ind == 0), and though 33 is below 64, it is ind == 1 and + * allowed. Not allowed would be 32, 96, 64, because 64 would go + * backwards after 96, both being ind == 0. + * + * From the last used SQN, we want to increment SEQ + 1, and then pick + * the matching IND part. + * + * IND size is suggested in TS 33.102 as 5 bits. SQN is 48 bits long. + * If ind_bitlen is passed too large here, the algorithms will break + * down. But at which point should we return an error? A sane limit + * seems to be ind_bitlen == 10, but to protect against failure, + * limiting ind_bitlen to 28 is enough, 28 being the number of bits + * suggested for the delta in 33.102, which is discussed to still + * require 2^15 > 32000 authentications to wrap the SQN back to the + * start. + * + * Note that if a caller with ind == 1 generates N vectors, the SQN + * stored after this will reflect SEQ + N. If then another caller with + * ind == 2 generates another N vectors, this will then use SEQ + N + * onwards and end up with SEQ + N + N. In other words, most of each + * SEQ's IND slots will remain unused. When looking at SQN being 48 + * bits wide, after dropping ind_bitlen (say 5) from it, we will still + * have a sequence range of 2^43 = 8.8e12, eight trillion sequences, + * which is large enough to not bother further. With the maximum + * ind_bitlen of 28 enforced below, we still get more than 1 million + * sequences, which is also sufficiently large. + * + * An ind_bitlen of zero may be passed from legacy callers that are not + * aware of the IND extension. For these, below algorithm works out as + * before, simply incrementing SQN by 1. + * + * This is also a mechanism for tools like the osmo-auc-gen to directly + * request a given SQN to be used. With ind_bitlen == 0 the caller can + * be sure that this code will increment SQN by exactly one before + * generating a tuple, thus a caller would simply pass + * { .ind_bitlen = 0, .ind = 0, .sqn = (desired_sqn - 1) } + */ + + if (aud->u.umts.ind_bitlen > 28) + return -2; + + seq_1 = 1LL << aud->u.umts.ind_bitlen; + ind_mask = ~(seq_1 - 1); + + /* the ind index must not affect the SEQ part */ + if (aud->u.umts.ind > seq_1) + return -3; + /* keep the incremented SQN local until gsm_milenage() succeeded. */ - next_sqn = aud->u.umts.sqn + 1; + next_sqn = ((aud->u.umts.sqn + seq_1) & ind_mask) + aud->u.umts.ind; osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, @@ -78,6 +141,8 @@ if (rc < 0) return rc; + /* Update our "largest used SQN" from the USIM -- milenage_gen_vec() + * below will increment SQN. */ aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 405da65..7aada36 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -37,6 +37,8 @@ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, .sqn = 0x21, + .ind_bitlen = 0, + .ind = 0, }, }; @@ -79,6 +81,9 @@ #endif memset(vec, 0, sizeof(*vec)); + /* ind_bitlen == 0 uses the legacy mode of incrementing SQN by 1. + * sqn == 0x21 == 33, so the SQN used to generate the vector is + * sqn + 1 == 34. */ rc = osmo_auth_gen_vec(vec, &test_aud, _rand); if (rc < 0) { fprintf(stderr, "error generating auth vector\n"); @@ -90,6 +95,7 @@ const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; + /* Invoking with ind_bitlen == 0, the next SQN after 31 is 32. */ rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); if (rc < 0) { printf("AUTS failed\n"); -- To view, visit https://gerrit.osmocom.org/2049 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:46:10 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:46:10 +0000 Subject: [MERGED] libosmocore[master]: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo_auth_gen_vec: UMTS auth: store last used SQN, not next ...................................................................... osmo_auth_gen_vec: UMTS auth: store last used SQN, not next Prepare for the implementation of splitting SQN increments in SEQ and an IND part; particularly to clearly show where the changes in auth/milenage_test's expectations originate. Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically stores the last used SQN, not the next one to be used. Particularly with the upcoming fix of the SQN scheme, this change is important: the next SQN will depend on which entity asks for it, because each auth consumer may have a particular slot in the IND part of SQN. It does not make sense to store the next SQN, because we will not know which consumer that will be for. The milenage_test has always calculated a tuple for SQN == 34. To account for the increment now happening before calculating a tuple, lower the test_aud->sqn by one to 0x21 == 33, so that it is still calculating for SQN == 34. Because we are no longer incrementing SQN after the tuple is generated, milenage_test's expected output after doing an AUTS resync to 31 changes to the next SQN = 32, the SQN used for the generated tuple. (BTW, a subsequent patch will illustrate AUTS in detail.) osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN will be incremented befor generating the auth vector. Also the SQN remains the same after generating, so SQN output needs less decrementing. Note that the expected output for osmo-auc-gen_test remains unchanged, hence the same input arguments (particularly -s and -A ) still produce the same results. Note: osmo-hlr regression tests will require adjustments when this patch is merged, because it must now pass desired_sqn - 1 instead of just desired_sqn. See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 . Related: OS#1968 Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 --- M src/gsm/auth_milenage.c M tests/auth/milenage_test.c M tests/auth/milenage_test.ok M utils/osmo-auc-gen.c 4 files changed, 18 insertions(+), 10 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index 1635ac6..e180762 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -30,10 +30,14 @@ const uint8_t *_rand) { size_t res_len = sizeof(vec->res); + uint64_t next_sqn; uint8_t sqn[6]; int rc; - osmo_store64be_ext(aud->u.umts.sqn, sqn, 6); + /* keep the incremented SQN local until gsm_milenage() succeeded. */ + next_sqn = aud->u.umts.sqn + 1; + + osmo_store64be_ext(next_sqn, sqn, 6); milenage_generate(aud->u.umts.opc, aud->u.umts.amf, aud->u.umts.k, sqn, _rand, vec->autn, vec->ik, vec->ck, vec->res, &res_len); @@ -43,7 +47,9 @@ return rc; vec->auth_types = OSMO_AUTH_TYPE_UMTS | OSMO_AUTH_TYPE_GSM; - aud->u.umts.sqn++; + + /* for storage in the caller's AUC database */ + aud->u.umts.sqn = next_sqn; return 0; } @@ -72,7 +78,7 @@ if (rc < 0) return rc; - aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16); + aud->u.umts.sqn = osmo_load64be_ext(sqn_out, 6) >> 16; return milenage_gen_vec(vec, aud, _rand); } diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 187b9ad..405da65 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -36,7 +36,7 @@ .k = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, - .sqn = 0x22, + .sqn = 0x21, }, }; diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 20c47c6..b0eb44b 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: tuple generated with SQN = 33 +AUTS success: tuple generated with SQN = 32 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index 6fa7cec..4e2456a 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -198,6 +198,10 @@ } ul = strtoul(optarg, 0, 10); test_aud.u.umts.sqn = ul; + /* Before calculating the UMTS auth vector, + * osmo_auth_gen_vec() increments the SQN. SQN-1 here + * to end up with the SQN the user requested. */ + test_aud.u.umts.sqn--; break; case 'r': rc = osmo_hexparse(optarg, _rand, sizeof(_rand)); @@ -260,16 +264,14 @@ else { dump_auth_vec(vec); if (test_aud.type == OSMO_AUTH_TYPE_UMTS) - /* After generating, SQN is incremented, so -1 */ - printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn - 1); + printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn); } /* After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does - * aud->u.umts.sqn++, and after vector generation milenage_gen_vec() - * does another ++, so to show SQN.MS we need to -2 */ + * aud->u.umts.sqn++, so to show SQN.MS we need to -1 */ if (auts_is_set) printf("AUTS success: SQN.MS = %" PRIu64 "\n", - test_aud.u.umts.sqn - 2); + test_aud.u.umts.sqn - 1); exit(0); } -- To view, visit https://gerrit.osmocom.org/2048 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:46:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:46:11 +0000 Subject: [MERGED] libosmocore[master]: osmo-auc-gen: clarify SQN output, prepare for SQN changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-auc-gen: clarify SQN output, prepare for SQN changes ...................................................................... osmo-auc-gen: clarify SQN output, prepare for SQN changes Upcoming patches will change the way SQN are incremented. Change the SQN related output by osmo-auc-gen so that it also makes sense after these changes, and so that its output is proven to remain unchanged for the same arguments: Always show the SQN used for vector generation when a UMTS vector was generated. Don't show the next SQN, it will not make sense anymore (see later patches). The adjustments of expected output of osmo-auc-gen_test illustrates how the output changes. Related: OS#1968 Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c --- M tests/osmo-auc-gen/osmo-auc-gen_test.ok M utils/osmo-auc-gen.c 2 files changed, 18 insertions(+), 16 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok index 9c2e462..fb7998f 100644 --- a/tests/osmo-auc-gen/osmo-auc-gen_test.ok +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -11,6 +11,7 @@ RES: f511d3a7f06e6a30 SRES: 057fb997 Kc: 60524000cc5e5407 +SQN: 0 > osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1 @@ -24,6 +25,7 @@ RES: f511d3a7f06e6a30 SRES: 057fb997 Kc: 60524000cc5e5407 +SQN: 1 > osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23 @@ -37,6 +39,7 @@ RES: f511d3a7f06e6a30 SRES: 057fb997 Kc: 60524000cc5e5407 +SQN: 23 > osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42 @@ -50,6 +53,7 @@ RES: 912cdfaadd7b0154 SRES: 4c57defe Kc: 169d78081b24c007 +SQN: 42 > osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99 @@ -63,6 +67,7 @@ RES: fd40205be2c9c7b2 SRES: 1f89e7e9 Kc: d2d5361395b9b74a +SQN: 99 > osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655 @@ -76,6 +81,7 @@ RES: 7c04e86a67967fcd SRES: 1b9297a7 Kc: 10687b71e4eb94c5 +SQN: 281474976710655 > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c @@ -89,4 +95,5 @@ RES: e229c19e791f2e41 SRES: 9b36efdf Kc: 059a4f668f6fbe39 -AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 +SQN: 24 +AUTS success: SQN.MS = 23 diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index f0cfa79..6fa7cec 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -257,24 +257,19 @@ if (fmt_triplets_dat) dump_triplets_dat(vec); - else + else { dump_auth_vec(vec); + if (test_aud.type == OSMO_AUTH_TYPE_UMTS) + /* After generating, SQN is incremented, so -1 */ + printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn - 1); + } - /* Print SQN from AUTS. It makes sense to print actually three SQN - * to clarify: - * After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does: - * aud->u.umts.sqn = 1 + (osmo_load64be_ext(sqn_out, 6) >> 16); - * Then calls milenage_gen_vec(), which, after it is done, does: - * aud->u.umts.sqn++; - */ + /* After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does + * aud->u.umts.sqn++, and after vector generation milenage_gen_vec() + * does another ++, so to show SQN.MS we need to -2 */ if (auts_is_set) - printf("AUTS success: SQN.MS = %" PRIu64 - ", generated vector with SQN = %" PRIu64 - ", next SQN = %" PRIu64 "\n", - test_aud.u.umts.sqn - 2, - test_aud.u.umts.sqn - 1, - test_aud.u.umts.sqn - ); + printf("AUTS success: SQN.MS = %" PRIu64 "\n", + test_aud.u.umts.sqn - 2); exit(0); } -- To view, visit https://gerrit.osmocom.org/2078 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:46:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:46:11 +0000 Subject: [MERGED] libosmocore[master]: add osmo-auc-gen_test In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: add osmo-auc-gen_test ...................................................................... add osmo-auc-gen_test Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN increment scheme changes. The test comprises of a shell script that invokes the osmo-auc-gen binary with various milenage parameters, of which the stdout/stderr are verified. More osmo-auc-gen invocations could be added, but my main focus is on the SEQ changes. Instead of manually testing that it still works for each SQN patch, I want this test to do it for me. To make sure that osmo-auc-gen is build before the tests are launched, place 'utils' before 'tests' in the root Makefile.am. Related: OS#1968 Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec --- M Makefile.am M tests/Makefile.am A tests/osmo-auc-gen/osmo-auc-gen_test.err A tests/osmo-auc-gen/osmo-auc-gen_test.ok A tests/osmo-auc-gen/osmo-auc-gen_test.sh M tests/testsuite.at 6 files changed, 134 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 1d17da5..e5639d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim tests utils +SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim utils tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 496ed65..352b5a7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -192,7 +192,10 @@ gsup/gsup_test.ok gsup/gsup_test.err \ oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ write_queue/wqueue_test.ok socket/socket_test.ok \ - socket/socket_test.err coding/coding_test.ok + socket/socket_test.err coding/coding_test.ok \ + osmo-auc-gen/osmo-auc-gen_test.sh \ + osmo-auc-gen/osmo-auc-gen_test.ok \ + osmo-auc-gen/osmo-auc-gen_test.err DISTCLEANFILES = atconfig atlocal noinst_HEADERS = conv/conv.h diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.err b/tests/osmo-auc-gen/osmo-auc-gen_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.err diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok new file mode 100644 index 0000000..9c2e462 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -0,0 +1,92 @@ + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 0 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47b0000716ce00883bc39e1 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c47a000058508ab3864e26a0 +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: 790c5d80c46c0000e74d796ec095dbee +IK: 6cf555588bb61ab2ff23cd333c05ed09 +CK: f0b29f50a7d873f30336473bdc35d04f +RES: f511d3a7f06e6a30 +SRES: 057fb997 +Kc: 60524000cc5e5407 + + +> osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 1dc4f974325cce611e54f516dc1fec56 +AUTN: 434a46a71aeb0000fedc563f27a0916c +IK: d7213dd74860ccb8c14e54c0c4abc91c +CK: c350653d72f7a5bac3a27422e5186019 +RES: 912cdfaadd7b0154 +SRES: 4c57defe +Kc: 169d78081b24c007 + + +> osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 2a48162ff3edca4adf0b7b5e527d6c16 +AUTN: bfbf3332c91e0000d6199cad31d15f26 +IK: 191a93c4396113bff6939d4f98e169a6 +CK: 9c38d9089265ed5ea164e190a65c200d +RES: fd40205be2c9c7b2 +SRES: 1f89e7e9 +Kc: d2d5361395b9b74a + + +> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655 +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 6a61050765caa32c90371370e5d6dc2d +AUTN: afb993e4f4b8000069cdeebb4a4b5b58 +IK: c348c2fe2f3e1fb37a7ae1638163bd98 +CK: e740c156278705a14e1a99ba6d31334f +RES: 7c04e86a67967fcd +SRES: 1b9297a7 +Kc: 10687b71e4eb94c5 + + +> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c +osmo-auc-gen (C) 2011-2012 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 39fa2f4e3d523d8619a73b4f65c3e14d +AUTN: 8704f5ba55eb0000d7fc4f7f19cfc180 +IK: 27497388b6cb044648f396aa155b95ef +CK: f64735036e5871319c679f4742a75ea1 +RES: e229c19e791f2e41 +SRES: 9b36efdf +Kc: 059a4f668f6fbe39 +AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh new file mode 100755 index 0000000..7842638 --- /dev/null +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh @@ -0,0 +1,30 @@ +#!/bin/sh +osmo_auc_gen="$1" + +set -e + +# run the osmo-auc-gen binary verbosely without showing its absolute path +# for identical expected output everywhere. +invoke() { + echo + echo + echo '>' osmo-auc-gen $@ + $osmo_auc_gen $@ +} + +bytes1="6a61050765caa32c90371370e5d6dc2d" +bytes2="1dc4f974325cce611e54f516dc1fec56" +bytes3="2a48162ff3edca4adf0b7b5e527d6c16" + +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 0 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 1 +invoke -3 -a milenage -r $bytes1 -k $bytes2 -o $bytes3 -s 23 +invoke -3 -a milenage -r $bytes2 -k $bytes3 -o $bytes1 -s 42 +invoke -3 -a milenage -r $bytes3 -k $bytes1 -o $bytes2 -s 99 +invoke -3 -a milenage -r $bytes1 -k $bytes3 -o $bytes2 -s 281474976710655 + +k="EB215756028D60E3275E613320AEC880" +opc="FB2A3D1B360F599ABAB99DB8669F8308" +rand="39fa2f4e3d523d8619a73b4f65c3e14d" +auts="979498b1f72d3e28c59fa2e72f9c" +invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts diff --git a/tests/testsuite.at b/tests/testsuite.at index 51050f0..64df724 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -249,3 +249,10 @@ touch experr AT_CHECK([$abs_top_builddir/tests/socket/socket_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([osmo-auc-gen]) +AT_KEYWORDS([osmo-auc-gen]) +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.ok > expout +cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.err > experr +AT_CHECK([$abs_top_srcdir/tests/osmo-auc-gen/osmo-auc-gen_test.sh $abs_top_builddir/utils/osmo-auc-gen], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2077 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:46:12 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:46:12 +0000 Subject: [MERGED] libosmocore[master]: milenage_test: enhance to verify new SQN increments In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: milenage_test: enhance to verify new SQN increments ...................................................................... milenage_test: enhance to verify new SQN increments After the legacy mode incrementing with ind_bitlen == 0 is through, do another AUTS run with sensible ind_bitlen and ind, and then two more normal vector generations to verify proper SQN increments. Related: OS#1968 Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 31 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 7aada36..b4c2c79 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -104,6 +104,34 @@ test_aud.u.umts.sqn); } + /* Now test SQN incrementing scheme using SEQ and IND parts: + * with ind_bitlen == 5 and ind == 10, the next SQN after 31 is + * 32 + 10 == 42. */ + test_aud.u.umts.ind_bitlen = 5; + test_aud.u.umts.ind = 10; + rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); + if (rc < 0) + printf("AUTS failed\n"); + else + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after that is 64 + 10 == 74 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + + /* And the one after *that* is 96 + 10 == 106 */ + rc = osmo_auth_gen_vec(vec, &test_aud, _rand); + if (rc < 0) + printf("generating vector failed\n"); + else + printf("tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); + opc_test(&test_aud); exit(0); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index b0eb44b..5a0a602 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -6,6 +6,9 @@ SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 AUTS success: tuple generated with SQN = 32 +AUTS success: tuple generated with SQN = 42 +tuple generated with SQN = 74 +tuple generated with SQN = 106 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2050 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2 Gerrit-PatchSet: 7 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:46:12 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:46:12 +0000 Subject: [MERGED] libosmocore[master]: milenage_test: cosmetic fix: shown value is not SEQ.MS In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: milenage_test: cosmetic fix: shown value is not SEQ.MS ...................................................................... milenage_test: cosmetic fix: shown value is not SEQ.MS In the milenage_test, the console output printed "SEQ.MS = 33", but 33 is a) the SQN, not SEQ; b) the SQN *after* the next auth generation, i.e. SQN.MS would have been 31. While at it also use the proper PRIu64 from inttypes.h to output the sqn value. This prepares for upcoming sparation of SQN incrementing by SEQ and IND, particularly to clearly show where the changes in auth/milenage_test's expectations originate. Related: OS#1968 Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 --- M tests/auth/milenage_test.c M tests/auth/milenage_test.ok 2 files changed, 4 insertions(+), 2 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 473be92..187b9ad 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,8 @@ if (rc < 0) { printf("AUTS failed\n"); } else { - printf("AUTS success: SEQ.MS = %llu\n", (unsigned long long)test_aud.u.umts.sqn); + printf("AUTS success: tuple generated with SQN = %" PRIu64 "\n", + test_aud.u.umts.sqn); } opc_test(&test_aud); diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 49146a5..20c47c6 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: SEQ.MS = 33 +AUTS success: tuple generated with SQN = 33 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- To view, visit https://gerrit.osmocom.org/2047 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:47:35 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:47:35 +0000 Subject: openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1360 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a Gerrit-PatchSet: 8 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:48:04 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:48:04 +0000 Subject: [MERGED] openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_PDCH_TWO_PHASE ...................................................................... libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_PDCH_TWO_PHASE When using a BSC located PCU the BSC must understand PDCH requests. Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a --- M openbsc/include/openbsc/gsm_data.h M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/gsm_04_08_utils.c 3 files changed, 16 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a36083a..e9ba173 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -360,7 +360,7 @@ enum rrlp_mode mode; } rrlp; - enum gsm_chan_t ctype_by_chreq[16]; + enum gsm_chan_t ctype_by_chreq[18]; /* Use a TCH for handling requests of type paging any */ int pag_any_tch; diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 7c469ee..e697cb8 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -46,6 +46,7 @@ GSM_CHREQ_REASON_CALL, GSM_CHREQ_REASON_LOCATION_UPD, GSM_CHREQ_REASON_OTHER, + GSM_CHREQ_REASON_PDCH, }; /* lchans 0..3 are SDCCH in combined channel configuration, diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 4a53b31..db9dabb 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -75,7 +75,11 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x70, 0xf8, CHREQ_T_PDCH_TWO_PHASE }, + { 0x78, 0xfc, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xfa, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xf9, CHREQ_T_PDCH_ONE_PHASE }, { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; @@ -92,7 +96,11 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, + { 0x70, 0xf8, CHREQ_T_PDCH_TWO_PHASE }, + { 0x78, 0xfc, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xfa, CHREQ_T_PDCH_ONE_PHASE }, + { 0x78, 0xf9, CHREQ_T_PDCH_ONE_PHASE }, { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, }; @@ -112,6 +120,8 @@ [CHREQ_T_PAG_R_TCH_FH] = GSM_LCHAN_TCH_F, [CHREQ_T_LMU] = GSM_LCHAN_SDCCH, [CHREQ_T_RESERVED_SDCCH] = GSM_LCHAN_SDCCH, + [CHREQ_T_PDCH_ONE_PHASE] = GSM_LCHAN_PDTCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_LCHAN_PDTCH, [CHREQ_T_RESERVED_IGNORE] = GSM_LCHAN_UNKNOWN, }; @@ -130,6 +140,8 @@ [CHREQ_T_PAG_R_TCH_F] = GSM_CHREQ_REASON_PAG, [CHREQ_T_PAG_R_TCH_FH] = GSM_CHREQ_REASON_PAG, [CHREQ_T_LMU] = GSM_CHREQ_REASON_OTHER, + [CHREQ_T_PDCH_ONE_PHASE] = GSM_CHREQ_REASON_PDCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_CHREQ_REASON_PDCH, [CHREQ_T_RESERVED_SDCCH] = GSM_CHREQ_REASON_OTHER, [CHREQ_T_RESERVED_IGNORE] = GSM_CHREQ_REASON_OTHER, }; -- To view, visit https://gerrit.osmocom.org/1360 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:51:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:51:00 +0000 Subject: osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2081/1/src/gsup_server.c File src/gsup_server.c: Line 231: whitespace -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:51:23 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:51:23 +0000 Subject: osmo-hlr[master]: auc tests: fix after SQN scheme changes from libosmocore In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2080 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:51:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:51:34 +0000 Subject: osmo-hlr[master]: auc tests: adjust cosmetically to prepare for SQN changes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2079 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I45d1866cde1b3e777460df76100af2fe4767c678 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:57:23 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:57:23 +0000 Subject: libosmocore[master]: vty: cleanup logging functions In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2084 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:57:58 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:57:58 +0000 Subject: libosmocore[master]: linuxlist.h: add llist_first/last_entry macros In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2076 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:58:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:58:00 +0000 Subject: [MERGED] libosmocore[master]: linuxlist.h: add llist_first/last_entry macros In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: linuxlist.h: add llist_first/last_entry macros ...................................................................... linuxlist.h: add llist_first/last_entry macros Copy list_first_entry, list_first_entry_or_null and list_last_entry from current linux kernel's tools/include/linux/list.h and rename to llist_*. Slightly adjust API doc but stay as close to the source as possible. This can replace similar implementations in osmo-bts-octphy's l1_if.c, in openbsc's gtphub.c and in osmo-hlr's gsup_server.c. Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453 --- M include/osmocom/core/linuxlist.h 1 file changed, 30 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/linuxlist.h b/include/osmocom/core/linuxlist.h index affa827..7d85077 100644 --- a/include/osmocom/core/linuxlist.h +++ b/include/osmocom/core/linuxlist.h @@ -215,6 +215,36 @@ #define llist_entry(ptr, type, member) \ container_of(ptr, type, member) +/*! \brief Get the first element from a list + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the list_head within the struct. + * + * Note, that list is expected to be not empty. + */ +#define llist_first_entry(ptr, type, member) \ + llist_entry((ptr)->next, type, member) + +/*! \brief Get the last element from a list + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the llist_head within the struct. + * + * Note, that list is expected to be not empty. + */ +#define llist_last_entry(ptr, type, member) \ + llist_entry((ptr)->prev, type, member) + +/*! \brief Get the first element from a list, or NULL + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the list_head within the struct. + * + * Note that if the list is empty, it returns NULL. + */ +#define llist_first_entry_or_null(ptr, type, member) \ + (!llist_empty(ptr) ? llist_first_entry(ptr, type, member) : NULL) + /*! \brief Iterate over a linked list * \param pos The \ref llist_head to use as a loop counter * \param head The head of the list over which to iterate -- To view, visit https://gerrit.osmocom.org/2076 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:58:52 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:58:52 +0000 Subject: libosmocore[master]: ctrl_type_vals: explicitly terminate In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:59:26 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:59:26 +0000 Subject: libosmocore[master]: tests/conv: move conv.h to the global include dir In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 12:59:49 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 12:59:49 +0000 Subject: libosmo-abis[master]: lapd: log pointer addresses In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2011 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9b961d5e36967cfd953551b24696849541257a1c Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:00:07 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:00:07 +0000 Subject: libosmo-abis[master]: lapd: Reduce N200 (SABM retransmission count) In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2010 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4f56f9d00520adc0c0a4497547762cd054030867 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:00:17 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:00:17 +0000 Subject: [MERGED] libosmo-abis[master]: lapd: Reduce N200 (SABM retransmission count) In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: lapd: Reduce N200 (SABM retransmission count) ...................................................................... lapd: Reduce N200 (SABM retransmission count) N200, which controls the maxium number of LAPD retransmissions, is set to 300. This will cause a long waiting time until LAPD detects a failed link. This commit reduces the retransmission count to 50 in order to get a faster link re-establishment in case of link failure. This patch will only affect the ericsson LAPD profile, all other lapd profiles will not be touched. Change-Id: I4f56f9d00520adc0c0a4497547762cd054030867 --- M src/input/lapd.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/input/lapd.c b/src/input/lapd.c index f5909b4..370697d 100644 --- a/src/input/lapd.c +++ b/src/input/lapd.c @@ -101,12 +101,12 @@ * periodically scanning through all timeslots to find the timeslot * where the bsc is transmitting its sabm frames the normal maximum * retransmission (n200) of 3 is not enough. In order not to miss - * the bts, n200 has been increased to 300, which is an educated + * the bts, n200 has been increased to 50, which is an educated * guess. */ const struct lapd_profile lapd_profile_abis_ericsson = { .k = LAPD_SET_K(2,1), - .n200 = 300, + .n200 = 50, .n201 = 260, .n202 = 0, /* infinite */ .t200_sec = 0, .t200_usec = 300000, -- To view, visit https://gerrit.osmocom.org/2010 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4f56f9d00520adc0c0a4497547762cd054030867 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:00:24 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:00:24 +0000 Subject: [MERGED] libosmo-abis[master]: lapd: log pointer addresses In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: lapd: log pointer addresses ...................................................................... lapd: log pointer addresses Add pointer address output to the sap alloc/free functions in order to track the objects later in the debug output (we have three of them) Change-Id: I9b961d5e36967cfd953551b24696849541257a1c --- M src/input/lapd.c 1 file changed, 7 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/input/lapd.c b/src/input/lapd.c index 370697d..4b5077b 100644 --- a/src/input/lapd.c +++ b/src/input/lapd.c @@ -229,8 +229,9 @@ if (!sap) return NULL; - LOGP(DLLAPD, LOGL_NOTICE, "LAPD Allocating SAP for SAPI=%u / TEI=%u\n", - sapi, teip->tei); + LOGP(DLLAPD, LOGL_NOTICE, + "LAPD Allocating SAP for SAPI=%u / TEI=%u (dl=%p, sap=%p)\n", + sapi, teip->tei, &sap->dl, sap); sap->sapi = sapi; sap->tei = teip; @@ -266,6 +267,10 @@ /* Free SAP instance, including the datalink */ static void lapd_sap_free(struct lapd_sap *sap) { + LOGP(DLLAPD, LOGL_NOTICE, + "LAPD Freeing SAP for SAPI=%u / TEI=%u (dl=%p, sap=%p)\n", + sap->sapi, sap->tei->tei, &sap->dl, sap); + /* free datalink structures and timers */ lapd_dl_exit(&sap->dl); -- To view, visit https://gerrit.osmocom.org/2011 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9b961d5e36967cfd953551b24696849541257a1c Gerrit-PatchSet: 3 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:00:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:00:44 +0000 Subject: openbsc[master]: cosmetic: Add commandline option to display version In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2073 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0c848fd42c13f473807caf3478d32c6ce5e43e31 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:00:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:00:48 +0000 Subject: [MERGED] openbsc[master]: cosmetic: Add commandline option to display version In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: cosmetic: Add commandline option to display version ...................................................................... cosmetic: Add commandline option to display version The -V option to display the Version and the copyright info is missing. Change-Id: I0c848fd42c13f473807caf3478d32c6ce5e43e31 --- M openbsc/src/gprs/sgsn_main.c 1 file changed, 6 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index 5cdfb31..04f2825 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -195,11 +195,12 @@ {"config-file", 1, 0, 'c'}, {"disable-color", 0, 0, 's'}, {"timestamp", 0, 0, 'T'}, + { "version", 0, 0, 'V' }, {"log-level", 1, 0, 'e'}, {NULL, 0, 0, 0} }; - c = getopt_long(argc, argv, "hd:Dc:sTe:", + c = getopt_long(argc, argv, "hd:Dc:sTVe:", long_options, &option_index); if (c == -1) break; @@ -224,6 +225,10 @@ case 'T': log_set_print_timestamp(osmo_stderr_target, 1); break; + case 'V': + print_version(1); + exit(0); + break; case 'e': log_set_log_level(osmo_stderr_target, atoi(optarg)); break; -- To view, visit https://gerrit.osmocom.org/2073 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0c848fd42c13f473807caf3478d32c6ce5e43e31 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:00:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:00:59 +0000 Subject: openbsc[master]: examples: remove logging level * everything In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2072 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I828ef7671b4fb38717526a18ff8e9a5428cd511e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:01:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:01:14 +0000 Subject: [MERGED] openbsc[master]: examples: remove logging level * everything In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: examples: remove logging level * everything ...................................................................... examples: remove logging level * everything Option "logging level ... everything" is broken for quite some time and might be deprecated in future. Replace it with "logging level ... debug" in config examples. Change-Id: I828ef7671b4fb38717526a18ff8e9a5428cd511e Related: OS#71 --- M openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg M openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg 2 files changed, 7 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg b/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg index 2e00bc2..6b48e97 100644 --- a/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg +++ b/openbsc/doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg @@ -6,7 +6,7 @@ logging filter all 1 logging color 1 logging timestamp 0 - logging level all everything + logging level all debug logging level rll notice logging level cc notice logging level mm notice @@ -22,14 +22,14 @@ logging level ho notice logging level db notice logging level ref notice - logging level gprs everything + logging level gprs debug logging level ns info - logging level bssgp everything - logging level llc everything - logging level sndcp everything + logging level bssgp debug + logging level llc debug + logging level sndcp debug logging level nat notice logging level ctrl notice - logging level smpp everything + logging level smpp debug logging level lglobal notice logging level llapd notice logging level linp notice diff --git a/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg b/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg index 566258e..15fd74a 100644 --- a/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg +++ b/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg @@ -6,7 +6,7 @@ logging filter all 1 logging color 1 logging timestamp 0 - logging level all everything + logging level all debug logging level gprs debug logging level ns info logging level bssgp debug -- To view, visit https://gerrit.osmocom.org/2072 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I828ef7671b4fb38717526a18ff8e9a5428cd511e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:02:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:02:00 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Explain TCP/IP header compression In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I98408e72020a474d378e39263a933eb7567de146 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:02:30 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:02:30 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: improve auth-policy explaination In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2016 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:04:10 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:04:10 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 1: did you verify that the node id's didn't change and the merge with sgsn_vty_additions.xml still works as intended after the update? -- To view, visit https://gerrit.osmocom.org/2015 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:04:51 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:04:51 +0000 Subject: osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 1: did you verify the node-id's didn't change and the merge with nitb_vty_additions.xml still works as intended? -- To view, visit https://gerrit.osmocom.org/2014 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:05:46 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:05:46 +0000 Subject: openbsc[master]: Install shared headers In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 I don't like this. Those headers are not a public API and they should not be installed on a normal system thar runs OpenBSC. -- To view, visit https://gerrit.osmocom.org/2070 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib76033b1d9f5faf7a00e4b926ce309528ed53dd7 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:07:40 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:07:40 +0000 Subject: osmo-trx[master]: Add autoconf-archive to dependencies In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 @Tom: You are a maintainer of osmo-trx (I guess the only one?), other people like me are not. So unless you set a patch to +2, it cannot be merged. Not sure if you're aware of this. -- To view, visit https://gerrit.osmocom.org/2074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:08:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:08:11 +0000 Subject: libosmocore[master]: fix wrong return code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Thorsten Alteholz Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:08:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:08:13 +0000 Subject: [MERGED] libosmocore[master]: fix wrong return code In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix wrong return code ...................................................................... fix wrong return code In case we are a daemon, we do not need to daemonize again. On the other hand everything is fine and we also do not need to bail out with an error. The daemonize template at [1] does the same. [1] http://www.itp.uzh.ch/~dpotter/howto/daemonize Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e --- M src/application.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/application.c b/src/application.c index 8a325c8..4112e75 100644 --- a/src/application.c +++ b/src/application.c @@ -124,7 +124,7 @@ /* Check if parent PID == init, in which case we are already a daemon */ if (getppid() == 1) - return -EEXIST; + return 0; /* Fork from the parent process */ pid = fork(); -- To view, visit https://gerrit.osmocom.org/2046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Thorsten Alteholz From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:15:28 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:15:28 +0000 Subject: [MERGED] openbsc[master]: gprs: fix T3186 encoding in Sysinfo 13 In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gprs: fix T3186 encoding in Sysinfo 13 ...................................................................... gprs: fix T3186 encoding in Sysinfo 13 The timer T3186, which is described in 3GPP TS 44.060, is using 3 bits of the si13 mac block. This requires special encoding. In the case of T3186, the value is encoded by the formula: bits = t/500-1. Our implementation uses the formula bits=t/500, which is incorrect. Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb --- M openbsc/src/libbsc/rest_octets.c 1 file changed, 7 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c index 6fae9cd..ed6c573 100644 --- a/openbsc/src/libbsc/rest_octets.c +++ b/openbsc/src/libbsc/rest_octets.c @@ -566,6 +566,8 @@ static int encode_t3192(unsigned int t3192) { + /* See also 3GPP TS 44.060 + Table 12.24.2: GPRS Cell Options information element details */ if (t3192 == 0) return 3; else if (t3192 <= 80) @@ -645,7 +647,11 @@ return drx_timer_max; bitvec_set_uint(bv, gco->nmo, 2); - bitvec_set_uint(bv, gco->t3168 / 500, 3); + + /* See also 3GPP TS 44.060 + Table 12.24.2: GPRS Cell Options information element details */ + bitvec_set_uint(bv, gco->t3168 / 500 - 1, 3); + bitvec_set_uint(bv, t3192, 3); bitvec_set_uint(bv, drx_timer_max, 3); /* ACCESS_BURST_TYPE: Hard-code 8bit */ -- To view, visit https://gerrit.osmocom.org/2032 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:17:40 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:17:40 +0000 Subject: [PATCH] openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2031 to look at the new patch set (#4). gsm_data_shared: add value strings for gsm_chreq Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data_shared.c 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/31/2031/4 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index e697cb8..9e51568 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -841,7 +841,7 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); - +const struct value_string gsm_chreq_descs[7]; const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; const char *gsm_pchan_name(enum gsm_phys_chan_config c); diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..dc1cf8d 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,16 @@ gsm_abis_mo_reset(mo); } +const struct value_string gsm_chreq_descs[7] = { + { GSM_CHREQ_REASON_EMERG, "emergency call" }, + { GSM_CHREQ_REASON_PAG, "answer to paging" }, + { GSM_CHREQ_REASON_CALL, "call re-establishment" }, + { GSM_CHREQ_REASON_LOCATION_UPD,"Location updating" }, + { GSM_CHREQ_REASON_PDCH, "one phase packet access" }, + { GSM_CHREQ_REASON_OTHER, "other" }, + { 0, NULL } +}; + const struct value_string gsm_pchant_names[13] = { { GSM_PCHAN_NONE, "NONE" }, { GSM_PCHAN_CCCH, "CCCH" }, -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:19:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:19:41 +0000 Subject: openbsc[master]: OM2000: Change the order of MO initialization In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2035 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8efd9bafdcf9504d2e5fc85c44c708fa53f4dff8 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:20:10 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:20:10 +0000 Subject: openbsc[master]: OM2000: Send ALTCRQ for SuperChannel after receiving IS Enab... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2036 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I672bfaa09c42fbeb0c8459f24b2222b952de954b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:20:30 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:20:30 +0000 Subject: openbsc[master]: abis_om2k: protect MO FSMs by NULL check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2037 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:20:38 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:20:38 +0000 Subject: openbsc[master]: RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2038 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I793e7d62df1ca9f9c38d39e22d3868064d446c8d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:21:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:21:02 +0000 Subject: openbsc[master]: RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2039 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I66541f9b20e7fd67fbec329283fc3c821c970a56 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:21:36 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:21:36 +0000 Subject: openbsc[master]: libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2040/1/openbsc/src/libbsc/abis_rsl.c File openbsc/src/libbsc/abis_rsl.c: Line 1095: msgb_put_u8(msg, 0xf1); don't we have some enum for this? -- To view, visit https://gerrit.osmocom.org/2040 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:22:01 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:22:01 +0000 Subject: openbsc[master]: libbsc: add debug log message to S_L_INP_* callbacks In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2041 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifca46dd8b356d0de31cccbd79e406079d3a0d7d2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:23:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:23:48 +0000 Subject: openbsc[master]: abis-rsl: Send imm.ass messages via PCH In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2066/1/openbsc/include/openbsc/pcuif_proto.h File openbsc/include/openbsc/pcuif_proto.h: Line 64: uint8_t imsi[3]; this changes the layout of the PCU socket interface protocol, and hence should be accompaned by a version increment in the pcu interface protocol to ensure both sides of the socket have a common understanding. -- To view, visit https://gerrit.osmocom.org/2066 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:24:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:24:48 +0000 Subject: openbsc[master]: abis_rsl: use msgb_pull to parse tlli from msg In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2069 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I971bf6c8821689f9d8a1294a9b3bf1af9c4091f7 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:27:26 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:27:26 +0000 Subject: openbsc[master]: pcu_sock: add basic pcu interface support In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 > Can we use shared header installed by osmo-pcu similar to #1258? Actually, I think I start to like the idea of having copies of the header file. This way, each version in the git repository has the matching version of the header file to its code. Let's say we change the interface and bump the version inside the pcu. Then the new versions header file is the right one inside the PCU repository. A different check-out (even of an older or current version) of BTS or BSC may implement a different version, based on its local header file. This is exactly what we want: If you try to run the two together, you will get some meaningful error message. -- To view, visit https://gerrit.osmocom.org/2056 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:31:26 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:31:26 +0000 Subject: openbsc[master]: pcu_sock: add basic pcu interface support In-Reply-To: References: Message-ID: Patch Set 1: -Code-Review (3 comments) https://gerrit.osmocom.org/#/c/2056/1/openbsc/include/openbsc/pcu_if.h File openbsc/include/openbsc/pcu_if.h: Line 13: struct osmo_fd conn_bfd; /* fd for connection to lcr */ to lrc?!? https://gerrit.osmocom.org/#/c/2056/1/openbsc/src/libbsc/bsc_init.c File openbsc/src/libbsc/bsc_init.c: Line 534: strcpy(pcu_sock_path, PCU_SOCK_DEFAULT); osmo_strlcpy for bounds checking? https://gerrit.osmocom.org/#/c/2056/1/openbsc/src/libbsc/pcu_sock.c File openbsc/src/libbsc/pcu_sock.c: Line 1: /* pcu_sock.c: Connect from PCU via unix domain socket */ the question here is still if this code could/should be generalized and shared between the PCU socket inside the BTS and the one inside the BSC. -- To view, visit https://gerrit.osmocom.org/2056 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:31:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:31:37 +0000 Subject: openbsc[master]: pcu_sock: Don't re-implement core functionality like gsm_bts... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2057 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5ea506c8240dac124ccf5522d02ba18e4f0cb90d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:31:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:31:47 +0000 Subject: openbsc[master]: pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for ... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2058 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:32:06 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:32:06 +0000 Subject: openbsc[master]: pcu_sock: Forward paging request from PCU via RSL to BTS In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2059 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I28bf0995699618f3f5fa15fc8e1733beddfc482f Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:32:17 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 13:32:17 +0000 Subject: [PATCH] openbsc[master]: Handle PCU version received viam OML alert Message-ID: Review at https://gerrit.osmocom.org/2085 Handle PCU version received viam OML alert Explicitly check for and log PCU version received from BTS via OML alert message. Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Related: OS#1614 --- M openbsc/src/libbsc/abis_nm.c 1 file changed, 54 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/2085/1 diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index 8b0eec2..47e72dd 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -273,43 +273,71 @@ return 0; } -static int rx_fail_evt_rep(struct msgb *mb) +static int rx_fail_evt_rep(struct msgb *mb, struct gsm_bts *bts) { struct abis_om_hdr *oh = msgb_l2(mb); struct abis_om_fom_hdr *foh = msgb_l3(mb); struct e1inp_sign_link *sign_link = mb->dst; struct tlv_parsed tp; - const uint8_t *p_val; - char *p_text; + const uint8_t *p_val = NULL; + enum abis_mm_event_causes c; + char *p_text = NULL; - LOGPC(DNM, LOGL_ERROR, "Failure Event Report: "); + abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, + oh->length-sizeof(*foh)); - abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh)); + if (TLVP_PRESENT(&tp, NM_ATT_ADD_TEXT)) { + p_val = TLVP_VAL(&tp, NM_ATT_ADD_TEXT); + p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, + TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); + } + if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { + p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); + if (p_val[0] == NM_PCAUSE_T_MANUF) { + c = osmo_load16be(p_val + 1); + if (c == OSMO_EVT_PCU_VERS) { + if (p_text) { + LOGPC(DNM, LOGL_NOTICE, + "BTS%u reported PCU version %s\n", + bts->nr, p_text); + return 0; + } else { + LOGPC(DNM, LOGL_ERROR, + "BTS%u sent %s without actual " + "version string.\n", + bts->nr, + get_value_string(abis_mm_event_cause_names, + c)); + return -EINVAL; + } + } + } + } else { + LOGPC(DNM, LOGL_ERROR, "BTS%u: Failure Event Report without " + "Probable Cause?!\n", bts->nr); + return -EINVAL; + } + + LOGPC(DNM, LOGL_ERROR, "BTS%u: Failure Event Report: ", bts->nr); if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE)) LOGPC(DNM, LOGL_ERROR, "Type=%s, ", abis_nm_event_type_name(*TLVP_VAL(&tp, NM_ATT_EVENT_TYPE))); if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY)) LOGPC(DNM, LOGL_ERROR, "Severity=%s, ", abis_nm_severity_name(*TLVP_VAL(&tp, NM_ATT_SEVERITY))); - if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { - p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); - LOGPC(DNM, LOGL_ERROR, "Probable cause=%s: ", - get_value_string(abis_nm_pcause_type_names, p_val[0])); - if (p_val[0] == NM_PCAUSE_T_MANUF) - LOGPC(DNM, LOGL_ERROR, "%s, ", - get_value_string(abis_mm_event_cause_names, - osmo_load16be(p_val + 1))); - else - LOGPC(DNM, LOGL_ERROR, "%02X %02X ", p_val[1], p_val[2]); - } - if (TLVP_PRESENT(&tp, NM_ATT_ADD_TEXT)) { - p_val = TLVP_VAL(&tp, NM_ATT_ADD_TEXT); - p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); - if (p_text) { - LOGPC(DNM, LOGL_ERROR, "Additional Text=%s. ", p_text); - talloc_free(p_text); - } + + LOGPC(DNM, LOGL_ERROR, "Probable cause=%s: ", + get_value_string(abis_nm_pcause_type_names, p_val[0])); + if (p_val[0] == NM_PCAUSE_T_MANUF) + LOGPC(DNM, LOGL_ERROR, "%s, ", + get_value_string(abis_mm_event_cause_names, c)); + else + LOGPC(DNM, LOGL_ERROR, "%02X %02X ", p_val[1], p_val[2]); + + if (p_text) { + LOGPC(DNM, LOGL_ERROR, "Additional Text=%s. ", p_text); + talloc_free(p_text); } LOGPC(DNM, LOGL_ERROR, "\n"); @@ -317,7 +345,7 @@ return 0; } -static int abis_nm_rcvmsg_report(struct msgb *mb) +static int abis_nm_rcvmsg_report(struct msgb *mb, struct gsm_bts *bts) { struct abis_om_fom_hdr *foh = msgb_l3(mb); uint8_t mt = foh->msg_type; @@ -335,7 +363,7 @@ osmo_signal_dispatch(SS_NM, S_NM_SW_ACTIV_REP, mb); break; case NM_MT_FAILURE_EVENT_REP: - rx_fail_evt_rep(mb); + rx_fail_evt_rep(mb, bts); osmo_signal_dispatch(SS_NM, S_NM_FAIL_REP, mb); break; case NM_MT_TEST_REP: @@ -580,7 +608,7 @@ /* check for unsolicited message */ if (is_report(mt)) - return abis_nm_rcvmsg_report(mb); + return abis_nm_rcvmsg_report(mb, bts); if (is_in_arr(mt, abis_nm_sw_load_msgs, ARRAY_SIZE(abis_nm_sw_load_msgs))) return abis_nm_rcvmsg_sw(mb); -- To view, visit https://gerrit.osmocom.org/2085 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:32:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:32:22 +0000 Subject: openbsc[master]: pcu_sock: Send non-NULL hLayer1 to PCU In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 agreed with max. -- To view, visit https://gerrit.osmocom.org/2060 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8170bd4134904702b6b272e496100361ba473cbc Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:32:58 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:32:58 +0000 Subject: openbsc[master]: pcu_sock: set flag PCU_IF_FLAG_SYSMO by setting pcu_direct = 1 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2061 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1f5407264fc4f209456ffcb73d7853ff315aab86 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:33:18 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:33:18 +0000 Subject: openbsc[master]: pcu_sock: pcu_tx_info_ind allow to use TRX not starting from 0 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2062 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I68dc5e837bd2a3602f7875063c85da4082196274 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:33:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:33:48 +0000 Subject: openbsc[master]: pcu_sock: implement direct tlli on AGCH In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2063 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I945f49e62e2a74a7906e2d49940927773edd04a9 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:34:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:34:22 +0000 Subject: openbsc[master]: pcu_sock: Forward imm.ass PCU originated messages In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2064/1/openbsc/include/openbsc/pcuif_proto.h File openbsc/include/openbsc/pcuif_proto.h: Line 10: #define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */ once again the pcu interface protocol is changed, thus the PCU_IF_VERSION must be changed! -- To view, visit https://gerrit.osmocom.org/2064 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice099c4ed7008200ed179e581aba1899c6c29455 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:34:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:34:44 +0000 Subject: openbsc[master]: pcu_sock: Fix broken paging command In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2065 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iefef08123bdc351afd8287d3f27ebf0ae58a6e7d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:35:07 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:35:07 +0000 Subject: openbsc[master]: pcu_sock: reorganize calculation of paging group In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2067 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:35:26 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:35:26 +0000 Subject: openbsc[master]: abis_rsl: fix off-by-one length check when parsing ericson t... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2068 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I658f6d82a67944345ddda5534fa996dca9e990ab Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:35:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:35:59 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:36:32 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:36:32 +0000 Subject: [MERGED] openbsc[master]: OM2000: Change the order of MO initialization In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: OM2000: Change the order of MO initialization ...................................................................... OM2000: Change the order of MO initialization So far: CF-IS-CON-TF Now: CF-TF-CON-IS Change-Id: I8efd9bafdcf9504d2e5fc85c44c708fa53f4dff8 --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 30 insertions(+), 28 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 62e8f6a..1fb7689 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -2157,18 +2157,19 @@ struct gsm_bts *bts = obfp->bts; OSMO_ASSERT(event == OM2K_BTS_EVT_CF_DONE); - osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_IS, - BTS_FSM_TIMEOUT, 0); - om2k_mo_fsm_start(fi, OM2K_BTS_EVT_IS_DONE, bts->c0, - &bts->rbs2000.is.om2k_mo); + /* TF can take a long time to initialize, wait for 10min */ + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TF, 600, 0); + om2k_mo_fsm_start(fi, OM2K_BTS_EVT_TF_DONE, bts->c0, + &bts->rbs2000.tf.om2k_mo); } -static void om2k_bts_s_wait_is(struct osmo_fsm_inst *fi, uint32_t event, void *data) +static void om2k_bts_s_wait_tf(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct om2k_bts_fsm_priv *obfp = fi->priv; struct gsm_bts *bts = obfp->bts; - OSMO_ASSERT(event == OM2K_BTS_EVT_IS_DONE); + OSMO_ASSERT(event == OM2K_BTS_EVT_TF_DONE); + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_CON, BTS_FSM_TIMEOUT, 0); om2k_mo_fsm_start(fi, OM2K_BTS_EVT_CON_DONE, bts->c0, @@ -2181,18 +2182,19 @@ struct gsm_bts *bts = obfp->bts; OSMO_ASSERT(event == OM2K_BTS_EVT_CON_DONE); - /* TF can take a long time to initialize, wait for 10min */ - osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TF, 600, 0); - om2k_mo_fsm_start(fi, OM2K_BTS_EVT_TF_DONE, bts->c0, - &bts->rbs2000.tf.om2k_mo); + + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_IS, + BTS_FSM_TIMEOUT, 0); + om2k_mo_fsm_start(fi, OM2K_BTS_EVT_IS_DONE, bts->c0, + &bts->rbs2000.is.om2k_mo); } -static void om2k_bts_s_wait_tf(struct osmo_fsm_inst *fi, uint32_t event, void *data) +static void om2k_bts_s_wait_is(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct om2k_bts_fsm_priv *obfp = fi->priv; struct gsm_bts_trx *trx; - OSMO_ASSERT(event == OM2K_BTS_EVT_TF_DONE); + OSMO_ASSERT(event == OM2K_BTS_EVT_IS_DONE); osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX, BTS_FSM_TIMEOUT, 0); @@ -2231,31 +2233,31 @@ [OM2K_BTS_S_WAIT_CF] = { .in_event_mask = S(OM2K_BTS_EVT_CF_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_IS), + S(OM2K_BTS_S_WAIT_TF), .name = "WAIT-CF", .action = om2k_bts_s_wait_cf, - }, - [OM2K_BTS_S_WAIT_IS] = { - .in_event_mask = S(OM2K_BTS_EVT_IS_DONE), - .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_CON), - .name = "WAIT-IS", - .action = om2k_bts_s_wait_is, - }, - [OM2K_BTS_S_WAIT_CON] = { - .in_event_mask = S(OM2K_BTS_EVT_CON_DONE), - .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_TF), - .name = "WAIT-CON", - .action = om2k_bts_s_wait_con, }, [OM2K_BTS_S_WAIT_TF] = { .in_event_mask = S(OM2K_BTS_EVT_TF_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_TRX), + S(OM2K_BTS_S_WAIT_CON), .name = "WAIT-TF", .action = om2k_bts_s_wait_tf, }, + [OM2K_BTS_S_WAIT_CON] = { + .in_event_mask = S(OM2K_BTS_EVT_CON_DONE), + .out_state_mask = S(OM2K_BTS_S_ERROR) | + S(OM2K_BTS_S_WAIT_IS), + .name = "WAIT-CON", + .action = om2k_bts_s_wait_con, + }, + [OM2K_BTS_S_WAIT_IS] = { + .in_event_mask = S(OM2K_BTS_EVT_IS_DONE), + .out_state_mask = S(OM2K_BTS_S_ERROR) | + S(OM2K_BTS_S_WAIT_TRX), + .name = "WAIT-IS", + .action = om2k_bts_s_wait_is, + }, [OM2K_BTS_S_WAIT_TRX] = { .in_event_mask = S(OM2K_BTS_EVT_TRX_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | -- To view, visit https://gerrit.osmocom.org/2035 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8efd9bafdcf9504d2e5fc85c44c708fa53f4dff8 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:37:52 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:37:52 +0000 Subject: osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:37:56 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:37:56 +0000 Subject: [MERGED] osmo-bts[master]: l1sap: fix rach reason (ra) parsing In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: l1sap: fix rach reason (ra) parsing ...................................................................... l1sap: fix rach reason (ra) parsing The ra parameter indicates the reason for the received rach request. osmo-bts uses the ra parameter to determine if the received rach request is packet access related. If yes, osmo-bts will forward the request to the PCU. In order to determine if the ra is packet related or not, the higher 4 bits must be equel to 0x7 and at least one of the lower 4 bits must be zero. The current method lacks checking of the lower 4 bits. It would also accept 0b01111111, which is reserved for future use. This commit extends the check to take also the last 4 bits into accound. See also: 3GPP TS 04.08, Table 9.9 Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 --- M include/osmo-bts/l1sap.h 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Max: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index dcebc1d..0e56406 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -24,7 +24,7 @@ #define L1SAP_IS_CHAN_AGCH_PCH(chan_nr) ((chan_nr & 0xf8) == 0x90) /* rach type from ra */ -#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70) +#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70 && (ra & 0x0f) != 0x0f) /* CCCH block from frame number */ #define L1SAP_FN2CCCHBLOCK(fn) ((fn % 51) / 5 - 1) -- To view, visit https://gerrit.osmocom.org/2023 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5eb88c42a91e158d9bfa4105ec9636035baf8959 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:38:24 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 15 Mar 2017 13:38:24 +0000 Subject: openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:41:28 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 13:41:28 +0000 Subject: openbsc[master]: pcu_sock: add basic pcu interface support In-Reply-To: References: Message-ID: Patch Set 1: > Let's say we change the interface and bump the version inside the pcu. So what shall we do if we have to make changes to BSC's copy of the protocol? We have to checkout latest version of OsmoPCU, see which version was used there and +1 to it to make sure we don't have different changes marked as the same version. And while our patch is under review, OsmoPCU might have another patch merged which will also bump version to the same we use. I thought the problem was in syncing the changes, not in the protocol versioning per se? Having single source of truth when it comes to protocol header solves this once and for all. -- To view, visit https://gerrit.osmocom.org/2056 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:46:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:46:59 +0000 Subject: [MERGED] libosmocore[master]: milenage_test: cosmetic: verify AUTS in comments In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: milenage_test: cosmetic: verify AUTS in comments ...................................................................... milenage_test: cosmetic: verify AUTS in comments In a comment and by code #if'd away, illustrate that the AUTS used in the unit test is accurate. Related: OS#1968 Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 --- M tests/auth/milenage_test.c 1 file changed, 56 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index b4c2c79..2bd3cf2 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -63,6 +63,15 @@ return rc; } +#define RECALC_AUTS 0 +#if RECALC_AUTS +typedef uint8_t u8; +extern int milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand, + u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar); +extern int milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand, + const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s); +#endif + int main(int argc, char **argv) { struct osmo_auth_vector _vec; @@ -92,6 +101,53 @@ dump_auth_vec(vec); + /* The USIM generates an AUTS to tell us it is at SQN == 31: + * + * SQN_MS = 00000000001f + * + * AUTS = Conc(SQN_MS) || MAC-S + * Conc(SQN_MS) = SQN_MS ? f5*[K](RAND) + * MAC-S = f1*[K] (SQN MS || RAND || AMF) + * + * K = 000102030405060708090a0b0c0d0e0f + * RAND = 00000000000000000000000000000000 + * + * f5*--> Conc(SQN_MS) = SQN_MS ^ f5*(K,RAND) + * = 00000000001f ^ 8711a0ec9e09 + * = 8711a0ec9e16 + * AMF = 0000 (TS 33.102 v7.0.0, 6.3.3) + * MAC-S = f1*[K] (SQN MS || RAND || AMF) + * = f1*[K] (00000000001f || 00000000000000000000000000000000 || 0000) + * = 37df17f80b384ee4 + * + * AUTS = 8711a0ec9e16 || 37df17f80b384ee4 + */ +#if RECALC_AUTS + uint8_t ak[6]; + uint8_t akstar[6]; + uint8_t opc[16]; + uint8_t k[16]; + uint8_t rand[16]; + osmo_hexparse("000102030405060708090a0b0c0d0e0f", k, sizeof(k)); + osmo_hexparse("000102030405060708090a0b0c0d0e0f", opc, sizeof(opc)); + osmo_hexparse("00000000000000000000000000000000", rand, sizeof(rand)); + milenage_f2345(opc, k, rand, NULL, NULL, NULL, ak, akstar); + printf("ak = %s\n", osmo_hexdump_nospc(ak, sizeof(ak))); + printf("akstar = %s\n", osmo_hexdump_nospc(akstar, sizeof(akstar))); + + uint8_t sqn_ms[6] = { 0, 0, 0, 0, 0, 31 }; + uint8_t amf[2] = {}; + uint8_t mac_s[8]; + milenage_f1(opc, k, rand, sqn_ms, amf, NULL, mac_s); + printf("mac_s = %s\n", osmo_hexdump_nospc(mac_s, sizeof(mac_s))); + /* verify valid AUTS resulting in SQN 31 with: + osmo-auc-gen -3 -a milenage -k 000102030405060708090a0b0c0d0e0f \ + -o 000102030405060708090a0b0c0d0e0f \ + -r 00000000000000000000000000000000 \ + -A 8711a0ec9e1637df17f80b384ee4 + */ +#endif + const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; -- To view, visit https://gerrit.osmocom.org/2051 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:47:20 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:47:20 +0000 Subject: [MERGED] libosmocore[master]: ctrl_type_vals: explicitly terminate In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: ctrl_type_vals: explicitly terminate ...................................................................... ctrl_type_vals: explicitly terminate Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. >From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc --- M include/osmocom/ctrl/control_cmd.h M src/ctrl/control_cmd.c M tests/ctrl/ctrl_test.ok 3 files changed, 4 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified Holger Freyther: Looks good to me, but someone else must approve diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index d82c9af..d9092f3 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -22,7 +22,7 @@ }; enum ctrl_type { - CTRL_TYPE_UNKNOWN = 0, + CTRL_TYPE_UNKNOWN, CTRL_TYPE_GET, CTRL_TYPE_SET, CTRL_TYPE_GET_REPLY, diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index cdec8ef..d706995 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -40,13 +40,14 @@ extern vector ctrl_node_vec; const struct value_string ctrl_type_vals[] = { + { CTRL_TYPE_UNKNOWN, "(unknown)" }, { CTRL_TYPE_GET, "GET" }, { CTRL_TYPE_SET, "SET" }, { CTRL_TYPE_GET_REPLY, "GET_REPLY" }, { CTRL_TYPE_SET_REPLY, "SET_REPLY" }, { CTRL_TYPE_TRAP, "TRAP" }, { CTRL_TYPE_ERROR, "ERROR" }, - { CTRL_TYPE_UNKNOWN, NULL } + { 0, NULL } }; /* Functions from libosmocom */ diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok index c4b05e9..8f97a27 100644 --- a/tests/ctrl/ctrl_test.ok +++ b/tests/ctrl/ctrl_test.ok @@ -1,5 +1,5 @@ Checking ctrl types... -ctrl type 0 is unknown 0x0 [PARSE FAILED] +ctrl type 0 is (unknown) -> 0 OK ctrl type 1 is GET -> 1 OK ctrl type 2 is SET -> 2 OK ctrl type 3 is GET_REPLY -> 3 OK -- To view, visit https://gerrit.osmocom.org/1962 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:50:06 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:50:06 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 4: Max, would you agree to remove your -1 at this point? -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:52:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 13:52:58 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 4: -Code-Review I still think it's suboptimal but as it doesn't break existing code now, sure, here it is. -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:54:25 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:54:25 +0000 Subject: libosmocore[master]: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2025 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:54:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:54:26 +0000 Subject: [MERGED] libosmocore[master]: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() ...................................................................... fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY() To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 --- M include/osmocom/core/utils.h 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Max: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified Holger Freyther: Looks good to me, but someone else must approve diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index d9c3097..63a73ab 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -18,7 +18,7 @@ /*! \brief Stringify the contents of a macro, e.g. a port number */ #define OSMO_STRINGIFY(x) #x /*! \brief Make a value_string entry from an enum value name */ -#define OSMO_VALUE_STRING(x) { x, OSMO_STRINGIFY(x) } +#define OSMO_VALUE_STRING(x) { x, #x } #include #include -- To view, visit https://gerrit.osmocom.org/2025 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:58:49 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:58:49 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 4: Thanks! you've made my day :) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 13:59:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 13:59:40 +0000 Subject: [MERGED] osmo-hlr[master]: auc tests: adjust cosmetically to prepare for SQN changes In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: auc tests: adjust cosmetically to prepare for SQN changes ...................................................................... auc tests: adjust cosmetically to prepare for SQN changes The current auc tests test a lot with SQN == 0. An upcoming change in the SQN algorithms from libosmocore [1] will require us to pass desired_sqn - 1, because the tuple generation will increment the SQN before calculating. Later on [2] we will also want to employ ind_bits and ind in the test. In order to have some room in the number range, cosmetically adjust the current SQN tested for from 0 to 32, changing the generated AUTN. The upcoming adjustment to the new situation will then be able to show that only the SQN values before and after vector generation change while the auth tuples as well as the SQNs used for generation remain the same (without having to trick around with wrapping SQN past its maximum value). Note that the TS 55.205 test sets include neither SQN nor AUTN. While AUTN changes with changing SQN, all the other values are invariant of the SQN used. So we can simply choose a different SQN and ignore the difference in the AUTN. [1] change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 "store last sqn" [2] change-id Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf "fix SQN increment" Related: OS#1969 Change-Id: I45d1866cde1b3e777460df76100af2fe4767c678 --- M tests/auc/Makefile.am M tests/auc/auc_test.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err M tests/auc/gen_ts_55_205_test_sets/func_template.c 5 files changed, 118 insertions(+), 93 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auc/Makefile.am b/tests/auc/Makefile.am index b3c20f2..88532bf 100644 --- a/tests/auc/Makefile.am +++ b/tests/auc/Makefile.am @@ -53,3 +53,7 @@ auc_ts_55_205_test_sets.c: $(top_srcdir)/tests/auc/gen_ts_55_205_test_sets/* $(top_srcdir)/tests/auc/gen_ts_55_205_test_sets/pdftxt_2_c.py > $@ +.PHONY: update_exp +update_exp: + $(builddir)/auc_test >"$(srcdir)/auc_test.ok" 2>"$(srcdir)/auc_test.err" + $(builddir)/auc_ts_55_205_test_sets >"$(srcdir)/auc_ts_55_205_test_sets.ok" 2>"$(srcdir)/auc_ts_55_205_test_sets.err" diff --git a/tests/auc/auc_test.c b/tests/auc/auc_test.c index 16c87f7..e507c29 100644 --- a/tests/auc/auc_test.c +++ b/tests/auc/auc_test.c @@ -194,6 +194,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, + .u.umts.sqn = 32, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -203,13 +204,14 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -219,19 +221,17 @@ " auth_types: 03000000\n" ); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); - /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 0; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + aud3g.u.umts.sqn = 32; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -301,6 +301,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, + .u.umts.sqn = 32, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -310,13 +311,14 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -336,19 +338,17 @@ * hence expecting kc: 059a4f668f6fbe39 */ - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); - /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 0; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + aud3g.u.umts.sqn = 32; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 1, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" - " autn: 8704f5ba55f30000d2ee44b22c8ea919\n" + " autn: 8704f5ba55d30000541dde77ea5b1d8c\n" " ck: f64735036e5871319c679f4742a75ea1\n" " ik: 27497388b6cb044648f396aa155b95ef\n" " res: e229c19e791f2e410000000000000000\n" @@ -361,8 +361,8 @@ fprintf(stderr, "- test AUTS resync\n"); vec = (struct osmo_auth_vector){}; - aud3g.u.umts.sqn = 0; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + aud3g.u.umts.sqn = 32; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); /* The AUTN sent was 8704f5ba55f30000d2ee44b22c8ea919 * with the first 6 bytes being SQN ^ AK. diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index aff96c9..51f176c 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -22,14 +22,14 @@ ===== test_gen_vectors_2g_plus_3g -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -39,16 +39,16 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations -aud3g.u.umts.sqn == 1 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -58,19 +58,19 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_gen_vectors_2g_plus_3g: SUCCESS ===== test_gen_vectors_3g_only -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -79,15 +79,15 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations -aud3g.u.umts.sqn == 1 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 8704f5ba55f30000d2ee44b22c8ea919 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef DAUC vector [0]: res = e229c19e791f2e410000000000000000 @@ -96,10 +96,10 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 1 +aud3g.u.umts.sqn == 33 vector matches expectations - test AUTS resync -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 8bedf46..9a9aaf5 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -1,12 +1,12 @@ ===== test_set_1 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = aa689c64837000000eed35e2ae9e21c0 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 DAUC vector [0]: res = a54211d5e3ba50bf0000000000000000 @@ -15,18 +15,19 @@ DAUC vector [0]: sres = 46f8416a DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_1: SUCCESS ===== test_set_2 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 33484dc2136b00009abcd7740cfa799c +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b DAUC vector [0]: res = 8011c48c0c214ed20000000000000000 @@ -35,18 +36,19 @@ DAUC vector [0]: sres = 8c308a5e DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_2: SUCCESS ===== test_set_3 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = f0b9c08ad02e00001b5ca3e1240212be +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b DAUC vector [0]: res = f365cd683cd92e960000000000000000 @@ -55,18 +57,19 @@ DAUC vector [0]: sres = cfbce3fe DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_3: SUCCESS ===== test_set_4 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 31e11a6091180000f55f5c8adb793014 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 DAUC vector [0]: res = 5860fc1bce351e7e0000000000000000 @@ -75,18 +78,19 @@ DAUC vector [0]: sres = 9655e265 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_4: SUCCESS ===== test_set_5 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 45b0f69ab06c0000a161b2de788f3b3f +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 DAUC vector [0]: res = 16c8233f05a0ac280000000000000000 @@ -95,18 +99,19 @@ DAUC vector [0]: sres = 13688f17 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_5: SUCCESS ===== test_set_6 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 7e6455f34cf3000040dc9568192ab1c0 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 DAUC vector [0]: res = 8c25a16cd918a1df0000000000000000 @@ -115,18 +120,19 @@ DAUC vector [0]: sres = 553d00b3 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_6: SUCCESS ===== test_set_7 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 88196c47986f000075c2ba7455852c2a +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 DAUC vector [0]: res = a63241e1ffc3e5ab0000000000000000 @@ -135,18 +141,19 @@ DAUC vector [0]: sres = 59f1a44a DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_7: SUCCESS ===== test_set_8 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 82a0f5287a71000023563512500d75d9 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e DAUC vector [0]: res = 4a90b2171ac83a760000000000000000 @@ -155,18 +162,19 @@ DAUC vector [0]: sres = 50588861 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_8: SUCCESS ===== test_set_9 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = a2f858aa9e5d0000bdd79d9f7c269d1c +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 DAUC vector [0]: res = 4bc2212d8624910a0000000000000000 @@ -175,18 +183,19 @@ DAUC vector [0]: sres = cde6b027 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_9: SUCCESS ===== test_set_10 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 4c539a26e1fa000059e7ec99b51f33f3 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd DAUC vector [0]: res = 6fc30fee6d1235230000000000000000 @@ -195,18 +204,19 @@ DAUC vector [0]: sres = 02d13acd DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_10: SUCCESS ===== test_set_11 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 30ff25cdadf600003991f8e7e72a5948 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 DAUC vector [0]: res = aefa357beac2a87a0000000000000000 @@ -215,18 +225,19 @@ DAUC vector [0]: sres = 44389d01 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_11: SUCCESS ===== test_set_12 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 5380d158cfe30000fd10b1f261e825c3 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 DAUC vector [0]: res = 98dbbd099b3b408d0000000000000000 @@ -235,18 +246,19 @@ DAUC vector [0]: sres = 03e0fd84 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_12: SUCCESS ===== test_set_13 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 217af49272ad0000cc1d4642c4476641 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 217af492728d00003bd338249751de80 DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a DAUC vector [0]: res = af4a411e1139f2c20000000000000000 @@ -255,18 +267,19 @@ DAUC vector [0]: sres = be73b3dc DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_13: SUCCESS ===== test_set_14 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 837fd7b744190000e4ae3648e1c7770b +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 DAUC vector [0]: res = 7bffa5c2f41fbc050000000000000000 @@ -275,18 +288,19 @@ DAUC vector [0]: sres = 8fe019c7 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_14: SUCCESS ===== test_set_15 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 5be11495525d00008538a96619c04b01 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 DAUC vector [0]: res = 7e3f44c7591f6f450000000000000000 @@ -295,18 +309,19 @@ DAUC vector [0]: sres = 27202b82 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_15: SUCCESS ===== test_set_16 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 1c408a858b3e0000956596c6cd632f0f +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 DAUC vector [0]: res = 70f6bdb9ad21525f0000000000000000 @@ -315,18 +330,19 @@ DAUC vector [0]: sres = ddd7efe6 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_16: SUCCESS ===== test_set_17 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = aefdaa5ddd9900003bf0fbdbbc9d8ecc +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 DAUC vector [0]: res = 479dd25c20792d630000000000000000 @@ -335,18 +351,19 @@ DAUC vector [0]: sres = 67e4ff3f DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_17: SUCCESS ===== test_set_18 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = ada15aeb7bb80000f141568691cccaec +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a DAUC vector [0]: res = 28d7b0f2a2ec3de50000000000000000 @@ -355,18 +372,19 @@ DAUC vector [0]: sres = 8a3b8d17 DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_18: SUCCESS ===== test_set_19 -aud3g.u.umts.sqn == 0 +aud3g.u.umts.sqn == 32 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 -DAUC vector [0]: sqn = 0 -DAUC vector [0]: autn = 83cfd54db9130000eb5e0ab0a7c030e6 +DAUC vector [0]: sqn = 32 +DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef DAUC vector [0]: res = a95100e2760952cd0000000000000000 @@ -375,6 +393,7 @@ DAUC vector [0]: sres = df58522f DAUC vector [0]: auth_types = 0x3 rc == 1 +aud3g.u.umts.sqn == 33 vector matches expectations ===== test_set_19: SUCCESS diff --git a/tests/auc/gen_ts_55_205_test_sets/func_template.c b/tests/auc/gen_ts_55_205_test_sets/func_template.c index 36926eb..83c5826 100644 --- a/tests/auc/gen_ts_55_205_test_sets/func_template.c +++ b/tests/auc/gen_ts_55_205_test_sets/func_template.c @@ -36,6 +36,7 @@ aud3g = (struct osmo_sub_auth_data){{ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, + .u.umts.sqn = 32, }}; osmo_hexparse("{Ki}", @@ -47,9 +48,10 @@ fake_rand, sizeof(fake_rand)); vec = (struct osmo_auth_vector){{ {{0}} }}; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 0, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); VEC_IS(&vec, " rand: {RAND}\n" -- To view, visit https://gerrit.osmocom.org/2079 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I45d1866cde1b3e777460df76100af2fe4767c678 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 14:00:42 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 14:00:42 +0000 Subject: [PATCH] osmo-bts[master]: Sync protocol with OsmoPCU Message-ID: Review at https://gerrit.osmocom.org/2086 Sync protocol with OsmoPCU Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 --- M include/osmo-bts/pcuif_proto.h 1 file changed, 16 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/86/2086/1 diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index 5527238..aea1512 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -1,7 +1,10 @@ #ifndef _PCUIF_PROTO_H #define _PCUIF_PROTO_H -#define PCU_IF_VERSION 0x07 +#include + +#define PCU_IF_VERSION 0x08 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -13,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -39,6 +43,16 @@ #define PCU_IF_FLAG_MCS7 (1 << 26) #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) + +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); struct gsm_pcu_if_data { uint8_t sapi; @@ -148,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; -- To view, visit https://gerrit.osmocom.org/2086 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 15 14:00:43 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 14:00:43 +0000 Subject: [PATCH] osmo-bts[master]: Handle TXT indication from OsmoPCU Message-ID: Review at https://gerrit.osmocom.org/2087 Handle TXT indication from OsmoPCU * handle OML message * handle OsmoPCU version message Change-Id: I16e73198501487a5b1076bf83390b85538d5af73 Related: OS#1614, 1615 --- M src/common/pcu_sock.c 1 file changed, 24 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/87/2087/1 diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 85bc880..f5732ff 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -538,6 +538,27 @@ return rc; } +static int pcu_rx_txt_ind(struct gsm_bts *bts, + struct gsm_pcu_if_txt_ind *txt) +{ + switch (txt->type) { + case PCU_VERSION: + LOGP(DPCU, LOGL_INFO, "OsmoPCU version %s connected\n", + txt->text); + osmo_signal_dispatch(SS_FAIL, OSMO_EVT_PCU_VERS, txt->text); + break; + case PCU_OML_ALERT: + osmo_signal_dispatch(SS_FAIL, OSMO_EVT_EXT_ALARM, txt->text); + break; + default: + LOGP(DPCU, LOGL_ERROR, "Unknown TXT_IND type %u received\n", + txt->type); + return -EINVAL; + } + + return 0; +} + static int pcu_rx_act_req(struct gsm_bts *bts, struct gsm_pcu_if_act_req *act_req) { @@ -586,6 +607,9 @@ case PCU_IF_MSG_ACT_REQ: rc = pcu_rx_act_req(bts, &pcu_prim->u.act_req); break; + case PCU_IF_MSG_TXT_IND: + rc = pcu_rx_txt_ind(bts, &pcu_prim->u.txt_ind); + break; default: LOGP(DPCU, LOGL_ERROR, "Received unknwon PCU msg type %d\n", msg_type); -- To view, visit https://gerrit.osmocom.org/2087 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16e73198501487a5b1076bf83390b85538d5af73 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 15 14:04:11 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 14:04:11 +0000 Subject: osmo-pcu[master]: Add support for sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 1: To double-check: we bump protocol version when we add new messages or only when we change existing messages? I mean when adding new message it should still work with older version: the new message will be ignored with appropriate warning so it seems backward-compatible. -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 14:07:36 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 14:07:36 +0000 Subject: libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Patch Set 4: I think we should refer to latest version of the standard in here which is 3GPP TS 45.003 and if the test vectors are part of the spec than we should even refer to particular ?. -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 15:07:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 15:07:07 +0000 Subject: [PATCH] openbsc[master]: oap tests: fix after SQN scheme changes from libosmocore Message-ID: Review at https://gerrit.osmocom.org/2088 oap tests: fix after SQN scheme changes from libosmocore In change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3, libosmocore changes from incrementing SQN after tuple generation to incrementing SQN before tuple generation. Thus we now need to pass desired_sqn - 1 to get the same tuples. Change-Id: Ifeda71e713bb60dcd31ac651f461b714cfa39b5c Related: OS#1968 OS#1969 --- M openbsc/src/libcommon/oap_client.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/88/2088/1 diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 54b71e4..5128ac1 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -99,7 +99,7 @@ memcpy(auth.u.umts.k, state->secret_k, sizeof(auth.u.umts.k)); memcpy(auth.u.umts.opc, state->secret_opc, sizeof(auth.u.umts.opc)); memset(auth.u.umts.amf, '\0', sizeof(auth.u.umts.amf)); - auth.u.umts.sqn = 42; /* TODO use incrementing sequence nr */ + auth.u.umts.sqn = 41; /* TODO use incrementing sequence nr */ memset(&vec, 0, sizeof(vec)); osmo_auth_gen_vec(&vec, &auth, rx_random); -- To view, visit https://gerrit.osmocom.org/2088 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifeda71e713bb60dcd31ac651f461b714cfa39b5c Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 15 15:07:50 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 15:07:50 +0000 Subject: [MERGED] openbsc[master]: oap tests: fix after SQN scheme changes from libosmocore In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: oap tests: fix after SQN scheme changes from libosmocore ...................................................................... oap tests: fix after SQN scheme changes from libosmocore In change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3, libosmocore changes from incrementing SQN after tuple generation to incrementing SQN before tuple generation. Thus we now need to pass desired_sqn - 1 to get the same tuples. Change-Id: Ifeda71e713bb60dcd31ac651f461b714cfa39b5c Related: OS#1968 OS#1969 --- M openbsc/src/libcommon/oap_client.c 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 54b71e4..5128ac1 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -99,7 +99,7 @@ memcpy(auth.u.umts.k, state->secret_k, sizeof(auth.u.umts.k)); memcpy(auth.u.umts.opc, state->secret_opc, sizeof(auth.u.umts.opc)); memset(auth.u.umts.amf, '\0', sizeof(auth.u.umts.amf)); - auth.u.umts.sqn = 42; /* TODO use incrementing sequence nr */ + auth.u.umts.sqn = 41; /* TODO use incrementing sequence nr */ memset(&vec, 0, sizeof(vec)); osmo_auth_gen_vec(&vec, &auth, rx_random); -- To view, visit https://gerrit.osmocom.org/2088 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifeda71e713bb60dcd31ac651f461b714cfa39b5c Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 15 18:26:45 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 15 Mar 2017 18:26:45 +0000 Subject: osmo-trx[master]: Add autoconf-archive to dependencies In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 15 18:32:43 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 15 Mar 2017 18:32:43 +0000 Subject: [MERGED] osmo-trx[master]: Add autoconf-archive to dependencies In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add autoconf-archive to dependencies ...................................................................... Add autoconf-archive to dependencies We use AX_EXT in ./configure for checking CPU features anyway, so it's better to add it as explicit dependency. Related: OS#1923 Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b --- M debian/control 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/debian/control b/debian/control index d016afa..151aa92 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Maintainer: Ivan Klyuchnikov Build-Depends: debhelper (>= 9), autotools-dev, + autoconf-archive, libdbd-sqlite3, libsqlite3-dev, pkg-config, -- To view, visit https://gerrit.osmocom.org/2074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7ba48e1df4ede8b477574da3faa15fd02e15c69b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From admin at opensuse.org Wed Mar 15 19:52:33 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 19:52:33 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c99bb922be5_6b03efc1094313f@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 143s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 143s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 144s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 144s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 144s] CK: e740c156278705a14e1a99ba6d31334f [ 144s] RES: 7c04e86a67967fcd [ 144s] SRES: 1b9297a7 [ 144s] Kc: 10687b71e4eb94c5 [ 144s] -SQN: 281474976710655 [ 144s] +SQN: 4294967295 [ 144s] [ 144s] [ 144s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 144s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 144s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 144s] make[1]: *** [override_dh_auto_test] Error 1 [ 144s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 144s] debian/rules:15: recipe for target 'build' failed [ 144s] make: *** [build] Error 2 [ 144s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 144s] [ 144s] build85 failed "build libosmocore_0.9.6.20170315.dsc" at Wed Mar 15 19:52:15 UTC 2017. [ 144s] [ 144s] ### VM INTERACTION START ### [ 146s] [ 136.282415] reboot: Power down [ 147s] ### VM INTERACTION END ### [ 147s] [ 147s] build85 failed "build libosmocore_0.9.6.20170315.dsc" at Wed Mar 15 19:52:19 UTC 2017. [ 147s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 15 19:54:35 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 19:54:35 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58c99c1426528_6b03efc10944043@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/i586 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 258s] | This file was extended by libosmocore config.status 0.9.6.20170315, which was [ 258s] | generated by GNU Autoconf 2.69. Invocation command line was [ 258s] | [ 258s] | CONFIG_FILES = [ 258s] | CONFIG_HEADERS = [ 258s] | CONFIG_LINKS = [ 258s] | CONFIG_COMMANDS = [ 258s] | $ ./config.status Doxyfile.core [ 258s] | [ 258s] | on cloud115 [ 258s] | [ 258s] | config.status:1152: creating Doxyfile.core [ 258s] [ 258s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 258s] make[1]: *** [override_dh_auto_test] Error 1 [ 258s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 258s] debian/rules:15: recipe for target 'build' failed [ 258s] make: *** [build] Error 2 [ 258s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 258s] [ 258s] cloud115 failed "build libosmocore_0.9.6.20170315.dsc" at Wed Mar 15 19:54:15 UTC 2017. [ 258s] [ 258s] ### VM INTERACTION START ### [ 259s] Powering off. [ 259s] [ 231.417372] reboot: Power down [ 260s] ### VM INTERACTION END ### [ 260s] [ 260s] cloud115 failed "build libosmocore_0.9.6.20170315.dsc" at Wed Mar 15 19:54:18 UTC 2017. [ 260s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 15 19:55:09 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 19:55:09 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58c99c4da0ff2_8b1119dc0436233c@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 263s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 263s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 263s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 263s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 263s] CK: e740c156278705a14e1a99ba6d31334f [ 263s] RES: 7c04e86a67967fcd [ 263s] SRES: 1b9297a7 [ 263s] Kc: 10687b71e4eb94c5 [ 263s] -SQN: 281474976710655 [ 263s] +SQN: 4294967295 [ 263s] [ 263s] [ 263s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 263s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 263s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 263s] make[1]: *** [override_dh_auto_test] Error 1 [ 263s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 263s] debian/rules:15: recipe for target 'build' failed [ 263s] make: *** [build] Error 2 [ 263s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 263s] [ 263s] cloud122 failed "build libosmocore_0.9.6.20170315.dsc" at Wed Mar 15 19:54:50 UTC 2017. [ 263s] [ 263s] ### VM INTERACTION START ### [ 267s] [ 243.818085] reboot: Power down [ 269s] ### VM INTERACTION END ### [ 269s] [ 269s] cloud122 failed "build libosmocore_0.9.6.20170315.dsc" at Wed Mar 15 19:54:56 UTC 2017. [ 269s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 15 20:03:13 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 20:03:13 +0000 Subject: Build failure of network:osmocom:nightly/openbsc in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58c99e294d557_8b1119dc0436255a@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openbsc/xUbuntu_16.10/i586 Package network:osmocom:nightly/openbsc failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly openbsc Last lines of build log: [ 117s] [ 117s] Makefile:719: recipe for target 'check-local' failed [ 117s] make[5]: *** [check-local] Error 1 [ 117s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 117s] Makefile:570: recipe for target 'check-am' failed [ 117s] make[4]: *** [check-am] Error 2 [ 117s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 117s] Makefile:422: recipe for target 'check-recursive' failed [ 117s] make[3]: *** [check-recursive] Error 1 [ 117s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 117s] Makefile:486: recipe for target 'check-recursive' failed [ 117s] make[2]: *** [check-recursive] Error 1 [ 117s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 117s] Makefile:777: recipe for target 'check' failed [ 117s] make[1]: *** [check] Error 2 [ 117s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 117s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 117s] debian/rules:13: recipe for target 'build' failed [ 117s] make: *** [build] Error 2 [ 117s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 117s] [ 117s] build77 failed "build openbsc_0.15.1.20170315.dsc" at Wed Mar 15 20:02:52 UTC 2017. [ 117s] [ 117s] ### VM INTERACTION START ### [ 120s] [ 110.873299] reboot: Power down [ 121s] ### VM INTERACTION END ### [ 121s] [ 121s] build77 failed "build openbsc_0.15.1.20170315.dsc" at Wed Mar 15 20:02:56 UTC 2017. [ 121s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 15 20:06:57 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 20:06:57 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58c99f366897e_6b03efc10944889@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 88s] [ 88s] Makefile:669: recipe for target 'check-local' failed [ 88s] make[5]: *** [check-local] Error 1 [ 88s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests' [ 88s] Makefile:529: recipe for target 'check-am' failed [ 88s] make[4]: *** [check-am] Error 2 [ 88s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests' [ 88s] Makefile:381: recipe for target 'check-recursive' failed [ 88s] make[3]: *** [check-recursive] Error 1 [ 88s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 88s] Makefile:405: recipe for target 'check-recursive' failed [ 88s] make[2]: *** [check-recursive] Error 1 [ 88s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 88s] Makefile:696: recipe for target 'check' failed [ 88s] make[1]: *** [check] Error 2 [ 88s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 88s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 88s] debian/rules:7: recipe for target 'build' failed [ 88s] make: *** [build] Error 2 [ 88s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 89s] [ 89s] lamb12 failed "build osmo-hlr_0.0.1.20170315.dsc" at Wed Mar 15 20:06:46 UTC 2017. [ 89s] [ 89s] ### VM INTERACTION START ### [ 92s] [ 78.449941] reboot: Power down [ 92s] ### VM INTERACTION END ### [ 92s] [ 92s] lamb12 failed "build osmo-hlr_0.0.1.20170315.dsc" at Wed Mar 15 20:06:49 UTC 2017. [ 92s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 15 20:10:04 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 20:10:04 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in Debian_8.0/x86_64 In-Reply-To: References: Message-ID: <58c99fb9695fd_6b03efc10945354@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/Debian_8.0/x86_64 Package network:osmocom:nightly/osmo-hlr failed to build in Debian_8.0/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 104s] Makefile:655: recipe for target 'check-local' failed [ 104s] make[5]: *** [check-local] Error 1 [ 104s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests' [ 104s] Makefile:517: recipe for target 'check-am' failed [ 104s] make[4]: *** [check-am] Error 2 [ 104s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests' [ 104s] Makefile:369: recipe for target 'check-recursive' failed [ 104s] make[3]: *** [check-recursive] Error 1 [ 104s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 104s] Makefile:393: recipe for target 'check-recursive' failed [ 104s] make[2]: *** [check-recursive] Error 1 [ 104s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 104s] Makefile:684: recipe for target 'check' failed [ 104s] make[1]: *** [check] Error 2 [ 104s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 104s] dh_auto_test: make -j1 check returned exit code 2 [ 104s] debian/rules:7: recipe for target 'build' failed [ 104s] make: *** [build] Error 2 [ 104s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 104s] [ 104s] lamb68 failed "build osmo-hlr_0.0.1.20170315.dsc" at Wed Mar 15 20:09:48 UTC 2017. [ 104s] [ 104s] ### VM INTERACTION START ### [ 105s] Powering off. [ 105s] [ 91.962561] reboot: Power down [ 105s] ### VM INTERACTION END ### [ 105s] [ 105s] lamb68 failed "build osmo-hlr_0.0.1.20170315.dsc" at Wed Mar 15 20:09:50 UTC 2017. [ 105s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Wed Mar 15 20:13:47 2017 From: admin at opensuse.org (OBS Notification) Date: Wed, 15 Mar 2017 20:13:47 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.04/x86_64 In-Reply-To: References: Message-ID: <58c9a0a01b93f_6b63efc10101185e@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.04/x86_64 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.04/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 225s] [ 225s] Makefile:669: recipe for target 'check-local' failed [ 225s] make[5]: *** [check-local] Error 1 [ 225s] make[5]: Leaving directory '/usr/src/packages/BUILD/tests' [ 225s] Makefile:529: recipe for target 'check-am' failed [ 225s] make[4]: *** [check-am] Error 2 [ 225s] make[4]: Leaving directory '/usr/src/packages/BUILD/tests' [ 225s] Makefile:381: recipe for target 'check-recursive' failed [ 225s] make[3]: *** [check-recursive] Error 1 [ 225s] make[3]: Leaving directory '/usr/src/packages/BUILD/tests' [ 225s] Makefile:405: recipe for target 'check-recursive' failed [ 225s] make[2]: *** [check-recursive] Error 1 [ 225s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 225s] Makefile:696: recipe for target 'check' failed [ 225s] make[1]: *** [check] Error 2 [ 225s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 225s] dh_auto_test: make -j1 check returned exit code 2 [ 225s] debian/rules:7: recipe for target 'build' failed [ 225s] make: *** [build] Error 2 [ 225s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 225s] [ 225s] lamb60 failed "build osmo-hlr_0.0.1.20170315.dsc" at Wed Mar 15 20:13:37 UTC 2017. [ 225s] [ 225s] ### VM INTERACTION START ### [ 228s] [ 212.188212] reboot: Power down [ 228s] ### VM INTERACTION END ### [ 228s] [ 228s] lamb60 failed "build osmo-hlr_0.0.1.20170315.dsc" at Wed Mar 15 20:13:40 UTC 2017. [ 228s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Wed Mar 15 23:46:20 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 15 Mar 2017 23:46:20 +0000 Subject: libosmocore[master]: core/conv: implement optimized Viterbi decoder In-Reply-To: References: Message-ID: Patch Set 5: (2 comments) https://gerrit.osmocom.org/#/c/1337/4/src/viterbi.c File src/viterbi.c: Line 539: * the interval specified by the decoder. > Is there a more specific function name? The 'len' value and loop refers to moving across the horizontal length of the trellis. A more specific name that matches Viterbi algorithm nomenclature could be something like trellis_traversal() or forward_traverse(). Line 564: int8_t depunc[dec->len * dec->n]; > Maybe we could do it inside the init_vdec (current name: alloc_vdec)? The API limits us to having decoder object construction and teardown on on every message decode. Sylvain and I had a discussion on this topic years ago and we agreed that reducing the overhead wasn't worth the complexity of an API change. Where the decoder construction/destruction takes place behind the API isn't very important. It just has to happen somewhere and be transparent to the application calling into libosmocore. -- To view, visit https://gerrit.osmocom.org/1337 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 15 23:59:13 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 15 Mar 2017 23:59:13 +0000 Subject: [PATCH] libosmocore[master]: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build Message-ID: Review at https://gerrit.osmocom.org/2089 osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build osmo-auc-gen on 32bit systems allowed only --sqn up to 32bits width. However, the recently added regression test for osmo-auc-gen includes an ivocation with a 48bit wide --sqn, which now causes the builds to fail on 32bit systems. Fix the --sqn argument parsing for larger integers by using strtoull(). Do away with the intermediate variable 'ul' and place the value directly in the auth data struct. Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77 --- M utils/osmo-auc-gen.c 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/89/2089/1 diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index 4e2456a..6b1e623 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -106,7 +106,6 @@ while (1) { int c; - unsigned long ul; static struct option long_options[] = { { "2g", 0, 0, '2' }, { "3g", 0, 0, '3' }, @@ -196,8 +195,7 @@ fprintf(stderr, "Only UMTS has SQN\n"); exit(2); } - ul = strtoul(optarg, 0, 10); - test_aud.u.umts.sqn = ul; + test_aud.u.umts.sqn = strtoull(optarg, 0, 10); /* Before calculating the UMTS auth vector, * osmo_auth_gen_vec() increments the SQN. SQN-1 here * to end up with the SQN the user requested. */ -- To view, visit https://gerrit.osmocom.org/2089 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 00:04:54 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 16 Mar 2017 00:04:54 +0000 Subject: libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Patch Set 4: > I think we should refer to latest version of the standard in here > which is 3GPP TS 45.003 and if the test vectors are part of the > spec than we should even refer to particular ?. The older 3GPP specification naming (05.03) is still used throughout - filenames for example. Perhaps refer to both '45' and '05' standard prefixes? -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 00:16:17 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 00:16:17 +0000 Subject: [MERGED] osmo-hlr[master]: auc tests: fix after SQN scheme changes from libosmocore In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: auc tests: fix after SQN scheme changes from libosmocore ...................................................................... auc tests: fix after SQN scheme changes from libosmocore In change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3, libosmocore changes from incrementing SQN after tuple generation to incrementing SQN before tuple generation. Thus we now need to pass desired_sqn - 1 to get the same tuples. Adjust all regression tests, showing that the tuples as well as the SQNs used to generate the tuples remain unchanged, and only the SQN before and after generating reflect different values. Related: OS#1968 OS#1969 Change-Id: I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 --- M tests/auc/auc_test.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err M tests/auc/gen_ts_55_205_test_sets/func_template.c 4 files changed, 106 insertions(+), 107 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/auc/auc_test.c b/tests/auc/auc_test.c index e507c29..f047a97 100644 --- a/tests/auc/auc_test.c +++ b/tests/auc/auc_test.c @@ -194,7 +194,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, - .u.umts.sqn = 32, + .u.umts.sqn = 31, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -204,10 +204,10 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -223,11 +223,11 @@ /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 32; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + aud3g.u.umts.sqn = 31; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -301,7 +301,7 @@ aud3g = (struct osmo_sub_auth_data){ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, - .u.umts.sqn = 32, + .u.umts.sqn = 31, }; osmo_hexparse("EB215756028D60E3275E613320AEC880", @@ -311,10 +311,10 @@ next_rand("39fa2f4e3d523d8619a73b4f65c3e14d", true); vec = (struct osmo_auth_vector){ {0} }; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -340,11 +340,11 @@ /* even though vec is not zero-initialized, it should produce the same * result with the same sequence nr */ - aud3g.u.umts.sqn = 32; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + aud3g.u.umts.sqn = 31; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: 39fa2f4e3d523d8619a73b4f65c3e14d\n" @@ -361,8 +361,8 @@ fprintf(stderr, "- test AUTS resync\n"); vec = (struct osmo_auth_vector){}; - aud3g.u.umts.sqn = 32; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + aud3g.u.umts.sqn = 31; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); /* The AUTN sent was 8704f5ba55f30000d2ee44b22c8ea919 * with the first 6 bytes being SQN ^ AK. @@ -409,9 +409,8 @@ next_rand("897210a0f7de278f0b8213098e098a3f", true); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, rand_auts, auts); VERBOSE_ASSERT(rc, == 1, "%d"); - /* The USIM's last sqn was 23, the calculated vector was 24, hence the - * next one stored should be 25. */ - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 25, "%"PRIu64); + /* The USIM's last sqn was 23, the calculated vector was 24 */ + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 24, "%"PRIu64); VEC_IS(&vec, " rand: 897210a0f7de278f0b8213098e098a3f\n" @@ -428,19 +427,19 @@ fprintf(stderr, "- verify N vectors with AUTS resync" " == N vectors without AUTS\n" - "First just set rand and sqn = 24, and compute 3 vectors\n"); + "First just set rand and sqn = 23, and compute 3 vectors\n"); next_rand("897210a0f7de278f0b8213098e098a3f", false); - aud3g.u.umts.sqn = 24; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 24, "%"PRIu64); + aud3g.u.umts.sqn = 23; + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 23, "%"PRIu64); memset(vecs, 0, sizeof(vecs)); rc = auc_compute_vectors(vecs, 3, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 3, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 27, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 26, "%"PRIu64); _test_gen_vectors_3g_only__expect_vecs(vecs); - fprintf(stderr, "Now reach sqn = 24 with AUTS and expect the same\n"); + fprintf(stderr, "Now reach sqn = 23 with AUTS and expect the same\n"); /* AUTS response by USIM */ osmo_hexparse("979498b1f72d3e28c59fa2e72f9c", auts, sizeof(auts)); diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index 51f176c..bfc046f 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -22,13 +22,13 @@ ===== test_gen_vectors_2g_plus_3g -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -39,15 +39,15 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -58,18 +58,18 @@ DAUC vector [0]: sres = 429d5b27 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_gen_vectors_2g_plus_3g: SUCCESS ===== test_gen_vectors_3g_only -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -79,14 +79,14 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -96,17 +96,17 @@ DAUC vector [0]: sres = 9b36efdf DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations - test AUTS resync -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 24 +DAUC vector [0]: resync: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -116,16 +116,16 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 25 +aud3g.u.umts.sqn == 24 vector matches expectations - verify N vectors with AUTS resync == N vectors without AUTS -First just set rand and sqn = 24, and compute 3 vectors -aud3g.u.umts.sqn == 24 +First just set rand and sqn = 23, and compute 3 vectors +aud3g.u.umts.sqn == 23 DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f -DAUC vector [0]: sqn = 24 +DAUC vector [0]: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -135,7 +135,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 25 +DAUC vector [1]: sqn = 24 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -145,7 +145,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 26 +DAUC vector [2]: sqn = 25 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 @@ -155,18 +155,18 @@ DAUC vector [2]: sres = cd6f0df5 DAUC vector [2]: auth_types = 0x3 rc == 3 -aud3g.u.umts.sqn == 27 +aud3g.u.umts.sqn == 26 [0]: vector matches expectations [1]: vector matches expectations [2]: vector matches expectations -Now reach sqn = 24 with AUTS and expect the same +Now reach sqn = 23 with AUTS and expect the same DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 24 +DAUC vector [0]: resync: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -176,7 +176,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 25 +DAUC vector [1]: sqn = 24 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -186,7 +186,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 26 +DAUC vector [2]: sqn = 25 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 9a9aaf5..59ba22d 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -1,11 +1,11 @@ ===== test_set_1 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 @@ -15,18 +15,18 @@ DAUC vector [0]: sres = 46f8416a DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_1: SUCCESS ===== test_set_2 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b @@ -36,18 +36,18 @@ DAUC vector [0]: sres = 8c308a5e DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_2: SUCCESS ===== test_set_3 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b @@ -57,18 +57,18 @@ DAUC vector [0]: sres = cfbce3fe DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_3: SUCCESS ===== test_set_4 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 @@ -78,18 +78,18 @@ DAUC vector [0]: sres = 9655e265 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_4: SUCCESS ===== test_set_5 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 @@ -99,18 +99,18 @@ DAUC vector [0]: sres = 13688f17 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_5: SUCCESS ===== test_set_6 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 @@ -120,18 +120,18 @@ DAUC vector [0]: sres = 553d00b3 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_6: SUCCESS ===== test_set_7 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 @@ -141,18 +141,18 @@ DAUC vector [0]: sres = 59f1a44a DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_7: SUCCESS ===== test_set_8 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e @@ -162,18 +162,18 @@ DAUC vector [0]: sres = 50588861 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_8: SUCCESS ===== test_set_9 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 @@ -183,18 +183,18 @@ DAUC vector [0]: sres = cde6b027 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_9: SUCCESS ===== test_set_10 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd @@ -204,18 +204,18 @@ DAUC vector [0]: sres = 02d13acd DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_10: SUCCESS ===== test_set_11 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 @@ -225,18 +225,18 @@ DAUC vector [0]: sres = 44389d01 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_11: SUCCESS ===== test_set_12 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 @@ -246,18 +246,18 @@ DAUC vector [0]: sres = 03e0fd84 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_12: SUCCESS ===== test_set_13 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 217af492728d00003bd338249751de80 DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a @@ -267,18 +267,18 @@ DAUC vector [0]: sres = be73b3dc DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_13: SUCCESS ===== test_set_14 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 @@ -288,18 +288,18 @@ DAUC vector [0]: sres = 8fe019c7 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_14: SUCCESS ===== test_set_15 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 @@ -309,18 +309,18 @@ DAUC vector [0]: sres = 27202b82 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_15: SUCCESS ===== test_set_16 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 @@ -330,18 +330,18 @@ DAUC vector [0]: sres = ddd7efe6 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_16: SUCCESS ===== test_set_17 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 @@ -351,18 +351,18 @@ DAUC vector [0]: sres = 67e4ff3f DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_17: SUCCESS ===== test_set_18 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a @@ -372,18 +372,18 @@ DAUC vector [0]: sres = 8a3b8d17 DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_18: SUCCESS ===== test_set_19 -aud3g.u.umts.sqn == 32 +aud3g.u.umts.sqn == 31 DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 -DAUC vector [0]: sqn = 32 +DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef @@ -393,7 +393,7 @@ DAUC vector [0]: sres = df58522f DAUC vector [0]: auth_types = 0x3 rc == 1 -aud3g.u.umts.sqn == 33 +aud3g.u.umts.sqn == 32 vector matches expectations ===== test_set_19: SUCCESS diff --git a/tests/auc/gen_ts_55_205_test_sets/func_template.c b/tests/auc/gen_ts_55_205_test_sets/func_template.c index 83c5826..0865432 100644 --- a/tests/auc/gen_ts_55_205_test_sets/func_template.c +++ b/tests/auc/gen_ts_55_205_test_sets/func_template.c @@ -36,7 +36,7 @@ aud3g = (struct osmo_sub_auth_data){{ .type = OSMO_AUTH_TYPE_UMTS, .algo = OSMO_AUTH_ALG_MILENAGE, - .u.umts.sqn = 32, + .u.umts.sqn = 31, }}; osmo_hexparse("{Ki}", @@ -48,10 +48,10 @@ fake_rand, sizeof(fake_rand)); vec = (struct osmo_auth_vector){{ {{0}} }}; - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 31, "%"PRIu64); rc = auc_compute_vectors(&vec, 1, &aud2g, &aud3g, NULL, NULL); VERBOSE_ASSERT(rc, == 1, "%d"); - VERBOSE_ASSERT(aud3g.u.umts.sqn, == 33, "%"PRIu64); + VERBOSE_ASSERT(aud3g.u.umts.sqn, == 32, "%"PRIu64); VEC_IS(&vec, " rand: {RAND}\n" -- To view, visit https://gerrit.osmocom.org/2080 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:27:46 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:27:46 +0000 Subject: [PATCH] osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2081 to look at the new patch set (#2). UMTS AKA: implement SQN increment according to SEQ and IND Add ind_bitlen column to auc_3g to record each USIM's IND size according to 3GPP TS 33.102 -- default is 5 bits, as suggested by the spec. Introduce auc_3g_ind to each connecting GSUP client to use as IND index for generating auth tuples sent to this client. With osmo_gsup_server_add_conn(), implement a scheme where clients receive fixed auc_3g_ind indexes based on the order in which they connect; each new connection takes the lowest unused auc_3g_ind, so in case one of the clients restarts, it will most likely receive the same auc_3g_ind, and if one client disconnects, no other clients' auc_3g_ind are affected. Add gsup_server_test.c to test the auc_3g_ind index distribution scheme. Related: OS#1969 Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 --- M configure.ac M sql/hlr.sql M src/db.c M src/db.h M src/db_auc.c M src/db_test.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M tests/Makefile.am A tests/gsup_server/Makefile.am A tests/gsup_server/gsup_server_test.c A tests/gsup_server/gsup_server_test.err A tests/gsup_server/gsup_server_test.ok M tests/testsuite.at 15 files changed, 361 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/81/2081/2 diff --git a/configure.ac b/configure.ac index a04185f..958b48b 100644 --- a/configure.ac +++ b/configure.ac @@ -50,4 +50,5 @@ tests/Makefile tests/auc/Makefile tests/auc/gen_ts_55_205_test_sets/Makefile + tests/gsup_server/Makefile ) diff --git a/sql/hlr.sql b/sql/hlr.sql index 9238871..5fbc712 100644 --- a/sql/hlr.sql +++ b/sql/hlr.sql @@ -63,7 +63,8 @@ k VARCHAR(32) NOT NULL, -- hex string: subscriber's secret key (128bit) op VARCHAR(32), -- hex string: operator's secret key (128bit) opc VARCHAR(32), -- hex string: derived from OP and K (128bit) - sqn INTEGER NOT NULL DEFAULT 0 -- sequence number of key usage + sqn INTEGER NOT NULL DEFAULT 0, -- sequence number of key usage + ind_bitlen INTEGER NOT NULL DEFAULT 5 -- nr of index bits at lower SQN end ); CREATE UNIQUE INDEX IF NOT EXISTS idx_subscr_imsi ON subscriber (imsi); diff --git a/src/db.c b/src/db.c index aa4726c..aaf6fe2 100644 --- a/src/db.c +++ b/src/db.c @@ -29,7 +29,7 @@ [SEL_BY_IMSI] = "SELECT id,imsi,msisdn,vlr_number,sgsn_number,sgsn_address,periodic_lu_tmr,periodic_rau_tau_tmr,nam_cs,nam_ps,lmsi,ms_purged_cs,ms_purged_ps FROM subscriber WHERE imsi = ?", [UPD_VLR_BY_ID] = "UPDATE subscriber SET vlr_number = ? WHERE id = ?", [UPD_SGSN_BY_ID] = "UPDATE subscriber SET sgsn_number = ? WHERE id = ?", - [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", + [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn, ind_bitlen FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", [AUC_UPD_SQN] = "UPDATE auc_3g SET sqn = ? WHERE subscriber_id = ?", [UPD_PURGE_CS_BY_IMSI] = "UPDATE subscriber SET ms_purged_cs=1 WHERE imsi = ?", [UPD_PURGE_PS_BY_IMSI] = "UPDATE subscriber SET ms_purged_ps=1 WHERE imsi = ?", diff --git a/src/db.h b/src/db.h index 0b3df88..a60cf62 100644 --- a/src/db.h +++ b/src/db.h @@ -39,8 +39,9 @@ uint64_t new_sqn); int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts); + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts); #include #include diff --git a/src/db_auc.c b/src/db_auc.c index a24f27e..3a888bb 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -158,6 +158,7 @@ aud3g->u.umts.opc_is_op = 1; } aud3g->u.umts.sqn = sqlite3_column_int64(stmt, 7); + aud3g->u.umts.ind_bitlen = sqlite3_column_int(stmt, 8); /* FIXME: amf? */ aud3g->type = OSMO_AUTH_TYPE_UMTS; } else @@ -185,8 +186,9 @@ /* return -1 in case of error, 0 for unknown imsi, positive for number * of vectors generated */ int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts) + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts) { struct osmo_sub_auth_data aud2g, aud3g; uint64_t subscr_id; @@ -197,6 +199,16 @@ if (rc <= 0) return rc; + aud3g.u.umts.ind = auc_3g_ind; + if (aud3g.type == OSMO_AUTH_TYPE_UMTS + && aud3g.u.umts.ind >= (1U << aud3g.u.umts.ind_bitlen)) { + LOGAUC(imsi, LOGL_NOTICE, "3G auth: SQN's IND bitlen %u is" + " too small to hold an index of %u. Truncating. This" + " may cause numerous additional AUTS resyncing.\n", + aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind); + aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1; + } + LOGAUC(imsi, LOGL_DEBUG, "Calling to generate %u vectors\n", num_vec); rc = auc_compute_vectors(vec, num_vec, &aud2g, &aud3g, rand_auts, auts); if (rc < 0) { diff --git a/src/db_test.c b/src/db_test.c index 998a37a..0e823f9 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -20,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, 0, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index b0e1858..95f5522 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -211,6 +211,50 @@ return 0; } +/* being added to libosmocore in https://gerrit.osmocom.org/2076, + * so long use this local copy. */ +#define _llist_first_entry(ptr, type, member) \ + llist_entry((ptr)->next, type, member) +#define _llist_first_entry_or_null(ptr, type, member) \ + (!llist_empty(ptr) ? _llist_first_entry(ptr, type, member) : NULL) + +/* Add conn to the clients list in a way that conn->auc_3g_ind takes the lowest + * unused integer and the list of clients remains sorted by auc_3g_ind. + * Keep this function non-static to allow linking in a unit test. */ +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn) +{ + struct osmo_gsup_conn *c; + struct osmo_gsup_conn *prev_conn; + + c = _llist_first_entry_or_null(clients, struct osmo_gsup_conn, list); + + /* Is the first index, 0, unused? */ + if (!c || c->auc_3g_ind > 0) { + conn->auc_3g_ind = 0; + llist_add(&conn->list, clients); + return; + } + + /* Look for a gap later on */ + prev_conn = NULL; + llist_for_each_entry(c, clients, list) { + /* skip first item, we know it has auc_3g_ind == 0. */ + if (!prev_conn) { + prev_conn = c; + continue; + } + if (c->auc_3g_ind > prev_conn->auc_3g_ind + 1) + break; + prev_conn = c; + } + + OSMO_ASSERT(prev_conn); + + conn->auc_3g_ind = prev_conn->auc_3g_ind + 1; + llist_add(&conn->list, &prev_conn->list); +} + /* a client has connected to the server socket and we have accept()ed it */ static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd) { @@ -225,15 +269,15 @@ conn->conn = ipa_server_conn_create(gsups, link, fd, osmo_gsup_server_read_cb, osmo_gsup_server_closed_cb, conn); - conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; OSMO_ASSERT(conn->conn); + conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; /* link data structure with server structure */ conn->server = gsups; - llist_add_tail(&conn->list, &gsups->clients); + osmo_gsup_server_add_conn(&gsups->clients, conn); - LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d\n", - conn->conn->addr, conn->conn->port); + LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d (IND=%u)\n", + conn->conn->addr, conn->conn->port, conn->auc_3g_ind); /* request the identity of the client */ rc = ipa_ccm_send_id_req(fd); diff --git a/src/gsup_server.h b/src/gsup_server.h index 885fe52..74062d4 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -31,6 +31,8 @@ struct ipa_server_conn *conn; //struct oap_state oap_state; struct tlv_parsed ccm; + + unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */ }; diff --git a/src/hlr.c b/src/hlr.c index 00a6459..b5777e2 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -63,7 +63,8 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, conn->auc_3g_ind, + gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 21c0e21..0bd0820 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = \ auc \ + gsup_server \ $(NULL) # The `:;' works around a Bash 3.2 bug when the output is not writeable. diff --git a/tests/gsup_server/Makefile.am b/tests/gsup_server/Makefile.am new file mode 100644 index 0000000..fee60f5 --- /dev/null +++ b/tests/gsup_server/Makefile.am @@ -0,0 +1,40 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/src \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(NULL) + +EXTRA_DIST = \ + gsup_server_test.ok \ + gsup_server_test.err \ + $(NULL) + +noinst_PROGRAMS = \ + gsup_server_test \ + $(NULL) + +gsup_server_test_SOURCES = \ + gsup_server_test.c \ + $(NULL) + +gsup_server_test_LDADD = \ + $(top_srcdir)/src/gsup_server.c \ + $(top_srcdir)/src/gsup_router.c \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(NULL) + +.PHONY: update_exp +update_exp: + $(builddir)/gsup_server_test >"$(srcdir)/gsup_server_test.ok" 2>"$(srcdir)/gsup_server_test.err" diff --git a/tests/gsup_server/gsup_server_test.c b/tests/gsup_server/gsup_server_test.c new file mode 100644 index 0000000..cc475be --- /dev/null +++ b/tests/gsup_server/gsup_server_test.c @@ -0,0 +1,145 @@ +/* (C) 2017 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * 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 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 . + * + */ + +#include +#include +#include "gsup_server.h" + +#define comment_start() printf("\n===== %s\n", __func__) +#define comment_end() printf("===== %s: SUCCESS\n\n", __func__) +#define btw(fmt, args...) printf("\n" fmt "\n", ## args) + +#define VERBOSE_ASSERT(val, expect_op, fmt) \ + do { \ + printf(#val " == " fmt "\n", (val)); \ + OSMO_ASSERT((val) expect_op); \ + } while (0) + +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn); + +static void test_add_conn(void) +{ + struct llist_head _list; + struct llist_head *clients = &_list; + struct osmo_gsup_conn conn_inst[23] = {}; + struct osmo_gsup_conn *conn; + unsigned int i; + + comment_start(); + + INIT_LLIST_HEAD(clients); + + btw("Add 10 items"); + for (i = 0; i < 10; i++) { + osmo_gsup_server_add_conn(clients, &conn_inst[i]); + printf("conn_inst[%u].auc_3g_ind == %u\n", i, conn_inst[i].auc_3g_ind); + OSMO_ASSERT(clients->next == &conn_inst[0].list); + } + + btw("Expecting a list of 0..9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + OSMO_ASSERT(conn == &conn_inst[i]); + i++; + } + + btw("Punch two holes in the sequence in arbitrary order," + " a larger one from 2..4 and a single one at 7."); + llist_del(&conn_inst[4].list); + llist_del(&conn_inst[2].list); + llist_del(&conn_inst[3].list); + llist_del(&conn_inst[7].list); + + btw("Expecting a list of 0,1, 5,6, 8,9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + i++; + } + + btw("Add conns, expecting them to take the open slots"); + osmo_gsup_server_add_conn(clients, &conn_inst[12]); + VERBOSE_ASSERT(conn_inst[12].auc_3g_ind, == 2, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[13]); + VERBOSE_ASSERT(conn_inst[13].auc_3g_ind, == 3, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[14]); + VERBOSE_ASSERT(conn_inst[14].auc_3g_ind, == 4, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[17]); + VERBOSE_ASSERT(conn_inst[17].auc_3g_ind, == 7, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[18]); + VERBOSE_ASSERT(conn_inst[18].auc_3g_ind, == 10, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("Does it also work for the first item?"); + llist_del(&conn_inst[0].list); + + btw("Expecting a list of 1..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i + 1); + i++; + } + + btw("Add another conn, should take auc_3g_ind == 0"); + osmo_gsup_server_add_conn(clients, &conn_inst[20]); + VERBOSE_ASSERT(conn_inst[20].auc_3g_ind, == 0, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("If a client reconnects, it will (likely) get the same auc_3g_ind"); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + llist_del(&conn_inst[5].list); + conn_inst[5].auc_3g_ind = 423; + osmo_gsup_server_add_conn(clients, &conn_inst[5]); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + + comment_end(); +} + +int main(int argc, char **argv) +{ + printf("test_gsup_server.c\n"); + + test_add_conn(); + + printf("Done\n"); + return 0; +} diff --git a/tests/gsup_server/gsup_server_test.err b/tests/gsup_server/gsup_server_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gsup_server/gsup_server_test.err diff --git a/tests/gsup_server/gsup_server_test.ok b/tests/gsup_server/gsup_server_test.ok new file mode 100644 index 0000000..80d944c --- /dev/null +++ b/tests/gsup_server/gsup_server_test.ok @@ -0,0 +1,94 @@ +test_gsup_server.c + +===== test_add_conn + +Add 10 items +conn_inst[0].auc_3g_ind == 0 +conn_inst[1].auc_3g_ind == 1 +conn_inst[2].auc_3g_ind == 2 +conn_inst[3].auc_3g_ind == 3 +conn_inst[4].auc_3g_ind == 4 +conn_inst[5].auc_3g_ind == 5 +conn_inst[6].auc_3g_ind == 6 +conn_inst[7].auc_3g_ind == 7 +conn_inst[8].auc_3g_ind == 8 +conn_inst[9].auc_3g_ind == 9 + +Expecting a list of 0..9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 + +Punch two holes in the sequence in arbitrary order, a larger one from 2..4 and a single one at 7. + +Expecting a list of 0,1, 5,6, 8,9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 5 +conn[3].auc_3g_ind == 6 +conn[4].auc_3g_ind == 8 +conn[5].auc_3g_ind == 9 + +Add conns, expecting them to take the open slots +conn_inst[12].auc_3g_ind == 2 +conn_inst[13].auc_3g_ind == 3 +conn_inst[14].auc_3g_ind == 4 +conn_inst[17].auc_3g_ind == 7 +conn_inst[18].auc_3g_ind == 10 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +Does it also work for the first item? + +Expecting a list of 1..10 +conn[0].auc_3g_ind == 1 +conn[1].auc_3g_ind == 2 +conn[2].auc_3g_ind == 3 +conn[3].auc_3g_ind == 4 +conn[4].auc_3g_ind == 5 +conn[5].auc_3g_ind == 6 +conn[6].auc_3g_ind == 7 +conn[7].auc_3g_ind == 8 +conn[8].auc_3g_ind == 9 +conn[9].auc_3g_ind == 10 + +Add another conn, should take auc_3g_ind == 0 +conn_inst[20].auc_3g_ind == 0 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +If a client reconnects, it will (likely) get the same auc_3g_ind +conn_inst[5].auc_3g_ind == 5 +conn_inst[5].auc_3g_ind == 5 +===== test_add_conn: SUCCESS + +Done diff --git a/tests/testsuite.at b/tests/testsuite.at index 46d1456..a969082 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -14,3 +14,10 @@ cat $abs_srcdir/auc/auc_ts_55_205_test_sets.err > experr AT_CHECK([$abs_top_builddir/tests/auc/auc_ts_55_205_test_sets], [], [expout], [experr]) AT_CLEANUP + +AT_SETUP([gsup_server]) +AT_KEYWORDS([gsup_server]) +cat $abs_srcdir/gsup_server/gsup_server_test.ok > expout +cat $abs_srcdir/gsup_server/gsup_server_test.err > experr +AT_CHECK([$abs_top_builddir/tests/gsup_server/gsup_server_test], [], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:27:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:27:48 +0000 Subject: [PATCH] osmo-hlr[master]: fix debug log: adjust to new SQN increment scheme Message-ID: Review at https://gerrit.osmocom.org/2090 fix debug log: adjust to new SQN increment scheme We can no longer accurately print the SQN from AUTS resync, since the SQN is incremented after AUTS. Instead, always print the SQN from the generated tuple, i.e. exactly the one left in auth data *after* the tuple was generated. This change was forgotten in recent adjustments to the new SQN incrementing scheme from libosmocore, in change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 for libosmocore change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3. Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f --- M src/auc.c 1 file changed, 2 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/90/2090/1 diff --git a/src/auc.c b/src/auc.c index 9c20db2..d3b3d36 100644 --- a/src/auc.c +++ b/src/auc.c @@ -123,14 +123,7 @@ rc = osmo_auth_gen_vec_auts(vec+i, aud3g, auts, rand_auts, rand); - /* The sqn used for the key is sqn - 1 because - * vector generation has already inc'd it. The - * USIM's sqn sent in AUTS is sqn - 2. */ - DBGP("vector [%u]: resync: sqn = %"PRIu64 "\n", - i, aud3g->u.umts.sqn - 1); } else { - DBGP("vector [%u]: sqn = %" PRIu64 "\n", - i, aud3g->u.umts.sqn); rc = osmo_auth_gen_vec(vec+i, aud3g, rand); } if (rc < 0) { @@ -138,6 +131,8 @@ "generation: [%u]: rc = %d\n", i, rc); goto out; } + DBGP("vector [%u]: sqn = %" PRIu64 "\n", + i, aud3g->u.umts.sqn); DBGVB(autn); DBGVB(ck); -- To view, visit https://gerrit.osmocom.org/2090 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:27:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:27:48 +0000 Subject: [PATCH] osmo-hlr[master]: debug log: output ind slot, previous sqn, and sqn db update Message-ID: Review at https://gerrit.osmocom.org/2091 debug log: output ind slot, previous sqn, and sqn db update Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32 --- M src/auc.c M src/db_auc.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err 4 files changed, 30 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/91/2091/1 diff --git a/src/auc.c b/src/auc.c index d3b3d36..f55b377 100644 --- a/src/auc.c +++ b/src/auc.c @@ -97,6 +97,8 @@ DBGP("3G: %s = %s\n", aud3g->u.umts.opc_is_op? "OP" : "opc", hexb(aud3g->u.umts.opc)); + DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", + aud3g->u.umts.ind, aud3g->u.umts.sqn); } if (aud2g) DBGP("2G: ki = %s\n", hexb(aud2g->u.gsm.ki)); diff --git a/src/db_auc.c b/src/db_auc.c index 3a888bb..eff25ce 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -222,7 +222,8 @@ /* Update SQN in database, as needed */ if (aud3g.algo) { - LOGAUC(imsi, LOGL_DEBUG, "Updating SQN in DB\n"); + LOGAUC(imsi, LOGL_DEBUG, "Updating SQN=%" PRIu64 " in DB\n", + aud3g.u.umts.sqn); rc = db_update_sqn(dbc, subscr_id, aud3g.u.umts.sqn); /* don't tell caller we generated any triplets in case of * update error */ diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index bfc046f..da36708 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -26,6 +26,7 @@ DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 31 @@ -45,6 +46,7 @@ DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 31 @@ -68,6 +70,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c @@ -85,6 +88,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c @@ -103,6 +107,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d @@ -124,6 +129,7 @@ DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 23 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: sqn = 23 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 @@ -163,6 +169,7 @@ DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 26 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 59ba22d..e69228d 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -4,6 +4,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 @@ -25,6 +26,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 @@ -46,6 +48,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 @@ -67,6 +70,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 @@ -88,6 +92,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 @@ -109,6 +114,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c @@ -130,6 +136,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 @@ -151,6 +158,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 @@ -172,6 +180,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 @@ -193,6 +202,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 @@ -214,6 +224,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe @@ -235,6 +246,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 @@ -256,6 +268,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 217af492728d00003bd338249751de80 @@ -277,6 +290,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 @@ -298,6 +312,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 @@ -319,6 +334,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 @@ -340,6 +356,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 @@ -361,6 +378,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 @@ -382,6 +400,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 DAUC vector [0]: sqn = 31 DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 -- To view, visit https://gerrit.osmocom.org/2091 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:33:04 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:33:04 +0000 Subject: [PATCH] libosmocore[master]: auth_milenage: fix check against too large ind Message-ID: Review at https://gerrit.osmocom.org/2092 auth_milenage: fix check against too large ind To ensure that the IND index appended to SEQ does not affect the SEQ, the check should read '>= seq_1', not '>'. Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8 --- M src/gsm/auth_milenage.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/2092/1 diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index f151c5e..c1331b5 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -94,7 +94,7 @@ ind_mask = ~(seq_1 - 1); /* the ind index must not affect the SEQ part */ - if (aud->u.umts.ind > seq_1) + if (aud->u.umts.ind >= seq_1) return -3; /* keep the incremented SQN local until gsm_milenage() succeeded. */ -- To view, visit https://gerrit.osmocom.org/2092 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:47:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:47:34 +0000 Subject: [PATCH] osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2081 to look at the new patch set (#3). UMTS AKA: implement SQN increment according to SEQ and IND Add ind_bitlen column to auc_3g to record each USIM's IND size according to 3GPP TS 33.102 -- default is 5 bits, as suggested by the spec. Introduce auc_3g_ind to each connecting GSUP client to use as IND index for generating auth tuples sent to this client. With osmo_gsup_server_add_conn(), implement a scheme where clients receive fixed auc_3g_ind indexes based on the order in which they connect; each new connection takes the lowest unused auc_3g_ind, so in case one of the clients restarts, it will most likely receive the same auc_3g_ind, and if one client disconnects, no other clients' auc_3g_ind are affected. Add gsup_server_test.c to test the auc_3g_ind index distribution scheme. Related: OS#1969 Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 --- M configure.ac M sql/hlr.sql M src/db.c M src/db.h M src/db_auc.c M src/db_test.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M tests/Makefile.am A tests/gsup_server/Makefile.am A tests/gsup_server/gsup_server_test.c A tests/gsup_server/gsup_server_test.err A tests/gsup_server/gsup_server_test.ok M tests/testsuite.at 15 files changed, 361 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/81/2081/3 diff --git a/configure.ac b/configure.ac index a04185f..958b48b 100644 --- a/configure.ac +++ b/configure.ac @@ -50,4 +50,5 @@ tests/Makefile tests/auc/Makefile tests/auc/gen_ts_55_205_test_sets/Makefile + tests/gsup_server/Makefile ) diff --git a/sql/hlr.sql b/sql/hlr.sql index 9238871..5fbc712 100644 --- a/sql/hlr.sql +++ b/sql/hlr.sql @@ -63,7 +63,8 @@ k VARCHAR(32) NOT NULL, -- hex string: subscriber's secret key (128bit) op VARCHAR(32), -- hex string: operator's secret key (128bit) opc VARCHAR(32), -- hex string: derived from OP and K (128bit) - sqn INTEGER NOT NULL DEFAULT 0 -- sequence number of key usage + sqn INTEGER NOT NULL DEFAULT 0, -- sequence number of key usage + ind_bitlen INTEGER NOT NULL DEFAULT 5 -- nr of index bits at lower SQN end ); CREATE UNIQUE INDEX IF NOT EXISTS idx_subscr_imsi ON subscriber (imsi); diff --git a/src/db.c b/src/db.c index aa4726c..aaf6fe2 100644 --- a/src/db.c +++ b/src/db.c @@ -29,7 +29,7 @@ [SEL_BY_IMSI] = "SELECT id,imsi,msisdn,vlr_number,sgsn_number,sgsn_address,periodic_lu_tmr,periodic_rau_tau_tmr,nam_cs,nam_ps,lmsi,ms_purged_cs,ms_purged_ps FROM subscriber WHERE imsi = ?", [UPD_VLR_BY_ID] = "UPDATE subscriber SET vlr_number = ? WHERE id = ?", [UPD_SGSN_BY_ID] = "UPDATE subscriber SET sgsn_number = ? WHERE id = ?", - [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", + [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn, ind_bitlen FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", [AUC_UPD_SQN] = "UPDATE auc_3g SET sqn = ? WHERE subscriber_id = ?", [UPD_PURGE_CS_BY_IMSI] = "UPDATE subscriber SET ms_purged_cs=1 WHERE imsi = ?", [UPD_PURGE_PS_BY_IMSI] = "UPDATE subscriber SET ms_purged_ps=1 WHERE imsi = ?", diff --git a/src/db.h b/src/db.h index 0b3df88..a60cf62 100644 --- a/src/db.h +++ b/src/db.h @@ -39,8 +39,9 @@ uint64_t new_sqn); int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts); + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts); #include #include diff --git a/src/db_auc.c b/src/db_auc.c index ac81404..8a369b5 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -159,6 +159,7 @@ aud3g->u.umts.opc_is_op = 1; } aud3g->u.umts.sqn = sqlite3_column_int64(stmt, 7); + aud3g->u.umts.ind_bitlen = sqlite3_column_int(stmt, 8); /* FIXME: amf? */ aud3g->type = OSMO_AUTH_TYPE_UMTS; } else @@ -186,8 +187,9 @@ /* return -1 in case of error, 0 for unknown imsi, positive for number * of vectors generated */ int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts) + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts) { struct osmo_sub_auth_data aud2g, aud3g; uint64_t subscr_id; @@ -198,6 +200,16 @@ if (rc <= 0) return rc; + aud3g.u.umts.ind = auc_3g_ind; + if (aud3g.type == OSMO_AUTH_TYPE_UMTS + && aud3g.u.umts.ind >= (1U << aud3g.u.umts.ind_bitlen)) { + LOGAUC(imsi, LOGL_NOTICE, "3G auth: SQN's IND bitlen %u is" + " too small to hold an index of %u. Truncating. This" + " may cause numerous additional AUTS resyncing.\n", + aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind); + aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1; + } + LOGAUC(imsi, LOGL_DEBUG, "Calling to generate %u vectors\n", num_vec); rc = auc_compute_vectors(vec, num_vec, &aud2g, &aud3g, rand_auts, auts); if (rc < 0) { diff --git a/src/db_test.c b/src/db_test.c index 998a37a..0e823f9 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -20,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, 0, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index b0e1858..b709cdb 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -211,6 +211,50 @@ return 0; } +/* being added to libosmocore in https://gerrit.osmocom.org/2076, + * so long use this local copy. */ +#define _llist_first_entry(ptr, type, member) \ + llist_entry((ptr)->next, type, member) +#define _llist_first_entry_or_null(ptr, type, member) \ + (!llist_empty(ptr) ? _llist_first_entry(ptr, type, member) : NULL) + +/* Add conn to the clients list in a way that conn->auc_3g_ind takes the lowest + * unused integer and the list of clients remains sorted by auc_3g_ind. + * Keep this function non-static to allow linking in a unit test. */ +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn) +{ + struct osmo_gsup_conn *c; + struct osmo_gsup_conn *prev_conn; + + c = _llist_first_entry_or_null(clients, struct osmo_gsup_conn, list); + + /* Is the first index, 0, unused? */ + if (!c || c->auc_3g_ind > 0) { + conn->auc_3g_ind = 0; + llist_add(&conn->list, clients); + return; + } + + /* Look for a gap later on */ + prev_conn = NULL; + llist_for_each_entry(c, clients, list) { + /* skip first item, we know it has auc_3g_ind == 0. */ + if (!prev_conn) { + prev_conn = c; + continue; + } + if (c->auc_3g_ind > prev_conn->auc_3g_ind + 1) + break; + prev_conn = c; + } + + OSMO_ASSERT(prev_conn); + + conn->auc_3g_ind = prev_conn->auc_3g_ind + 1; + llist_add(&conn->list, &prev_conn->list); +} + /* a client has connected to the server socket and we have accept()ed it */ static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd) { @@ -225,15 +269,15 @@ conn->conn = ipa_server_conn_create(gsups, link, fd, osmo_gsup_server_read_cb, osmo_gsup_server_closed_cb, conn); - conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; OSMO_ASSERT(conn->conn); + conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; /* link data structure with server structure */ conn->server = gsups; - llist_add_tail(&conn->list, &gsups->clients); + osmo_gsup_server_add_conn(&gsups->clients, conn); - LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d\n", - conn->conn->addr, conn->conn->port); + LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d (IND=%u)\n", + conn->conn->addr, conn->conn->port, conn->auc_3g_ind); /* request the identity of the client */ rc = ipa_ccm_send_id_req(fd); diff --git a/src/gsup_server.h b/src/gsup_server.h index 885fe52..74062d4 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -31,6 +31,8 @@ struct ipa_server_conn *conn; //struct oap_state oap_state; struct tlv_parsed ccm; + + unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */ }; diff --git a/src/hlr.c b/src/hlr.c index 00a6459..b5777e2 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -63,7 +63,8 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, conn->auc_3g_ind, + gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 21c0e21..0bd0820 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = \ auc \ + gsup_server \ $(NULL) # The `:;' works around a Bash 3.2 bug when the output is not writeable. diff --git a/tests/gsup_server/Makefile.am b/tests/gsup_server/Makefile.am new file mode 100644 index 0000000..fee60f5 --- /dev/null +++ b/tests/gsup_server/Makefile.am @@ -0,0 +1,40 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/src \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(NULL) + +EXTRA_DIST = \ + gsup_server_test.ok \ + gsup_server_test.err \ + $(NULL) + +noinst_PROGRAMS = \ + gsup_server_test \ + $(NULL) + +gsup_server_test_SOURCES = \ + gsup_server_test.c \ + $(NULL) + +gsup_server_test_LDADD = \ + $(top_srcdir)/src/gsup_server.c \ + $(top_srcdir)/src/gsup_router.c \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(NULL) + +.PHONY: update_exp +update_exp: + $(builddir)/gsup_server_test >"$(srcdir)/gsup_server_test.ok" 2>"$(srcdir)/gsup_server_test.err" diff --git a/tests/gsup_server/gsup_server_test.c b/tests/gsup_server/gsup_server_test.c new file mode 100644 index 0000000..cc475be --- /dev/null +++ b/tests/gsup_server/gsup_server_test.c @@ -0,0 +1,145 @@ +/* (C) 2017 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * 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 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 . + * + */ + +#include +#include +#include "gsup_server.h" + +#define comment_start() printf("\n===== %s\n", __func__) +#define comment_end() printf("===== %s: SUCCESS\n\n", __func__) +#define btw(fmt, args...) printf("\n" fmt "\n", ## args) + +#define VERBOSE_ASSERT(val, expect_op, fmt) \ + do { \ + printf(#val " == " fmt "\n", (val)); \ + OSMO_ASSERT((val) expect_op); \ + } while (0) + +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn); + +static void test_add_conn(void) +{ + struct llist_head _list; + struct llist_head *clients = &_list; + struct osmo_gsup_conn conn_inst[23] = {}; + struct osmo_gsup_conn *conn; + unsigned int i; + + comment_start(); + + INIT_LLIST_HEAD(clients); + + btw("Add 10 items"); + for (i = 0; i < 10; i++) { + osmo_gsup_server_add_conn(clients, &conn_inst[i]); + printf("conn_inst[%u].auc_3g_ind == %u\n", i, conn_inst[i].auc_3g_ind); + OSMO_ASSERT(clients->next == &conn_inst[0].list); + } + + btw("Expecting a list of 0..9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + OSMO_ASSERT(conn == &conn_inst[i]); + i++; + } + + btw("Punch two holes in the sequence in arbitrary order," + " a larger one from 2..4 and a single one at 7."); + llist_del(&conn_inst[4].list); + llist_del(&conn_inst[2].list); + llist_del(&conn_inst[3].list); + llist_del(&conn_inst[7].list); + + btw("Expecting a list of 0,1, 5,6, 8,9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + i++; + } + + btw("Add conns, expecting them to take the open slots"); + osmo_gsup_server_add_conn(clients, &conn_inst[12]); + VERBOSE_ASSERT(conn_inst[12].auc_3g_ind, == 2, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[13]); + VERBOSE_ASSERT(conn_inst[13].auc_3g_ind, == 3, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[14]); + VERBOSE_ASSERT(conn_inst[14].auc_3g_ind, == 4, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[17]); + VERBOSE_ASSERT(conn_inst[17].auc_3g_ind, == 7, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[18]); + VERBOSE_ASSERT(conn_inst[18].auc_3g_ind, == 10, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("Does it also work for the first item?"); + llist_del(&conn_inst[0].list); + + btw("Expecting a list of 1..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i + 1); + i++; + } + + btw("Add another conn, should take auc_3g_ind == 0"); + osmo_gsup_server_add_conn(clients, &conn_inst[20]); + VERBOSE_ASSERT(conn_inst[20].auc_3g_ind, == 0, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("If a client reconnects, it will (likely) get the same auc_3g_ind"); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + llist_del(&conn_inst[5].list); + conn_inst[5].auc_3g_ind = 423; + osmo_gsup_server_add_conn(clients, &conn_inst[5]); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + + comment_end(); +} + +int main(int argc, char **argv) +{ + printf("test_gsup_server.c\n"); + + test_add_conn(); + + printf("Done\n"); + return 0; +} diff --git a/tests/gsup_server/gsup_server_test.err b/tests/gsup_server/gsup_server_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gsup_server/gsup_server_test.err diff --git a/tests/gsup_server/gsup_server_test.ok b/tests/gsup_server/gsup_server_test.ok new file mode 100644 index 0000000..80d944c --- /dev/null +++ b/tests/gsup_server/gsup_server_test.ok @@ -0,0 +1,94 @@ +test_gsup_server.c + +===== test_add_conn + +Add 10 items +conn_inst[0].auc_3g_ind == 0 +conn_inst[1].auc_3g_ind == 1 +conn_inst[2].auc_3g_ind == 2 +conn_inst[3].auc_3g_ind == 3 +conn_inst[4].auc_3g_ind == 4 +conn_inst[5].auc_3g_ind == 5 +conn_inst[6].auc_3g_ind == 6 +conn_inst[7].auc_3g_ind == 7 +conn_inst[8].auc_3g_ind == 8 +conn_inst[9].auc_3g_ind == 9 + +Expecting a list of 0..9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 + +Punch two holes in the sequence in arbitrary order, a larger one from 2..4 and a single one at 7. + +Expecting a list of 0,1, 5,6, 8,9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 5 +conn[3].auc_3g_ind == 6 +conn[4].auc_3g_ind == 8 +conn[5].auc_3g_ind == 9 + +Add conns, expecting them to take the open slots +conn_inst[12].auc_3g_ind == 2 +conn_inst[13].auc_3g_ind == 3 +conn_inst[14].auc_3g_ind == 4 +conn_inst[17].auc_3g_ind == 7 +conn_inst[18].auc_3g_ind == 10 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +Does it also work for the first item? + +Expecting a list of 1..10 +conn[0].auc_3g_ind == 1 +conn[1].auc_3g_ind == 2 +conn[2].auc_3g_ind == 3 +conn[3].auc_3g_ind == 4 +conn[4].auc_3g_ind == 5 +conn[5].auc_3g_ind == 6 +conn[6].auc_3g_ind == 7 +conn[7].auc_3g_ind == 8 +conn[8].auc_3g_ind == 9 +conn[9].auc_3g_ind == 10 + +Add another conn, should take auc_3g_ind == 0 +conn_inst[20].auc_3g_ind == 0 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +If a client reconnects, it will (likely) get the same auc_3g_ind +conn_inst[5].auc_3g_ind == 5 +conn_inst[5].auc_3g_ind == 5 +===== test_add_conn: SUCCESS + +Done diff --git a/tests/testsuite.at b/tests/testsuite.at index 46d1456..a969082 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -14,3 +14,10 @@ cat $abs_srcdir/auc/auc_ts_55_205_test_sets.err > experr AT_CHECK([$abs_top_builddir/tests/auc/auc_ts_55_205_test_sets], [], [expout], [experr]) AT_CLEANUP + +AT_SETUP([gsup_server]) +AT_KEYWORDS([gsup_server]) +cat $abs_srcdir/gsup_server/gsup_server_test.ok > expout +cat $abs_srcdir/gsup_server/gsup_server_test.err > experr +AT_CHECK([$abs_top_builddir/tests/gsup_server/gsup_server_test], [], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 3 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:47:34 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:47:34 +0000 Subject: [PATCH] osmo-hlr[master]: fix debug log: adjust to new SQN increment scheme In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2090 to look at the new patch set (#2). fix debug log: adjust to new SQN increment scheme We can no longer accurately print the SQN from AUTS resync, since the SQN is incremented after AUTS. Instead, always print the SQN from the generated tuple, i.e. exactly the one left in auth data *after* the tuple was generated. This change was forgotten in recent adjustments to the new SQN incrementing scheme from libosmocore, in change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 for libosmocore change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3. It should have been obvious that something was missing in the previous patch from the auc_test output: the SQN in the output changed while the AUTN remained the same. That slipped by without being noticed :/ Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f --- M src/auc.c M src/db_auc.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err 4 files changed, 33 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/90/2090/2 diff --git a/src/auc.c b/src/auc.c index 9c20db2..d3b3d36 100644 --- a/src/auc.c +++ b/src/auc.c @@ -123,14 +123,7 @@ rc = osmo_auth_gen_vec_auts(vec+i, aud3g, auts, rand_auts, rand); - /* The sqn used for the key is sqn - 1 because - * vector generation has already inc'd it. The - * USIM's sqn sent in AUTS is sqn - 2. */ - DBGP("vector [%u]: resync: sqn = %"PRIu64 "\n", - i, aud3g->u.umts.sqn - 1); } else { - DBGP("vector [%u]: sqn = %" PRIu64 "\n", - i, aud3g->u.umts.sqn); rc = osmo_auth_gen_vec(vec+i, aud3g, rand); } if (rc < 0) { @@ -138,6 +131,8 @@ "generation: [%u]: rc = %d\n", i, rc); goto out; } + DBGP("vector [%u]: sqn = %" PRIu64 "\n", + i, aud3g->u.umts.sqn); DBGVB(autn); DBGVB(ck); diff --git a/src/db_auc.c b/src/db_auc.c index a24f27e..ac81404 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index bfc046f..8748ece 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -28,7 +28,7 @@ DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -47,7 +47,7 @@ DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -69,7 +69,7 @@ DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -86,7 +86,7 @@ DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -106,7 +106,7 @@ DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 23 +DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -125,7 +125,7 @@ DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f -DAUC vector [0]: sqn = 23 +DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -135,7 +135,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 24 +DAUC vector [1]: sqn = 25 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -145,7 +145,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 25 +DAUC vector [2]: sqn = 26 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 @@ -166,7 +166,7 @@ DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 23 +DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -176,7 +176,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 24 +DAUC vector [1]: sqn = 25 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -186,7 +186,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 25 +DAUC vector [2]: sqn = 26 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 59ba22d..3037d2f 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -5,7 +5,7 @@ DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 @@ -26,7 +26,7 @@ DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b @@ -47,7 +47,7 @@ DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b @@ -68,7 +68,7 @@ DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 @@ -89,7 +89,7 @@ DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 @@ -110,7 +110,7 @@ DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 @@ -131,7 +131,7 @@ DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 @@ -152,7 +152,7 @@ DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e @@ -173,7 +173,7 @@ DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 @@ -194,7 +194,7 @@ DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd @@ -215,7 +215,7 @@ DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 @@ -236,7 +236,7 @@ DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 @@ -257,7 +257,7 @@ DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 217af492728d00003bd338249751de80 DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a @@ -278,7 +278,7 @@ DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 @@ -299,7 +299,7 @@ DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 @@ -320,7 +320,7 @@ DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 @@ -341,7 +341,7 @@ DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 @@ -362,7 +362,7 @@ DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a @@ -383,7 +383,7 @@ DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef -- To view, visit https://gerrit.osmocom.org/2090 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 04:52:04 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 04:52:04 +0000 Subject: [PATCH] osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2081 to look at the new patch set (#4). UMTS AKA: implement SQN increment according to SEQ and IND Add ind_bitlen column to auc_3g to record each USIM's IND size according to 3GPP TS 33.102 -- default is 5 bits, as suggested by the spec. Introduce auc_3g_ind to each connecting GSUP client to use as IND index for generating auth tuples sent to this client. With osmo_gsup_server_add_conn(), implement a scheme where clients receive fixed auc_3g_ind indexes based on the order in which they connect; each new connection takes the lowest unused auc_3g_ind, so in case one of the clients restarts, it will most likely receive the same auc_3g_ind, and if one client disconnects, no other clients' auc_3g_ind are affected. Add gsup_server_test.c to test the auc_3g_ind index distribution scheme. Depends: libosmocore I4eac5be0c0b2cede04464c4c3a0873102d952453 for llist_first Related: OS#1969 Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 --- M configure.ac M sql/hlr.sql M src/db.c M src/db.h M src/db_auc.c M src/db_test.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M tests/Makefile.am A tests/gsup_server/Makefile.am A tests/gsup_server/gsup_server_test.c A tests/gsup_server/gsup_server_test.err A tests/gsup_server/gsup_server_test.ok M tests/testsuite.at 15 files changed, 354 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/81/2081/4 diff --git a/configure.ac b/configure.ac index a04185f..958b48b 100644 --- a/configure.ac +++ b/configure.ac @@ -50,4 +50,5 @@ tests/Makefile tests/auc/Makefile tests/auc/gen_ts_55_205_test_sets/Makefile + tests/gsup_server/Makefile ) diff --git a/sql/hlr.sql b/sql/hlr.sql index 9238871..5fbc712 100644 --- a/sql/hlr.sql +++ b/sql/hlr.sql @@ -63,7 +63,8 @@ k VARCHAR(32) NOT NULL, -- hex string: subscriber's secret key (128bit) op VARCHAR(32), -- hex string: operator's secret key (128bit) opc VARCHAR(32), -- hex string: derived from OP and K (128bit) - sqn INTEGER NOT NULL DEFAULT 0 -- sequence number of key usage + sqn INTEGER NOT NULL DEFAULT 0, -- sequence number of key usage + ind_bitlen INTEGER NOT NULL DEFAULT 5 -- nr of index bits at lower SQN end ); CREATE UNIQUE INDEX IF NOT EXISTS idx_subscr_imsi ON subscriber (imsi); diff --git a/src/db.c b/src/db.c index aa4726c..aaf6fe2 100644 --- a/src/db.c +++ b/src/db.c @@ -29,7 +29,7 @@ [SEL_BY_IMSI] = "SELECT id,imsi,msisdn,vlr_number,sgsn_number,sgsn_address,periodic_lu_tmr,periodic_rau_tau_tmr,nam_cs,nam_ps,lmsi,ms_purged_cs,ms_purged_ps FROM subscriber WHERE imsi = ?", [UPD_VLR_BY_ID] = "UPDATE subscriber SET vlr_number = ? WHERE id = ?", [UPD_SGSN_BY_ID] = "UPDATE subscriber SET sgsn_number = ? WHERE id = ?", - [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", + [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn, ind_bitlen FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", [AUC_UPD_SQN] = "UPDATE auc_3g SET sqn = ? WHERE subscriber_id = ?", [UPD_PURGE_CS_BY_IMSI] = "UPDATE subscriber SET ms_purged_cs=1 WHERE imsi = ?", [UPD_PURGE_PS_BY_IMSI] = "UPDATE subscriber SET ms_purged_ps=1 WHERE imsi = ?", diff --git a/src/db.h b/src/db.h index 0b3df88..a60cf62 100644 --- a/src/db.h +++ b/src/db.h @@ -39,8 +39,9 @@ uint64_t new_sqn); int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts); + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts); #include #include diff --git a/src/db_auc.c b/src/db_auc.c index ac81404..8a369b5 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -159,6 +159,7 @@ aud3g->u.umts.opc_is_op = 1; } aud3g->u.umts.sqn = sqlite3_column_int64(stmt, 7); + aud3g->u.umts.ind_bitlen = sqlite3_column_int(stmt, 8); /* FIXME: amf? */ aud3g->type = OSMO_AUTH_TYPE_UMTS; } else @@ -186,8 +187,9 @@ /* return -1 in case of error, 0 for unknown imsi, positive for number * of vectors generated */ int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts) + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts) { struct osmo_sub_auth_data aud2g, aud3g; uint64_t subscr_id; @@ -198,6 +200,16 @@ if (rc <= 0) return rc; + aud3g.u.umts.ind = auc_3g_ind; + if (aud3g.type == OSMO_AUTH_TYPE_UMTS + && aud3g.u.umts.ind >= (1U << aud3g.u.umts.ind_bitlen)) { + LOGAUC(imsi, LOGL_NOTICE, "3G auth: SQN's IND bitlen %u is" + " too small to hold an index of %u. Truncating. This" + " may cause numerous additional AUTS resyncing.\n", + aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind); + aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1; + } + LOGAUC(imsi, LOGL_DEBUG, "Calling to generate %u vectors\n", num_vec); rc = auc_compute_vectors(vec, num_vec, &aud2g, &aud3g, rand_auts, auts); if (rc < 0) { diff --git a/src/db_test.c b/src/db_test.c index 998a37a..0e823f9 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -20,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, 0, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index b0e1858..b382c86 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -211,6 +211,43 @@ return 0; } +/* Add conn to the clients list in a way that conn->auc_3g_ind takes the lowest + * unused integer and the list of clients remains sorted by auc_3g_ind. + * Keep this function non-static to allow linking in a unit test. */ +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn) +{ + struct osmo_gsup_conn *c; + struct osmo_gsup_conn *prev_conn; + + c = llist_first_entry_or_null(clients, struct osmo_gsup_conn, list); + + /* Is the first index, 0, unused? */ + if (!c || c->auc_3g_ind > 0) { + conn->auc_3g_ind = 0; + llist_add(&conn->list, clients); + return; + } + + /* Look for a gap later on */ + prev_conn = NULL; + llist_for_each_entry(c, clients, list) { + /* skip first item, we know it has auc_3g_ind == 0. */ + if (!prev_conn) { + prev_conn = c; + continue; + } + if (c->auc_3g_ind > prev_conn->auc_3g_ind + 1) + break; + prev_conn = c; + } + + OSMO_ASSERT(prev_conn); + + conn->auc_3g_ind = prev_conn->auc_3g_ind + 1; + llist_add(&conn->list, &prev_conn->list); +} + /* a client has connected to the server socket and we have accept()ed it */ static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd) { @@ -225,15 +262,15 @@ conn->conn = ipa_server_conn_create(gsups, link, fd, osmo_gsup_server_read_cb, osmo_gsup_server_closed_cb, conn); - conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; OSMO_ASSERT(conn->conn); + conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; /* link data structure with server structure */ conn->server = gsups; - llist_add_tail(&conn->list, &gsups->clients); + osmo_gsup_server_add_conn(&gsups->clients, conn); - LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d\n", - conn->conn->addr, conn->conn->port); + LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d (IND=%u)\n", + conn->conn->addr, conn->conn->port, conn->auc_3g_ind); /* request the identity of the client */ rc = ipa_ccm_send_id_req(fd); diff --git a/src/gsup_server.h b/src/gsup_server.h index 885fe52..74062d4 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -31,6 +31,8 @@ struct ipa_server_conn *conn; //struct oap_state oap_state; struct tlv_parsed ccm; + + unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */ }; diff --git a/src/hlr.c b/src/hlr.c index 00a6459..b5777e2 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -63,7 +63,8 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, conn->auc_3g_ind, + gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 21c0e21..0bd0820 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = \ auc \ + gsup_server \ $(NULL) # The `:;' works around a Bash 3.2 bug when the output is not writeable. diff --git a/tests/gsup_server/Makefile.am b/tests/gsup_server/Makefile.am new file mode 100644 index 0000000..fee60f5 --- /dev/null +++ b/tests/gsup_server/Makefile.am @@ -0,0 +1,40 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/src \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(NULL) + +EXTRA_DIST = \ + gsup_server_test.ok \ + gsup_server_test.err \ + $(NULL) + +noinst_PROGRAMS = \ + gsup_server_test \ + $(NULL) + +gsup_server_test_SOURCES = \ + gsup_server_test.c \ + $(NULL) + +gsup_server_test_LDADD = \ + $(top_srcdir)/src/gsup_server.c \ + $(top_srcdir)/src/gsup_router.c \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(NULL) + +.PHONY: update_exp +update_exp: + $(builddir)/gsup_server_test >"$(srcdir)/gsup_server_test.ok" 2>"$(srcdir)/gsup_server_test.err" diff --git a/tests/gsup_server/gsup_server_test.c b/tests/gsup_server/gsup_server_test.c new file mode 100644 index 0000000..cc475be --- /dev/null +++ b/tests/gsup_server/gsup_server_test.c @@ -0,0 +1,145 @@ +/* (C) 2017 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * 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 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 . + * + */ + +#include +#include +#include "gsup_server.h" + +#define comment_start() printf("\n===== %s\n", __func__) +#define comment_end() printf("===== %s: SUCCESS\n\n", __func__) +#define btw(fmt, args...) printf("\n" fmt "\n", ## args) + +#define VERBOSE_ASSERT(val, expect_op, fmt) \ + do { \ + printf(#val " == " fmt "\n", (val)); \ + OSMO_ASSERT((val) expect_op); \ + } while (0) + +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn); + +static void test_add_conn(void) +{ + struct llist_head _list; + struct llist_head *clients = &_list; + struct osmo_gsup_conn conn_inst[23] = {}; + struct osmo_gsup_conn *conn; + unsigned int i; + + comment_start(); + + INIT_LLIST_HEAD(clients); + + btw("Add 10 items"); + for (i = 0; i < 10; i++) { + osmo_gsup_server_add_conn(clients, &conn_inst[i]); + printf("conn_inst[%u].auc_3g_ind == %u\n", i, conn_inst[i].auc_3g_ind); + OSMO_ASSERT(clients->next == &conn_inst[0].list); + } + + btw("Expecting a list of 0..9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + OSMO_ASSERT(conn == &conn_inst[i]); + i++; + } + + btw("Punch two holes in the sequence in arbitrary order," + " a larger one from 2..4 and a single one at 7."); + llist_del(&conn_inst[4].list); + llist_del(&conn_inst[2].list); + llist_del(&conn_inst[3].list); + llist_del(&conn_inst[7].list); + + btw("Expecting a list of 0,1, 5,6, 8,9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + i++; + } + + btw("Add conns, expecting them to take the open slots"); + osmo_gsup_server_add_conn(clients, &conn_inst[12]); + VERBOSE_ASSERT(conn_inst[12].auc_3g_ind, == 2, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[13]); + VERBOSE_ASSERT(conn_inst[13].auc_3g_ind, == 3, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[14]); + VERBOSE_ASSERT(conn_inst[14].auc_3g_ind, == 4, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[17]); + VERBOSE_ASSERT(conn_inst[17].auc_3g_ind, == 7, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[18]); + VERBOSE_ASSERT(conn_inst[18].auc_3g_ind, == 10, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("Does it also work for the first item?"); + llist_del(&conn_inst[0].list); + + btw("Expecting a list of 1..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i + 1); + i++; + } + + btw("Add another conn, should take auc_3g_ind == 0"); + osmo_gsup_server_add_conn(clients, &conn_inst[20]); + VERBOSE_ASSERT(conn_inst[20].auc_3g_ind, == 0, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("If a client reconnects, it will (likely) get the same auc_3g_ind"); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + llist_del(&conn_inst[5].list); + conn_inst[5].auc_3g_ind = 423; + osmo_gsup_server_add_conn(clients, &conn_inst[5]); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + + comment_end(); +} + +int main(int argc, char **argv) +{ + printf("test_gsup_server.c\n"); + + test_add_conn(); + + printf("Done\n"); + return 0; +} diff --git a/tests/gsup_server/gsup_server_test.err b/tests/gsup_server/gsup_server_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gsup_server/gsup_server_test.err diff --git a/tests/gsup_server/gsup_server_test.ok b/tests/gsup_server/gsup_server_test.ok new file mode 100644 index 0000000..80d944c --- /dev/null +++ b/tests/gsup_server/gsup_server_test.ok @@ -0,0 +1,94 @@ +test_gsup_server.c + +===== test_add_conn + +Add 10 items +conn_inst[0].auc_3g_ind == 0 +conn_inst[1].auc_3g_ind == 1 +conn_inst[2].auc_3g_ind == 2 +conn_inst[3].auc_3g_ind == 3 +conn_inst[4].auc_3g_ind == 4 +conn_inst[5].auc_3g_ind == 5 +conn_inst[6].auc_3g_ind == 6 +conn_inst[7].auc_3g_ind == 7 +conn_inst[8].auc_3g_ind == 8 +conn_inst[9].auc_3g_ind == 9 + +Expecting a list of 0..9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 + +Punch two holes in the sequence in arbitrary order, a larger one from 2..4 and a single one at 7. + +Expecting a list of 0,1, 5,6, 8,9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 5 +conn[3].auc_3g_ind == 6 +conn[4].auc_3g_ind == 8 +conn[5].auc_3g_ind == 9 + +Add conns, expecting them to take the open slots +conn_inst[12].auc_3g_ind == 2 +conn_inst[13].auc_3g_ind == 3 +conn_inst[14].auc_3g_ind == 4 +conn_inst[17].auc_3g_ind == 7 +conn_inst[18].auc_3g_ind == 10 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +Does it also work for the first item? + +Expecting a list of 1..10 +conn[0].auc_3g_ind == 1 +conn[1].auc_3g_ind == 2 +conn[2].auc_3g_ind == 3 +conn[3].auc_3g_ind == 4 +conn[4].auc_3g_ind == 5 +conn[5].auc_3g_ind == 6 +conn[6].auc_3g_ind == 7 +conn[7].auc_3g_ind == 8 +conn[8].auc_3g_ind == 9 +conn[9].auc_3g_ind == 10 + +Add another conn, should take auc_3g_ind == 0 +conn_inst[20].auc_3g_ind == 0 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +If a client reconnects, it will (likely) get the same auc_3g_ind +conn_inst[5].auc_3g_ind == 5 +conn_inst[5].auc_3g_ind == 5 +===== test_add_conn: SUCCESS + +Done diff --git a/tests/testsuite.at b/tests/testsuite.at index 46d1456..a969082 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -14,3 +14,10 @@ cat $abs_srcdir/auc/auc_ts_55_205_test_sets.err > experr AT_CHECK([$abs_top_builddir/tests/auc/auc_ts_55_205_test_sets], [], [expout], [experr]) AT_CLEANUP + +AT_SETUP([gsup_server]) +AT_KEYWORDS([gsup_server]) +cat $abs_srcdir/gsup_server/gsup_server_test.ok > expout +cat $abs_srcdir/gsup_server/gsup_server_test.err > experr +AT_CHECK([$abs_top_builddir/tests/gsup_server/gsup_server_test], [], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 4 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 08:55:50 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 08:55:50 +0000 Subject: libosmocore[master]: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2089 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 08:59:48 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 08:59:48 +0000 Subject: libosmocore[master]: core/conv: implement optimized Viterbi decoder In-Reply-To: References: Message-ID: Patch Set 4: That's a nitpicking of course, but maybe change the name to viterbi_common.c or viterbi_generic.c to avoid confusion with the generated files? -- To view, visit https://gerrit.osmocom.org/1337 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:09:51 2017 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Thu, 16 Mar 2017 09:09:51 +0000 Subject: libosmocore[master]: core/conv: implement optimized Viterbi decoder In-Reply-To: References: Message-ID: Patch Set 5: @Harald: Ooops, I had completely missed the updated version, I'll check it out this weekend. -- To view, visit https://gerrit.osmocom.org/1337 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:38:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:38:20 +0000 Subject: osmo-hlr[master]: debug log: output ind slot, previous sqn, and sqn db update In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2091 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32 Gerrit-PatchSet: 3 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:39:31 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:39:31 +0000 Subject: osmo-hlr[master]: fix debug log: adjust to new SQN increment scheme In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2090 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:40:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:40:02 +0000 Subject: osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 4 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:40:04 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:40:04 +0000 Subject: [MERGED] osmo-hlr[master]: UMTS AKA: implement SQN increment according to SEQ and IND In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: UMTS AKA: implement SQN increment according to SEQ and IND ...................................................................... UMTS AKA: implement SQN increment according to SEQ and IND Add ind_bitlen column to auc_3g to record each USIM's IND size according to 3GPP TS 33.102 -- default is 5 bits, as suggested by the spec. Introduce auc_3g_ind to each connecting GSUP client to use as IND index for generating auth tuples sent to this client. With osmo_gsup_server_add_conn(), implement a scheme where clients receive fixed auc_3g_ind indexes based on the order in which they connect; each new connection takes the lowest unused auc_3g_ind, so in case one of the clients restarts, it will most likely receive the same auc_3g_ind, and if one client disconnects, no other clients' auc_3g_ind are affected. Add gsup_server_test.c to test the auc_3g_ind index distribution scheme. Depends: libosmocore I4eac5be0c0b2cede04464c4c3a0873102d952453 for llist_first Related: OS#1969 Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 --- M configure.ac M sql/hlr.sql M src/db.c M src/db.h M src/db_auc.c M src/db_test.c M src/gsup_server.c M src/gsup_server.h M src/hlr.c M tests/Makefile.am A tests/gsup_server/Makefile.am A tests/gsup_server/gsup_server_test.c A tests/gsup_server/gsup_server_test.err A tests/gsup_server/gsup_server_test.ok M tests/testsuite.at 15 files changed, 354 insertions(+), 12 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/configure.ac b/configure.ac index a04185f..958b48b 100644 --- a/configure.ac +++ b/configure.ac @@ -50,4 +50,5 @@ tests/Makefile tests/auc/Makefile tests/auc/gen_ts_55_205_test_sets/Makefile + tests/gsup_server/Makefile ) diff --git a/sql/hlr.sql b/sql/hlr.sql index 9238871..5fbc712 100644 --- a/sql/hlr.sql +++ b/sql/hlr.sql @@ -63,7 +63,8 @@ k VARCHAR(32) NOT NULL, -- hex string: subscriber's secret key (128bit) op VARCHAR(32), -- hex string: operator's secret key (128bit) opc VARCHAR(32), -- hex string: derived from OP and K (128bit) - sqn INTEGER NOT NULL DEFAULT 0 -- sequence number of key usage + sqn INTEGER NOT NULL DEFAULT 0, -- sequence number of key usage + ind_bitlen INTEGER NOT NULL DEFAULT 5 -- nr of index bits at lower SQN end ); CREATE UNIQUE INDEX IF NOT EXISTS idx_subscr_imsi ON subscriber (imsi); diff --git a/src/db.c b/src/db.c index aa4726c..aaf6fe2 100644 --- a/src/db.c +++ b/src/db.c @@ -29,7 +29,7 @@ [SEL_BY_IMSI] = "SELECT id,imsi,msisdn,vlr_number,sgsn_number,sgsn_address,periodic_lu_tmr,periodic_rau_tau_tmr,nam_cs,nam_ps,lmsi,ms_purged_cs,ms_purged_ps FROM subscriber WHERE imsi = ?", [UPD_VLR_BY_ID] = "UPDATE subscriber SET vlr_number = ? WHERE id = ?", [UPD_SGSN_BY_ID] = "UPDATE subscriber SET sgsn_number = ? WHERE id = ?", - [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", + [AUC_BY_IMSI] = "SELECT id, algo_id_2g, ki, algo_id_3g, k, op, opc, sqn, ind_bitlen FROM subscriber LEFT JOIN auc_2g ON auc_2g.subscriber_id = subscriber.id LEFT JOIN auc_3g ON auc_3g.subscriber_id = subscriber.id WHERE imsi = ?", [AUC_UPD_SQN] = "UPDATE auc_3g SET sqn = ? WHERE subscriber_id = ?", [UPD_PURGE_CS_BY_IMSI] = "UPDATE subscriber SET ms_purged_cs=1 WHERE imsi = ?", [UPD_PURGE_PS_BY_IMSI] = "UPDATE subscriber SET ms_purged_ps=1 WHERE imsi = ?", diff --git a/src/db.h b/src/db.h index 0b3df88..a60cf62 100644 --- a/src/db.h +++ b/src/db.h @@ -39,8 +39,9 @@ uint64_t new_sqn); int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts); + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts); #include #include diff --git a/src/db_auc.c b/src/db_auc.c index ac81404..8a369b5 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -159,6 +159,7 @@ aud3g->u.umts.opc_is_op = 1; } aud3g->u.umts.sqn = sqlite3_column_int64(stmt, 7); + aud3g->u.umts.ind_bitlen = sqlite3_column_int(stmt, 8); /* FIXME: amf? */ aud3g->type = OSMO_AUTH_TYPE_UMTS; } else @@ -186,8 +187,9 @@ /* return -1 in case of error, 0 for unknown imsi, positive for number * of vectors generated */ int db_get_auc(struct db_context *dbc, const char *imsi, - struct osmo_auth_vector *vec, unsigned int num_vec, - const uint8_t *rand_auts, const uint8_t *auts) + unsigned int auc_3g_ind, struct osmo_auth_vector *vec, + unsigned int num_vec, const uint8_t *rand_auts, + const uint8_t *auts) { struct osmo_sub_auth_data aud2g, aud3g; uint64_t subscr_id; @@ -198,6 +200,16 @@ if (rc <= 0) return rc; + aud3g.u.umts.ind = auc_3g_ind; + if (aud3g.type == OSMO_AUTH_TYPE_UMTS + && aud3g.u.umts.ind >= (1U << aud3g.u.umts.ind_bitlen)) { + LOGAUC(imsi, LOGL_NOTICE, "3G auth: SQN's IND bitlen %u is" + " too small to hold an index of %u. Truncating. This" + " may cause numerous additional AUTS resyncing.\n", + aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind); + aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1; + } + LOGAUC(imsi, LOGL_DEBUG, "Calling to generate %u vectors\n", num_vec); rc = auc_compute_vectors(vec, num_vec, &aud2g, &aud3g, rand_auts, auts); if (rc < 0) { diff --git a/src/db_test.c b/src/db_test.c index 998a37a..0e823f9 100644 --- a/src/db_test.c +++ b/src/db_test.c @@ -20,7 +20,7 @@ for (i = 0; i < ARRAY_SIZE(vec); i++) vec[i].res_len = 0; - rc = db_get_auc(dbc, imsi, vec, ARRAY_SIZE(vec), NULL, NULL); + rc = db_get_auc(dbc, imsi, 0, vec, ARRAY_SIZE(vec), NULL, NULL); if (rc <= 0) { LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi); return rc; diff --git a/src/gsup_server.c b/src/gsup_server.c index b0e1858..b382c86 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -211,6 +211,43 @@ return 0; } +/* Add conn to the clients list in a way that conn->auc_3g_ind takes the lowest + * unused integer and the list of clients remains sorted by auc_3g_ind. + * Keep this function non-static to allow linking in a unit test. */ +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn) +{ + struct osmo_gsup_conn *c; + struct osmo_gsup_conn *prev_conn; + + c = llist_first_entry_or_null(clients, struct osmo_gsup_conn, list); + + /* Is the first index, 0, unused? */ + if (!c || c->auc_3g_ind > 0) { + conn->auc_3g_ind = 0; + llist_add(&conn->list, clients); + return; + } + + /* Look for a gap later on */ + prev_conn = NULL; + llist_for_each_entry(c, clients, list) { + /* skip first item, we know it has auc_3g_ind == 0. */ + if (!prev_conn) { + prev_conn = c; + continue; + } + if (c->auc_3g_ind > prev_conn->auc_3g_ind + 1) + break; + prev_conn = c; + } + + OSMO_ASSERT(prev_conn); + + conn->auc_3g_ind = prev_conn->auc_3g_ind + 1; + llist_add(&conn->list, &prev_conn->list); +} + /* a client has connected to the server socket and we have accept()ed it */ static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd) { @@ -225,15 +262,15 @@ conn->conn = ipa_server_conn_create(gsups, link, fd, osmo_gsup_server_read_cb, osmo_gsup_server_closed_cb, conn); - conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; OSMO_ASSERT(conn->conn); + conn->conn->ccm_cb = osmo_gsup_server_ccm_cb; /* link data structure with server structure */ conn->server = gsups; - llist_add_tail(&conn->list, &gsups->clients); + osmo_gsup_server_add_conn(&gsups->clients, conn); - LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d\n", - conn->conn->addr, conn->conn->port); + LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d (IND=%u)\n", + conn->conn->addr, conn->conn->port, conn->auc_3g_ind); /* request the identity of the client */ rc = ipa_ccm_send_id_req(fd); diff --git a/src/gsup_server.h b/src/gsup_server.h index 885fe52..74062d4 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -31,6 +31,8 @@ struct ipa_server_conn *conn; //struct oap_state oap_state; struct tlv_parsed ccm; + + unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */ }; diff --git a/src/hlr.c b/src/hlr.c index 00a6459..b5777e2 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -63,7 +63,8 @@ memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); - rc = db_get_auc(dbc, gsup->imsi, gsup_out.auth_vectors, + rc = db_get_auc(dbc, gsup->imsi, conn->auc_3g_ind, + gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), gsup->rand, gsup->auts); if (rc < 0) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 21c0e21..0bd0820 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = \ auc \ + gsup_server \ $(NULL) # The `:;' works around a Bash 3.2 bug when the output is not writeable. diff --git a/tests/gsup_server/Makefile.am b/tests/gsup_server/Makefile.am new file mode 100644 index 0000000..fee60f5 --- /dev/null +++ b/tests/gsup_server/Makefile.am @@ -0,0 +1,40 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/src \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(NULL) + +EXTRA_DIST = \ + gsup_server_test.ok \ + gsup_server_test.err \ + $(NULL) + +noinst_PROGRAMS = \ + gsup_server_test \ + $(NULL) + +gsup_server_test_SOURCES = \ + gsup_server_test.c \ + $(NULL) + +gsup_server_test_LDADD = \ + $(top_srcdir)/src/gsup_server.c \ + $(top_srcdir)/src/gsup_router.c \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(NULL) + +.PHONY: update_exp +update_exp: + $(builddir)/gsup_server_test >"$(srcdir)/gsup_server_test.ok" 2>"$(srcdir)/gsup_server_test.err" diff --git a/tests/gsup_server/gsup_server_test.c b/tests/gsup_server/gsup_server_test.c new file mode 100644 index 0000000..cc475be --- /dev/null +++ b/tests/gsup_server/gsup_server_test.c @@ -0,0 +1,145 @@ +/* (C) 2017 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * 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 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 . + * + */ + +#include +#include +#include "gsup_server.h" + +#define comment_start() printf("\n===== %s\n", __func__) +#define comment_end() printf("===== %s: SUCCESS\n\n", __func__) +#define btw(fmt, args...) printf("\n" fmt "\n", ## args) + +#define VERBOSE_ASSERT(val, expect_op, fmt) \ + do { \ + printf(#val " == " fmt "\n", (val)); \ + OSMO_ASSERT((val) expect_op); \ + } while (0) + +void osmo_gsup_server_add_conn(struct llist_head *clients, + struct osmo_gsup_conn *conn); + +static void test_add_conn(void) +{ + struct llist_head _list; + struct llist_head *clients = &_list; + struct osmo_gsup_conn conn_inst[23] = {}; + struct osmo_gsup_conn *conn; + unsigned int i; + + comment_start(); + + INIT_LLIST_HEAD(clients); + + btw("Add 10 items"); + for (i = 0; i < 10; i++) { + osmo_gsup_server_add_conn(clients, &conn_inst[i]); + printf("conn_inst[%u].auc_3g_ind == %u\n", i, conn_inst[i].auc_3g_ind); + OSMO_ASSERT(clients->next == &conn_inst[0].list); + } + + btw("Expecting a list of 0..9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + OSMO_ASSERT(conn == &conn_inst[i]); + i++; + } + + btw("Punch two holes in the sequence in arbitrary order," + " a larger one from 2..4 and a single one at 7."); + llist_del(&conn_inst[4].list); + llist_del(&conn_inst[2].list); + llist_del(&conn_inst[3].list); + llist_del(&conn_inst[7].list); + + btw("Expecting a list of 0,1, 5,6, 8,9"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + i++; + } + + btw("Add conns, expecting them to take the open slots"); + osmo_gsup_server_add_conn(clients, &conn_inst[12]); + VERBOSE_ASSERT(conn_inst[12].auc_3g_ind, == 2, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[13]); + VERBOSE_ASSERT(conn_inst[13].auc_3g_ind, == 3, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[14]); + VERBOSE_ASSERT(conn_inst[14].auc_3g_ind, == 4, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[17]); + VERBOSE_ASSERT(conn_inst[17].auc_3g_ind, == 7, "%u"); + + osmo_gsup_server_add_conn(clients, &conn_inst[18]); + VERBOSE_ASSERT(conn_inst[18].auc_3g_ind, == 10, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("Does it also work for the first item?"); + llist_del(&conn_inst[0].list); + + btw("Expecting a list of 1..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i + 1); + i++; + } + + btw("Add another conn, should take auc_3g_ind == 0"); + osmo_gsup_server_add_conn(clients, &conn_inst[20]); + VERBOSE_ASSERT(conn_inst[20].auc_3g_ind, == 0, "%u"); + + btw("Expecting a list of 0..10"); + i = 0; + llist_for_each_entry(conn, clients, list) { + printf("conn[%u].auc_3g_ind == %u\n", i, conn->auc_3g_ind); + OSMO_ASSERT(conn->auc_3g_ind == i); + i++; + } + + btw("If a client reconnects, it will (likely) get the same auc_3g_ind"); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + llist_del(&conn_inst[5].list); + conn_inst[5].auc_3g_ind = 423; + osmo_gsup_server_add_conn(clients, &conn_inst[5]); + VERBOSE_ASSERT(conn_inst[5].auc_3g_ind, == 5, "%u"); + + comment_end(); +} + +int main(int argc, char **argv) +{ + printf("test_gsup_server.c\n"); + + test_add_conn(); + + printf("Done\n"); + return 0; +} diff --git a/tests/gsup_server/gsup_server_test.err b/tests/gsup_server/gsup_server_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/gsup_server/gsup_server_test.err diff --git a/tests/gsup_server/gsup_server_test.ok b/tests/gsup_server/gsup_server_test.ok new file mode 100644 index 0000000..80d944c --- /dev/null +++ b/tests/gsup_server/gsup_server_test.ok @@ -0,0 +1,94 @@ +test_gsup_server.c + +===== test_add_conn + +Add 10 items +conn_inst[0].auc_3g_ind == 0 +conn_inst[1].auc_3g_ind == 1 +conn_inst[2].auc_3g_ind == 2 +conn_inst[3].auc_3g_ind == 3 +conn_inst[4].auc_3g_ind == 4 +conn_inst[5].auc_3g_ind == 5 +conn_inst[6].auc_3g_ind == 6 +conn_inst[7].auc_3g_ind == 7 +conn_inst[8].auc_3g_ind == 8 +conn_inst[9].auc_3g_ind == 9 + +Expecting a list of 0..9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 + +Punch two holes in the sequence in arbitrary order, a larger one from 2..4 and a single one at 7. + +Expecting a list of 0,1, 5,6, 8,9 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 5 +conn[3].auc_3g_ind == 6 +conn[4].auc_3g_ind == 8 +conn[5].auc_3g_ind == 9 + +Add conns, expecting them to take the open slots +conn_inst[12].auc_3g_ind == 2 +conn_inst[13].auc_3g_ind == 3 +conn_inst[14].auc_3g_ind == 4 +conn_inst[17].auc_3g_ind == 7 +conn_inst[18].auc_3g_ind == 10 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +Does it also work for the first item? + +Expecting a list of 1..10 +conn[0].auc_3g_ind == 1 +conn[1].auc_3g_ind == 2 +conn[2].auc_3g_ind == 3 +conn[3].auc_3g_ind == 4 +conn[4].auc_3g_ind == 5 +conn[5].auc_3g_ind == 6 +conn[6].auc_3g_ind == 7 +conn[7].auc_3g_ind == 8 +conn[8].auc_3g_ind == 9 +conn[9].auc_3g_ind == 10 + +Add another conn, should take auc_3g_ind == 0 +conn_inst[20].auc_3g_ind == 0 + +Expecting a list of 0..10 +conn[0].auc_3g_ind == 0 +conn[1].auc_3g_ind == 1 +conn[2].auc_3g_ind == 2 +conn[3].auc_3g_ind == 3 +conn[4].auc_3g_ind == 4 +conn[5].auc_3g_ind == 5 +conn[6].auc_3g_ind == 6 +conn[7].auc_3g_ind == 7 +conn[8].auc_3g_ind == 8 +conn[9].auc_3g_ind == 9 +conn[10].auc_3g_ind == 10 + +If a client reconnects, it will (likely) get the same auc_3g_ind +conn_inst[5].auc_3g_ind == 5 +conn_inst[5].auc_3g_ind == 5 +===== test_add_conn: SUCCESS + +Done diff --git a/tests/testsuite.at b/tests/testsuite.at index 46d1456..a969082 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -14,3 +14,10 @@ cat $abs_srcdir/auc/auc_ts_55_205_test_sets.err > experr AT_CHECK([$abs_top_builddir/tests/auc/auc_ts_55_205_test_sets], [], [expout], [experr]) AT_CLEANUP + +AT_SETUP([gsup_server]) +AT_KEYWORDS([gsup_server]) +cat $abs_srcdir/gsup_server/gsup_server_test.ok > expout +cat $abs_srcdir/gsup_server/gsup_server_test.err > experr +AT_CHECK([$abs_top_builddir/tests/gsup_server/gsup_server_test], [], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/2081 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60 Gerrit-PatchSet: 4 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:40:04 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:40:04 +0000 Subject: [MERGED] osmo-hlr[master]: fix debug log: adjust to new SQN increment scheme In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix debug log: adjust to new SQN increment scheme ...................................................................... fix debug log: adjust to new SQN increment scheme We can no longer accurately print the SQN from AUTS resync, since the SQN is incremented after AUTS. Instead, always print the SQN from the generated tuple, i.e. exactly the one left in auth data *after* the tuple was generated. This change was forgotten in recent adjustments to the new SQN incrementing scheme from libosmocore, in change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 for libosmocore change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3. It should have been obvious that something was missing in the previous patch from the auc_test output: the SQN in the output changed while the AUTN remained the same. That slipped by without being noticed :/ Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f --- M src/auc.c M src/db_auc.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err 4 files changed, 33 insertions(+), 37 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/auc.c b/src/auc.c index 9c20db2..d3b3d36 100644 --- a/src/auc.c +++ b/src/auc.c @@ -123,14 +123,7 @@ rc = osmo_auth_gen_vec_auts(vec+i, aud3g, auts, rand_auts, rand); - /* The sqn used for the key is sqn - 1 because - * vector generation has already inc'd it. The - * USIM's sqn sent in AUTS is sqn - 2. */ - DBGP("vector [%u]: resync: sqn = %"PRIu64 "\n", - i, aud3g->u.umts.sqn - 1); } else { - DBGP("vector [%u]: sqn = %" PRIu64 "\n", - i, aud3g->u.umts.sqn); rc = osmo_auth_gen_vec(vec+i, aud3g, rand); } if (rc < 0) { @@ -138,6 +131,8 @@ "generation: [%u]: rc = %d\n", i, rc); goto out; } + DBGP("vector [%u]: sqn = %" PRIu64 "\n", + i, aud3g->u.umts.sqn); DBGVB(autn); DBGVB(ck); diff --git a/src/db_auc.c b/src/db_auc.c index a24f27e..ac81404 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index bfc046f..8748ece 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -28,7 +28,7 @@ DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -47,7 +47,7 @@ DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -69,7 +69,7 @@ DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -86,7 +86,7 @@ DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c DAUC vector [0]: ck = f64735036e5871319c679f4742a75ea1 DAUC vector [0]: ik = 27497388b6cb044648f396aa155b95ef @@ -106,7 +106,7 @@ DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 23 +DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -125,7 +125,7 @@ DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f -DAUC vector [0]: sqn = 23 +DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -135,7 +135,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 24 +DAUC vector [1]: sqn = 25 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -145,7 +145,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 25 +DAUC vector [2]: sqn = 26 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 @@ -166,7 +166,7 @@ DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d -DAUC vector [0]: resync: sqn = 23 +DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 DAUC vector [0]: ck = e9922bd036718ed9e40bd1d02c3b81a5 DAUC vector [0]: ik = f19c20ca863137f8892326d959ec5e01 @@ -176,7 +176,7 @@ DAUC vector [0]: sres = 0ad888ef DAUC vector [0]: auth_types = 0x3 DAUC vector [1]: rand = 9a8321b108ef38a01c93241a9f1a9b50 -DAUC vector [1]: sqn = 24 +DAUC vector [1]: sqn = 25 DAUC vector [1]: autn = 79a5113eb0910000be6020540503ffc5 DAUC vector [1]: ck = 3686f05df057d1899c66ae4eb18cf941 DAUC vector [1]: ik = 79f21ed53bcb47787de57d136ff803a5 @@ -186,7 +186,7 @@ DAUC vector [1]: sres = 882b1d59 DAUC vector [1]: auth_types = 0x3 DAUC vector [2]: rand = ab9432c2190049b12da4352bb02bac61 -DAUC vector [2]: sqn = 25 +DAUC vector [2]: sqn = 26 DAUC vector [2]: autn = 24b018d46c3b00009c7e1b47f3a19b2b DAUC vector [2]: ck = d86c3191a36fc0602e48202ef2080964 DAUC vector [2]: ik = 648dab72016181406243420649e63dc9 diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 59ba22d..3037d2f 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -5,7 +5,7 @@ DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 DAUC vector [0]: ck = b40ba9a3c58b2a05bbf0d987b21bf8cb DAUC vector [0]: ik = f769bcd751044604127672711c6d3441 @@ -26,7 +26,7 @@ DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 DAUC vector [0]: ck = 5dbdbb2954e8f3cde665b046179a5098 DAUC vector [0]: ik = 59a92d3b476a0443487055cf88b2307b @@ -47,7 +47,7 @@ DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 DAUC vector [0]: ck = e203edb3971574f5a94b0d61b816345d DAUC vector [0]: ik = 0c4524adeac041c4dd830d20854fc46b @@ -68,7 +68,7 @@ DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 DAUC vector [0]: ck = 7657766b373d1c2138f307e3de9242f9 DAUC vector [0]: ik = 1c42e960d89b8fa99f2744e0708ccb53 @@ -89,7 +89,7 @@ DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 DAUC vector [0]: ck = 3f8c7587fe8e4b233af676aede30ba3b DAUC vector [0]: ik = a7466cc1e6b2a1337d49d3b66e95d7b4 @@ -110,7 +110,7 @@ DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c DAUC vector [0]: ck = 4cd0846020f8fa0731dd47cbdc6be411 DAUC vector [0]: ik = 88ab80a415f15c73711254a1d388f696 @@ -131,7 +131,7 @@ DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 DAUC vector [0]: ck = 10f05bab75a99a5fbb98a9c287679c3b DAUC vector [0]: ik = f9ec0865eb32f22369cade40c59c3a44 @@ -152,7 +152,7 @@ DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 DAUC vector [0]: ck = 71236b7129f9b22ab77ea7a54c96da22 DAUC vector [0]: ik = 90527ebaa5588968db41727325a04d9e @@ -173,7 +173,7 @@ DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 DAUC vector [0]: ck = 08cef6d004ec61471a3c3cda048137fa DAUC vector [0]: ik = ed0318ca5deb9206272f6e8fa64ba411 @@ -194,7 +194,7 @@ DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 DAUC vector [0]: ck = 69b1cae7c7429d975e245cacb05a517c DAUC vector [0]: ik = 74f24e8c26df58e1b38d7dcd4f1b7fbd @@ -215,7 +215,7 @@ DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe DAUC vector [0]: ck = 908c43f0569cb8f74bc971e706c36c5f DAUC vector [0]: ik = c251df0d888dd9329bcf46655b226e40 @@ -236,7 +236,7 @@ DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 DAUC vector [0]: ck = 44c0f23c5493cfd241e48f197e1d1012 DAUC vector [0]: ik = 0c9fb81613884c2535dd0eabf3b440d8 @@ -257,7 +257,7 @@ DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 217af492728d00003bd338249751de80 DAUC vector [0]: ck = 5af86b80edb70df5292cc1121cbad50c DAUC vector [0]: ik = 7f4d6ae7440e18789a8b75ad3f42f03a @@ -278,7 +278,7 @@ DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 DAUC vector [0]: ck = 3f8c3f3ccf7625bf77fc94bcfd22fd26 DAUC vector [0]: ik = abcbae8fd46115e9961a55d0da5f2078 @@ -299,7 +299,7 @@ DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 DAUC vector [0]: ck = d42b2d615e49a03ac275a5aef97af892 DAUC vector [0]: ik = 0b3f8d024fe6bfafaa982b8f82e319c2 @@ -320,7 +320,7 @@ DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 DAUC vector [0]: ck = 6edaf99e5bd9f85d5f36d91c1272fb4b DAUC vector [0]: ik = d61c853c280dd9c46f297baec386de17 @@ -341,7 +341,7 @@ DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 DAUC vector [0]: ck = 66195dbed0313274c5ca7766615fa25e DAUC vector [0]: ik = 66bec707eb2afc476d7408a8f2927b36 @@ -362,7 +362,7 @@ DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 DAUC vector [0]: ck = 5349fbe098649f948f5d2e973a81c00f DAUC vector [0]: ik = 9744871ad32bf9bbd1dd5ce54e3e2e5a @@ -383,7 +383,7 @@ DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 -DAUC vector [0]: sqn = 31 +DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 DAUC vector [0]: ck = b5f2da03883b69f96bf52e029ed9ac45 DAUC vector [0]: ik = b4721368bc16ea67875c5598688bb0ef -- To view, visit https://gerrit.osmocom.org/2090 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:40:05 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:40:05 +0000 Subject: [MERGED] osmo-hlr[master]: debug log: output ind slot, previous sqn, and sqn db update In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: debug log: output ind slot, previous sqn, and sqn db update ...................................................................... debug log: output ind slot, previous sqn, and sqn db update Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32 --- M src/auc.c M src/db_auc.c M tests/auc/auc_test.err M tests/auc/auc_ts_55_205_test_sets.err 4 files changed, 30 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/auc.c b/src/auc.c index d3b3d36..f55b377 100644 --- a/src/auc.c +++ b/src/auc.c @@ -97,6 +97,8 @@ DBGP("3G: %s = %s\n", aud3g->u.umts.opc_is_op? "OP" : "opc", hexb(aud3g->u.umts.opc)); + DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", + aud3g->u.umts.ind, aud3g->u.umts.sqn); } if (aud2g) DBGP("2G: ki = %s\n", hexb(aud2g->u.gsm.ki)); diff --git a/src/db_auc.c b/src/db_auc.c index 8a369b5..f532b83 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -223,7 +223,8 @@ /* Update SQN in database, as needed */ if (aud3g.algo) { - LOGAUC(imsi, LOGL_DEBUG, "Updating SQN in DB\n"); + LOGAUC(imsi, LOGL_DEBUG, "Updating SQN=%" PRIu64 " in DB\n", + aud3g.u.umts.sqn); rc = db_update_sqn(dbc, subscr_id, aud3g.u.umts.sqn); /* don't tell caller we generated any triplets in case of * update error */ diff --git a/tests/auc/auc_test.err b/tests/auc/auc_test.err index 8748ece..5263d04 100644 --- a/tests/auc/auc_test.err +++ b/tests/auc/auc_test.err @@ -26,6 +26,7 @@ DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 32 @@ -45,6 +46,7 @@ DAUC Computing 1 auth vector: 3G + separate 2G DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC 2G: ki = eb215756028d60e3275e613320aec880 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 32 @@ -68,6 +70,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c @@ -85,6 +88,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 39fa2f4e3d523d8619a73b4f65c3e14d DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 8704f5ba55d30000541dde77ea5b1d8c @@ -103,6 +107,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d @@ -124,6 +129,7 @@ DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys) DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 23 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: sqn = 24 DAUC vector [0]: autn = c6b9790dad4b00000cf322869ea6a481 @@ -163,6 +169,7 @@ DAUC Computing 3 auth vectors: 3G only (2G derived from 3G keys), with AUTS resync DAUC 3G: k = eb215756028d60e3275e613320aec880 DAUC 3G: opc = fb2a3d1b360f599abab99db8669f8308 +DAUC 3G: for sqn ind 0, previous sqn was 26 DAUC vector [0]: rand = 897210a0f7de278f0b8213098e098a3f DAUC vector [0]: resync: auts = 979498b1f72d3e28c59fa2e72f9c DAUC vector [0]: resync: rand_auts = 39fa2f4e3d523d8619a73b4f65c3e14d diff --git a/tests/auc/auc_ts_55_205_test_sets.err b/tests/auc/auc_ts_55_205_test_sets.err index 3037d2f..1c5ad60 100644 --- a/tests/auc/auc_ts_55_205_test_sets.err +++ b/tests/auc/auc_ts_55_205_test_sets.err @@ -4,6 +4,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 465b5ce8b199b49faa5f0a2ee238a6bc DAUC 3G: opc = cd63cb71954a9f4e48a5994e37a02baf +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 23553cbe9637a89d218ae64dae47bf35 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = aa689c64835000002bb2bf2f1faba139 @@ -25,6 +26,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = fec86ba6eb707ed08905757b1bb44b8f DAUC 3G: opc = 1006020f0a478bf6b699f15c062e42b3 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 9f7c8d021accf4db213ccff0c7f71a6a DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 33484dc2134b000091ec125f4840ed64 @@ -46,6 +48,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 9e5944aea94b81165c82fbf9f32db751 DAUC 3G: opc = a64a507ae1a2a98bb88eb4210135dc87 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = ce83dbc54ac0274a157c17f80d017bd6 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = f0b9c08ad00e00005da4ccbbdfa29310 @@ -67,6 +70,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 4ab1deb05ca6ceb051fc98e77d026a84 DAUC 3G: opc = dcf07cbd51855290b92a07a9891e523e +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 74b0cd6031a1c8339b2b6ce2b8c4a186 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 31e11a60913800006a7003718d5d82e5 @@ -88,6 +92,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6c38a116ac280c454f59332ee35c8c4f DAUC 3G: opc = 3803ef5363b947c6aaa225e58fae3934 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = ee6466bc96202c5a557abbeff8babf63 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 45b0f69ab04c000053f2a822f2b3e824 @@ -109,6 +114,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 2d609d4db0ac5bf0d2c0de267014de0d DAUC 3G: opc = c35a0ab0bcbfc9252caff15f24efbde0 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 194aa756013896b74b4a2a3b0af4539e DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 7e6455f34cd300004a2a9f2f3a529b8c @@ -130,6 +136,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a530a7fe428fad1082c45eddfce13884 DAUC 3G: opc = 27953e49bc8af6dcc6e730eb80286be3 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 3a4c2b3245c50eb5c71d08639395764d DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 88196c47984f00000a50c5f4056ccb68 @@ -151,6 +158,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d9151cf04896e25830bf2e08267b8360 DAUC 3G: opc = c4c93effe8a08138c203d4c27ce4e3d9 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = f761e5e93d603feb730e27556cb8a2ca DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 82a0f5287a5100006d6c0ff132426479 @@ -172,6 +180,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = a0e2971b6822e8d354a18cc235624ecb DAUC 3G: opc = 82a26f22bba9e9488f949a10d98e9cc4 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 08eff828b13fdb562722c65c7f30a9b2 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = a2f858aa9e7d00001c14f5fcd445bc46 @@ -193,6 +202,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 0da6f7ba86d5eac8a19cf563ac58642d DAUC 3G: opc = 0db1071f8767562ca43a0a64c41e8d08 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 679ac4dbacd7d233ff9d6806f4149ce3 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 4c539a26e1da000071cc0b769fd1aa96 @@ -214,6 +224,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 77b45843c88e58c10d202684515ed430 DAUC 3G: opc = d483afae562409a326b5bb0b20c4d762 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 4c47eb3076dc55fe5106cb2034b8cd78 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 30ff25cdadd60000e08a00f7ed54d6fe @@ -235,6 +246,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 729b17729270dd87ccdf1bfe29b4e9bb DAUC 3G: opc = 228c2f2f06ac3268a9e616ee16db4ba1 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 311c4c929744d675b720f3b7e9b1cbd0 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 5380d158cfc30000f4e1436e9f67e4b2 @@ -256,6 +268,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = d32dd23e89dc662354ca12eb79dd32fa DAUC 3G: opc = d22a4b4180a5325708a5ff70d9f67ec7 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = cf7d0ab1d94306950bf12018fbd46887 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 217af492728d00003bd338249751de80 @@ -277,6 +290,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = af7c65e1927221de591187a2c5987a53 DAUC 3G: opc = a4cf5c8155c08a7eff418e5443b98e55 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 1f0f8578464fd59b64bed2d09436b57a DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 837fd7b744390000557a836fd534e542 @@ -298,6 +312,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5bd7ecd3d3127a41d12539bed4e7cf71 DAUC 3G: opc = 76089d3c0ff3efdc6e36721d4fceb747 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 59b75f14251c75031d0bcbac1c2c04c7 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 5be11495527d0000298064f82a439924 @@ -319,6 +334,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 6cd1c6ceb1e01e14f1b82316a90b7f3d DAUC 3G: opc = a219dc37f1dc7d66738b5843c799f206 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = f69b78f300a0568bce9f0cb93c4be4c9 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 1c408a858b1e0000e6e96310f83b5689 @@ -340,6 +356,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = b73a90cbcf3afb622dba83c58a8415df DAUC 3G: opc = df0c67868fa25f748b7044c6e7c245b8 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = b120f1c1a0102a2f507dd543de68281f DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = aefdaa5dddb90000c4741d698b7a7ed3 @@ -361,6 +378,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 5122250214c33e723a5dd523fc145fc0 DAUC 3G: opc = 981d464c7c52eb6e5036234984ad0bcf +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 81e92b6c0ee0e12ebceba8d92a99dfa5 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = ada15aeb7b980000a99729b59d5688b2 @@ -382,6 +400,7 @@ DAUC Computing 1 auth vector: 3G only (2G derived from 3G keys) DAUC 3G: k = 90dca4eda45b53cf0f12d7c9c3bc6a89 DAUC 3G: opc = cb9cccc4b9258e6dca4760379fb82581 +DAUC 3G: for sqn ind 0, previous sqn was 31 DAUC vector [0]: rand = 9fddc72092c6ad036b6e464789315b78 DAUC vector [0]: sqn = 32 DAUC vector [0]: autn = 83cfd54db9330000695685b2b9214472 -- To view, visit https://gerrit.osmocom.org/2091 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32 Gerrit-PatchSet: 3 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:40:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:40:20 +0000 Subject: libosmocore[master]: auth_milenage: fix check against too large ind In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2092 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:40:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:40:22 +0000 Subject: [MERGED] libosmocore[master]: auth_milenage: fix check against too large ind In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: auth_milenage: fix check against too large ind ...................................................................... auth_milenage: fix check against too large ind To ensure that the IND index appended to SEQ does not affect the SEQ, the check should read '>= seq_1', not '>'. Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8 --- M src/gsm/auth_milenage.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index f151c5e..c1331b5 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -94,7 +94,7 @@ ind_mask = ~(seq_1 - 1); /* the ind index must not affect the SEQ part */ - if (aud->u.umts.ind > seq_1) + if (aud->u.umts.ind >= seq_1) return -3; /* keep the incremented SQN local until gsm_milenage() succeeded. */ -- To view, visit https://gerrit.osmocom.org/2092 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:41:23 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:41:23 +0000 Subject: osmo-bts[master]: Handle TXT indication from OsmoPCU In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2087 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16e73198501487a5b1076bf83390b85538d5af73 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:42:01 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:42:01 +0000 Subject: libosmocore[master]: add gsm48_pdisc_msgtype_name() In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2027 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:42:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:42:13 +0000 Subject: libosmocore[master]: add gsm48_pdisc_names and gsm48_pdisc_name() In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2026 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:46:27 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:46:27 +0000 Subject: osmo-bts[master]: Sync protocol with OsmoPCU In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2086 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:49:17 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:49:17 +0000 Subject: openbsc[master]: Handle PCU version received viam OML alert In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (2 comments) https://gerrit.osmocom.org/#/c/2085/1/openbsc/src/libbsc/abis_nm.c File openbsc/src/libbsc/abis_nm.c: PS1, Line 296: p this kind of code structure won't scale and is not well prepared to handling other types of event reports. Please add some kind of a dispatcher table, where one can easily add parser/handlers for other types. Line 299: if (c == OSMO_EVT_PCU_VERS) { please introduce one handler function for NM_PCAUSE_T_MANUF (which should be part of the "bts model" and call it there. And in that bts-specific handler function (for sysmobts at this time), use a switch statement on the 'c' -- To view, visit https://gerrit.osmocom.org/2085 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:50:23 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:50:23 +0000 Subject: libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:50:54 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 09:50:54 +0000 Subject: [ABANDON] openbsc[master]: Install shared headers In-Reply-To: References: Message-ID: Max has abandoned this change. Change subject: Install shared headers ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/2070 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: Ib76033b1d9f5faf7a00e4b926ce309528ed53dd7 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:52:55 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:52:55 +0000 Subject: osmo-pcu[master]: Add support for sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2071/1/src/encoding.cpp File src/encoding.cpp: Line 380: pcu_tx_txt_ind(PCU_OML_ALERT, "PCU: length of IMM.ASS without " we are sending the message over the PCU socket, so it is clear that it originates from the PCU. Any forwarding of this message from BTS to BSC should preserve this information (originating from PCU, not from BTS) in machine-parseable way somehow. And before it is printed, the printer can use this to prefix with PCU. I don't like to have a "PCU:" string here. and have other code in other network elements rely on it. -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 16 09:55:38 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 09:55:38 +0000 Subject: osmo-pcu[master]: Add support for sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 1: The OML FAULURE EVENT REPORT includes an object class and object instance. This tells us where the failure orignates from. A PCU originated failure event report should be setting a PCU-speific object class + instance. This information can then be used by the recipient in the BSC to print the source of the problem/message. -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 10:03:27 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 10:03:27 +0000 Subject: osmo-pcu[master]: Add support for sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 1: You mean 3GPP TS 52.021 ?9.2? There's no obj. class for PCU in there. Shall I extend abis_nm_obj_class with smth like NM_OC_PCU? -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 10:29:06 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 10:29:06 +0000 Subject: osmo-pcu[master]: Add support for sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 1: > You mean 3GPP TS 52.021 ?9.2? There's no obj. class for PCU in > there. No, but in our code there is, ever sicne we first started to support GPRS some 5 years ago. This is how the BSC configures PCU parameters. > Shall I extend abis_nm_obj_class with smth like NM_OC_PCU? There is no need, there are already two object classes for the PCU. Why add more? -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 10:31:06 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 10:31:06 +0000 Subject: osmo-pcu[master]: Add support for sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 1: ????????NM_OC_GPRS_NSE??????????????????= 0xf0, ????????NM_OC_GPRS_CELL?????????????????= 0xf1, ????????NM_OC_GPRS_NSVC?????????????????= 0xf2, I think GPRS_CELL is the most logical one, as it neither relates to the NS Entity nor the NSVC. -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 12:53:50 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 12:53:50 +0000 Subject: [MERGED] libosmocore[master]: contrib: add script to find unterminated value_string arrays In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: contrib: add script to find unterminated value_string arrays ...................................................................... contrib: add script to find unterminated value_string arrays Unterminated value_string arrays are dangerous since get_value_string() and get_string_value() need to know where the struct ends. If the terminator is missing, they might run through and return arbitrary memory locations. Employ some regexes to find such unterminated value string arrays and return nonzero if any are found. This can be used in our jenkins build jobs to avoid committing unterminated value_string arrays. In fact I've found one in current libosmocore: gsm0808_bssap_names in gsm/gsm0808.c, fixed in a separate patch. Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- A contrib/verify_value_string_arrays_are_terminated.py 1 file changed, 33 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py new file mode 100755 index 0000000..020bb4d --- /dev/null +++ b/contrib/verify_value_string_arrays_are_terminated.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# vim: expandtab tabstop=2 shiftwidth=2 nocin + +''' +Usage: + verify_value_string_arrays_are_terminated.py PATH [PATH [...]] + +e.g. +libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +''' + +import re +import sys +import codecs + +value_string_array_re = re.compile( + r'((\bstruct\s+value_string\b[^{;]*?)\s*=[^{;]*{[^;]*}\s*;)', + re.MULTILINE | re.DOTALL) + +members = r'(\.(value|str)\s*=\s*)?' +terminator_re = re.compile('{\s*' + members + '(0|NULL)\s*,' + '\s*' + members + '(0|NULL)\s*}') +errors_found = 0 + +for f in sys.argv[1:]: + arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) + for array_def, name in arrays: + if not terminator_re.search(array_def): + print('ERROR: file contains unterminated value_string %r: %r' + % (name, f)) + errors_found += 1 + +sys.exit(errors_found) -- To view, visit https://gerrit.osmocom.org/1940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2bc93ab4781487e7685cfb63091a489cd126b1a8 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 12:54:19 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 12:54:19 +0000 Subject: [MERGED] libosmocore[master]: add gsm48_pdisc_names and gsm48_pdisc_name() In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: add gsm48_pdisc_names and gsm48_pdisc_name() ...................................................................... add gsm48_pdisc_names and gsm48_pdisc_name() I often want to log the protocol discriminator in the openbsc debug log. It's more useful to get the name directly instead of looking it up every time. Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae --- M include/osmocom/gsm/protocol/gsm_04_08.h M src/gsm/gsm48.c M src/gsm/libosmogsm.map 3 files changed, 24 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 522015a..87debba 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -926,6 +926,10 @@ #define GSM48_PDISC_MASK 0x0f #define GSM48_PDISC_USSD 0x11 +extern const struct value_string gsm48_pdisc_names[]; +static inline const char *gsm48_pdisc_name(uint8_t val) +{ return get_value_string(gsm48_pdisc_names, val); } + bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr); static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr) diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index b626f82..d408897 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -678,3 +678,22 @@ else return n_pag_blocks * (chan_desc->bs_pa_mfrms + 2); } + +const struct value_string gsm48_pdisc_names[] = { + OSMO_VALUE_STRING(GSM48_PDISC_GROUP_CC), + OSMO_VALUE_STRING(GSM48_PDISC_BCAST_CC), + OSMO_VALUE_STRING(GSM48_PDISC_PDSS1), + OSMO_VALUE_STRING(GSM48_PDISC_CC), + OSMO_VALUE_STRING(GSM48_PDISC_PDSS2), + OSMO_VALUE_STRING(GSM48_PDISC_MM), + OSMO_VALUE_STRING(GSM48_PDISC_RR), + OSMO_VALUE_STRING(GSM48_PDISC_MM_GPRS), + OSMO_VALUE_STRING(GSM48_PDISC_SMS), + OSMO_VALUE_STRING(GSM48_PDISC_SM_GPRS), + OSMO_VALUE_STRING(GSM48_PDISC_NC_SS), + OSMO_VALUE_STRING(GSM48_PDISC_LOC), + OSMO_VALUE_STRING(GSM48_PDISC_EXTEND), + OSMO_VALUE_STRING(GSM48_PDISC_MASK), + OSMO_VALUE_STRING(GSM48_PDISC_USSD), + { 0, NULL } +}; diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 8d28476..60f83de 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -217,6 +217,7 @@ gsm48_mcc_mnc_from_bcd; gsm48_chan_mode_names; gsm_chan_t_names; +gsm48_pdisc_names; gsm_7bit_decode; gsm_7bit_decode_ussd; -- To view, visit https://gerrit.osmocom.org/2026 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 12:54:19 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 12:54:19 +0000 Subject: [MERGED] libosmocore[master]: add gsm48_pdisc_msgtype_name() In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: add gsm48_pdisc_msgtype_name() ...................................................................... add gsm48_pdisc_msgtype_name() Composing the message type string requires knowing the protocol discriminator. To ease printing the message type, add this function to switch between the defined value_string[]s depending on pdisc. Also publish the message type value_string[]s -- without inline functions to access them because it is anyway more convenient to use gsm48_pdisc_msgtype_name() instead. Since gsm48_pdisc_msgtype_name() is nontrivial, do not add as inline function -- in case the message type is not known, it needs a static string buffer. Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df --- M include/osmocom/gsm/protocol/gsm_04_08.h M src/gsm/gsm48.c M src/gsm/libosmogsm.map 3 files changed, 207 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 87debba..3f0ce64 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1180,6 +1180,11 @@ #define GSM48_MT_CC_START_DTMF_REJ 0x37 #define GSM48_MT_CC_FACILITY 0x3a +extern const struct value_string gsm48_rr_msgtype_names[]; +extern const struct value_string gsm48_mm_msgtype_names[]; +extern const struct value_string gsm48_cc_msgtype_names[]; +const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type); + /* FIXME: Table 10.4 / 10.4a (GPRS) */ /* Section 10.5.3.3 CM service type */ diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index d408897..757a855 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -697,3 +697,201 @@ OSMO_VALUE_STRING(GSM48_PDISC_USSD), { 0, NULL } }; + +const struct value_string gsm48_rr_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_RR_INIT_REQ), + OSMO_VALUE_STRING(GSM48_MT_RR_ADD_ASS), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS_EXT), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS_REJ), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_ASS_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_REJECT), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_REQUEST), + OSMO_VALUE_STRING(GSM48_MT_RR_PACKET_ASS), + + OSMO_VALUE_STRING(GSM48_MT_RR_CIPH_M_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_CIPH_M_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_ACK), + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_REJ), + + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_COMPL), + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_COMPL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_INFO), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_INFO), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_ASS_CMD), + + OSMO_VALUE_STRING(GSM48_MT_RR_CELL_CHG_ORDER), + OSMO_VALUE_STRING(GSM48_MT_RR_PDCH_ASS_CMD), + + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_REL), + OSMO_VALUE_STRING(GSM48_MT_RR_PART_REL), + OSMO_VALUE_STRING(GSM48_MT_RR_PART_REL_COMP), + + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_1), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_2), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_3), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_RESP), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_NCH), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_FACCH), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_RESP), + OSMO_VALUE_STRING(GSM48_MT_RR_PACKET_NOTIF), + OSMO_VALUE_STRING(GSM48_MT_RR_UTRAN_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_CDMA2K_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_IS_TO_UTRAN_HANDO), + OSMO_VALUE_STRING(GSM48_MT_RR_IS_TO_CDMA2K_HANDO), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_8), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_1), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_3), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_4), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_6), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_7), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2bis), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2ter), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2quater), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5bis), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5ter), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_9), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_13), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_16), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_17), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_18), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_19), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_20), + + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_MODE_MODIF), + OSMO_VALUE_STRING(GSM48_MT_RR_STATUS), + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_MODE_MODIF_ACK), + OSMO_VALUE_STRING(GSM48_MT_RR_FREQ_REDEF), + OSMO_VALUE_STRING(GSM48_MT_RR_MEAS_REP), + OSMO_VALUE_STRING(GSM48_MT_RR_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_CLSM_ENQ), + OSMO_VALUE_STRING(GSM48_MT_RR_EXT_MEAS_REP), + OSMO_VALUE_STRING(GSM48_MT_RR_EXT_MEAS_REP_ORD), + OSMO_VALUE_STRING(GSM48_MT_RR_GPRS_SUSP_REQ), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_INFO), + + OSMO_VALUE_STRING(GSM48_MT_RR_VGCS_UPL_GRANT), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_RELEASE), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_FREE), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_BUSY), + OSMO_VALUE_STRING(GSM48_MT_RR_TALKER_IND), + { 0, NULL } +}; + +const struct value_string gsm48_mm_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_MM_IMSI_DETACH_IND), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_ACCEPT), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_REJECT), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_REQUEST), + + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_REJ), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_RESP), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_FAIL), + OSMO_VALUE_STRING(GSM48_MT_MM_ID_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_ID_RESP), + OSMO_VALUE_STRING(GSM48_MT_MM_TMSI_REALL_CMD), + OSMO_VALUE_STRING(GSM48_MT_MM_TMSI_REALL_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_ACC), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_REJ), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_ABORT), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_PROMPT), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_REEST_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_ABORT), + + OSMO_VALUE_STRING(GSM48_MT_MM_NULL), + OSMO_VALUE_STRING(GSM48_MT_MM_STATUS), + OSMO_VALUE_STRING(GSM48_MT_MM_INFO), + { 0, NULL } +}; + +const struct value_string gsm48_cc_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_CC_ALERTING), + OSMO_VALUE_STRING(GSM48_MT_CC_CALL_CONF), + OSMO_VALUE_STRING(GSM48_MT_CC_CALL_PROC), + OSMO_VALUE_STRING(GSM48_MT_CC_CONNECT), + OSMO_VALUE_STRING(GSM48_MT_CC_CONNECT_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_EMERG_SETUP), + OSMO_VALUE_STRING(GSM48_MT_CC_PROGRESS), + OSMO_VALUE_STRING(GSM48_MT_CC_ESTAB), + OSMO_VALUE_STRING(GSM48_MT_CC_ESTAB_CONF), + OSMO_VALUE_STRING(GSM48_MT_CC_RECALL), + OSMO_VALUE_STRING(GSM48_MT_CC_START_CC), + OSMO_VALUE_STRING(GSM48_MT_CC_SETUP), + + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY), + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY_COMPL), + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY_REJECT), + OSMO_VALUE_STRING(GSM48_MT_CC_USER_INFO), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD_REJ), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR_REJ), + + OSMO_VALUE_STRING(GSM48_MT_CC_DISCONNECT), + OSMO_VALUE_STRING(GSM48_MT_CC_RELEASE), + OSMO_VALUE_STRING(GSM48_MT_CC_RELEASE_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_CC_CONG_CTRL), + OSMO_VALUE_STRING(GSM48_MT_CC_NOTIFY), + OSMO_VALUE_STRING(GSM48_MT_CC_STATUS), + OSMO_VALUE_STRING(GSM48_MT_CC_STATUS_ENQ), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF), + OSMO_VALUE_STRING(GSM48_MT_CC_STOP_DTMF), + OSMO_VALUE_STRING(GSM48_MT_CC_STOP_DTMF_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF_REJ), + OSMO_VALUE_STRING(GSM48_MT_CC_FACILITY), + { 0, NULL } +}; + +/*! /brief Compose a string naming the message type for given protocol. + * If the message type string is known, return the message type name, otherwise + * return ":". + * /param pdisc[in] protocol discriminator like GSM48_PDISC_MM + * /param msg_type[in] message type like GSM48_MT_MM_LOC_UPD_REQUEST + * /returns statically allocated string or string constant. + */ +const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type) +{ + static char namebuf[64]; + const struct value_string *msgt_names; + + switch (pdisc) { + case GSM48_PDISC_RR: + msgt_names = gsm48_rr_msgtype_names; + break; + case GSM48_PDISC_MM: + msgt_names = gsm48_mm_msgtype_names; + break; + case GSM48_PDISC_CC: + msgt_names = gsm48_cc_msgtype_names; + break; + default: + msgt_names = NULL; + break; + } + + if (msgt_names) + return get_value_string(msgt_names, msg_type); + + snprintf(namebuf, sizeof(namebuf), "%s:0x%02x", + gsm48_pdisc_name(pdisc), msg_type); + return namebuf; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 60f83de..4a33c46 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -218,6 +218,10 @@ gsm48_chan_mode_names; gsm_chan_t_names; gsm48_pdisc_names; +gsm48_rr_msgtype_names; +gsm48_mm_msgtype_names; +gsm48_cc_msgtype_names; +gsm48_pdisc_msgtype_name; gsm_7bit_decode; gsm_7bit_decode_ussd; -- To view, visit https://gerrit.osmocom.org/2027 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 13:07:25 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 13:07:25 +0000 Subject: [PATCH] openbsc[master]: Don't drop OML links for Get Attributes NACK Message-ID: Review at https://gerrit.osmocom.org/2093 Don't drop OML links for Get Attributes NACK Previously any OML NACK message will result in BSC dropping OML link to BTS which makes it impossible to use optional OML messages which might be unsupported by BTS. Fix this for 3GPP TS 52.021 ?8.11.1 Get Attributes message. Also, log human-readable NACK name to see what exactly causing OML link drop. Change-Id: Ib8af2872c27abb793172ec59bdc145b8d54f83da Related: OS#1614 --- M openbsc/src/libbsc/bsc_init.c 1 file changed, 10 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/93/2093/1 diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index b17ff79..521fc89 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -44,19 +44,19 @@ /* Callback function for NACK on the OML NM */ static int oml_msg_nack(struct nm_nack_signal_data *nack) { - if (nack->mt == NM_MT_SET_BTS_ATTR_NACK) { - - LOGP(DNM, LOGL_ERROR, "Failed to set BTS attributes. That is fatal. " - "Was the bts type and frequency properly specified?\n"); - goto drop_bts; - } else { - LOGP(DNM, LOGL_ERROR, "Got a NACK going to drop the OML links.\n"); - goto drop_bts; + if (nack->mt == NM_MT_GET_ATTR_NACK) { + LOGP(DNM, LOGL_ERROR, "BTS%u does not support Get Attributes " + "OML message.\n", nack->bts->nr); + return 0; } - return 0; + if (nack->mt == NM_MT_SET_BTS_ATTR_NACK) + LOGP(DNM, LOGL_ERROR, "Failed to set BTS attributes. That is fatal. " + "Was the bts type and frequency properly specified?\n"); + else + LOGP(DNM, LOGL_ERROR, "Got %s NACK going to drop the OML links.\n", + abis_nm_nack_name(nack->mt)); -drop_bts: if (!nack->bts) { LOGP(DNM, LOGL_ERROR, "Unknown bts. Can not drop it.\n"); return 0; -- To view, visit https://gerrit.osmocom.org/2093 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8af2872c27abb793172ec59bdc145b8d54f83da Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 16 13:34:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 13:34:07 +0000 Subject: openbsc[master]: gsm_data_shared: add value strings for gsm_chreq In-Reply-To: References: Message-ID: Patch Set 4: Code-Review-1 (2 comments) https://gerrit.osmocom.org/#/c/2031/3/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 844: const struct value_string gsm_chreq_descs[7]; > is it here ok with the number? or sould we use elsewhere we use extern const struct value_string my_names[]; but I guess it's fine to stay consistent with the surroundings. We can remove the explicit sizes in a separate commit, if that makes sense. https://gerrit.osmocom.org/#/c/2031/3/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 54: const struct value_string gsm_chreq_descs[7] = { probably keep the 7 here as well, too. -- To view, visit https://gerrit.osmocom.org/2031 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I23d3be5610a5a46098d2b12feed4245828599aae Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:31:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:31:54 +0000 Subject: [PATCH] libosmocore[master]: Add a README file for some background information about this... Message-ID: Review at https://gerrit.osmocom.org/2094 Add a README file for some background information about this repo Let's add some general information about this repository, links to redmine, gerrit, the mailing list, etc. Change-Id: If034c6f551ff9bfaff0b8368fd0963f3147155b9 --- M Makefile.am A README.md 2 files changed, 81 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/94/2094/1 diff --git a/Makefile.am b/Makefile.am index e5639d3..6ef275f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -EXTRA_DIST = git-version-gen .version +EXTRA_DIST = git-version-gen .version README.md if HAVE_DOXYGEN diff --git a/README.md b/README.md new file mode 100644 index 0000000..d09a4b8 --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +libosmocore - set of Osmocom core libraries +=========================================== + +This repository contains a set of C-language libraries that form the +core infrastructure of many [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects. + +Historically, a lot of this code was developed as part of the +[OpenBSC](https://osmocom.org/projects/openbsc) project, but which are +of a more generic nature and thus useful to (at least) other programs +that we develop in the sphere of Free Software / Open Source mobile +communications. + +There is no clear scope of it. We simply move all shared code between +the various Osmocom projects in this library to avoid code duplication. + +The libosmcoore.git repository build multiple libraries: + +* **libosmocore** contains some general-purpose functions like select-loop + abstraction, message buffers, timers, linked lists +* **libosmovty** contains routines related to the interactive command-line + interface called VTY +* **libosmogsm** contains definitions and helper code related to GSM protocols +* **libosmoctrl** contains a shared implementation of the Osmocom control + interface +* **libosmogb** contains an implementation of the Gb interface with its + NS/BSSGP protocols +* **libosmocodec** contains an implementation of GSM voice codecs +* **libosmocoding** contains an implementation of GSM channel coding +* **libosmosim** contains infrastructure to interface SIM/UICC/USIM cards +* **libosmotrau** contains encoding/decoding functions for A-bis TRAU frames + + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/libosmocore/wiki/Libosmocore + +GIT Repository +-------------- + +You can clone from the official libosmocore.git repository using + + git clone git://git.osmocom.org/libosmocore.git + +There is a cgit interface at http://git.osmocom.org/libosmocore/ + +Documentation +------------- + +Doxygen-generated API documentation is generated during the build +process, but also available online for each of the sub-libraries at +http://ftp.osmocom.org/api/latest/libosmocore/ + +Mailing List +------------ + +Discussions related to libosmocore are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmocore can be seen at +https://gerrit.osmocom.org/#/q/project:libosmocore+status:open -- To view, visit https://gerrit.osmocom.org/2094 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If034c6f551ff9bfaff0b8368fd0963f3147155b9 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:37:31 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:37:31 +0000 Subject: [PATCH] libosmo-abis[master]: Add README file to libosmo-abis repository Message-ID: Review at https://gerrit.osmocom.org/2095 Add README file to libosmo-abis repository Change-Id: I76ced414b22637792389fcf79ae6c7159502259b --- M Makefile.am A README.md 2 files changed, 67 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/95/2095/1 diff --git a/Makefile.am b/Makefile.am index 7901d3b..9e24bef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,4 +12,4 @@ dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -EXTRA_DIST = .version +EXTRA_DIST = .version README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5278563 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +libosmo-abis - Osmocom Abis interface library +============================================= + +This repository contains a set of C-language libraries that form the +A-bis interface library of [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects such as OpenBSC / OsmoBSC. + +Historically, a lot of this code was developed as part of the +[OpenBSC](https://osmocom.org/projects/openbsc) project, but which are +of a more generic nature and thus useful to (at least) other programs +that we develop in the sphere of Free Software / Open Source mobile +communications. + +The libosmo-abis.git repository build multiple libraries: + +* **libosmoabis** contains some abstraction layer over E1/T1 and IP + based ETSI/3GPP A-bis interface. It can use mISDN and DAHDI as + underlying driver/hardware. +* **libosmotrau** contains routines related to A-bis TRAU frame handling + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/libosmo-abis + +GIT Repository +-------------- + +You can clone from the official libosmo-abis.git repository using + + git clone git://git.osmocom.org/libosmo-abis.git + +There is a cgit interface at http://git.osmocom.org/libosmo-abis/ + +Documentation +------------- + +There is no Doxygen-generated API documentation yet for this library. It +would be great to some day have it, comparable to libosmocore. + +Mailing List +------------ + +Discussions related to libosmo-abis are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmo-abis can be seen at +https://gerrit.osmocom.org/#/q/project:libosmo-abis+status:open -- To view, visit https://gerrit.osmocom.org/2095 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I76ced414b22637792389fcf79ae6c7159502259b Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:44:40 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:44:40 +0000 Subject: libosmocore[master]: Add a README file for some background information about this... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2094 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If034c6f551ff9bfaff0b8368fd0963f3147155b9 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:44:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:44:41 +0000 Subject: [MERGED] libosmocore[master]: Add a README file for some background information about this... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add a README file for some background information about this repo ...................................................................... Add a README file for some background information about this repo Let's add some general information about this repository, links to redmine, gerrit, the mailing list, etc. Change-Id: If034c6f551ff9bfaff0b8368fd0963f3147155b9 --- M Makefile.am A README.md 2 files changed, 81 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index e5639d3..6ef275f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -EXTRA_DIST = git-version-gen .version +EXTRA_DIST = git-version-gen .version README.md if HAVE_DOXYGEN diff --git a/README.md b/README.md new file mode 100644 index 0000000..d09a4b8 --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +libosmocore - set of Osmocom core libraries +=========================================== + +This repository contains a set of C-language libraries that form the +core infrastructure of many [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects. + +Historically, a lot of this code was developed as part of the +[OpenBSC](https://osmocom.org/projects/openbsc) project, but which are +of a more generic nature and thus useful to (at least) other programs +that we develop in the sphere of Free Software / Open Source mobile +communications. + +There is no clear scope of it. We simply move all shared code between +the various Osmocom projects in this library to avoid code duplication. + +The libosmcoore.git repository build multiple libraries: + +* **libosmocore** contains some general-purpose functions like select-loop + abstraction, message buffers, timers, linked lists +* **libosmovty** contains routines related to the interactive command-line + interface called VTY +* **libosmogsm** contains definitions and helper code related to GSM protocols +* **libosmoctrl** contains a shared implementation of the Osmocom control + interface +* **libosmogb** contains an implementation of the Gb interface with its + NS/BSSGP protocols +* **libosmocodec** contains an implementation of GSM voice codecs +* **libosmocoding** contains an implementation of GSM channel coding +* **libosmosim** contains infrastructure to interface SIM/UICC/USIM cards +* **libosmotrau** contains encoding/decoding functions for A-bis TRAU frames + + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/libosmocore/wiki/Libosmocore + +GIT Repository +-------------- + +You can clone from the official libosmocore.git repository using + + git clone git://git.osmocom.org/libosmocore.git + +There is a cgit interface at http://git.osmocom.org/libosmocore/ + +Documentation +------------- + +Doxygen-generated API documentation is generated during the build +process, but also available online for each of the sub-libraries at +http://ftp.osmocom.org/api/latest/libosmocore/ + +Mailing List +------------ + +Discussions related to libosmocore are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmocore can be seen at +https://gerrit.osmocom.org/#/q/project:libosmocore+status:open -- To view, visit https://gerrit.osmocom.org/2094 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If034c6f551ff9bfaff0b8368fd0963f3147155b9 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:44:45 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:44:45 +0000 Subject: libosmo-abis[master]: Add README file to libosmo-abis repository In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2095 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76ced414b22637792389fcf79ae6c7159502259b Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:44:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:44:48 +0000 Subject: [MERGED] libosmo-abis[master]: Add README file to libosmo-abis repository In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add README file to libosmo-abis repository ...................................................................... Add README file to libosmo-abis repository Change-Id: I76ced414b22637792389fcf79ae6c7159502259b --- M Makefile.am A README.md 2 files changed, 67 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 7901d3b..9e24bef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,4 +12,4 @@ dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -EXTRA_DIST = .version +EXTRA_DIST = .version README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5278563 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +libosmo-abis - Osmocom Abis interface library +============================================= + +This repository contains a set of C-language libraries that form the +A-bis interface library of [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects such as OpenBSC / OsmoBSC. + +Historically, a lot of this code was developed as part of the +[OpenBSC](https://osmocom.org/projects/openbsc) project, but which are +of a more generic nature and thus useful to (at least) other programs +that we develop in the sphere of Free Software / Open Source mobile +communications. + +The libosmo-abis.git repository build multiple libraries: + +* **libosmoabis** contains some abstraction layer over E1/T1 and IP + based ETSI/3GPP A-bis interface. It can use mISDN and DAHDI as + underlying driver/hardware. +* **libosmotrau** contains routines related to A-bis TRAU frame handling + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/libosmo-abis + +GIT Repository +-------------- + +You can clone from the official libosmo-abis.git repository using + + git clone git://git.osmocom.org/libosmo-abis.git + +There is a cgit interface at http://git.osmocom.org/libosmo-abis/ + +Documentation +------------- + +There is no Doxygen-generated API documentation yet for this library. It +would be great to some day have it, comparable to libosmocore. + +Mailing List +------------ + +Discussions related to libosmo-abis are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmo-abis can be seen at +https://gerrit.osmocom.org/#/q/project:libosmo-abis+status:open -- To view, visit https://gerrit.osmocom.org/2095 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I76ced414b22637792389fcf79ae6c7159502259b Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:45:58 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:45:58 +0000 Subject: [PATCH] libosmo-netif[master]: Add README file to libosmo-netif repository Message-ID: Review at https://gerrit.osmocom.org/2096 Add README file to libosmo-netif repository Change-Id: Idfc804740e5a086701017d55c86aaf3304c84148 --- M Makefile.am A README.md 2 files changed, 55 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/96/2096/1 diff --git a/Makefile.am b/Makefile.am index 7b43d4d..a78c523 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-netif.pc -EXTRA_DIST = .version +EXTRA_DIST = .version README.md BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: diff --git a/README.md b/README.md new file mode 100644 index 0000000..6583792 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +libosmo-netif- Osmocom network interface interface library +========================================================== + +This repository contains a C-language library that form the +basis of various higher-layer cellular communications protocol +implementation. It implements stream server and clients for TCP, UDP, +IPA as well as the non-standard/proprietary OSMUX protocol. + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/libosmo-netif + +GIT Repository +-------------- + +You can clone from the official libosmo-netif.git repository using + + git clone git://git.osmocom.org/libosmo-netif.git + +There is a cgit interface at http://git.osmocom.org/libosmo-netif/ + +Documentation +------------- + +There is no Doxygen-generated API documentation yet for this library. It +would be great to some day have it, comparable to libosmocore. + +Mailing List +------------ + +Discussions related to libosmo-netif are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmo-netif can be seen at +https://gerrit.osmocom.org/#/q/project:libosmo-netif+status:open -- To view, visit https://gerrit.osmocom.org/2096 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idfc804740e5a086701017d55c86aaf3304c84148 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:47:31 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:47:31 +0000 Subject: libosmo-netif[master]: Add README file to libosmo-netif repository In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2096 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idfc804740e5a086701017d55c86aaf3304c84148 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:47:32 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:47:32 +0000 Subject: [MERGED] libosmo-netif[master]: Add README file to libosmo-netif repository In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add README file to libosmo-netif repository ...................................................................... Add README file to libosmo-netif repository Change-Id: Idfc804740e5a086701017d55c86aaf3304c84148 --- M Makefile.am A README.md 2 files changed, 55 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 7b43d4d..a78c523 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-netif.pc -EXTRA_DIST = .version +EXTRA_DIST = .version README.md BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: diff --git a/README.md b/README.md new file mode 100644 index 0000000..6583792 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +libosmo-netif- Osmocom network interface interface library +========================================================== + +This repository contains a C-language library that form the +basis of various higher-layer cellular communications protocol +implementation. It implements stream server and clients for TCP, UDP, +IPA as well as the non-standard/proprietary OSMUX protocol. + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/libosmo-netif + +GIT Repository +-------------- + +You can clone from the official libosmo-netif.git repository using + + git clone git://git.osmocom.org/libosmo-netif.git + +There is a cgit interface at http://git.osmocom.org/libosmo-netif/ + +Documentation +------------- + +There is no Doxygen-generated API documentation yet for this library. It +would be great to some day have it, comparable to libosmocore. + +Mailing List +------------ + +Discussions related to libosmo-netif are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmo-netif can be seen at +https://gerrit.osmocom.org/#/q/project:libosmo-netif+status:open -- To view, visit https://gerrit.osmocom.org/2096 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idfc804740e5a086701017d55c86aaf3304c84148 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:48:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:48:22 +0000 Subject: openbsc[master]: Don't drop OML links for Get Attributes NACK In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2093 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib8af2872c27abb793172ec59bdc145b8d54f83da Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:48:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:48:54 +0000 Subject: libosmocore[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7fe3678b524d602fc6aa14bc0ed06308df809a3e Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:09 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:09 +0000 Subject: osmo-iuh[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1956 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I54ede7b120953c233c0e10cc88e9fd448c961308 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:11 +0000 Subject: osmo-hlr[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1955 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8cf15d898ef274c505cda0a6b8ddcbf01ba190d9 Gerrit-PatchSet: 3 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:14 +0000 Subject: libosmo-sccp[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1949 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic06cb58061ba2d5698dd80df9777b9d3a825d5f7 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:15 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:15 +0000 Subject: osmo-pcu[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1958 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I27217c9162efd800eebcb403eab770f4528d21ac Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:18 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:18 +0000 Subject: osmo-bts[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1951 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id4eb92924c03748563921e3f56cc0e5e0ffff502 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:34 +0000 Subject: openbsc[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1946 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4183415cd1ead9d46ae3a556e94243325ef5a844 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:39 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:39 +0000 Subject: libosmo-abis[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1947 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I37c14c1a18207f64aa5e15ec0d2503bc834b2627 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:43 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:43 +0000 Subject: openggsn[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1950 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7c676debcdfef2471004deb9ef5a63e8f4e97e15 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:50 +0000 Subject: libosmo-netif[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1948 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 14:49:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 14:49:54 +0000 Subject: osmo-sip-connector[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1957 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic247005aeeabdf349caf48657af0249da8c8d9ea Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 15:33:55 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 15:33:55 +0000 Subject: [PATCH] openbsc[master]: LU counters: count completion and failure, not messages sent Message-ID: Review at https://gerrit.osmocom.org/2097 LU counters: count completion and failure, not messages sent >From a human admin viewpoint it doesn't make sense to count the messages sent: When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect the MS to respond with a TMSI Realloc Complete message. When that fails to come through, the LU actually ends in failure, even though a LU Accept was sent. If a conn breaks/vanishes during LU, we cancel the LU without sending any reply at all, so the failed LU would not be counted. Instead, count Location Updating results, i.e. completion and failures. (With the new VLR developments, LU counters need to be triggered in completely different places, and this patch prepares for that by providing sensible counters.) Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libmsc/gsm_04_08.c M openbsc/src/libmsc/vty_interface_layer3.c 3 files changed, 37 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/97/2097/1 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e9ba173..17cc804 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -218,8 +218,8 @@ MSC_CTR_LOC_UPDATE_TYPE_NORMAL, MSC_CTR_LOC_UPDATE_TYPE_PERIODIC, MSC_CTR_LOC_UPDATE_TYPE_DETACH, - MSC_CTR_LOC_UPDATE_RESP_REJECT, - MSC_CTR_LOC_UPDATE_RESP_ACCEPT, + MSC_CTR_LOC_UPDATE_FAILED, + MSC_CTR_LOC_UPDATE_COMPLETED, MSC_CTR_SMS_SUBMITTED, MSC_CTR_SMS_NO_RECEIVER, MSC_CTR_SMS_DELIVERED, @@ -240,8 +240,8 @@ [MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type.normal", "Received location update normal requests."}, [MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type.periodic", "Received location update periodic requests."}, [MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type.detach", "Received location update detach indication."}, - [MSC_CTR_LOC_UPDATE_RESP_REJECT] = {"loc_update_resp.reject", "Sent location update reject responses."}, - [MSC_CTR_LOC_UPDATE_RESP_ACCEPT] = {"loc_update_resp.accept", "Sent location update accept responses."}, + [MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp.failed", "Rejected location updates."}, + [MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp.completed", "Successful location updates."}, [MSC_CTR_SMS_SUBMITTED] = {"sms.submitted", "Received a RPDU from a MS (MO)."}, [MSC_CTR_SMS_NO_RECEIVER] = {"sms.no_receiver", "Counts SMS which couldn't routed because no receiver found."}, [MSC_CTR_SMS_DELIVERED] = {"sms.delivered", "Global SMS Deliver attempts."}, diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index c910d71..c80ebf1 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -295,7 +295,7 @@ } } -static void release_loc_updating_req(struct gsm_subscriber_connection *conn, int release) +static void _release_loc_updating_req(struct gsm_subscriber_connection *conn, int release) { if (!conn->loc_operation) return; @@ -310,11 +310,31 @@ msc_release_connection(conn); } +static void loc_updating_failure(struct gsm_subscriber_connection *conn, int release) +{ + if (!conn->loc_operation) + return; + LOGP(DMM, LOGL_ERROR, "Location Updating failed for %s\n", + subscr_name(conn->subscr)); + rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_FAILED]); + _release_loc_updating_req(conn, release); +} + +static void loc_updating_success(struct gsm_subscriber_connection *conn, int release) +{ + if (!conn->loc_operation) + return; + LOGP(DMM, LOGL_INFO, "Location Updating completed for %s\n", + subscr_name(conn->subscr)); + rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_COMPLETED]); + _release_loc_updating_req(conn, release); +} + static void allocate_loc_updating_req(struct gsm_subscriber_connection *conn) { if (conn->loc_operation) LOGP(DMM, LOGL_ERROR, "Connection already had operation.\n"); - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); conn->loc_operation = talloc_zero(tall_locop_ctx, struct gsm_loc_updating_operation); @@ -349,9 +369,11 @@ * The gsm0408_loc_upd_acc sends a MI with the TMSI. The * MS needs to respond with a TMSI REALLOCATION COMPLETE * (even if the TMSI is the same). + * If avoid_tmsi == true, we don't send a TMSI, we don't + * expect a reply and Location Updating is done. */ if (avoid_tmsi) - release_loc_updating_req(conn, 1); + loc_updating_success(conn, 1); return rc; } @@ -407,7 +429,7 @@ * Cancel any outstanding location updating request * operation taking place on the subscriber connection. */ - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); /* We might need to cancel the paging response or such. */ if (conn->sec_operation && conn->sec_operation->cb) { @@ -459,8 +481,6 @@ struct gsm_bts *bts = conn->bts; struct msgb *msg; - rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT]); - msg = gsm48_create_loc_upd_rej(cause); if (!msg) { LOGP(DMM, LOGL_ERROR, "Failed to create msg for LOCATION UPDATING REJECT.\n"); @@ -507,8 +527,6 @@ } DEBUGP(DMM, "-> LOCATION UPDATE ACCEPT\n"); - - rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT]); return gsm48_conn_sendmsg(msg, conn, NULL); } @@ -566,7 +584,7 @@ } if (!conn->subscr && conn->loc_operation) { gsm0408_loc_upd_rej(conn, net->reject_cause); - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); return 0; } if (conn->loc_operation) @@ -595,7 +613,7 @@ LOGP(DMM, LOGL_DEBUG, "Location Updating Request procedure timedout.\n"); gsm0408_loc_upd_rej(conn, conn->network->reject_cause); - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); } static void schedule_reject(struct gsm_subscriber_connection *conn) @@ -672,7 +690,7 @@ subscr = subscr_create(conn->network, mi_string); if (!subscr) { gsm0408_loc_upd_rej(conn, conn->network->reject_cause); - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); /* FIXME: set release == true? */ return 0; } break; @@ -1401,7 +1419,7 @@ case GSM48_MT_MM_TMSI_REALL_COMPL: DEBUGP(DMM, "TMSI Reallocation Completed. Subscriber: %s\n", subscr_name(conn->subscr)); - release_loc_updating_req(conn, 1); + loc_updating_success(conn, 1); break; case GSM48_MT_MM_IMSI_DETACH_IND: rc = gsm48_rx_mm_imsi_detach_ind(conn, msg); diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 1bc9372..f631bcc 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -827,9 +827,9 @@ vty_out(vty, "IMSI Detach Indications : %lu%s", net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_DETACH].current, VTY_NEWLINE); - vty_out(vty, "Location Update Response: %lu accept, %lu reject%s", - net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT].current, - net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT].current, + vty_out(vty, "Location Updating Results: %lu completed, %lu failed%s", + net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_COMPLETED].current, + net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_FAILED].current, VTY_NEWLINE); vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, " "%lu completed, %lu failed%s", -- To view, visit https://gerrit.osmocom.org/2097 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 17:09:50 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 17:09:50 +0000 Subject: [PATCH] openbsc[master]: LU counters: count completion and failure, not messages sent In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2097 to look at the new patch set (#2). LU counters: count completion and failure, not messages sent >From a human admin viewpoint it doesn't make sense to count the messages sent: When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect the MS to respond with a TMSI Realloc Complete message. When that fails to come through, the LU actually ends in failure, even though a LU Accept was sent. If a conn breaks/vanishes during LU, we cancel the LU without sending any reply at all, so the failed LU would not be counted. Instead, count Location Updating results, i.e. completion and failures. (With the new VLR developments, LU counters need to be triggered in completely different places, and this patch prepares for that by providing sensible counters.) Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libmsc/gsm_04_08.c M openbsc/src/libmsc/vty_interface_layer3.c 3 files changed, 38 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/97/2097/2 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e9ba173..17cc804 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -218,8 +218,8 @@ MSC_CTR_LOC_UPDATE_TYPE_NORMAL, MSC_CTR_LOC_UPDATE_TYPE_PERIODIC, MSC_CTR_LOC_UPDATE_TYPE_DETACH, - MSC_CTR_LOC_UPDATE_RESP_REJECT, - MSC_CTR_LOC_UPDATE_RESP_ACCEPT, + MSC_CTR_LOC_UPDATE_FAILED, + MSC_CTR_LOC_UPDATE_COMPLETED, MSC_CTR_SMS_SUBMITTED, MSC_CTR_SMS_NO_RECEIVER, MSC_CTR_SMS_DELIVERED, @@ -240,8 +240,8 @@ [MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type.normal", "Received location update normal requests."}, [MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type.periodic", "Received location update periodic requests."}, [MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type.detach", "Received location update detach indication."}, - [MSC_CTR_LOC_UPDATE_RESP_REJECT] = {"loc_update_resp.reject", "Sent location update reject responses."}, - [MSC_CTR_LOC_UPDATE_RESP_ACCEPT] = {"loc_update_resp.accept", "Sent location update accept responses."}, + [MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp.failed", "Rejected location updates."}, + [MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp.completed", "Successful location updates."}, [MSC_CTR_SMS_SUBMITTED] = {"sms.submitted", "Received a RPDU from a MS (MO)."}, [MSC_CTR_SMS_NO_RECEIVER] = {"sms.no_receiver", "Counts SMS which couldn't routed because no receiver found."}, [MSC_CTR_SMS_DELIVERED] = {"sms.delivered", "Global SMS Deliver attempts."}, diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index c910d71..31392f3 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -295,7 +295,7 @@ } } -static void release_loc_updating_req(struct gsm_subscriber_connection *conn, int release) +static void _release_loc_updating_req(struct gsm_subscriber_connection *conn, int release) { if (!conn->loc_operation) return; @@ -310,11 +310,31 @@ msc_release_connection(conn); } +static void loc_updating_failure(struct gsm_subscriber_connection *conn, int release) +{ + if (!conn->loc_operation) + return; + LOGP(DMM, LOGL_ERROR, "Location Updating failed for %s\n", + subscr_name(conn->subscr)); + rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_FAILED]); + _release_loc_updating_req(conn, release); +} + +static void loc_updating_success(struct gsm_subscriber_connection *conn, int release) +{ + if (!conn->loc_operation) + return; + LOGP(DMM, LOGL_INFO, "Location Updating completed for %s\n", + subscr_name(conn->subscr)); + rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_COMPLETED]); + _release_loc_updating_req(conn, release); +} + static void allocate_loc_updating_req(struct gsm_subscriber_connection *conn) { if (conn->loc_operation) LOGP(DMM, LOGL_ERROR, "Connection already had operation.\n"); - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); conn->loc_operation = talloc_zero(tall_locop_ctx, struct gsm_loc_updating_operation); @@ -349,9 +369,11 @@ * The gsm0408_loc_upd_acc sends a MI with the TMSI. The * MS needs to respond with a TMSI REALLOCATION COMPLETE * (even if the TMSI is the same). + * If avoid_tmsi == true, we don't send a TMSI, we don't + * expect a reply and Location Updating is done. */ if (avoid_tmsi) - release_loc_updating_req(conn, 1); + loc_updating_success(conn, 1); return rc; } @@ -364,7 +386,7 @@ switch (event) { case GSM_SECURITY_AUTH_FAILED: - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); break; case GSM_SECURITY_ALREADY: @@ -407,7 +429,7 @@ * Cancel any outstanding location updating request * operation taking place on the subscriber connection. */ - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); /* We might need to cancel the paging response or such. */ if (conn->sec_operation && conn->sec_operation->cb) { @@ -459,8 +481,6 @@ struct gsm_bts *bts = conn->bts; struct msgb *msg; - rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT]); - msg = gsm48_create_loc_upd_rej(cause); if (!msg) { LOGP(DMM, LOGL_ERROR, "Failed to create msg for LOCATION UPDATING REJECT.\n"); @@ -507,8 +527,6 @@ } DEBUGP(DMM, "-> LOCATION UPDATE ACCEPT\n"); - - rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT]); return gsm48_conn_sendmsg(msg, conn, NULL); } @@ -566,7 +584,7 @@ } if (!conn->subscr && conn->loc_operation) { gsm0408_loc_upd_rej(conn, net->reject_cause); - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); return 0; } if (conn->loc_operation) @@ -595,7 +613,7 @@ LOGP(DMM, LOGL_DEBUG, "Location Updating Request procedure timedout.\n"); gsm0408_loc_upd_rej(conn, conn->network->reject_cause); - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); } static void schedule_reject(struct gsm_subscriber_connection *conn) @@ -672,7 +690,7 @@ subscr = subscr_create(conn->network, mi_string); if (!subscr) { gsm0408_loc_upd_rej(conn, conn->network->reject_cause); - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); /* FIXME: set release == true? */ return 0; } break; @@ -1401,7 +1419,7 @@ case GSM48_MT_MM_TMSI_REALL_COMPL: DEBUGP(DMM, "TMSI Reallocation Completed. Subscriber: %s\n", subscr_name(conn->subscr)); - release_loc_updating_req(conn, 1); + loc_updating_success(conn, 1); break; case GSM48_MT_MM_IMSI_DETACH_IND: rc = gsm48_rx_mm_imsi_detach_ind(conn, msg); diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 1bc9372..f631bcc 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -827,9 +827,9 @@ vty_out(vty, "IMSI Detach Indications : %lu%s", net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_DETACH].current, VTY_NEWLINE); - vty_out(vty, "Location Update Response: %lu accept, %lu reject%s", - net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT].current, - net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT].current, + vty_out(vty, "Location Updating Results: %lu completed, %lu failed%s", + net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_COMPLETED].current, + net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_FAILED].current, VTY_NEWLINE); vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, " "%lu completed, %lu failed%s", -- To view, visit https://gerrit.osmocom.org/2097 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:01 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:01 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Turn off native architecture builds Message-ID: Review at https://gerrit.osmocom.org/2098 buildenv: Turn off native architecture builds The compiler option -march=native instructs the compiler to auto-optimize the code for the current build architecture. This is fine for building and using locally, but contraproductive when generating binary packages. This commit introduces more general options and also removes --with-sse from the default configure options and replaces them with $(SIMD_FLAGS), which also contains a collection of supported SIMD options, so we won't loose the SSE support. Change-Id: I3df4b8db9692016115edbe2247beeec090715687 --- M Transceiver52M/x86/Makefile.am M configure.ac 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/98/2098/1 diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index eda1a17..699faad 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -1,5 +1,5 @@ if !ARCH_ARM -AM_CFLAGS = -Wall -std=gnu99 -march=native -I${srcdir}/../common +AM_CFLAGS = -Wall -std=gnu99 $(SIMD_FLAGS) -I${srcdir}/../common noinst_LTLIBRARIES = libarch.la diff --git a/configure.ac b/configure.ac index f1159c6..7d7750e 100644 --- a/configure.ac +++ b/configure.ac @@ -113,7 +113,7 @@ ]) # Find and define supported SIMD extensions -AS_IF([test "x$with_sse" != "xno"], [ +AS_IF([test "x$with_sse" == "xyes"], [ AX_EXT ]) -- To view, visit https://gerrit.osmocom.org/2098 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3df4b8db9692016115edbe2247beeec090715687 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:01 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:01 +0000 Subject: [PATCH] osmo-trx[master]: cosmetic: Make parameter lists uniform Message-ID: Review at https://gerrit.osmocom.org/2099 cosmetic: Make parameter lists uniform The non-sse implementation and the sse implementation of the convert and convolve functions have different parameter lists. This makes it difficult to use function pointers in order to select the right function depending on the SSE-Level and CPU. This commit uniformizes the parameter lists in preparation for planned runtime cpu detection support Change-Id: Ice063b89791537c4b591751f12f5ef5c413a2d27 --- M Transceiver52M/x86/convert.c M Transceiver52M/x86/convolve.c 2 files changed, 143 insertions(+), 110 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/99/2099/1 diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index eafe7b2..862a2e7 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -176,26 +176,34 @@ void convert_float_short(short *out, const float *in, float scale, int len) { + void (*conv_func)(short *, const float *, float, int); + #ifdef HAVE_SSE3 if (!(len % 16)) - _sse_convert_scale_ps_si16_16n(out, in, scale, len); + conv_func = _sse_convert_scale_ps_si16_16n; else if (!(len % 8)) - _sse_convert_scale_ps_si16_8n(out, in, scale, len); + conv_func = _sse_convert_scale_ps_si16_8n; else - _sse_convert_scale_ps_si16(out, in, scale, len); + conv_func = _sse_convert_scale_ps_si16; #else - convert_scale_ps_si16(out, in, scale, len); + conv_func = convert_scale_ps_si16; #endif + + conv_func(out, in, scale, len); } void convert_short_float(float *out, const short *in, int len) { + void (*conv_func) (float *, const short *, int); + #ifdef HAVE_SSE4_1 if (!(len % 16)) - _sse_convert_si16_ps_16n(out, in, len); + conv_func = _sse_convert_si16_ps_16n; else - _sse_convert_si16_ps(out, in, len); + conv_func = _sse_convert_si16_ps; #else - convert_si16_ps(out, in, len); + conv_func = convert_si16_ps; #endif + + conv_func(out, in, len); } diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c index 04923bc..e2a1dea 100644 --- a/Transceiver52M/x86/convolve.c +++ b/Transceiver52M/x86/convolve.c @@ -47,12 +47,20 @@ #include /* 4-tap SSE complex-real convolution */ -static void sse_conv_real4(const float *restrict x, - const float *restrict h, - float *restrict y, - int len) +static void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_real() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; /* Load (aligned) filter taps */ m0 = _mm_load_ps(&h[0]); @@ -61,8 +69,8 @@ for (int i = 0; i < len; i++) { /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 4]); + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -81,12 +89,17 @@ } /* 8-tap SSE complex-real convolution */ -static void sse_conv_real8(const float *restrict x, - const float *restrict h, - float *restrict y, - int len) +static void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* See NOTE in sse_conv_real4() */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; /* Load (aligned) filter taps */ m0 = _mm_load_ps(&h[0]); @@ -99,10 +112,10 @@ for (int i = 0; i < len; i++) { /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 4]); - m2 = _mm_loadu_ps(&x[2 * i + 8]); - m3 = _mm_loadu_ps(&x[2 * i + 12]); + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -128,13 +141,18 @@ } /* 12-tap SSE complex-real convolution */ -static void sse_conv_real12(const float *restrict x, - const float *restrict h, - float *restrict y, - int len) +static void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* See NOTE in sse_conv_real4() */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7; __m128 m8, m9, m10, m11, m12, m13, m14; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; /* Load (aligned) filter taps */ m0 = _mm_load_ps(&h[0]); @@ -150,18 +168,18 @@ for (int i = 0; i < len; i++) { /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 4]); - m2 = _mm_loadu_ps(&x[2 * i + 8]); - m3 = _mm_loadu_ps(&x[2 * i + 12]); + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - m0 = _mm_loadu_ps(&x[2 * i + 16]); - m1 = _mm_loadu_ps(&x[2 * i + 20]); + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -190,13 +208,18 @@ } /* 16-tap SSE complex-real convolution */ -static void sse_conv_real16(const float *restrict x, - const float *restrict h, - float *restrict y, - int len) +static void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* See NOTE in sse_conv_real4() */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7; __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; /* Load (aligned) filter taps */ m0 = _mm_load_ps(&h[0]); @@ -216,20 +239,20 @@ for (int i = 0; i < len; i++) { /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 4]); - m2 = _mm_loadu_ps(&x[2 * i + 8]); - m3 = _mm_loadu_ps(&x[2 * i + 12]); + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - m0 = _mm_loadu_ps(&x[2 * i + 16]); - m1 = _mm_loadu_ps(&x[2 * i + 20]); - m2 = _mm_loadu_ps(&x[2 * i + 24]); - m3 = _mm_loadu_ps(&x[2 * i + 28]); + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + m2 = _mm_loadu_ps(&_x[2 * i + 24]); + m3 = _mm_loadu_ps(&_x[2 * i + 28]); m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -265,13 +288,18 @@ } /* 20-tap SSE complex-real convolution */ -static void sse_conv_real20(const float *restrict x, - const float *restrict h, - float *restrict y, - int len) +static void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* See NOTE in sse_conv_real4() */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7; __m128 m8, m9, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; /* Load (aligned) filter taps */ m0 = _mm_load_ps(&h[0]); @@ -293,12 +321,12 @@ for (int i = 0; i < len; i++) { /* Multiply-accumulate first 12 taps */ - m0 = _mm_loadu_ps(&x[2 * i + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 4]); - m2 = _mm_loadu_ps(&x[2 * i + 8]); - m3 = _mm_loadu_ps(&x[2 * i + 12]); - m4 = _mm_loadu_ps(&x[2 * i + 16]); - m5 = _mm_loadu_ps(&x[2 * i + 20]); + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + m4 = _mm_loadu_ps(&_x[2 * i + 16]); + m5 = _mm_loadu_ps(&_x[2 * i + 20]); m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -320,10 +348,10 @@ m9 = _mm_add_ps(m1, m7); /* Multiply-accumulate last 8 taps */ - m0 = _mm_loadu_ps(&x[2 * i + 24]); - m1 = _mm_loadu_ps(&x[2 * i + 28]); - m2 = _mm_loadu_ps(&x[2 * i + 32]); - m3 = _mm_loadu_ps(&x[2 * i + 36]); + m0 = _mm_loadu_ps(&_x[2 * i + 24]); + m1 = _mm_loadu_ps(&_x[2 * i + 28]); + m2 = _mm_loadu_ps(&_x[2 * i + 32]); + m3 = _mm_loadu_ps(&_x[2 * i + 36]); m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -351,12 +379,17 @@ } /* 4*N-tap SSE complex-real convolution */ -static void sse_conv_real4n(const float *x, - const float *h, - float *y, - int h_len, int len) +static void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* See NOTE in sse_conv_real4() */ + __m128 m0, m1, m2, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; for (int i = 0; i < len; i++) { /* Zero */ @@ -370,8 +403,8 @@ m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 8 * n + 4]); + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -394,12 +427,20 @@ } /* 4*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_4n(const float *x, - const float *h, - float *y, - int h_len, int len) +static void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_complex() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; for (int i = 0; i < len; i++) { /* Zero */ @@ -414,8 +455,8 @@ m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 8 * n + 4]); + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -445,13 +486,18 @@ } /* 8*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_8n(const float *x, - const float *h, - float *y, - int h_len, int len) +static void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, + int step, int offset) { + /* See NOTE in sse_conv_cmplx_4n() */ + __m128 m0, m1, m2, m3, m4, m5, m6, m7; __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; for (int i = 0; i < len; i++) { /* Zero */ @@ -473,10 +519,10 @@ m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&x[2 * i + 16 * n + 0]); - m1 = _mm_loadu_ps(&x[2 * i + 16 * n + 4]); - m2 = _mm_loadu_ps(&x[2 * i + 16 * n + 8]); - m3 = _mm_loadu_ps(&x[2 * i + 16 * n + 12]); + m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); @@ -522,14 +568,10 @@ /* API: Aligned complex-real */ int convolve_real(const float *x, int x_len, const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) + float *y, int y_len, int start, int len, int step, int offset) { - void (*conv_func)(const float *, const float *, - float *, int) = NULL; - void (*conv_func_n)(const float *, const float *, - float *, int, int) = NULL; + void (*conv_func) (const float *, int, const float *, int, float *, int, + int, int, int, int) = (void *)_base_convolve_real; if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) return -1; @@ -556,22 +598,12 @@ break; default: if (!(h_len % 4)) - conv_func_n = sse_conv_real4n; + conv_func = sse_conv_real4n; } } #endif - if (conv_func) { - conv_func(&x[2 * (-(h_len - 1) + start)], - h, y, len); - } else if (conv_func_n) { - conv_func_n(&x[2 * (-(h_len - 1) + start)], - h, y, h_len, len); - } else { - _base_convolve_real(x, x_len, - h, h_len, - y, y_len, - start, len, step, offset); - } + + conv_func(x, x_len, h, h_len, y, y_len, start, len, step, offset); return len; } @@ -580,11 +612,11 @@ int convolve_complex(const float *x, int x_len, const float *h, int h_len, float *y, int y_len, - int start, int len, - int step, int offset) + int start, int len, int step, int offset) { - void (*conv_func)(const float *, const float *, - float *, int, int) = NULL; + void (*conv_func) (const float *, int, const float *, int, float *, int, + int, int, int, int) = + (void *)_base_convolve_complex; if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) return -1; @@ -599,15 +631,8 @@ conv_func = sse_conv_cmplx_4n; } #endif - if (conv_func) { - conv_func(&x[2 * (-(h_len - 1) + start)], - h, y, h_len, len); - } else { - _base_convolve_complex(x, x_len, - h, h_len, - y, y_len, - start, len, step, offset); - } + + conv_func(x, x_len, h, h_len, y, y_len, start, len, step, offset); return len; } -- To view, visit https://gerrit.osmocom.org/2099 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice063b89791537c4b591751f12f5ef5c413a2d27 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:01 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:01 +0000 Subject: [PATCH] osmo-trx[master]: ssedetect: Add runtime CPU detection Message-ID: Review at https://gerrit.osmocom.org/2100 ssedetect: Add runtime CPU detection The current implementation can select the SSE support level during compiletime only. This commit adds functionality to automatically detect and switch the SSE support level and automatically switch the Implementation if the CPU does not support the required SSE level. Change-Id: Iba74f8a6e4e921ff31e4bd9f0c7c881fe547423a --- M Transceiver52M/arm/convolve.c M Transceiver52M/common/convert.h M Transceiver52M/common/convolve.h M Transceiver52M/osmo-trx.cpp M Transceiver52M/x86/convert.c M Transceiver52M/x86/convolve.c 6 files changed, 142 insertions(+), 49 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/00/2100/1 diff --git a/Transceiver52M/arm/convolve.c b/Transceiver52M/arm/convolve.c index 2b42090..912d0c2 100644 --- a/Transceiver52M/arm/convolve.c +++ b/Transceiver52M/arm/convolve.c @@ -58,6 +58,13 @@ } #endif +/* API: Initalize convolve module */ +void convolve_init(void) +{ + /* Stub */ + return; +} + /* API: Aligned complex-real */ int convolve_real(float *x, int x_len, float *h, int h_len, diff --git a/Transceiver52M/common/convert.h b/Transceiver52M/common/convert.h index 4827c28..1d3a180 100644 --- a/Transceiver52M/common/convert.h +++ b/Transceiver52M/common/convert.h @@ -3,5 +3,6 @@ void convert_float_short(short *out, const float *in, float scale, int len); void convert_short_float(float *out, const short *in, int len); +void convert_init(void); #endif /* _CONVERT_H_ */ diff --git a/Transceiver52M/common/convolve.h b/Transceiver52M/common/convolve.h index 08bda0c..43db577 100644 --- a/Transceiver52M/common/convolve.h +++ b/Transceiver52M/common/convolve.h @@ -27,4 +27,6 @@ int start, int len, int step, int offset); +void convolve_init(void); + #endif /* _CONVOLVE_H_ */ diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 5e81586..dff482e 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -32,6 +32,11 @@ #include #include +extern "C" { +#include "convolve.h" +#include "convert.h" +} + /* Samples-per-symbol for downlink path * 4 - Uses precision modulator (more computation, less distortion) * 1 - Uses minimized modulator (less computation, more distortion) @@ -498,6 +503,9 @@ RadioDevice::InterfaceType iface = RadioDevice::NORMAL; struct trx_config config; + convolve_init(); + convert_init(); + handle_options(argc, argv, &config); setup_signal_handlers(); diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index 862a2e7..db1c0fc 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -25,6 +25,17 @@ #include "config.h" #endif +/* Architecture dependant function pointers */ +struct convert_cpu_context { + void (*convert_si16_ps_16n) (float *, const short *, int); + void (*convert_si16_ps) (float *, const short *, int); + void (*convert_scale_ps_si16_16n)(short *, const float *, float, int); + void (*convert_scale_ps_si16_8n)(short *, const float *, float, int); + void (*convert_scale_ps_si16)(short *, const float *, float, int); +}; + +static struct convert_cpu_context c; + #ifdef HAVE_SSE3 #include #include @@ -157,53 +168,61 @@ _mm_storeu_si128((__m128i *) &out[16 * i + 8], m7); } } -#else /* HAVE_SSE3 */ +#endif + +__attribute__((optimize("no-tree-vectorize"))) static void convert_scale_ps_si16(short *out, const float *in, float scale, int len) { for (int i = 0; i < len; i++) out[i] = in[i] * scale; } -#endif -#ifndef HAVE_SSE4_1 +__attribute__((optimize("no-tree-vectorize"))) static void convert_si16_ps(float *out, const short *in, int len) { for (int i = 0; i < len; i++) out[i] = in[i]; } + +void convert_init(void) +{ + c.convert_scale_ps_si16_16n = convert_scale_ps_si16; + c.convert_scale_ps_si16_8n = convert_scale_ps_si16; + c.convert_scale_ps_si16 = convert_scale_ps_si16; + c.convert_si16_ps_16n = convert_si16_ps; + c.convert_si16_ps = convert_si16_ps; + +#ifdef HAVE_SSE4_1 + if (__builtin_cpu_supports("sse4.1")) { + c.convert_si16_ps_16n = &_sse_convert_si16_ps_16n; + c.convert_si16_ps = &_sse_convert_si16_ps; + } #endif + +#ifdef HAVE_SSE3 + if (__builtin_cpu_supports("sse3")) { + c.convert_scale_ps_si16_16n = _sse_convert_scale_ps_si16_16n; + c.convert_scale_ps_si16_8n = _sse_convert_scale_ps_si16_8n; + c.convert_scale_ps_si16 = _sse_convert_scale_ps_si16; + } +#endif +} void convert_float_short(short *out, const float *in, float scale, int len) { - void (*conv_func)(short *, const float *, float, int); - -#ifdef HAVE_SSE3 if (!(len % 16)) - conv_func = _sse_convert_scale_ps_si16_16n; + c.convert_scale_ps_si16_16n(out, in, scale, len); else if (!(len % 8)) - conv_func = _sse_convert_scale_ps_si16_8n; + c.convert_scale_ps_si16_8n(out, in, scale, len); else - conv_func = _sse_convert_scale_ps_si16; -#else - conv_func = convert_scale_ps_si16; -#endif - - conv_func(out, in, scale, len); + c.convert_scale_ps_si16(out, in, scale, len); } void convert_short_float(float *out, const short *in, int len) { - void (*conv_func) (float *, const short *, int); - -#ifdef HAVE_SSE4_1 if (!(len % 16)) - conv_func = _sse_convert_si16_ps_16n; + c.convert_si16_ps_16n(out, in, len); else - conv_func = _sse_convert_si16_ps; -#else - conv_func = convert_si16_ps; -#endif - - conv_func(out, in, len); + c.convert_si16_ps(out, in, len); } diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c index e2a1dea..2f3b293 100644 --- a/Transceiver52M/x86/convolve.c +++ b/Transceiver52M/x86/convolve.c @@ -26,6 +26,31 @@ #include "config.h" #endif +/* Architecture dependant function pointers */ +struct convolve_cpu_context { + void (*conv_cmplx_4n) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_cmplx_8n) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_cmplx) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real4) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real8) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real12) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real16) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real20) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real4n) (const float *, int, const float *, int, float *, + int, int, int, int, int); + void (*conv_real) (const float *, int, const float *, int, float *, int, + int, int, int, int); +}; +static struct convolve_cpu_context c; + /* Forward declarations from base implementation */ int _base_convolve_real(const float *x, int x_len, const float *h, int h_len, @@ -565,45 +590,77 @@ } #endif +/* API: Initalize convolve module */ +void convolve_init(void) +{ + c.conv_cmplx_4n = (void *)_base_convolve_complex; + c.conv_cmplx_8n = (void *)_base_convolve_complex; + c.conv_cmplx = (void *)_base_convolve_complex; + c.conv_real4 = (void *)_base_convolve_real; + c.conv_real8 = (void *)_base_convolve_real; + c.conv_real12 = (void *)_base_convolve_real; + c.conv_real16 = (void *)_base_convolve_real; + c.conv_real20 = (void *)_base_convolve_real; + c.conv_real4n = (void *)_base_convolve_real; + c.conv_real = (void *)_base_convolve_real; + +#ifdef HAVE_SSE3 + if (__builtin_cpu_supports("sse3")) { + c.conv_cmplx_4n = sse_conv_cmplx_4n; + c.conv_cmplx_8n = sse_conv_cmplx_8n; + c.conv_real4 = sse_conv_real4; + c.conv_real8 = sse_conv_real8; + c.conv_real12 = sse_conv_real12; + c.conv_real16 = sse_conv_real16; + c.conv_real20 = sse_conv_real20; + c.conv_real4n = sse_conv_real4n; + } +#endif +} + /* API: Aligned complex-real */ int convolve_real(const float *x, int x_len, const float *h, int h_len, float *y, int y_len, int start, int len, int step, int offset) { - void (*conv_func) (const float *, int, const float *, int, float *, int, - int, int, int, int) = (void *)_base_convolve_real; - if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) return -1; memset(y, 0, len * 2 * sizeof(float)); -#ifdef HAVE_SSE3 if (step <= 4) { switch (h_len) { case 4: - conv_func = sse_conv_real4; + c.conv_real4(x, x_len, h, h_len, y, y_len, start, len, + step, offset); break; case 8: - conv_func = sse_conv_real8; + c.conv_real8(x, x_len, h, h_len, y, y_len, start, len, + step, offset); break; case 12: - conv_func = sse_conv_real12; + c.conv_real12(x, x_len, h, h_len, y, y_len, start, len, + step, offset); break; case 16: - conv_func = sse_conv_real16; + c.conv_real16(x, x_len, h, h_len, y, y_len, start, len, + step, offset); break; case 20: - conv_func = sse_conv_real20; + c.conv_real20(x, x_len, h, h_len, y, y_len, start, len, + step, offset); break; default: if (!(h_len % 4)) - conv_func = sse_conv_real4n; + c.conv_real4n(x, x_len, h, h_len, y, y_len, + start, len, step, offset); + else + c.conv_real(x, x_len, h, h_len, y, y_len, start, + len, step, offset); } - } -#endif - - conv_func(x, x_len, h, h_len, y, y_len, start, len, step, offset); + } else + c.conv_real(x, x_len, h, h_len, y, y_len, start, len, step, + offset); return len; } @@ -614,25 +671,24 @@ float *y, int y_len, int start, int len, int step, int offset) { - void (*conv_func) (const float *, int, const float *, int, float *, int, - int, int, int, int) = - (void *)_base_convolve_complex; - if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) return -1; memset(y, 0, len * 2 * sizeof(float)); -#ifdef HAVE_SSE3 if (step <= 4) { if (!(h_len % 8)) - conv_func = sse_conv_cmplx_8n; + c.conv_cmplx_8n(x, x_len, h, h_len, y, y_len, start, + len, step, offset); else if (!(h_len % 4)) - conv_func = sse_conv_cmplx_4n; - } -#endif - - conv_func(x, x_len, h, h_len, y, y_len, start, len, step, offset); + c.conv_cmplx_4n(x, x_len, h, h_len, y, y_len, start, + len, step, offset); + else + c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len, + step, offset); + } else + c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len, step, + offset); return len; } -- To view, visit https://gerrit.osmocom.org/2100 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iba74f8a6e4e921ff31e4bd9f0c7c881fe547423a Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:01 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:01 +0000 Subject: [PATCH] osmo-trx[master]: cosmetic: Add info about SSE support Message-ID: Review at https://gerrit.osmocom.org/2101 cosmetic: Add info about SSE support The osmo-trx binary outputs no info about its SSE support status. This commits adds some putput that informs about the SSE of the binary and also tells which of the SSE levels the CPU supports. Change-Id: Iacc83fd668c31644e0efb3e18962cf2870ed1daf --- M Transceiver52M/osmo-trx.cpp 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/01/2101/1 diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index dff482e..ae0e2dc 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -503,6 +503,22 @@ RadioDevice::InterfaceType iface = RadioDevice::NORMAL; struct trx_config config; +#ifdef HAVE_SSE3 + printf("Info: SSE3 support compiled in"); + if (__builtin_cpu_supports("sse3")) + printf(" and supported by CPU\n"); + else + printf(", but not supported by CPU\n"); +#endif + +#ifdef HAVE_SSE4_1 + printf("Info: SSE4.1 support compiled in"); + if (__builtin_cpu_supports("sse4.1")) + printf(" and supported by CPU\n"); + else + printf(", but not supported by CPU\n"); +#endif + convolve_init(); convert_init(); -- To view, visit https://gerrit.osmocom.org/2101 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iacc83fd668c31644e0efb3e18962cf2870ed1daf Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:02 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:02 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Make build CPU invariant Message-ID: Review at https://gerrit.osmocom.org/2102 buildenv: Make build CPU invariant Currently the build environment checks which extension the current CPU supports and picks the compiler flags accordingly. If the build is happening on a machine that does not support the extensions we need (SSE3, SSE4.1), the binary will lack those extensions, even if its intended to be used on a more powerful machine that would support the extensions. This commit removes the CPU tests from the build process. Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c --- M config/ax_ext.m4 1 file changed, 20 insertions(+), 96 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/02/2102/1 diff --git a/config/ax_ext.m4 b/config/ax_ext.m4 index fbd10cc..f453b2e 100644 --- a/config/ax_ext.m4 +++ b/config/ax_ext.m4 @@ -44,95 +44,19 @@ AC_REQUIRE([AX_GCC_X86_AVX_XGETBV]) AX_GCC_X86_CPUID(0x00000001) - ecx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 3` - edx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 4` - AC_CACHE_CHECK([whether mmx is supported], [ax_cv_have_mmx_ext], - [ - ax_cv_have_mmx_ext=no - if test "$((0x$edx>>23&0x01))" = 1; then - ax_cv_have_mmx_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse is supported], [ax_cv_have_sse_ext], - [ - ax_cv_have_sse_ext=no - if test "$((0x$edx>>25&0x01))" = 1; then - ax_cv_have_sse_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse2 is supported], [ax_cv_have_sse2_ext], - [ - ax_cv_have_sse2_ext=no - if test "$((0x$edx>>26&0x01))" = 1; then - ax_cv_have_sse2_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse3 is supported], [ax_cv_have_sse3_ext], - [ - ax_cv_have_sse3_ext=no - if test "$((0x$ecx&0x01))" = 1; then - ax_cv_have_sse3_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether ssse3 is supported], [ax_cv_have_ssse3_ext], - [ - ax_cv_have_ssse3_ext=no - if test "$((0x$ecx>>9&0x01))" = 1; then - ax_cv_have_ssse3_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse4.1 is supported], [ax_cv_have_sse41_ext], - [ - ax_cv_have_sse41_ext=no - if test "$((0x$ecx>>19&0x01))" = 1; then - ax_cv_have_sse41_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse4.2 is supported], [ax_cv_have_sse42_ext], - [ + # NOTE: The CPU architecture is detected during runtime, and the + # implementation is optimized towards certain CPU extensions. Here + # we explicitly select the extensions we use within the code + ax_cv_have_mmx_ext=no + ax_cv_have_sse_ext=no + ax_cv_have_sse2_ext=no + ax_cv_have_sse3_ext=yes + ax_cv_have_ssse3_ext=no + ax_cv_have_sse41_ext=yes ax_cv_have_sse42_ext=no - if test "$((0x$ecx>>20&0x01))" = 1; then - ax_cv_have_sse42_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether avx is supported by processor], [ax_cv_have_avx_cpu_ext], - [ ax_cv_have_avx_cpu_ext=no - if test "$((0x$ecx>>28&0x01))" = 1; then - ax_cv_have_avx_cpu_ext=yes - fi - ]) - - if test x"$ax_cv_have_avx_cpu_ext" = x"yes"; then - AX_GCC_X86_AVX_XGETBV(0x00000000) - - xgetbv_eax="0" - if test x"$ax_cv_gcc_x86_avx_xgetbv_0x00000000" != x"unknown"; then - xgetbv_eax=`echo $ax_cv_gcc_x86_avx_xgetbv_0x00000000 | cut -d ":" -f 1` - fi - - AC_CACHE_CHECK([whether avx is supported by operating system], [ax_cv_have_avx_ext], - [ - ax_cv_have_avx_ext=no - - if test "$((0x$ecx>>27&0x01))" = 1; then - if test "$((0x$xgetbv_eax&0x6))" = 6; then - ax_cv_have_avx_ext=yes - fi - fi - ]) - if test x"$ax_cv_have_avx_ext" = x"no"; then - AC_MSG_WARN([Your processor supports AVX, but your operating system doesn't]) - fi - fi + ax_cv_have_avx_ext=no if test "$ax_cv_have_mmx_ext" = yes; then AX_CHECK_COMPILE_FLAG(-mmmx, ax_cv_support_mmx_ext=yes, []) @@ -140,7 +64,7 @@ SIMD_FLAGS="$SIMD_FLAGS -mmmx" AC_DEFINE(HAVE_MMX,,[Support mmx instructions]) else - AC_MSG_WARN([Your processor supports mmx instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support mmx instructions, can you try another compiler?]) fi fi @@ -150,7 +74,7 @@ SIMD_FLAGS="$SIMD_FLAGS -msse" AC_DEFINE(HAVE_SSE,,[Support SSE (Streaming SIMD Extensions) instructions]) else - AC_MSG_WARN([Your processor supports sse instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support sse instructions, can you try another compiler?]) fi fi @@ -160,7 +84,7 @@ SIMD_FLAGS="$SIMD_FLAGS -msse2" AC_DEFINE(HAVE_SSE2,,[Support SSE2 (Streaming SIMD Extensions 2) instructions]) else - AC_MSG_WARN([Your processor supports sse2 instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support sse2 instructions, can you try another compiler?]) fi fi @@ -170,7 +94,7 @@ SIMD_FLAGS="$SIMD_FLAGS -msse3" AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) else - AC_MSG_WARN([Your processor supports sse3 instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support sse3 instructions, can you try another compiler?]) fi fi @@ -180,7 +104,7 @@ SIMD_FLAGS="$SIMD_FLAGS -mssse3" AC_DEFINE(HAVE_SSSE3,,[Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions]) else - AC_MSG_WARN([Your processor supports ssse3 instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support ssse3 instructions, can you try another compiler?]) fi fi @@ -188,9 +112,9 @@ AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) if test x"$ax_cv_support_sse41_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse4.1" - AC_DEFINE(HAVE_SSE4_1,,[Support SSSE4.1 (Streaming SIMD Extensions 4.1) instructions]) + AC_DEFINE(HAVE_SSE4_1,,[Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions]) else - AC_MSG_WARN([Your processor supports sse4.1 instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support sse4.1 instructions, can you try another compiler?]) fi fi @@ -198,9 +122,9 @@ AX_CHECK_COMPILE_FLAG(-msse4.2, ax_cv_support_sse42_ext=yes, []) if test x"$ax_cv_support_sse42_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse4.2" - AC_DEFINE(HAVE_SSE4_2,,[Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions]) + AC_DEFINE(HAVE_SSE4_2,,[Support SSE4.2 (Streaming SIMD Extensions 4.2) instructions]) else - AC_MSG_WARN([Your processor supports sse4.2 instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support sse4.2 instructions, can you try another compiler?]) fi fi @@ -210,7 +134,7 @@ SIMD_FLAGS="$SIMD_FLAGS -mavx" AC_DEFINE(HAVE_AVX,,[Support AVX (Advanced Vector Extensions) instructions]) else - AC_MSG_WARN([Your processor supports avx instructions but not your compiler, can you try another compiler?]) + AC_MSG_WARN([Your compiler does not support avx instructions, can you try another compiler?]) fi fi -- To view, visit https://gerrit.osmocom.org/2102 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:02 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:02 +0000 Subject: [PATCH] osmo-trx[master]: cosmetic: remove code duplication Message-ID: Review at https://gerrit.osmocom.org/2103 cosmetic: remove code duplication The ARM and the X86 implementation of the conversion functions share the same, non cpu specific implementation in separate files. This commit removes the code duplication by putting the generic implementation into a convert_base.c, similar to to convolve_base.c Change-Id: Ic8d8534a343e27cde79ddc85be4998ebd0cb6e5c --- M Transceiver52M/arm/convert.c M Transceiver52M/common/convert.h A Transceiver52M/common/convert_base.c M Transceiver52M/x86/Makefile.am M Transceiver52M/x86/convert.c 5 files changed, 49 insertions(+), 35 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/03/2103/1 diff --git a/Transceiver52M/arm/convert.c b/Transceiver52M/arm/convert.c index e489d22..57796ea 100644 --- a/Transceiver52M/arm/convert.c +++ b/Transceiver52M/arm/convert.c @@ -28,19 +28,6 @@ void neon_convert_ps_si16_4n(short *, const float *, const float *, int); void neon_convert_si16_ps_4n(float *, const short *, int); -#ifndef HAVE_NEON -static void convert_si16_ps(float *out, const short *in, int len) -{ - for (int i = 0; i < len; i++) - out[i] = in[i]; -} - -static void convert_ps_si16(short *out, const float *in, float scale, int len) -{ - for (int i = 0; i < len; i++) - out[i] = in[i] * scale; -} -#else /* 4*N 16-bit signed integer conversion with remainder */ static void neon_convert_si16_ps(float *out, const short *in, @@ -79,7 +66,7 @@ else neon_convert_ps_si16_4n(out, in, q, len >> 2); #else - convert_ps_si16(out, in, scale, len); + base_convert_float_short(out, in, scale, len); #endif } @@ -91,6 +78,6 @@ else neon_convert_si16_ps_4n(out, in, len >> 2); #else - convert_si16_ps(out, in, len); + base_convert_short_float(out, in, len); #endif } diff --git a/Transceiver52M/common/convert.h b/Transceiver52M/common/convert.h index 1d3a180..73402b0 100644 --- a/Transceiver52M/common/convert.h +++ b/Transceiver52M/common/convert.h @@ -2,7 +2,14 @@ #define _CONVERT_H_ void convert_float_short(short *out, const float *in, float scale, int len); + void convert_short_float(float *out, const short *in, int len); + +void base_convert_float_short(short *out, const float *in, + float scale, int len); + +void base_convert_short_float(float *out, const short *in, int len); + void convert_init(void); #endif /* _CONVERT_H_ */ diff --git a/Transceiver52M/common/convert_base.c b/Transceiver52M/common/convert_base.c new file mode 100644 index 0000000..5251fb8 --- /dev/null +++ b/Transceiver52M/common/convert_base.c @@ -0,0 +1,34 @@ +/* + * Conversion + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "convert.h" + +void base_convert_float_short(short *out, const float *in, + float scale, int len) +{ + for (int i = 0; i < len; i++) + out[i] = in[i] * scale; +} + +void base_convert_short_float(float *out, const short *in, int len) +{ + for (int i = 0; i < len; i++) + out[i] = in[i]; +} + diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index 699faad..7a0b75f 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -5,6 +5,7 @@ libarch_la_SOURCES = \ ../common/convolve_base.c \ + ../common/convert_base.c \ convert.c \ convolve.c endif diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index db1c0fc..3f76b65 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -170,28 +170,13 @@ } #endif -__attribute__((optimize("no-tree-vectorize"))) -static void convert_scale_ps_si16(short *out, const float *in, - float scale, int len) -{ - for (int i = 0; i < len; i++) - out[i] = in[i] * scale; -} - -__attribute__((optimize("no-tree-vectorize"))) -static void convert_si16_ps(float *out, const short *in, int len) -{ - for (int i = 0; i < len; i++) - out[i] = in[i]; -} - void convert_init(void) { - c.convert_scale_ps_si16_16n = convert_scale_ps_si16; - c.convert_scale_ps_si16_8n = convert_scale_ps_si16; - c.convert_scale_ps_si16 = convert_scale_ps_si16; - c.convert_si16_ps_16n = convert_si16_ps; - c.convert_si16_ps = convert_si16_ps; + c.convert_scale_ps_si16_16n = base_convert_float_short; + c.convert_scale_ps_si16_8n = base_convert_float_short; + c.convert_scale_ps_si16 = base_convert_float_short; + c.convert_si16_ps_16n = base_convert_short_float; + c.convert_si16_ps = base_convert_short_float; #ifdef HAVE_SSE4_1 if (__builtin_cpu_supports("sse4.1")) { -- To view, visit https://gerrit.osmocom.org/2103 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic8d8534a343e27cde79ddc85be4998ebd0cb6e5c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:00:02 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 16 Mar 2017 18:00:02 +0000 Subject: [PATCH] osmo-trx[master]: Add test program to verify convolution implementation Message-ID: Review at https://gerrit.osmocom.org/2104 Add test program to verify convolution implementation Convolution is a complex process and we should be able to verify if computing results change when the implementation is touched. This commit adds a test program that executes some testcases. The testcases are crafted in a way that every implmentation (several different ones for SSE) is executed once. The output can be compared against the included .ok file. Change-Id: Ic702ecb356c652fbcd76bee689717fb5d3526fe9 --- A utils/convolvetest/Makefile A utils/convolvetest/convtest.ok A utils/convolvetest/main.c 3 files changed, 238 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/04/2104/1 diff --git a/utils/convolvetest/Makefile b/utils/convolvetest/Makefile new file mode 100644 index 0000000..0ce4cb1 --- /dev/null +++ b/utils/convolvetest/Makefile @@ -0,0 +1,16 @@ +all: main.o convolve_base.o convolve.o + gcc -g -Wall ./*.o -o convtest -losmocore + +clean: + rm -f ./*.o + rm -f ./convtest + +main.o: main.c + gcc -g -Wall -c main.c + +convolve_base.o: ../../Transceiver52M/common/convolve_base.c + gcc -std=c99 -c ../../Transceiver52M/common/convolve_base.c + +convolve.o: ../../Transceiver52M/x86/convolve.c + gcc -std=c99 -c ../../Transceiver52M/x86/convolve.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 + diff --git a/utils/convolvetest/convtest.ok b/utils/convolvetest/convtest.ok new file mode 100644 index 0000000..5766252 --- /dev/null +++ b/utils/convolvetest/convtest.ok @@ -0,0 +1,72 @@ +==== TEST COMPLEX BASE IMPLEMENTATION ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995,0.446645} + +float y[] = {0.389293,10.824917,-0.676577,10.619646,0.283489,11.279525,0.384482,11.586230,0.711259,11.540458,-0.391531,11.281723,0.019900,12.278080,-0.070459,11.104558,0.087938,11.825965,-1.003252,11.698885,0.358887,11.911197,-0.678904,11.933812,0.245140,11.886644} + +==== TEST COMPLEX SSE3 IMPLEMENTATION: (h_len%4=0) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995,0.446645,0.327805,0.785346,0.676628} + +float y[] = {-0.641594,12.367426,-0.970113,12.963129,-0.466783,13.747334,0.637486,13.341836,-0.168561,14.091346,0.306652,15.018833,0.233741,14.726789,-0.011241,15.034849,0.000155,13.639509,0.558827,15.495646,-0.406179,14.103148,-0.000244,15.591370,-0.492319,14.785577} + +==== TEST COMPLEX SSE3 IMPLEMENTATION: (h_len%8=0) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995} + +float y[] = {-0.278295,10.097409,0.919633,11.502825,0.340383,10.979163,0.891132,11.679869,0.425363,11.186544,1.099703,12.121126,0.188196,11.180099,0.228905,12.436676,0.149904,11.522589,0.543155,11.703615,0.033465,12.425473,0.561782,12.373415,-0.218184,12.154579} + + + +==== TEST REAL BASE IMPLEMENTATION ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995,0.446645} + +float y[] = {5.354852,5.387001,4.829278,5.046340,5.849788,5.775999,5.653334,5.372714,5.999860,5.593828,5.628739,5.178002,6.010774,6.186034,6.337766,5.538046,5.616131,6.289612,5.486091,5.835261,6.277413,5.894117,5.563587,6.082063,5.828556,6.160175} + +==== TEST REAL SSE3 IMPLEMENTATION (hlen=4) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604} + +float y[] = {1.154625,1.856899,1.754012,1.866038,1.759821,1.614741,1.946849,1.905307,2.034228,1.369325,1.929276,1.644739,1.911431,1.455565,1.751712,1.711433,1.206255,1.551974,1.351406,1.252433,1.410497,1.527218,1.666560,1.330974,1.544475,1.701906} + +==== TEST REAL SSE3 IMPLEMENTATION (hlen=8) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771} + +float y[] = {2.966950,2.964003,3.035802,3.567513,2.983864,3.487861,3.089418,3.836586,2.979637,3.173361,3.524760,3.308944,3.511707,2.951268,3.500564,3.466951,3.174077,2.778949,3.124344,2.816606,3.196814,2.774090,3.272130,2.980138,2.646414,3.090803} + +==== TEST REAL SSE3 IMPLEMENTATION (hlen=12) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811} + +float y[] = {3.906606,3.831477,4.613783,4.371631,4.441847,4.311853,4.446086,5.089131,4.708794,4.314635,4.866886,4.812932,4.678810,4.796319,4.687846,5.426141,4.119072,4.687284,4.516533,4.303559,4.733458,4.146965,5.133350,4.832816,4.598291,4.252030} + +==== TEST REAL SSE3 IMPLEMENTATION (hlen=16) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995} + +float y[] = {4.845784,5.086479,6.160082,6.147918,5.549072,5.538811,6.264142,6.083664,5.942431,5.214122,6.458036,6.120992,6.385656,5.751343,6.099504,6.738166,5.942206,5.756058,6.343914,6.239408,6.090616,6.325348,6.214744,6.674619,5.691174,6.413076} + +==== TEST REAL SSE3 IMPLEMENTATION (hlen=20) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995,0.446645,0.327805,0.785346,0.676628} + +float y[] = {6.148925,6.262301,5.792440,6.652380,6.759685,6.515733,6.943458,6.334218,6.539823,6.542612,7.766725,7.472028,7.258010,6.947061,7.347066,7.503224,7.134092,6.244353,7.690946,7.584768,7.779833,6.845586,7.351567,8.099596,7.393943,7.176465} + +==== TEST REAL SSE3 IMPLEMENTATION (h_len%4=0) ==== +float x[] = {0.828957,0.675654,0.904170,0.191112,0.394521,0.706067,0.868924,0.547397,0.738959,0.932485,0.233119,0.926576,0.551443,0.933420,0.494407,0.552568,0.939129,0.799646,0.814139,0.594497,0.657201,0.995300,0.935852,0.324541,0.874309,0.589157,0.637771,0.759324,0.775421,0.794910,0.262785,0.604379,0.470564,0.166955} + +float h[] = {0.726144,0.746635,0.470674,0.211604,0.963092,0.264553,0.265818,0.725771,0.590649,0.313560,0.547613,0.946811,0.793753,0.690502,0.276120,0.792995,0.446645,0.327805,0.785346,0.676628,0.906507,0.279178,0.015699,0.609179} + +float y[] = {7.032490,7.904466,6.745667,7.146502,6.958916,7.972230,7.314566,6.972099,7.773273,7.740826,7.380684,7.907260,8.446323,7.862378,8.022881,7.726059,7.748359,7.602177,8.926439,8.905205,8.569546,7.948394,8.588051,8.850824,8.592319,7.636216} + diff --git a/utils/convolvetest/main.c b/utils/convolvetest/main.c new file mode 100644 index 0000000..ff88ba5 --- /dev/null +++ b/utils/convolvetest/main.c @@ -0,0 +1,150 @@ +#include +#include +#include +#include "../../Transceiver52M/common/convolve.h" + +#define TESTVEC_LEN 1000 +#define DO_INIT 1 + +float x_vect[TESTVEC_LEN]; +float y_vect[TESTVEC_LEN]; +float h_vect[TESTVEC_LEN]; + +float *x; +float *h; +float *y; + +/* Generate some random values for testing */ +void gen_floats(float *vect, int len) +{ + int i; + for(i=0;i From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:18:10 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 18:18:10 +0000 Subject: osmo-trx[master]: buildenv: Turn off native architecture builds In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2098 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3df4b8db9692016115edbe2247beeec090715687 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:18:52 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 18:18:52 +0000 Subject: osmo-trx[master]: cosmetic: Make parameter lists uniform In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2099 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice063b89791537c4b591751f12f5ef5c413a2d27 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:19:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 18:19:47 +0000 Subject: osmo-trx[master]: cosmetic: Add info about SSE support In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2101 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iacc83fd668c31644e0efb3e18962cf2870ed1daf Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:21:45 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 18:21:45 +0000 Subject: osmo-trx[master]: buildenv: Make build CPU invariant In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2102/1/config/ax_ext.m4 File config/ax_ext.m4: Line 51: ax_cv_have_mmx_ext=no why not either set all of them to yes, or remove the sse2/sse/avx bits below? The code after your patch might be easily misunderstood to set HAVE_SSE4_2 depending on compiler support, but actually it is not and all the related autoconf macros below are dead code, right? -- To view, visit https://gerrit.osmocom.org/2102 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:22:18 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 18:22:18 +0000 Subject: osmo-trx[master]: cosmetic: remove code duplication In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2103 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8d8534a343e27cde79ddc85be4998ebd0cb6e5c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:24:29 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 18:24:29 +0000 Subject: osmo-trx[master]: Add test program to verify convolution implementation In-Reply-To: References: Message-ID: Patch Set 1: it would be great if the tests would not only test the (fastest) one selected by default based on the CPU capabilies on the host running the test, but if we actaully executed all versions supported by the CPU, i.e. generic-C, SSE3 and SSE4.1 on modern systems. -- To view, visit https://gerrit.osmocom.org/2104 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic702ecb356c652fbcd76bee689717fb5d3526fe9 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:44:17 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 18:44:17 +0000 Subject: [MERGED] openbsc[master]: Don't drop OML links for Get Attributes NACK In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Don't drop OML links for Get Attributes NACK ...................................................................... Don't drop OML links for Get Attributes NACK Previously any OML NACK message will result in BSC dropping OML link to BTS which makes it impossible to use optional OML messages which might be unsupported by BTS. Fix this for 3GPP TS 52.021 ?8.11.1 Get Attributes message. Also, log human-readable NACK name to see what exactly causing OML link drop. Change-Id: Ib8af2872c27abb793172ec59bdc145b8d54f83da Related: OS#1614 --- M openbsc/src/libbsc/bsc_init.c 1 file changed, 10 insertions(+), 10 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index b17ff79..521fc89 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -44,19 +44,19 @@ /* Callback function for NACK on the OML NM */ static int oml_msg_nack(struct nm_nack_signal_data *nack) { - if (nack->mt == NM_MT_SET_BTS_ATTR_NACK) { - - LOGP(DNM, LOGL_ERROR, "Failed to set BTS attributes. That is fatal. " - "Was the bts type and frequency properly specified?\n"); - goto drop_bts; - } else { - LOGP(DNM, LOGL_ERROR, "Got a NACK going to drop the OML links.\n"); - goto drop_bts; + if (nack->mt == NM_MT_GET_ATTR_NACK) { + LOGP(DNM, LOGL_ERROR, "BTS%u does not support Get Attributes " + "OML message.\n", nack->bts->nr); + return 0; } - return 0; + if (nack->mt == NM_MT_SET_BTS_ATTR_NACK) + LOGP(DNM, LOGL_ERROR, "Failed to set BTS attributes. That is fatal. " + "Was the bts type and frequency properly specified?\n"); + else + LOGP(DNM, LOGL_ERROR, "Got %s NACK going to drop the OML links.\n", + abis_nm_nack_name(nack->mt)); -drop_bts: if (!nack->bts) { LOGP(DNM, LOGL_ERROR, "Unknown bts. Can not drop it.\n"); return 0; -- To view, visit https://gerrit.osmocom.org/2093 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib8af2872c27abb793172ec59bdc145b8d54f83da Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 16 18:59:23 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 18:59:23 +0000 Subject: [PATCH] osmo-pcu[master]: Support sending OML Alerts via BTS In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2071 to look at the new patch set (#2). Support sending OML Alerts via BTS * extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 --- M include/osmocom/pcu/pcuif_proto.h M src/encoding.cpp M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_l1_if.h 5 files changed, 57 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/71/2071/2 diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h index 944f364..5ed7f1a 100644 --- a/include/osmocom/pcu/pcuif_proto.h +++ b/include/osmocom/pcu/pcuif_proto.h @@ -3,7 +3,8 @@ #include -#define PCU_IF_VERSION 0x07 +#define PCU_IF_VERSION 0x08 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -15,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -41,6 +43,16 @@ #define PCU_IF_FLAG_MCS7 (1 << 26) #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) + +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); struct gsm_pcu_if_data { uint8_t sapi; @@ -150,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; diff --git a/src/encoding.cpp b/src/encoding.cpp index ea38b77..942772b 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -377,6 +377,8 @@ if ((wp % 8)) { LOGP(DRLCMACUL, LOGL_ERROR, "Length of IMM.ASS without rest " "octets is not multiple of 8 bits, PLEASE FIX!\n"); + pcu_tx_txt_ind(PCU_OML_ALERT, "Length of IMM.ASS without rest " + "octets is not multiple of 8 bits, exiting."); exit (0); } plen = wp / 8; @@ -621,6 +623,8 @@ if ((wp % 8)) { LOGP(DRLCMACUL, LOGL_ERROR, "Length of PAG.REQ without rest " "octets is not multiple of 8 bits, PLEASE FIX!\n"); + pcu_tx_txt_ind(PCU_OML_ALERT, "Length of PAG.REQ without rest " + "octets is not multiple of 8 bits, exiting."); exit (0); } plen = wp / 8; diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index d542b66..75abaa9 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -287,6 +287,9 @@ pcu_sock_state = state; + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_OML_ALERT, "%s", PACKAGE_VERSION); + return 0; } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index b892597..da66e32 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -73,6 +73,39 @@ return msg; } +const struct value_string gsm_pcu_if_text_type_names[] = { + OSMO_VALUE_STRING(PCU_VERSION), + OSMO_VALUE_STRING(PCU_OML_ALERT), + { 0, NULL } +}; + +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...) +{ + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_txt_ind *txt; + va_list ap; + char *rep; + struct msgb *msg = pcu_msgb_alloc(PCU_IF_MSG_TXT_IND, 0); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->data; + txt = &pcu_prim->u.txt_ind; + txt->type = t; + + va_start(ap, fmt); + rep = talloc_vasprintf(tall_pcu_ctx, fmt, ap); + va_end(ap); + + osmo_strlcpy(txt->text, rep, TXT_MAX_LEN); + talloc_free(rep); + + LOGP(DL1IF, LOGL_INFO, "Sending %s TXT as %s to BTS\n", txt->text, + get_value_string(gsm_pcu_if_text_type_names, t)); + + return pcu_sock_send(msg); +} + static int pcu_tx_act_req(uint8_t trx, uint8_t ts, uint8_t activate) { struct msgb *msg; diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index eaa0143..1618260 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef __cplusplus } #endif @@ -131,6 +132,8 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi); +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...); + int pcu_l1if_open(void); void pcu_l1if_close(void); -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:04 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:04 +0000 Subject: [MERGED] libosmocore[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: I7fe3678b524d602fc6aa14bc0ed06308df809a3e --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 108a73a..656f02f 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -2,6 +2,8 @@ set -ex +./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force ./configure --enable-static --enable-sanitize $MAKE $PARALLEL_MAKE check \ -- To view, visit https://gerrit.osmocom.org/1945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7fe3678b524d602fc6aa14bc0ed06308df809a3e Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:12 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:12 +0000 Subject: [MERGED] libosmo-abis[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: I37c14c1a18207f64aa5e15ec0d2503bc834b2627 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 2ca3f46..f1019e4 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1947 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I37c14c1a18207f64aa5e15ec0d2503bc834b2627 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:22 +0000 Subject: [MERGED] libosmo-sccp[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: Ic06cb58061ba2d5698dd80df9777b9d3a825d5f7 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 33045d8..668a58b 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1949 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic06cb58061ba2d5698dd80df9777b9d3a825d5f7 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:27 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:27 +0000 Subject: [MERGED] openggsn[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: I7c676debcdfef2471004deb9ef5a63e8f4e97e15 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index b8d4373..30416b2 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,9 @@ $MAKE $PARALLEL_MAKE install cd ../../ + +deps/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + autoreconf --install --force PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig:$PKG_CONFIG_PATH ./configure PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig:$PKG_CONFIG_PATH $MAKE $PARALLEL_MAKE -- To view, visit https://gerrit.osmocom.org/1950 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c676debcdfef2471004deb9ef5a63e8f4e97e15 Gerrit-PatchSet: 2 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:40 +0000 Subject: [MERGED] osmo-bts[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: Id4eb92924c03748563921e3f56cc0e5e0ffff502 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins_bts_trx.sh M contrib/jenkins_oct.sh M contrib/jenkins_oct_and_bts_trx.sh M contrib/jenkins_sysmobts.sh 4 files changed, 10 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins_bts_trx.sh b/contrib/jenkins_bts_trx.sh index c4f05a9..dbd41ca 100755 --- a/contrib/jenkins_bts_trx.sh +++ b/contrib/jenkins_bts_trx.sh @@ -14,6 +14,9 @@ export LD_LIBRARY_PATH="$inst/lib" osmo-build-dep.sh libosmocore + +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + osmo-build-dep.sh libosmo-abis cd "$deps" diff --git a/contrib/jenkins_oct.sh b/contrib/jenkins_oct.sh index 4fecd0a..9f06888 100755 --- a/contrib/jenkins_oct.sh +++ b/contrib/jenkins_oct.sh @@ -19,6 +19,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" diff --git a/contrib/jenkins_oct_and_bts_trx.sh b/contrib/jenkins_oct_and_bts_trx.sh index 0740bd0..93aa47a 100755 --- a/contrib/jenkins_oct_and_bts_trx.sh +++ b/contrib/jenkins_oct_and_bts_trx.sh @@ -14,6 +14,9 @@ export LD_LIBRARY_PATH="$inst/lib" osmo-build-dep.sh libosmocore + +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + osmo-build-dep.sh libosmo-abis cd "$deps" diff --git a/contrib/jenkins_sysmobts.sh b/contrib/jenkins_sysmobts.sh index be544a7..c6f109d 100755 --- a/contrib/jenkins_sysmobts.sh +++ b/contrib/jenkins_sysmobts.sh @@ -19,6 +19,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1951 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id4eb92924c03748563921e3f56cc0e5e0ffff502 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:48 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:48 +0000 Subject: [MERGED] osmo-hlr[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: I8cf15d898ef274c505cda0a6b8ddcbf01ba190d9 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index c9cab3b..f2c9cbb 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -14,6 +14,9 @@ export LD_LIBRARY_PATH="$inst/lib" osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false + +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + osmo-build-dep.sh libosmo-abis set +x -- To view, visit https://gerrit.osmocom.org/1955 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8cf15d898ef274c505cda0a6b8ddcbf01ba190d9 Gerrit-PatchSet: 3 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:54 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:54 +0000 Subject: [MERGED] osmo-iuh[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: I54ede7b120953c233c0e10cc88e9fd448c961308 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 770575e..06f170b 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1956 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I54ede7b120953c233c0e10cc88e9fd448c961308 Gerrit-PatchSet: 2 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:00:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:00:59 +0000 Subject: [MERGED] osmo-sip-connector[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: Ic247005aeeabdf349caf48657af0249da8c8d9ea Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 588634e..1e028f1 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1957 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic247005aeeabdf349caf48657af0249da8c8d9ea Gerrit-PatchSet: 2 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:01:05 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:01:05 +0000 Subject: [MERGED] osmo-pcu[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: I27217c9162efd800eebcb403eab770f4528d21ac Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index fb0fb2f..8a96380 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -52,6 +52,8 @@ # Build deps osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1958 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I27217c9162efd800eebcb403eab770f4528d21ac Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:07:19 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:07:19 +0000 Subject: libosmo-netif[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 2: grr what's up with osmux_test >:( -- To view, visit https://gerrit.osmocom.org/1948 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:32:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:32:08 +0000 Subject: [PATCH] libsmpp34[master]: Actually fill the README file with contenst (and markdown sy... Message-ID: Review at https://gerrit.osmocom.org/2105 Actually fill the README file with contenst (and markdown syntax) Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 --- D README A README.md 2 files changed, 62 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/05/2105/1 diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 --- a/README +++ /dev/null diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c0e8af --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +libsmpp34 - C library for SMPP 3.4 +================================== + +This repository contains a C-language library implementing the SMPP +Protocol version 3.4 as specified by the SMPP Developers Forum. + +The library was inherited from the +[c-open-smmp34](https://sourceforge.net/projects/c-open-smpp-34/) +project, which unfortunately doesn't have any form of revision control +system and hence the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications project has imported the v1.10 release into this +git repository and performed subsequent improvements. + +Homepage +-------- + +The official homepage of the Osmocom version of the library is +http://osmocom.org/projects/libsmpp34 +while the original upstream project is found at +https://sourceforge.net/projects/c-open-smpp-34/ + +GIT Repository +-------------- + +You can clone from the Osmocom libsmpp34.git repository using + + git clone git://git.osmocom.org/libsmpp34.git + +There is a cgit interface at http://git.osmocom.org/libsmpp34/ + +Documentation +------------- + +API documentation is generated during the build +process, but also available online from the upstream project at +http://c-open-smpp-34.sourceforge.net/out-1.10/web/c-open-libsmpp34_en/index.html + +Mailing List +------------ + +Discussions related to libsmpp34 are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmocore can be seen at +https://gerrit.osmocom.org/#/q/project:libsmpp34+status:open -- To view, visit https://gerrit.osmocom.org/2105 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:38:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:38:08 +0000 Subject: [PATCH] osmo-tetra[master]: reformat README file as markdown Message-ID: Review at https://gerrit.osmocom.org/2106 reformat README file as markdown Change-Id: I7b2602fa1614cafcfb6e6c4fad0d15ba183b0d1d --- R README.md 1 file changed, 31 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/06/2106/1 diff --git a/README b/README.md similarity index 68% rename from README rename to README.md index 30188a2..1b4b1ec 100644 --- a/README +++ b/README.md @@ -1,6 +1,7 @@ TETRA MAC/PHY layer experimentation code +======================================== + (C) 2010-2016 by Harald Welte and contributors -====================================================================== This code aims to implement the sending and receiving part of the TETRA MAC/PHY layer. @@ -15,17 +16,21 @@ You will need libosmocore (http://bb.osmocom.org/trac/wiki/libosmocore) to link. -== Demodulator == +Demodulator +=========== src/demod/python/cpsk.py - * contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI + * contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI + src/demod/python/osmosdr-tetra_demod_fft.py - * call demodulator on any source supported by gr-osmosdr - (uhd, fcd, hackrf, blaerf, etc.) + * call demodulator on any source supported by gr-osmosdr + (uhd, fcd, hackrf, blaerf, etc.) + src/demod/python/simdemod2.py - * call demodulator on a 'cfile' containing complex baseband samples + * call demodulator on a 'cfile' containing complex baseband samples + src/demod/python/{uhd,fcdp}-tetra_demod.py - * use demodulator directly with UHd or FCDP hadware (no gr-osmosdr) + * use demodulator directly with UHd or FCDP hadware (no gr-osmosdr) The output of the demodulator is a file containing one float value for each symbol, containing the phase shift (in units of pi/4) relative to the previous symbol. @@ -34,37 +39,41 @@ bits, i.e. 1-bit-per-byte -== PHY/MAC layer == +PHY/MAC layer +============= -=== library code === +library code +------------ Specifically, it implements: lower_mac/crc_simple.[ch] - * CRC16-CCITT (currently defunct/broken as we need it for - non-octet-aligned bitfields) +* CRC16-CCITT (currently defunct/broken as we need it for + non-octet-aligned bitfields) lower_mac/tetra_conv_enc.[ch] - * 16-state Rate-Compatible Punctured Convolutional (RCPC) coder +* 16-state Rate-Compatible Punctured Convolutional (RCPC) coder lower_mac/tetra_interleave.[ch] - * Block interleaving (over a single block only) +* Block interleaving (over a single block only) lower_mac/tetra_rm3014.[ch] - * (30, 14) Reed-Muller code for the ACCH (broadcast block of - each downlink burst) +* (30, 14) Reed-Muller code for the ACCH (broadcast block of + each downlink burst) lower_mac/tetra_scramb.[ch] - * Scrambling +* Scrambling lower_mac/viterbi*.[ch] - * Convolutional decoder for signalling and voice channels +* Convolutional decoder for signalling and voice channels phy/tetra_burst.[ch] - * Routines to encode continuous normal and sync bursts +* Routines to encode continuous normal and sync bursts phy/tetra_burst_sync.[ch] -=== Receiver Program === +Receiver Program +---------------- The main receiver program 'tetra-rx' expects an input file containing a stream of unpacked bits, i.e. 1-bit-per-byte. -=== Transmitter Program === +Transmitter Program +------------------- The main program conv_enc_test.c generates a single continuous downlinc sync burst (SB), contining: @@ -77,7 +86,8 @@ It does not actually modulate and/or transmit yet. -== Quick example == +Quick example +============= # assuming you have generated a file samples.cfile at a sample rate of # 195.312kHz (100MHz/512 == USRP2 at decimation 512) -- To view, visit https://gerrit.osmocom.org/2106 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7b2602fa1614cafcfb6e6c4fad0d15ba183b0d1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:38:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:38:08 +0000 Subject: [PATCH] osmo-tetra[master]: README.md: Add general information about the project Message-ID: Review at https://gerrit.osmocom.org/2107 README.md: Add general information about the project Change-Id: I3e187676a2c1ceb305f97e95d906659609135068 --- M README.md 1 file changed, 44 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/07/2107/1 diff --git a/README.md b/README.md index 1b4b1ec..818e78c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,50 @@ It is most useful to look at Figure 8.5, 8.6, 9.3 and 19.12 in conjunction with this program. -You will need libosmocore (http://bb.osmocom.org/trac/wiki/libosmocore) to link. +You will need +[libosmocore](https://osmocom.org/projects/libosmocore/wiki/Libosmocore) +to build this softwar + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/tetra/wiki/OsmocomTETRA + +GIT Repository +-------------- + +You can clone from the official osmo-tetra.git repository using + + git clone git://git.osmocom.org/osmo-tetra.git + +There is a cgit interface at http://git.osmocom.org/osmo-tetra/ + +Mailing List +------------ + +Discussions related to osmo-tetra are happening on the +tetra at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/tetra for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-tetra can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-tetra+status:open Demodulator -- To view, visit https://gerrit.osmocom.org/2107 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e187676a2c1ceb305f97e95d906659609135068 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:40:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:40:22 +0000 Subject: [PATCH] osmo-hlr[master]: fix db_subscr_ps error handling Message-ID: Review at https://gerrit.osmocom.org/2108 fix db_subscr_ps error handling Reset stmt and return right away on failure to execute. Change-Id: I27e8b46915efd678c72138e250a9cbb4c9c8ac20 Fixes: Coverity Scan CID#164747 --- M src/db_hlr.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/08/2108/1 diff --git a/src/db_hlr.c b/src/db_hlr.c index 340e7ce..f6ae18f 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -92,7 +92,8 @@ rc = sqlite3_step(stmt); /* execute the statement */ if (rc != SQLITE_DONE) { LOGHLR(imsi, LOGL_ERROR, "Error executing SQL: %d\n", rc); - rc = -ENOEXEC; + db_remove_reset(stmt); + return -ENOEXEC; } rc = sqlite3_changes(dbc->db); /* verify execution result */ -- To view, visit https://gerrit.osmocom.org/2108 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I27e8b46915efd678c72138e250a9cbb4c9c8ac20 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:47:39 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 16 Mar 2017 19:47:39 +0000 Subject: libosmo-netif[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Patch Set 2: how irritating... The main libosmo-netif build succeeds, this patch builds based on the very same commit hash, just adds an unrelated script run. How can this failure be so persistent! -- To view, visit https://gerrit.osmocom.org/1948 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:59:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:59:44 +0000 Subject: osmo-tetra[master]: reformat README file as markdown In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/2106 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7b2602fa1614cafcfb6e6c4fad0d15ba183b0d1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:59:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:59:50 +0000 Subject: osmo-tetra[master]: README.md: Add general information about the project In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/2107 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e187676a2c1ceb305f97e95d906659609135068 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:59:51 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:59:51 +0000 Subject: [MERGED] osmo-tetra[master]: README.md: Add general information about the project In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README.md: Add general information about the project ...................................................................... README.md: Add general information about the project Change-Id: I3e187676a2c1ceb305f97e95d906659609135068 --- M README.md 1 file changed, 44 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/README.md b/README.md index 1b4b1ec..818e78c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,50 @@ It is most useful to look at Figure 8.5, 8.6, 9.3 and 19.12 in conjunction with this program. -You will need libosmocore (http://bb.osmocom.org/trac/wiki/libosmocore) to link. +You will need +[libosmocore](https://osmocom.org/projects/libosmocore/wiki/Libosmocore) +to build this softwar + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/tetra/wiki/OsmocomTETRA + +GIT Repository +-------------- + +You can clone from the official osmo-tetra.git repository using + + git clone git://git.osmocom.org/osmo-tetra.git + +There is a cgit interface at http://git.osmocom.org/osmo-tetra/ + +Mailing List +------------ + +Discussions related to osmo-tetra are happening on the +tetra at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/tetra for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-tetra can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-tetra+status:open Demodulator -- To view, visit https://gerrit.osmocom.org/2107 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3e187676a2c1ceb305f97e95d906659609135068 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 19:59:51 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 19:59:51 +0000 Subject: [MERGED] osmo-tetra[master]: reformat README file as markdown In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: reformat README file as markdown ...................................................................... reformat README file as markdown Change-Id: I7b2602fa1614cafcfb6e6c4fad0d15ba183b0d1d --- R README.md 1 file changed, 31 insertions(+), 21 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/README b/README.md similarity index 68% rename from README rename to README.md index 30188a2..1b4b1ec 100644 --- a/README +++ b/README.md @@ -1,6 +1,7 @@ TETRA MAC/PHY layer experimentation code +======================================== + (C) 2010-2016 by Harald Welte and contributors -====================================================================== This code aims to implement the sending and receiving part of the TETRA MAC/PHY layer. @@ -15,17 +16,21 @@ You will need libosmocore (http://bb.osmocom.org/trac/wiki/libosmocore) to link. -== Demodulator == +Demodulator +=========== src/demod/python/cpsk.py - * contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI + * contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI + src/demod/python/osmosdr-tetra_demod_fft.py - * call demodulator on any source supported by gr-osmosdr - (uhd, fcd, hackrf, blaerf, etc.) + * call demodulator on any source supported by gr-osmosdr + (uhd, fcd, hackrf, blaerf, etc.) + src/demod/python/simdemod2.py - * call demodulator on a 'cfile' containing complex baseband samples + * call demodulator on a 'cfile' containing complex baseband samples + src/demod/python/{uhd,fcdp}-tetra_demod.py - * use demodulator directly with UHd or FCDP hadware (no gr-osmosdr) + * use demodulator directly with UHd or FCDP hadware (no gr-osmosdr) The output of the demodulator is a file containing one float value for each symbol, containing the phase shift (in units of pi/4) relative to the previous symbol. @@ -34,37 +39,41 @@ bits, i.e. 1-bit-per-byte -== PHY/MAC layer == +PHY/MAC layer +============= -=== library code === +library code +------------ Specifically, it implements: lower_mac/crc_simple.[ch] - * CRC16-CCITT (currently defunct/broken as we need it for - non-octet-aligned bitfields) +* CRC16-CCITT (currently defunct/broken as we need it for + non-octet-aligned bitfields) lower_mac/tetra_conv_enc.[ch] - * 16-state Rate-Compatible Punctured Convolutional (RCPC) coder +* 16-state Rate-Compatible Punctured Convolutional (RCPC) coder lower_mac/tetra_interleave.[ch] - * Block interleaving (over a single block only) +* Block interleaving (over a single block only) lower_mac/tetra_rm3014.[ch] - * (30, 14) Reed-Muller code for the ACCH (broadcast block of - each downlink burst) +* (30, 14) Reed-Muller code for the ACCH (broadcast block of + each downlink burst) lower_mac/tetra_scramb.[ch] - * Scrambling +* Scrambling lower_mac/viterbi*.[ch] - * Convolutional decoder for signalling and voice channels +* Convolutional decoder for signalling and voice channels phy/tetra_burst.[ch] - * Routines to encode continuous normal and sync bursts +* Routines to encode continuous normal and sync bursts phy/tetra_burst_sync.[ch] -=== Receiver Program === +Receiver Program +---------------- The main receiver program 'tetra-rx' expects an input file containing a stream of unpacked bits, i.e. 1-bit-per-byte. -=== Transmitter Program === +Transmitter Program +------------------- The main program conv_enc_test.c generates a single continuous downlinc sync burst (SB), contining: @@ -77,7 +86,8 @@ It does not actually modulate and/or transmit yet. -== Quick example == +Quick example +============= # assuming you have generated a file samples.cfile at a sample rate of # 195.312kHz (100MHz/512 == USRP2 at decimation 512) -- To view, visit https://gerrit.osmocom.org/2106 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7b2602fa1614cafcfb6e6c4fad0d15ba183b0d1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 20:03:39 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 20:03:39 +0000 Subject: [PATCH] libsmpp34[master]: Actually fill the README file with contents (and markdown sy... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2105 to look at the new patch set (#2). Actually fill the README file with contents (and markdown syntax) Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 --- M Makefile.am D README A README.md M configure.ac 4 files changed, 65 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/05/2105/2 diff --git a/Makefile.am b/Makefile.am index 7f175ba..752e34e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,8 @@ test_apps/pack_and_send.inc\ test_apps/esme.xml\ test_apps/sendwp.xml\ - test_apps/recv_and_unpack.inc + test_apps/recv_and_unpack.inc \ + README.md pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsmpp34.pc diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 --- a/README +++ /dev/null diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c0e8af --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +libsmpp34 - C library for SMPP 3.4 +================================== + +This repository contains a C-language library implementing the SMPP +Protocol version 3.4 as specified by the SMPP Developers Forum. + +The library was inherited from the +[c-open-smmp34](https://sourceforge.net/projects/c-open-smpp-34/) +project, which unfortunately doesn't have any form of revision control +system and hence the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications project has imported the v1.10 release into this +git repository and performed subsequent improvements. + +Homepage +-------- + +The official homepage of the Osmocom version of the library is +http://osmocom.org/projects/libsmpp34 +while the original upstream project is found at +https://sourceforge.net/projects/c-open-smpp-34/ + +GIT Repository +-------------- + +You can clone from the Osmocom libsmpp34.git repository using + + git clone git://git.osmocom.org/libsmpp34.git + +There is a cgit interface at http://git.osmocom.org/libsmpp34/ + +Documentation +------------- + +API documentation is generated during the build +process, but also available online from the upstream project at +http://c-open-smpp-34.sourceforge.net/out-1.10/web/c-open-libsmpp34_en/index.html + +Mailing List +------------ + +Discussions related to libsmpp34 are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmocore can be seen at +https://gerrit.osmocom.org/#/q/project:libsmpp34+status:open diff --git a/configure.ac b/configure.ac index 0d84ffc..9f816bb 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ(2.57) AC_INIT(libsmpp34, 1.10, ultraismo at yahoo.com) AC_CONFIG_AUX_DIR(aux_config) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([foreign]) AM_CONFIG_HEADER([aux_config/config.h]) # Checks for programs. -- To view, visit https://gerrit.osmocom.org/2105 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 Gerrit-PatchSet: 2 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 20:04:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 20:04:50 +0000 Subject: libsmpp34[master]: Actually fill the README file with contents (and markdown sy... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2105 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 Gerrit-PatchSet: 2 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 20:04:51 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 20:04:51 +0000 Subject: [MERGED] libsmpp34[master]: Actually fill the README file with contents (and markdown sy... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Actually fill the README file with contents (and markdown syntax) ...................................................................... Actually fill the README file with contents (and markdown syntax) Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 --- M Makefile.am D README A README.md M configure.ac 4 files changed, 65 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 7f175ba..752e34e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,8 @@ test_apps/pack_and_send.inc\ test_apps/esme.xml\ test_apps/sendwp.xml\ - test_apps/recv_and_unpack.inc + test_apps/recv_and_unpack.inc \ + README.md pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsmpp34.pc diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 --- a/README +++ /dev/null diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c0e8af --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +libsmpp34 - C library for SMPP 3.4 +================================== + +This repository contains a C-language library implementing the SMPP +Protocol version 3.4 as specified by the SMPP Developers Forum. + +The library was inherited from the +[c-open-smmp34](https://sourceforge.net/projects/c-open-smpp-34/) +project, which unfortunately doesn't have any form of revision control +system and hence the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications project has imported the v1.10 release into this +git repository and performed subsequent improvements. + +Homepage +-------- + +The official homepage of the Osmocom version of the library is +http://osmocom.org/projects/libsmpp34 +while the original upstream project is found at +https://sourceforge.net/projects/c-open-smpp-34/ + +GIT Repository +-------------- + +You can clone from the Osmocom libsmpp34.git repository using + + git clone git://git.osmocom.org/libsmpp34.git + +There is a cgit interface at http://git.osmocom.org/libsmpp34/ + +Documentation +------------- + +API documentation is generated during the build +process, but also available online from the upstream project at +http://c-open-smpp-34.sourceforge.net/out-1.10/web/c-open-libsmpp34_en/index.html + +Mailing List +------------ + +Discussions related to libsmpp34 are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for libosmocore can be seen at +https://gerrit.osmocom.org/#/q/project:libsmpp34+status:open diff --git a/configure.ac b/configure.ac index 0d84ffc..9f816bb 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ(2.57) AC_INIT(libsmpp34, 1.10, ultraismo at yahoo.com) AC_CONFIG_AUX_DIR(aux_config) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([foreign]) AM_CONFIG_HEADER([aux_config/config.h]) # Checks for programs. -- To view, visit https://gerrit.osmocom.org/2105 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2343b2fd45d00935c0e27c84e8b55c39765d51f8 Gerrit-PatchSet: 2 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From admin at opensuse.org Thu Mar 16 20:05:04 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:05:04 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58caf006e2f45_6d45ddc0c1851b8@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 182s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 182s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 182s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 182s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 182s] CK: e740c156278705a14e1a99ba6d31334f [ 182s] RES: 7c04e86a67967fcd [ 182s] SRES: 1b9297a7 [ 182s] Kc: 10687b71e4eb94c5 [ 182s] -SQN: 281474976710655 [ 182s] +SQN: 4294967295 [ 182s] [ 182s] [ 182s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 182s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 182s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 182s] make[1]: *** [override_dh_auto_test] Error 1 [ 182s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 182s] debian/rules:15: recipe for target 'build' failed [ 182s] make: *** [build] Error 2 [ 182s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 182s] [ 182s] lamb02 failed "build libosmocore_0.9.6.20170316.dsc" at Thu Mar 16 20:04:53 UTC 2017. [ 182s] [ 182s] ### VM INTERACTION START ### [ 185s] [ 172.127349] reboot: Power down [ 185s] ### VM INTERACTION END ### [ 185s] [ 185s] lamb02 failed "build libosmocore_0.9.6.20170316.dsc" at Thu Mar 16 20:04:57 UTC 2017. [ 185s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 16 20:05:24 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:05:24 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58caf025b571d_6d45ddc0c1852a5@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/i586 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 201s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 201s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 201s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 201s] CK: e740c156278705a14e1a99ba6d31334f [ 201s] RES: 7c04e86a67967fcd [ 201s] SRES: 1b9297a7 [ 201s] Kc: 10687b71e4eb94c5 [ 201s] -SQN: 281474976710655 [ 201s] +SQN: 4294967295 [ 201s] [ 201s] [ 201s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 201s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 201s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 201s] make[1]: *** [override_dh_auto_test] Error 1 [ 201s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 201s] debian/rules:15: recipe for target 'build' failed [ 201s] make: *** [build] Error 2 [ 201s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 201s] [ 201s] build80 failed "build libosmocore_0.9.6.20170316.dsc" at Thu Mar 16 20:05:14 UTC 2017. [ 201s] [ 201s] ### VM INTERACTION START ### [ 201s] Powering off. [ 201s] [ 187.553773] reboot: Power down [ 202s] ### VM INTERACTION END ### [ 202s] [ 202s] build80 failed "build libosmocore_0.9.6.20170316.dsc" at Thu Mar 16 20:05:16 UTC 2017. [ 202s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 16 20:07:22 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:07:22 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58caf07ed778c_6d45ddc0c185790@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 302s] | ## ---------------------- ## [ 302s] | [ 302s] | This file was extended by libosmocore config.status 0.9.6.20170316, which was [ 302s] | generated by GNU Autoconf 2.69. Invocation command line was [ 302s] | [ 302s] | CONFIG_FILES = [ 302s] | CONFIG_HEADERS = [ 302s] | CONFIG_LINKS = [ 302s] | CONFIG_COMMANDS = [ 302s] | $ ./config.status Doxyfile.core [ 302s] | [ 302s] | on cloud113 [ 302s] | [ 302s] | config.status:1156: creating Doxyfile.core [ 302s] [ 302s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 302s] make[1]: *** [override_dh_auto_test] Error 1 [ 302s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 302s] debian/rules:15: recipe for target 'build' failed [ 302s] make: *** [build] Error 2 [ 302s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 302s] [ 302s] cloud113 failed "build libosmocore_0.9.6.20170316.dsc" at Thu Mar 16 20:07:17 UTC 2017. [ 302s] [ 302s] ### VM INTERACTION START ### [ 306s] ### VM INTERACTION END ### [ 306s] [ 306s] cloud113 failed "build libosmocore_0.9.6.20170316.dsc" at Thu Mar 16 20:07:21 UTC 2017. [ 306s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 16 20:14:13 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:14:13 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58caf2416075f_6ce5ddc0c1879d3@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/Debian_8.0/i586 Package network:osmocom:nightly/osmo-hlr failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 225s] ^ [ 225s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 225s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 225s] ^ [ 225s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 225s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 225s] ^ [ 225s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 225s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 225s] ^ [ 225s] Makefile:504: recipe for target 'auc.o' failed [ 225s] make[3]: *** [auc.o] Error 1 [ 225s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 225s] Makefile:393: recipe for target 'all-recursive' failed [ 225s] make[2]: *** [all-recursive] Error 1 [ 225s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 225s] Makefile:339: recipe for target 'all' failed [ 225s] make[1]: *** [all] Error 2 [ 225s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 225s] dh_auto_build: make -j1 returned exit code 2 [ 225s] debian/rules:7: recipe for target 'build' failed [ 225s] make: *** [build] Error 2 [ 225s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 225s] [ 225s] wildcard2 failed "build osmo-hlr_0.0.1.20170316.dsc" at Thu Mar 16 20:13:51 UTC 2017. [ 225s] [ 225s] ### VM INTERACTION START ### [ 226s] Powering off. [ 226s] [ 152.987844] reboot: Power down -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 16 20:15:24 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:15:24 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58caf282c10b0_6d45ddc0c18656b@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.04/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 182s] ^ [ 182s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 182s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 182s] ^ [ 182s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 182s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 182s] ^ [ 182s] Makefile:516: recipe for target 'auc.o' failed [ 182s] make[3]: *** [auc.o] Error 1 [ 182s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 182s] Makefile:405: recipe for target 'all-recursive' failed [ 182s] make[2]: *** [all-recursive] Error 1 [ 182s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 182s] Makefile:352: recipe for target 'all' failed [ 182s] make[1]: *** [all] Error 2 [ 182s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 183s] dh_auto_build: make -j1 returned exit code 2 [ 183s] debian/rules:7: recipe for target 'build' failed [ 183s] make: *** [build] Error 2 [ 183s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 183s] [ 183s] lamb67 failed "build osmo-hlr_0.0.1.20170316.dsc" at Thu Mar 16 20:15:09 UTC 2017. [ 183s] [ 183s] ### VM INTERACTION START ### [ 186s] [ 172.398666] reboot: Power down [ 186s] ### VM INTERACTION END ### [ 186s] [ 186s] lamb67 failed "build osmo-hlr_0.0.1.20170316.dsc" at Thu Mar 16 20:15:13 UTC 2017. [ 186s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 16 20:15:59 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:15:59 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58caf2b86e47b_6ce5ddc0c188219@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 134s] ^~~~ [ 134s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 134s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 134s] ^ [ 134s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 134s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 134s] ^~~~ [ 134s] Makefile:516: recipe for target 'auc.o' failed [ 134s] make[3]: *** [auc.o] Error 1 [ 134s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 134s] Makefile:405: recipe for target 'all-recursive' failed [ 134s] make[2]: *** [all-recursive] Error 1 [ 134s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 134s] Makefile:352: recipe for target 'all' failed [ 134s] make[1]: *** [all] Error 2 [ 134s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 134s] dh_auto_build: make -j1 returned exit code 2 [ 134s] debian/rules:7: recipe for target 'build' failed [ 134s] make: *** [build] Error 2 [ 134s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 134s] [ 134s] cloud125 failed "build osmo-hlr_0.0.1.20170316.dsc" at Thu Mar 16 20:15:42 UTC 2017. [ 134s] [ 134s] ### VM INTERACTION START ### [ 137s] [ 110.514045] reboot: Power down [ 140s] ### VM INTERACTION END ### [ 140s] [ 140s] cloud125 failed "build osmo-hlr_0.0.1.20170316.dsc" at Thu Mar 16 20:15:49 UTC 2017. [ 140s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Thu Mar 16 20:18:48 2017 From: admin at opensuse.org (OBS Notification) Date: Thu, 16 Mar 2017 20:18:48 +0000 Subject: Build failure of network:osmocom:nightly/openbsc in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58caf34e9c666_6ce5ddc0c188512@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openbsc/xUbuntu_16.10/i586 Package network:osmocom:nightly/openbsc failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly openbsc Last lines of build log: [ 126s] [ 126s] Makefile:719: recipe for target 'check-local' failed [ 126s] make[5]: *** [check-local] Error 1 [ 126s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 126s] Makefile:570: recipe for target 'check-am' failed [ 126s] make[4]: *** [check-am] Error 2 [ 126s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 126s] Makefile:422: recipe for target 'check-recursive' failed [ 126s] make[3]: *** [check-recursive] Error 1 [ 126s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 126s] Makefile:486: recipe for target 'check-recursive' failed [ 126s] make[2]: *** [check-recursive] Error 1 [ 126s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 126s] Makefile:777: recipe for target 'check' failed [ 126s] make[1]: *** [check] Error 2 [ 126s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 126s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 126s] debian/rules:13: recipe for target 'build' failed [ 126s] make: *** [build] Error 2 [ 126s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 126s] [ 126s] build81 failed "build openbsc_0.15.1.20170316.dsc" at Thu Mar 16 20:18:31 UTC 2017. [ 126s] [ 126s] ### VM INTERACTION START ### [ 129s] [ 118.511882] reboot: Power down [ 129s] ### VM INTERACTION END ### [ 129s] [ 129s] build81 failed "build openbsc_0.15.1.20170316.dsc" at Thu Mar 16 20:18:35 UTC 2017. [ 129s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Thu Mar 16 20:30:33 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 20:30:33 +0000 Subject: [PATCH] openbsc[master]: Handle PCU version received via OML alert In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2085 to look at the new patch set (#2). Handle PCU version received via OML alert Explicitly check for and log PCU version received from BTS via OML alert message. Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Related: OS#1614 --- M openbsc/src/libbsc/abis_nm.c 1 file changed, 93 insertions(+), 33 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/2085/2 diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index 8b0eec2..33a23a2 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -273,51 +273,111 @@ return 0; } -static int rx_fail_evt_rep(struct msgb *mb) +static inline void log_oml_fail_rep(const struct gsm_bts *bts, const char *type, + const char *severity, const uint8_t *p_val, + const char *text) +{ + enum abis_nm_pcause_type pcause = p_val[0]; + enum abis_mm_event_causes cause = osmo_load16be(p_val + 1); + + LOGPC(DNM, LOGL_ERROR, "BTS %u: Failure Event Report: ", bts->nr); + if (type) + LOGPC(DNM, LOGL_ERROR, "Type=%s, ", type); + if (severity) + LOGPC(DNM, LOGL_ERROR, "Severity=%s, ", severity); + + LOGPC(DNM, LOGL_ERROR, "Probable cause=%s: ", + get_value_string(abis_nm_pcause_type_names, pcause)); + + if (pcause == NM_PCAUSE_T_MANUF) + LOGPC(DNM, LOGL_ERROR, "%s, ", + get_value_string(abis_mm_event_cause_names, cause)); + else + LOGPC(DNM, LOGL_ERROR, "%02X %02X ", p_val[1], p_val[2]); + + if (text) { + LOGPC(DNM, LOGL_ERROR, "Additional Text=%s. ", text); + } + + LOGPC(DNM, LOGL_ERROR, "\n"); +} + +static inline void handle_manufact_report(const struct gsm_bts *bts, + const uint8_t *p_val, const char *type, + const char *severity, const char *text) +{ + enum abis_mm_event_causes cause = osmo_load16be(p_val + 1); + + switch (cause) { + case OSMO_EVT_PCU_VERS: + if (text) + LOGPC(DNM, LOGL_NOTICE, + "BTS %u reported connected PCU version %s\n", + bts->nr, text); + else + LOGPC(DNM, LOGL_ERROR, + "BTS %u sent %s without actual version string.\n", + bts->nr, + get_value_string(abis_mm_event_cause_names, + cause)); + break; + default: + log_oml_fail_rep(bts, type, severity, p_val, text); + }; +} + +static int rx_fail_evt_rep(struct msgb *mb, const struct gsm_bts *bts) { struct abis_om_hdr *oh = msgb_l2(mb); struct abis_om_fom_hdr *foh = msgb_l3(mb); struct e1inp_sign_link *sign_link = mb->dst; struct tlv_parsed tp; - const uint8_t *p_val; - char *p_text; + int rc = 0; + const uint8_t *p_val = NULL; + char *p_text = NULL; + const char *e_type = NULL, *severity = NULL; - LOGPC(DNM, LOGL_ERROR, "Failure Event Report: "); + abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, + oh->length-sizeof(*foh)); - abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh)); - - if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE)) - LOGPC(DNM, LOGL_ERROR, "Type=%s, ", - abis_nm_event_type_name(*TLVP_VAL(&tp, NM_ATT_EVENT_TYPE))); - if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY)) - LOGPC(DNM, LOGL_ERROR, "Severity=%s, ", - abis_nm_severity_name(*TLVP_VAL(&tp, NM_ATT_SEVERITY))); - if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { - p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); - LOGPC(DNM, LOGL_ERROR, "Probable cause=%s: ", - get_value_string(abis_nm_pcause_type_names, p_val[0])); - if (p_val[0] == NM_PCAUSE_T_MANUF) - LOGPC(DNM, LOGL_ERROR, "%s, ", - get_value_string(abis_mm_event_cause_names, - osmo_load16be(p_val + 1))); - else - LOGPC(DNM, LOGL_ERROR, "%02X %02X ", p_val[1], p_val[2]); - } if (TLVP_PRESENT(&tp, NM_ATT_ADD_TEXT)) { p_val = TLVP_VAL(&tp, NM_ATT_ADD_TEXT); - p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); - if (p_text) { - LOGPC(DNM, LOGL_ERROR, "Additional Text=%s. ", p_text); - talloc_free(p_text); - } + p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, + TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); } - LOGPC(DNM, LOGL_ERROR, "\n"); + if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE)) + e_type = abis_nm_event_type_name(*TLVP_VAL(&tp, + NM_ATT_EVENT_TYPE)); - return 0; + if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY)) + severity = abis_nm_severity_name(*TLVP_VAL(&tp, + NM_ATT_SEVERITY)); + + if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { + p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); + + switch (p_val[0]) { + case NM_PCAUSE_T_MANUF: + handle_manufact_report(bts, p_val, e_type, severity, + p_text); + break; + default: + log_oml_fail_rep(bts, e_type, severity, p_val, p_text); + }; + } else { + LOGPC(DNM, LOGL_ERROR, "BTS%u: Failure Event Report without " + "Probable Cause?!\n", bts->nr); + rc = -EINVAL; + } + + if (p_text) + talloc_free(p_text); + + return rc; } -static int abis_nm_rcvmsg_report(struct msgb *mb) +static int abis_nm_rcvmsg_report(struct msgb *mb, struct gsm_bts *bts) { struct abis_om_fom_hdr *foh = msgb_l3(mb); uint8_t mt = foh->msg_type; @@ -335,7 +395,7 @@ osmo_signal_dispatch(SS_NM, S_NM_SW_ACTIV_REP, mb); break; case NM_MT_FAILURE_EVENT_REP: - rx_fail_evt_rep(mb); + rx_fail_evt_rep(mb, bts); osmo_signal_dispatch(SS_NM, S_NM_FAIL_REP, mb); break; case NM_MT_TEST_REP: @@ -580,7 +640,7 @@ /* check for unsolicited message */ if (is_report(mt)) - return abis_nm_rcvmsg_report(mb); + return abis_nm_rcvmsg_report(mb, bts); if (is_in_arr(mt, abis_nm_sw_load_msgs, ARRAY_SIZE(abis_nm_sw_load_msgs))) return abis_nm_rcvmsg_sw(mb); -- To view, visit https://gerrit.osmocom.org/2085 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 20:34:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 20:34:00 +0000 Subject: openbsc[master]: Handle PCU version received via OML alert In-Reply-To: References: Message-ID: Patch Set 2: > should be part of the "bts model" and call it there Could you elaborate why? The code is generic and in the absence of Osmocom-specific (or presence of some other vendor-specific) extensions it will just print debug log. -- To view, visit https://gerrit.osmocom.org/2085 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 20:37:21 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 16 Mar 2017 20:37:21 +0000 Subject: [PATCH] osmo-pcu[master]: Support sending OML Alerts via BTS In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2071 to look at the new patch set (#3). Support sending OML Alerts via BTS * extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Note: requires corresponding change If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore. Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 --- M include/osmocom/pcu/pcuif_proto.h M src/encoding.cpp M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_l1_if.h 5 files changed, 56 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/71/2071/3 diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h index 944f364..88dc09e 100644 --- a/include/osmocom/pcu/pcuif_proto.h +++ b/include/osmocom/pcu/pcuif_proto.h @@ -4,6 +4,7 @@ #include #define PCU_IF_VERSION 0x07 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -15,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -41,6 +43,16 @@ #define PCU_IF_FLAG_MCS7 (1 << 26) #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) + +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); struct gsm_pcu_if_data { uint8_t sapi; @@ -150,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; diff --git a/src/encoding.cpp b/src/encoding.cpp index ea38b77..942772b 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -377,6 +377,8 @@ if ((wp % 8)) { LOGP(DRLCMACUL, LOGL_ERROR, "Length of IMM.ASS without rest " "octets is not multiple of 8 bits, PLEASE FIX!\n"); + pcu_tx_txt_ind(PCU_OML_ALERT, "Length of IMM.ASS without rest " + "octets is not multiple of 8 bits, exiting."); exit (0); } plen = wp / 8; @@ -621,6 +623,8 @@ if ((wp % 8)) { LOGP(DRLCMACUL, LOGL_ERROR, "Length of PAG.REQ without rest " "octets is not multiple of 8 bits, PLEASE FIX!\n"); + pcu_tx_txt_ind(PCU_OML_ALERT, "Length of PAG.REQ without rest " + "octets is not multiple of 8 bits, exiting."); exit (0); } plen = wp / 8; diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index d542b66..d7e55e7 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -287,6 +287,9 @@ pcu_sock_state = state; + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + return 0; } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index b892597..da66e32 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -73,6 +73,39 @@ return msg; } +const struct value_string gsm_pcu_if_text_type_names[] = { + OSMO_VALUE_STRING(PCU_VERSION), + OSMO_VALUE_STRING(PCU_OML_ALERT), + { 0, NULL } +}; + +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...) +{ + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_txt_ind *txt; + va_list ap; + char *rep; + struct msgb *msg = pcu_msgb_alloc(PCU_IF_MSG_TXT_IND, 0); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->data; + txt = &pcu_prim->u.txt_ind; + txt->type = t; + + va_start(ap, fmt); + rep = talloc_vasprintf(tall_pcu_ctx, fmt, ap); + va_end(ap); + + osmo_strlcpy(txt->text, rep, TXT_MAX_LEN); + talloc_free(rep); + + LOGP(DL1IF, LOGL_INFO, "Sending %s TXT as %s to BTS\n", txt->text, + get_value_string(gsm_pcu_if_text_type_names, t)); + + return pcu_sock_send(msg); +} + static int pcu_tx_act_req(uint8_t trx, uint8_t ts, uint8_t activate) { struct msgb *msg; diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index eaa0143..1618260 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef __cplusplus } #endif @@ -131,6 +132,8 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi); +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...); + int pcu_l1if_open(void); void pcu_l1if_close(void); -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 16 21:46:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 21:46:37 +0000 Subject: [MERGED] openbsc[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 Change-Id: I4183415cd1ead9d46ae3a556e94243325ef5a844 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 7ad4ee6..08e16b9 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1946 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4183415cd1ead9d46ae3a556e94243325ef5a844 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 16 21:46:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 21:46:44 +0000 Subject: [MERGED] libosmo-netif[master]: jenkins: add value_string termination check In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: jenkins: add value_string termination check ...................................................................... jenkins: add value_string termination check Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 9a37ca5..2fce993 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -12,6 +12,8 @@ osmo-build-dep.sh libosmocore +"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") + export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -- To view, visit https://gerrit.osmocom.org/1948 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If7f6dce2b8325d4f2f732e1c14d6a1082e122584 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 16 21:49:27 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 21:49:27 +0000 Subject: osmo-pcu[master]: Support sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 3: (2 comments) https://gerrit.osmocom.org/#/c/2071/3/src/encoding.cpp File src/encoding.cpp: Line 627: "octets is not multiple of 8 bits, exiting."); as we have already two instances where the same string is used first for a LOGP and then for a pcu_tx_txt_ind, it might make sense to have a convenience wrapper for both, i.e. logging + txt indication? https://gerrit.osmocom.org/#/c/2071/3/src/pcu_l1_if.cpp File src/pcu_l1_if.cpp: Line 97: rep = talloc_vasprintf(tall_pcu_ctx, fmt, ap); you're checking for msgb_alloc == NULL above, but not for the allocation failure that might be in talloc_vasprintf. -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 16 22:59:12 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 22:59:12 +0000 Subject: [PATCH] libosmocore[master]: logging: fail gracefully if log_info() was not called Message-ID: Review at https://gerrit.osmocom.org/2109 logging: fail gracefully if log_info() was not called The logging code crashes if osmo_log_info is not set, which is typically achieved by calling log_init(). Let's fail with a reasonable assert and error message if the user forgets that. Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2 --- M src/logging.c 1 file changed, 21 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/2109/1 diff --git a/src/logging.c b/src/logging.c index 6a1e929..d900340 100644 --- a/src/logging.c +++ b/src/logging.c @@ -154,6 +154,15 @@ NULL, }; +static void assert_loginfo(void) +{ + if (!osmo_log_info) { + fprintf(stderr, "ERROR: osmo_log_info == NULL! " + "You must call log_init() before using logging!\n"); + OSMO_ASSERT(osmo_log_info); + } +} + /* special magic for negative (library-internal) log subsystem numbers */ static int subsys_lib2index(int subsys) { @@ -186,6 +195,8 @@ { int i; + assert_loginfo(); + for (i = 0; i < osmo_log_info->num_cat; ++i) { if (osmo_log_info->cat[i].name == NULL) continue; @@ -208,6 +219,8 @@ int i = 0; char *mask = strdup(_mask); char *category_token = NULL; + + assert_loginfo(); /* Disable everything to enable it afterwards */ for (i = 0; i < osmo_log_info->num_cat; ++i) @@ -611,6 +624,8 @@ struct log_target *target; unsigned int i; + assert_loginfo(); + target = talloc_zero(tall_log_ctx, struct log_target); if (!target) return NULL; @@ -783,6 +798,8 @@ int size = strlen("logging level () ()") + 1; char *str; + assert_loginfo(); + for (i = 0; i < info->num_cat; i++) { if (info->cat[i].name == NULL) continue; @@ -862,6 +879,8 @@ unsigned int size = strlen(LOGGING_STR "Set the log level for a specified category\n") + 1; + + assert_loginfo(); for (i = 0; i < info->num_cat; i++) { if (info->cat[i].name == NULL) @@ -980,6 +999,8 @@ { struct log_target *tar; + assert_loginfo(); + subsys = map_subsys(subsys); /* TODO: The following could/should be cached (update on config) */ -- To view, visit https://gerrit.osmocom.org/2109 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:24:29 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:24:29 +0000 Subject: [PATCH] libosmo-netif[master]: stream_client: Actually use/honor the reconect parameter Message-ID: Review at https://gerrit.osmocom.org/2110 stream_client: Actually use/honor the reconect parameter The reconnect behavior was likely broken in commit de3f57a8293a5b39435d6f283da23e0172bad8bb If the user requests a re-connect, we should start it. Not only in case the connection drops later, but also if the initial connection itself fails. Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b --- M src/stream.c 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/10/2110/1 diff --git a/src/stream.c b/src/stream.c index a30fd04..d72d800 100644 --- a/src/stream.c +++ b/src/stream.c @@ -308,8 +308,11 @@ ret = osmo_sock_init(AF_INET, SOCK_STREAM, cli->proto, cli->addr, cli->port, OSMO_SOCK_F_CONNECT); - if (ret < 0) + if (ret < 0) { + if (reconnect && errno == ECONNREFUSED) + osmo_stream_cli_reconnect(cli); return ret; + } cli->ofd.fd = ret; if (osmo_fd_register(&cli->ofd) < 0) { -- To view, visit https://gerrit.osmocom.org/2110 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:24:29 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:24:29 +0000 Subject: [PATCH] libosmo-netif[master]: stream: don't crash in _close() when fd is not initialized Message-ID: Review at https://gerrit.osmocom.org/2111 stream: don't crash in _close() when fd is not initialized Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 --- M src/stream.c 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/11/2111/1 diff --git a/src/stream.c b/src/stream.c index d72d800..de00f52 100644 --- a/src/stream.c +++ b/src/stream.c @@ -101,6 +101,8 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli) { + if (cli->ofd.fd == -1) + return; osmo_fd_unregister(&cli->ofd); close(cli->ofd.fd); } @@ -506,6 +508,8 @@ void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link) { + if (link->ofd.fd == -1) + return; osmo_fd_unregister(&link->ofd); close(link->ofd.fd); } -- To view, visit https://gerrit.osmocom.org/2111 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:24:30 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:24:30 +0000 Subject: [PATCH] libosmo-netif[master]: stream: When destroying, make sure to kill reconnect timer Message-ID: Review at https://gerrit.osmocom.org/2112 stream: When destroying, make sure to kill reconnect timer if osmo_stream_cli_destroy() is called while the reconnect timer is running, we would end up in a crash. Change-Id: If6597130f472f1e2b8d9682002250ecd54675bb0 --- M src/stream.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/12/2112/1 diff --git a/src/stream.c b/src/stream.c index de00f52..84580af 100644 --- a/src/stream.c +++ b/src/stream.c @@ -294,6 +294,7 @@ void osmo_stream_cli_destroy(struct osmo_stream_cli *cli) { + osmo_timer_del(&cli->timer); talloc_free(cli); } -- To view, visit https://gerrit.osmocom.org/2112 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If6597130f472f1e2b8d9682002250ecd54675bb0 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:39:09 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:39:09 +0000 Subject: libosmocore[master]: logging: fail gracefully if log_info() was not called In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2109 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:39:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:39:13 +0000 Subject: libosmo-netif[master]: stream: When destroying, make sure to kill reconnect timer In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2112 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If6597130f472f1e2b8d9682002250ecd54675bb0 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:39:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:39:16 +0000 Subject: libosmo-netif[master]: stream: don't crash in _close() when fd is not initialized In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2111 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 16 23:39:18 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 16 Mar 2017 23:39:18 +0000 Subject: libosmo-netif[master]: stream_client: Actually use/honor the reconect parameter In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2110 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 06:08:02 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Fri, 17 Mar 2017 06:08:02 +0000 Subject: [PATCH] libosmocore[master]: tests/conv: add GSM 05.03 specific test In-Reply-To: References: Message-ID: Hello Max, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1628 to look at the new patch set (#5). tests/conv: add GSM 05.03 specific test This change extends the convolutional code test coverage, adding the GSM 05.03 specific test vectors, generated by the conv_gen.py. Inspired by Tom's patch: http://lists.osmocom.org/pipermail/openbsc/2014-April/007364.html Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a --- M .gitignore M tests/Makefile.am A tests/conv/conv_gsm0503_test.c A tests/conv/conv_gsm0503_test.ok M tests/testsuite.at 5 files changed, 229 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/28/1628/5 diff --git a/.gitignore b/.gitignore index ecbcedd..4b198d9 100644 --- a/.gitignore +++ b/.gitignore @@ -121,6 +121,7 @@ include/osmocom/core/crc*gen.h include/osmocom/core/bit*gen.h include/osmocom/gsm/gsm0503.h +tests/conv/gsm0503_test_vectors.c # vi files *.sw? diff --git a/tests/Makefile.am b/tests/Makefile.am index f8d326e..d69a72a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -15,7 +15,7 @@ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test socket/socket_test \ - coding/coding_test + coding/coding_test conv/conv_gsm0503_test if ENABLE_MSGFILE check_PROGRAMS += msgfile/msgfile_test @@ -60,6 +60,9 @@ conv_conv_test_SOURCES = conv/conv_test.c conv/conv.c conv_conv_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la + +conv_conv_gsm0503_test_SOURCES = conv/conv_gsm0503_test.c conv/conv.c conv/gsm0503_test_vectors.c +conv_conv_gsm0503_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la gsm0808_gsm0808_test_SOURCES = gsm0808/gsm0808_test.c gsm0808_gsm0808_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la @@ -195,9 +198,11 @@ socket/socket_test.err coding/coding_test.ok \ osmo-auc-gen/osmo-auc-gen_test.sh \ osmo-auc-gen/osmo-auc-gen_test.ok \ - osmo-auc-gen/osmo-auc-gen_test.err + osmo-auc-gen/osmo-auc-gen_test.err \ + conv/conv_gsm0503_test.ok -DISTCLEANFILES = atconfig atlocal +DISTCLEANFILES = atconfig atlocal conv/gsm0503_test_vectors.c +BUILT_SOURCES = conv/gsm0503_test_vectors.c TESTSUITE = $(srcdir)/testsuite @@ -217,3 +222,7 @@ $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at mv $@.tmp $@ + +conv/gsm0503_test_vectors.c: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py + $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_vectors gsm \ + --target-path $(builddir)/conv diff --git a/tests/conv/conv_gsm0503_test.c b/tests/conv/conv_gsm0503_test.c new file mode 100644 index 0000000..1b0a724 --- /dev/null +++ b/tests/conv/conv_gsm0503_test.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Forward declaration of GSM 05.03 specific test vectors */ +extern const struct conv_test_vector gsm0503_vectors[]; +extern const int gsm0503_vectors_len; + +int main(int argc, char *argv[]) +{ + int rc, i; + + for (i = 0; i < gsm0503_vectors_len; i++) { + rc = do_check(&gsm0503_vectors[i]); + if (rc) + return rc; + } + + return 0; +} diff --git a/tests/conv/conv_gsm0503_test.ok b/tests/conv/conv_gsm0503_test.ok new file mode 100644 index 0000000..05761f2 --- /dev/null +++ b/tests/conv/conv_gsm0503_test.ok @@ -0,0 +1,183 @@ +[+] Testing: gsm0503_xcch +[.] Input length : ret = 224 exp = 224 -> OK +[.] Output length : ret = 456 exp = 456 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_rach +[.] Input length : ret = 14 exp = 14 -> OK +[.] Output length : ret = 36 exp = 36 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_sch +[.] Input length : ret = 35 exp = 35 -> OK +[.] Output length : ret = 78 exp = 78 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_cs2 +[.] Input length : ret = 290 exp = 290 -> OK +[.] Output length : ret = 456 exp = 456 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_cs3 +[.] Input length : ret = 334 exp = 334 -> OK +[.] Output length : ret = 456 exp = 456 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_12_2 +[.] Input length : ret = 250 exp = 250 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_10_2 +[.] Input length : ret = 210 exp = 210 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_7_95 +[.] Input length : ret = 165 exp = 165 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_7_4 +[.] Input length : ret = 154 exp = 154 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_6_7 +[.] Input length : ret = 140 exp = 140 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_5_9 +[.] Input length : ret = 124 exp = 124 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_5_15 +[.] Input length : ret = 109 exp = 109 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_afs_4_75 +[.] Input length : ret = 101 exp = 101 -> OK +[.] Output length : ret = 448 exp = 448 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_fr +[.] Input length : ret = 185 exp = 185 -> OK +[.] Output length : ret = 378 exp = 378 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_hr +[.] Input length : ret = 98 exp = 98 -> OK +[.] Output length : ret = 211 exp = 211 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_7_95 +[.] Input length : ret = 129 exp = 129 -> OK +[.] Output length : ret = 188 exp = 188 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_7_4 +[.] Input length : ret = 126 exp = 126 -> OK +[.] Output length : ret = 196 exp = 196 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_6_7 +[.] Input length : ret = 116 exp = 116 -> OK +[.] Output length : ret = 200 exp = 200 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_5_9 +[.] Input length : ret = 108 exp = 108 -> OK +[.] Output length : ret = 208 exp = 208 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_5_15 +[.] Input length : ret = 97 exp = 97 -> OK +[.] Output length : ret = 212 exp = 212 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_tch_ahs_4_75 +[.] Input length : ret = 89 exp = 89 -> OK +[.] Output length : ret = 212 exp = 212 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_mcs1_dl_hdr +[.] Input length : ret = 36 exp = 36 -> OK +[.] Output length : ret = 108 exp = 108 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK + +[+] Testing: gsm0503_mcs1_ul_hdr +[.] Input length : ret = 39 exp = 39 -> OK +[.] Output length : ret = 117 exp = 117 -> OK +[.] Random vector checks: +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK +[..] Encoding / Decoding cycle : OK diff --git a/tests/testsuite.at b/tests/testsuite.at index 64df724..afc7cff 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -45,6 +45,12 @@ AT_CHECK([$abs_top_builddir/tests/conv/conv_test], [0], [expout]) AT_CLEANUP +AT_SETUP([conv_gsm0503]) +AT_KEYWORDS([conv_gsm0503]) +cat $abs_srcdir/conv/conv_gsm0503_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/conv/conv_gsm0503_test], [0], [expout]) +AT_CLEANUP + AT_SETUP([coding]) AT_KEYWORDS([coding]) cat $abs_srcdir/coding/coding_test.ok > expout -- To view, visit https://gerrit.osmocom.org/1628 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Fri Mar 17 09:49:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 17 Mar 2017 09:49:00 +0000 Subject: [PATCH] osmo-pcu[master]: Support sending OML Alerts via BTS In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2071 to look at the new patch set (#4). Support sending OML Alerts via BTS * extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Note: requires corresponding change If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore. Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 --- M include/osmocom/pcu/pcuif_proto.h M src/encoding.cpp M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_l1_if.h 5 files changed, 71 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/71/2071/4 diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h index 944f364..88dc09e 100644 --- a/include/osmocom/pcu/pcuif_proto.h +++ b/include/osmocom/pcu/pcuif_proto.h @@ -4,6 +4,7 @@ #include #define PCU_IF_VERSION 0x07 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -15,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -41,6 +43,16 @@ #define PCU_IF_FLAG_MCS7 (1 << 26) #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) + +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); struct gsm_pcu_if_data { uint8_t sapi; @@ -150,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; diff --git a/src/encoding.cpp b/src/encoding.cpp index ea38b77..2f052a4 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -320,6 +320,13 @@ return plen; } +static inline void log_alert_exit(const char * error) +{ + LOGP(DRLCMACUL, LOGL_ERROR, error); + pcu_tx_txt_ind(PCU_OML_ALERT, error); + exit(1); +} + /* * Immediate assignment, sent on the CCCH/AGCH * see GSM 04.08, 9.1.18 and GSM 44.018, 9.1.18 + 10.5.2.16 @@ -374,11 +381,10 @@ // A zero-length LV. Just write L=0. bitvec_write_field(dest, wp,0,8); - if ((wp % 8)) { - LOGP(DRLCMACUL, LOGL_ERROR, "Length of IMM.ASS without rest " - "octets is not multiple of 8 bits, PLEASE FIX!\n"); - exit (0); - } + if ((wp % 8)) + log_alert_exit("Length of IMM.ASS without rest octets is not " + "multiple of 8 bits, PLEASE FIX!\n"); + plen = wp / 8; if (downlink) @@ -618,11 +624,11 @@ { bitvec_write_field(dest, wp,ptmsi[i],8); // PTMSI } - if ((wp % 8)) { - LOGP(DRLCMACUL, LOGL_ERROR, "Length of PAG.REQ without rest " - "octets is not multiple of 8 bits, PLEASE FIX!\n"); - exit (0); - } + + if ((wp % 8)) + log_alert_exit("Length of PAG.REQ without rest octets is not " + "multiple of 8 bits, PLEASE FIX!\n"); + plen = wp / 8; bitvec_write_field(dest, wp,0x0,1); // "L" NLN(PCH) = off bitvec_write_field(dest, wp,0x0,1); // "L" Priority1 = off diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index d542b66..d7e55e7 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -287,6 +287,9 @@ pcu_sock_state = state; + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + return 0; } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index b892597..c16ac0c 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -73,6 +73,42 @@ return msg; } +const struct value_string gsm_pcu_if_text_type_names[] = { + OSMO_VALUE_STRING(PCU_VERSION), + OSMO_VALUE_STRING(PCU_OML_ALERT), + { 0, NULL } +}; + +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...) +{ + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_txt_ind *txt; + va_list ap; + char *rep; + struct msgb *msg = pcu_msgb_alloc(PCU_IF_MSG_TXT_IND, 0); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->data; + txt = &pcu_prim->u.txt_ind; + txt->type = t; + + va_start(ap, fmt); + rep = talloc_vasprintf(tall_pcu_ctx, fmt, ap); + va_end(ap); + + if (!rep) + return -ENOMEM; + + osmo_strlcpy(txt->text, rep, TXT_MAX_LEN); + talloc_free(rep); + + LOGP(DL1IF, LOGL_INFO, "Sending %s TXT as %s to BTS\n", txt->text, + get_value_string(gsm_pcu_if_text_type_names, t)); + + return pcu_sock_send(msg); +} + static int pcu_tx_act_req(uint8_t trx, uint8_t ts, uint8_t activate) { struct msgb *msg; diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index eaa0143..1618260 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef __cplusplus } #endif @@ -131,6 +132,8 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi); +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...); + int pcu_l1if_open(void); void pcu_l1if_close(void); -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 4 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Mar 17 09:50:23 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 17 Mar 2017 09:50:23 +0000 Subject: libosmocore[master]: tests/conv: move conv.h to the global include dir In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:07:32 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 11:07:32 +0000 Subject: [PATCH] libosmo-netif[master]: stream: don't crash in _close() when fd is not initialized In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2111 to look at the new patch set (#2). stream: don't crash in _close() when fd is not initialized We use the magic value '-1' in case the file descriptor is not yet initialized. If somebody calls osmo_stream_*_close() before this changes, we used to crash. Let's check for this and avoid a crash. Also, after close let's change the fd to -1 again to mark the fd invalidity. Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 --- M src/stream.c 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/11/2111/2 diff --git a/src/stream.c b/src/stream.c index d72d800..93de3b7 100644 --- a/src/stream.c +++ b/src/stream.c @@ -101,8 +101,11 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli) { + if (cli->ofd.fd == -1) + return; osmo_fd_unregister(&cli->ofd); close(cli->ofd.fd); + cli->ofd.fd = -1; } static void osmo_stream_cli_read(struct osmo_stream_cli *cli) @@ -506,8 +509,11 @@ void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link) { + if (link->ofd.fd == -1) + return; osmo_fd_unregister(&link->ofd); close(link->ofd.fd); + link->ofd.fd = -1; } struct osmo_stream_srv { -- To view, visit https://gerrit.osmocom.org/2111 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:07:32 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 11:07:32 +0000 Subject: [PATCH] libosmo-netif[master]: stream: Export osmo_stream_cli_reconnect() Message-ID: Review at https://gerrit.osmocom.org/2113 stream: Export osmo_stream_cli_reconnect() In case the application is using the read-callback and a read returns 0, then the application itself would want to trigger the reconnect. This is different from the osmo_stream_cli_recv() case where the reconnect can be handled internally to the library. Change-Id: I41314bad4a9f44e8a61b9d2ba33d1a76b25bd145 --- M include/osmocom/netif/stream.h M src/stream.c 2 files changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/13/2113/1 diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index 3981e41..819f1ce 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -44,6 +44,7 @@ struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli); void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli)); +void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli); struct osmo_stream_cli *osmo_stream_cli_create(void *ctx); void osmo_stream_cli_destroy(struct osmo_stream_cli *cli); diff --git a/src/stream.c b/src/stream.c index 2fca7be..f5408f8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -85,7 +85,7 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli); -static void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli) +void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli) { if (cli->reconnect_timeout < 0) { LOGP(DLINP, LOGL_DEBUG, "not reconnecting, disabled.\n"); -- To view, visit https://gerrit.osmocom.org/2113 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I41314bad4a9f44e8a61b9d2ba33d1a76b25bd145 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:26:37 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 11:26:37 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 1: > did you verify that the node id's didn't change and the merge with > sgsn_vty_additions.xml still works as intended after the update? I have checked the node-id and command ids. They were changed and the text from the additions did not show up in the reference. The node ids are now changed so that they match up again. The pdf now looks good to me. The text shows now up again. -- To view, visit https://gerrit.osmocom.org/2015 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:29:09 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 11:29:09 +0000 Subject: osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 1: > did you verify the node-id's didn't change and the merge with > nitb_vty_additions.xml still works as intended? I have checked the node ids here as well. They were also changed, but after correcting them the text does not appear in the PDF, even though the node-ids are correct now. -- To view, visit https://gerrit.osmocom.org/2014 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:29:26 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 11:29:26 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2014 to look at the new patch set (#2). osmo-nitb: Update VTY command reference Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca --- M OsmoNITB/vty/nitb_vty_additions.xml M OsmoNITB/vty/nitb_vty_reference.xml 2 files changed, 1,085 insertions(+), 433 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/14/2014/2 diff --git a/OsmoNITB/vty/nitb_vty_additions.xml b/OsmoNITB/vty/nitb_vty_additions.xml index b982a6a..0d473bd 100644 --- a/OsmoNITB/vty/nitb_vty_additions.xml +++ b/OsmoNITB/vty/nitb_vty_additions.xml @@ -1,11 +1,11 @@ - + MNCC Internal Configuration This node allows to configure the default codecs for the internal call control handling. - + SMPP Configuration This node allows to configure the SMPP interface @@ -13,8 +13,8 @@ contains generic/common SMPP related configuration, and no per-ESME specific parameters. - - + + ESME Configuration This node allows to configure one particular SMPP ESME, which is an External SMS Entity such as a SMS based diff --git a/OsmoNITB/vty/nitb_vty_reference.xml b/OsmoNITB/vty/nitb_vty_reference.xml index 13e130b..5f49b09 100644 --- a/OsmoNITB/vty/nitb_vty_reference.xml +++ b/OsmoNITB/vty/nitb_vty_reference.xml @@ -116,14 +116,6 @@ - - - - - - - - @@ -176,6 +168,24 @@ + + + + + + + + + + + + + + + + + + @@ -192,7 +202,7 @@ - + @@ -220,6 +230,9 @@ + + + @@ -227,10 +240,13 @@ - + + + + - + @@ -246,6 +262,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -274,10 +313,10 @@ - - - - + + + + @@ -290,7 +329,7 @@ - + @@ -306,42 +345,48 @@ - - - - + + + + - - - - + + + + - + - - - - + + + + - - - + + + + + + + + + - - - - + + + + @@ -354,10 +399,10 @@ - - - - + + + + @@ -366,10 +411,10 @@ - - - - + + + + @@ -381,10 +426,10 @@ - - - - + + + + @@ -401,11 +446,12 @@ - + - - - + + + + @@ -587,14 +633,6 @@ - - - - - - - - @@ -647,6 +685,24 @@ + + + + + + + + + + + + + + + + + + @@ -663,7 +719,7 @@ - + @@ -691,6 +747,9 @@ + + + @@ -698,10 +757,13 @@ - + + + + - + @@ -719,6 +781,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -727,6 +812,12 @@ + + + + + + @@ -740,6 +831,15 @@ + + + + + + + + + @@ -842,10 +942,10 @@ - - - - + + + + @@ -858,7 +958,7 @@ - + @@ -874,42 +974,48 @@ - - - - + + + + - - - - + + + + - + - - - - + + + + - - - + + + + + + + + + - - - - + + + + @@ -922,10 +1028,10 @@ - - - - + + + + @@ -934,10 +1040,10 @@ - - - - + + + + @@ -949,10 +1055,10 @@ - - - - + + + + @@ -969,13 +1075,32 @@ + + + + + + + + + + + + + + + + + + + - - - - + + + + @@ -984,10 +1109,10 @@ - - - - + + + + @@ -996,10 +1121,10 @@ - - - - + + + + @@ -1009,10 +1134,10 @@ - - - - + + + + @@ -1021,46 +1146,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -1101,20 +1193,20 @@ - - - - + + + + - + - - - + + + @@ -1352,6 +1444,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1367,9 +1503,14 @@ - + - + + + + + + @@ -1448,7 +1589,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -1476,6 +1635,9 @@ + + + @@ -1483,20 +1645,15 @@ - + + + + - + - - - - - - - - @@ -1512,8 +1669,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1574,8 +1856,14 @@ + + + + + + - + @@ -1677,8 +1965,23 @@ + + + + + + + + + + + + + + + @@ -1758,13 +2061,20 @@ - + + + + + + + + @@ -1876,91 +2186,91 @@ - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + @@ -1987,7 +2297,7 @@ - + @@ -2072,6 +2382,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2146,6 +2483,13 @@ + + + + + + + @@ -2375,6 +2719,12 @@ + + + + + + @@ -2382,6 +2732,14 @@ + + + + + + + + @@ -2414,6 +2772,19 @@ + + + + + + + + + + + + + @@ -2583,6 +2954,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2665,6 +3078,370 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2681,8 +3458,14 @@ + + + + + + - + @@ -2801,7 +3584,7 @@ - + @@ -2851,7 +3634,7 @@ - + @@ -2863,6 +3646,9 @@ + + + @@ -2931,7 +3717,7 @@ - + @@ -2996,7 +3782,7 @@ - + @@ -3092,34 +3878,91 @@ + + + + + - + + + - - - - - - + - + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -3186,244 +4029,53 @@ - - - + - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + - + + - + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - \ No newline at end of file + -- To view, visit https://gerrit.osmocom.org/2014 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:29:26 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 11:29:26 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: osmo-sgsn: Update VTY command reference In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2015 to look at the new patch set (#2). osmo-sgsn: Update VTY command reference Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 --- M OsmoSGSN/vty/sgsn_vty_additions.xml M OsmoSGSN/vty/sgsn_vty_reference.xml 2 files changed, 665 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/15/2015/2 diff --git a/OsmoSGSN/vty/sgsn_vty_additions.xml b/OsmoSGSN/vty/sgsn_vty_additions.xml index c9de19a..dd26dba 100644 --- a/OsmoSGSN/vty/sgsn_vty_additions.xml +++ b/OsmoSGSN/vty/sgsn_vty_additions.xml @@ -1,5 +1,5 @@ - + SGSN Configuration Node Configure the remote GGSN, access-control and other diff --git a/OsmoSGSN/vty/sgsn_vty_reference.xml b/OsmoSGSN/vty/sgsn_vty_reference.xml index 15a4237..5ec0121 100644 --- a/OsmoSGSN/vty/sgsn_vty_reference.xml +++ b/OsmoSGSN/vty/sgsn_vty_reference.xml @@ -102,6 +102,24 @@ + + + + + + + + + + + + + + + + + + @@ -118,7 +136,7 @@ - + @@ -132,6 +150,10 @@ + + + + @@ -139,10 +161,13 @@ - + + + + - + @@ -158,6 +183,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -188,6 +236,13 @@ + + + + + + + @@ -254,6 +309,17 @@ + + + + + + + + + + + @@ -433,6 +499,24 @@ + + + + + + + + + + + + + + + + + + @@ -449,7 +533,7 @@ - + @@ -463,6 +547,10 @@ + + + + @@ -470,10 +558,13 @@ - + + + + - + @@ -489,6 +580,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -519,6 +633,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -596,6 +781,17 @@ + + + + + + + + + + + @@ -845,9 +1041,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -936,7 +1181,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -950,6 +1213,10 @@ + + + + @@ -957,10 +1224,13 @@ - + + + + - + @@ -1037,6 +1307,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1048,8 +1435,14 @@ + + + + + + - + @@ -1211,7 +1604,7 @@ - + @@ -1262,7 +1655,15 @@ - + + + + + + + + + @@ -1344,12 +1745,259 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + -- To view, visit https://gerrit.osmocom.org/2015 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:39:11 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 11:39:11 +0000 Subject: osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 2: > > did you verify the node-id's didn't change and the merge with > > nitb_vty_additions.xml still works as intended? > > I have checked the node ids here as well. They were also changed, > but after correcting them the text does not appear in the PDF, even > though the node-ids are correct now. The problem also appears when I check with the current master. Something else might be wrong. -- To view, visit https://gerrit.osmocom.org/2014 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 11:50:48 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 11:50:48 +0000 Subject: osmo-trx[master]: Add test program to verify convolution implementation In-Reply-To: References: Message-ID: Patch Set 1: > it would be great if the tests would not only test the (fastest) > one selected by default based on the CPU capabilies on the host > running the test, but if we actaully executed all versions > supported by the CPU, i.e. generic-C, SSE3 and SSE4.1 on modern > systems. Maybe I get it wrong, but the parameters are chosen in a way that every implementation is executed once. We run the generic-C, as well as every SSE implementation once. (SSE4.1 is only used with convert, which is not tested here) -- To view, visit https://gerrit.osmocom.org/2104 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic702ecb356c652fbcd76bee689717fb5d3526fe9 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 12:47:29 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 17 Mar 2017 12:47:29 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Make build CPU invariant In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2102 to look at the new patch set (#2). buildenv: Make build CPU invariant Currently the build environment checks which extension the current CPU supports and picks the compiler flags accordingly. If the build is happening on a machine that does not support the extensions we need (SSE3, SSE4.1), the binary will lack those extensions, even if its intended to be used on a more powerful machine that would support the extensions. This commit removes the CPU tests from the build process. Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c --- M config/ax_ext.m4 1 file changed, 16 insertions(+), 166 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/02/2102/2 diff --git a/config/ax_ext.m4 b/config/ax_ext.m4 index fbd10cc..4883b89 100644 --- a/config/ax_ext.m4 +++ b/config/ax_ext.m4 @@ -30,6 +30,10 @@ # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. +# +# NOTE: The functionality that requests the cpuid has been stripped because +# this project detects the CPU capabilities during runtime. However, we +# still need to check if the compiler supports the requested SIMD flag #serial 12 @@ -44,176 +48,22 @@ AC_REQUIRE([AX_GCC_X86_AVX_XGETBV]) AX_GCC_X86_CPUID(0x00000001) - ecx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 3` - edx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 4` - AC_CACHE_CHECK([whether mmx is supported], [ax_cv_have_mmx_ext], - [ - ax_cv_have_mmx_ext=no - if test "$((0x$edx>>23&0x01))" = 1; then - ax_cv_have_mmx_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse is supported], [ax_cv_have_sse_ext], - [ - ax_cv_have_sse_ext=no - if test "$((0x$edx>>25&0x01))" = 1; then - ax_cv_have_sse_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse2 is supported], [ax_cv_have_sse2_ext], - [ - ax_cv_have_sse2_ext=no - if test "$((0x$edx>>26&0x01))" = 1; then - ax_cv_have_sse2_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse3 is supported], [ax_cv_have_sse3_ext], - [ - ax_cv_have_sse3_ext=no - if test "$((0x$ecx&0x01))" = 1; then - ax_cv_have_sse3_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether ssse3 is supported], [ax_cv_have_ssse3_ext], - [ - ax_cv_have_ssse3_ext=no - if test "$((0x$ecx>>9&0x01))" = 1; then - ax_cv_have_ssse3_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse4.1 is supported], [ax_cv_have_sse41_ext], - [ - ax_cv_have_sse41_ext=no - if test "$((0x$ecx>>19&0x01))" = 1; then - ax_cv_have_sse41_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether sse4.2 is supported], [ax_cv_have_sse42_ext], - [ - ax_cv_have_sse42_ext=no - if test "$((0x$ecx>>20&0x01))" = 1; then - ax_cv_have_sse42_ext=yes - fi - ]) - - AC_CACHE_CHECK([whether avx is supported by processor], [ax_cv_have_avx_cpu_ext], - [ - ax_cv_have_avx_cpu_ext=no - if test "$((0x$ecx>>28&0x01))" = 1; then - ax_cv_have_avx_cpu_ext=yes - fi - ]) - - if test x"$ax_cv_have_avx_cpu_ext" = x"yes"; then - AX_GCC_X86_AVX_XGETBV(0x00000000) - - xgetbv_eax="0" - if test x"$ax_cv_gcc_x86_avx_xgetbv_0x00000000" != x"unknown"; then - xgetbv_eax=`echo $ax_cv_gcc_x86_avx_xgetbv_0x00000000 | cut -d ":" -f 1` - fi - - AC_CACHE_CHECK([whether avx is supported by operating system], [ax_cv_have_avx_ext], - [ - ax_cv_have_avx_ext=no - - if test "$((0x$ecx>>27&0x01))" = 1; then - if test "$((0x$xgetbv_eax&0x6))" = 6; then - ax_cv_have_avx_ext=yes - fi - fi - ]) - if test x"$ax_cv_have_avx_ext" = x"no"; then - AC_MSG_WARN([Your processor supports AVX, but your operating system doesn't]) - fi + AX_CHECK_COMPILE_FLAG(-msse3, ax_cv_support_sse3_ext=yes, []) + if test x"$ax_cv_support_sse3_ext" = x"yes"; then + SIMD_FLAGS="$SIMD_FLAGS -msse3" + AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) + else + AC_MSG_WARN([Your compiler does not support sse3 instructions, can you try another compiler?]) fi - if test "$ax_cv_have_mmx_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-mmmx, ax_cv_support_mmx_ext=yes, []) - if test x"$ax_cv_support_mmx_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -mmmx" - AC_DEFINE(HAVE_MMX,,[Support mmx instructions]) - else - AC_MSG_WARN([Your processor supports mmx instructions but not your compiler, can you try another compiler?]) - fi + AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) + if test x"$ax_cv_support_sse41_ext" = x"yes"; then + SIMD_FLAGS="$SIMD_FLAGS -msse4.1" + AC_DEFINE(HAVE_SSE4_1,,[Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions]) + else + AC_MSG_WARN([Your compiler does not support sse4.1 instructions, can you try another compiler?]) fi - - if test "$ax_cv_have_sse_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-msse, ax_cv_support_sse_ext=yes, []) - if test x"$ax_cv_support_sse_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -msse" - AC_DEFINE(HAVE_SSE,,[Support SSE (Streaming SIMD Extensions) instructions]) - else - AC_MSG_WARN([Your processor supports sse instructions but not your compiler, can you try another compiler?]) - fi - fi - - if test "$ax_cv_have_sse2_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-msse2, ax_cv_support_sse2_ext=yes, []) - if test x"$ax_cv_support_sse2_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -msse2" - AC_DEFINE(HAVE_SSE2,,[Support SSE2 (Streaming SIMD Extensions 2) instructions]) - else - AC_MSG_WARN([Your processor supports sse2 instructions but not your compiler, can you try another compiler?]) - fi - fi - - if test "$ax_cv_have_sse3_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-msse3, ax_cv_support_sse3_ext=yes, []) - if test x"$ax_cv_support_sse3_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -msse3" - AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) - else - AC_MSG_WARN([Your processor supports sse3 instructions but not your compiler, can you try another compiler?]) - fi - fi - - if test "$ax_cv_have_ssse3_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-mssse3, ax_cv_support_ssse3_ext=yes, []) - if test x"$ax_cv_support_ssse3_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -mssse3" - AC_DEFINE(HAVE_SSSE3,,[Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions]) - else - AC_MSG_WARN([Your processor supports ssse3 instructions but not your compiler, can you try another compiler?]) - fi - fi - - if test "$ax_cv_have_sse41_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) - if test x"$ax_cv_support_sse41_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -msse4.1" - AC_DEFINE(HAVE_SSE4_1,,[Support SSSE4.1 (Streaming SIMD Extensions 4.1) instructions]) - else - AC_MSG_WARN([Your processor supports sse4.1 instructions but not your compiler, can you try another compiler?]) - fi - fi - - if test "$ax_cv_have_sse42_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-msse4.2, ax_cv_support_sse42_ext=yes, []) - if test x"$ax_cv_support_sse42_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -msse4.2" - AC_DEFINE(HAVE_SSE4_2,,[Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions]) - else - AC_MSG_WARN([Your processor supports sse4.2 instructions but not your compiler, can you try another compiler?]) - fi - fi - - if test "$ax_cv_have_avx_ext" = yes; then - AX_CHECK_COMPILE_FLAG(-mavx, ax_cv_support_avx_ext=yes, []) - if test x"$ax_cv_support_avx_ext" = x"yes"; then - SIMD_FLAGS="$SIMD_FLAGS -mavx" - AC_DEFINE(HAVE_AVX,,[Support AVX (Advanced Vector Extensions) instructions]) - else - AC_MSG_WARN([Your processor supports avx instructions but not your compiler, can you try another compiler?]) - fi - fi - ;; esac -- To view, visit https://gerrit.osmocom.org/2102 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:27:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:27:00 +0000 Subject: [PATCH] osmo-pcu[master]: Update README file with general project info and use Markdown Message-ID: Review at https://gerrit.osmocom.org/2114 Update README file with general project info and use Markdown Also, it seems the readme was so far not included in any tarballs (make dist). Let's change that. Change-Id: I1967fbbdeadb967c0c0dce2c112ac692c539da1d --- M Makefile.am D README A README.md 3 files changed, 85 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/14/2114/1 diff --git a/Makefile.am b/Makefile.am index 1536016..2ac1cd9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 SUBDIRS = include src examples tests -EXTRA_DIST = osmoappdesc.py +EXTRA_DIST = osmoappdesc.py README.md pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = osmo-pcu.pc diff --git a/README b/README deleted file mode 100644 index 77fad7a..0000000 --- a/README +++ /dev/null @@ -1,19 +0,0 @@ -This is an implementation of Packet Control Unit (PCU) according to TS 04.60 - -The PCU is part of BSS, so it connects directly to SGSN. - - -== Current limitations == - - * No PFC support - * No fixed allocation support - * No extended dynamic allocation support - * No unacknowledged mode operation - * Only single slot assignment on uplink direction - * No half-duplex class support (only semi-duplex) - * No handover support - * No measurement support - * No TA loop - * No power loop - * No CS loop - * No EGPRS diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed5ab17 --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +osmo-pcu - Osmocom Packet Control Unit +====================================== + +This repository contains a C/C++-language implementation of a GPRS +Packet Control Unit, as specified by ETSI/3GPP. It is part of the +[Osmocom](https://osmocom.org/) Open Source Mobile Communications +project. + +The Packet Control Unit is terminating the Layer 2 (RLC/MAC) of the GPRS +radio interface and adapting it to the Gb Interface (BSSGP+NS Protocol) +towards the SGSN. + +The PCU interfaces with the physical layer of the radio interface. +OsmoPCU is typically used co-located with the BTS, specifically +[OsmoBTS](https://osmocom.org/projects/osmobts/wiki). +For legacy BTSs that run proprietary sotware without an interface to +OsmoPCU, you may also co-locate it with the BSC, specifically +[OsmoBSC](https://osmocom.org/projects/openbsc/wiki/Osmo-bsc) + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/osmopcu/wiki/OsmoPCU + +GIT Repository +-------------- + +You can clone from the official osmo-pcu.git repository using + + git clone git://git.osmocom.org/osmo-pcu.git + +There is a cgit interface at http://git.osmocom.org/osmo-pcu/ + +Documentation +------------- + +We provide a +[user manual](http://ftp.osmocom.org/docs/latest/osmopcu-usermanual.pdf) +as well as a +[vty reference manual](http://ftp.osmocom.org/docs/latest/osmopcu-vty-reference.pdf) + +Please note that a lot of the PCU configuration actually happens inside +the BSC, which passes this configuration via A-bis OML to the BTS, which +then in turn passes it via the PCU socket into OsmoPCU. + +Mailing List +------------ + +Discussions related to osmo-pcu are happening on the +osmocom-net-gprs at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/osmocom-net-gprs for +subscription options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-pcu can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-pcu+status:open + + +Current limitations +------------------- + + * No PFC support + * No fixed allocation support + * No extended dynamic allocation support + * No unacknowledged mode operation + * Only single slot assignment on uplink direction + * No half-duplex class support (only semi-duplex) + * No TA loop + * No power loop -- To view, visit https://gerrit.osmocom.org/2114 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1967fbbdeadb967c0c0dce2c112ac692c539da1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:49:35 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:49:35 +0000 Subject: [PATCH] osmo-bts[master]: README: Add general project information and convert to markdown Message-ID: Review at https://gerrit.osmocom.org/2115 README: Add general project information and convert to markdown Also, make sure README.md is included in EXTRA_DIST Change-Id: Icd9192833e1f95758c84cad85f0f0289ff4eb32a --- M Makefile.am D README A README.md 3 files changed, 113 insertions(+), 58 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/15/2115/1 diff --git a/Makefile.am b/Makefile.am index 0c252ac..9a5e26f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,4 +12,5 @@ contrib/sysmobts-calib/sysmobts-layer1.c \ contrib/sysmobts-calib/sysmobts-layer1.h \ doc/examples/sysmo/osmo-bts.cfg \ - doc/examples/sysmobts-mgr.cfg + doc/examples/sysmobts-mgr.cfg \ + README.md diff --git a/README b/README deleted file mode 100644 index 1fe6e8c..0000000 --- a/README +++ /dev/null @@ -1,57 +0,0 @@ -= Repository for the Osmocom BTS implementation. = - -For most complete and accurate information, please refer to -https://osmocom.org/projects/osmobts/wiki - -To submit patches, please refer to -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit -(Note: github pull requests are rejected by a bot) - -== Summary == - -This code implements Layer 2 and higher of a more or less conventional GSM BTS -(Base Transceiver Station) - however, using an Abis/IP interface, rather than -the old-fashioned E1/T1. - -Specifically, this includes - * BTS-side implementation of TS 08.58 (RSL) and TS 12.21 (OML) - * BTS-side implementation of LAPDm (using libosmocore/libosmogsm) - * A somewhat separated interface between those higher layer parts and the - Layer1 interface. - -Several kinds of BTS hardware are supported: - * sysmocom sysmoBTS - * Octasic octphy - * Nutaq litecell 1.5 - * software-defined radio based osmo-bts-trx (e.g. B210) - -== Known Limitations == - -As of August 20, 2015, the following known limitations exist in this -implementation: - -=== Common Core === - * No Extended BCCH support - * System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13 - * No RATSCCH in AMR - * No OML (TS 12.21) alarms yet (temperature, ...) - * Only single-TRX BTS at this point - * Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR - * No support for frequency hopping - * No reporting of interference levels as part of TS 08.58 RF RES IND - * No error reporting in case PAGING COMMAND fails due to queue overflow - * No use of TS 08.58 BS Power and MS Power parameters - * No support of TS 08.58 MultiRate Control - * No support of TS 08.58 Supported Codec Types - * No support of Bter frame / ENHANCED MEASUREMENT REPORT - -=== osmo-bts-sysmo === - * No CSD / ECSD support (not planned) - * GSM-R frequency band supported, but no NCH/ASCI/SoLSA - * All timeslots on one TRX have to use same training sequence (TSC) - * No multi-TRX support yet, though hardware+L1 support stacking - * Makes no use of 12.21 Intave Parameters and Interference - Level Boundaries - * Doesn't yet include MAC address in Abis/IP Identity message - * MphConfig.CNF can be returned to the wrong callback. E.g. with Tx Power - and ciphering. The dispatch should take a look at the hLayer3. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a5bf9fd --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +osmo-bts - Osmocom BTS Implementation +==================================== + +This repository contains a C-language implementation of a GSM Base +Transceiver Station (BTS). It is part of the +[Osmocom](https://osmocom.org/) Open Source Mobile Communications +project. + +This code implements Layer 2 and higher of a more or less conventional GSM BTS +(Base Transceiver Station) - however, using an Abis/IP interface, rather than +the old-fashioned E1/T1. + +Specifically, this includes + * BTS-side implementation of TS 08.58 (RSL) and TS 12.21 (OML) + * BTS-side implementation of LAPDm (using libosmocore/libosmogsm) + * A somewhat separated interface between those higher layer parts and the + Layer1 interface. + +Several kinds of BTS hardware are supported: + * sysmocom sysmoBTS + * Octasic octphy + * Nutaq litecell 1.5 + * software-defined radio based osmo-bts-trx (e.g. USRP B210, UmTRX) + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/osmobts/wiki + +GIT Repository +-------------- + +You can clone from the official osmo-bts.git repository using + + git clone git://git.osmocom.org/osmo-bts.git + +There is a cgit interface at http://git.osmocom.org/osmo-bts/ + +Documentation +------------- + +We provide a +[User Manual](http://ftp.osmocom.org/docs/latest/osmobts-usermanual.pdf) +as well as a +[VTY Reference Manual](http://ftp.osmocom.org/docs/latest/osmobsc-vty-reference.pdf) +and a +[Abis refrence MAnual](http://ftp.osmocom.org/docs/latest/osmobts-abis.pdf) +describing the OsmoBTS specific A-bis dialect. + +Mailing List +------------ + +Discussions related to osmo-bts are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-bts can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-bts+status:open + +Known Limitations +================= + +As of August 20, 2015, the following known limitations exist in this +implementation: + +Common Core +----------- + + * No Extended BCCH support + * System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13 + * No RATSCCH in AMR + * No OML (TS 12.21) alarms yet (temperature, ...) + * Only single-TRX BTS at this point + * Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR + * No support for frequency hopping + * No reporting of interference levels as part of TS 08.58 RF RES IND + * No error reporting in case PAGING COMMAND fails due to queue overflow + * No use of TS 08.58 BS Power and MS Power parameters + * No support of TS 08.58 MultiRate Control + * No support of TS 08.58 Supported Codec Types + * No support of Bter frame / ENHANCED MEASUREMENT REPORT + +osmo-bts-sysmo +-------------- + + * No CSD / ECSD support (not planned) + * GSM-R frequency band supported, but no NCH/ASCI/SoLSA + * All timeslots on one TRX have to use same training sequence (TSC) + * No multi-TRX support yet, though hardware+L1 support stacking + * Makes no use of 12.21 Intave Parameters and Interference + Level Boundaries + * Doesn't yet include MAC address in Abis/IP Identity message + * MphConfig.CNF can be returned to the wrong callback. E.g. with Tx Power + and ciphering. The dispatch should take a look at the hLayer3. -- To view, visit https://gerrit.osmocom.org/2115 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icd9192833e1f95758c84cad85f0f0289ff4eb32a Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:49:36 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:49:36 +0000 Subject: [PATCH] osmo-bts[master]: README: update some of the limitations Message-ID: Review at https://gerrit.osmocom.org/2116 README: update some of the limitations Change-Id: Ifec983e02ce517d4fe17d595b65312c53b0429b7 --- M README.md 1 file changed, 20 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/16/2116/1 diff --git a/README.md b/README.md index a5bf9fd..43c27b2 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Known Limitations ================= -As of August 20, 2015, the following known limitations exist in this +As of March 17, 2017, the following known limitations exist in this implementation: Common Core @@ -86,8 +86,6 @@ * No Extended BCCH support * System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13 * No RATSCCH in AMR - * No OML (TS 12.21) alarms yet (temperature, ...) - * Only single-TRX BTS at this point * Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR * No support for frequency hopping * No reporting of interference levels as part of TS 08.58 RF RES IND @@ -106,6 +104,24 @@ * No multi-TRX support yet, though hardware+L1 support stacking * Makes no use of 12.21 Intave Parameters and Interference Level Boundaries - * Doesn't yet include MAC address in Abis/IP Identity message * MphConfig.CNF can be returned to the wrong callback. E.g. with Tx Power and ciphering. The dispatch should take a look at the hLayer3. + +osmo-bts-octphy +--------------- + + * No support of EFR, HR voice codec (lack of PHY support?) + * No re-transmission of PHY primitives in case of time-out + * Link Quality / Measurement processing incomplete + * impossible to modify encryption parameters using RSL MODE MODIFY + * no clear indication of nominal transmit power, various power related + computations are likely off + * no OML attribute validation during bts_model_check_oml() + +osmo-bts-trx +------------ + + * TCH/F_PDCH cannel not working as voice (https://osmocom.org/issues/1865) + * No BER value delivered to OsmoPCU (https://osmocom.org/issues/1855) + * No 11bit RACH support (https://osmocom.org/issues/1854) + * No CBCH support (https://osmocom.org/issues/1617) -- To view, visit https://gerrit.osmocom.org/2116 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifec983e02ce517d4fe17d595b65312c53b0429b7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:51:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:51:11 +0000 Subject: osmo-pcu[master]: Update README file with general project info and use Markdown In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2114 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1967fbbdeadb967c0c0dce2c112ac692c539da1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:51:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:51:13 +0000 Subject: [MERGED] osmo-pcu[master]: Update README file with general project info and use Markdown In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Update README file with general project info and use Markdown ...................................................................... Update README file with general project info and use Markdown Also, it seems the readme was so far not included in any tarballs (make dist). Let's change that. Change-Id: I1967fbbdeadb967c0c0dce2c112ac692c539da1d --- M Makefile.am D README A README.md 3 files changed, 85 insertions(+), 20 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 1536016..2ac1cd9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 SUBDIRS = include src examples tests -EXTRA_DIST = osmoappdesc.py +EXTRA_DIST = osmoappdesc.py README.md pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = osmo-pcu.pc diff --git a/README b/README deleted file mode 100644 index 77fad7a..0000000 --- a/README +++ /dev/null @@ -1,19 +0,0 @@ -This is an implementation of Packet Control Unit (PCU) according to TS 04.60 - -The PCU is part of BSS, so it connects directly to SGSN. - - -== Current limitations == - - * No PFC support - * No fixed allocation support - * No extended dynamic allocation support - * No unacknowledged mode operation - * Only single slot assignment on uplink direction - * No half-duplex class support (only semi-duplex) - * No handover support - * No measurement support - * No TA loop - * No power loop - * No CS loop - * No EGPRS diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed5ab17 --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +osmo-pcu - Osmocom Packet Control Unit +====================================== + +This repository contains a C/C++-language implementation of a GPRS +Packet Control Unit, as specified by ETSI/3GPP. It is part of the +[Osmocom](https://osmocom.org/) Open Source Mobile Communications +project. + +The Packet Control Unit is terminating the Layer 2 (RLC/MAC) of the GPRS +radio interface and adapting it to the Gb Interface (BSSGP+NS Protocol) +towards the SGSN. + +The PCU interfaces with the physical layer of the radio interface. +OsmoPCU is typically used co-located with the BTS, specifically +[OsmoBTS](https://osmocom.org/projects/osmobts/wiki). +For legacy BTSs that run proprietary sotware without an interface to +OsmoPCU, you may also co-locate it with the BSC, specifically +[OsmoBSC](https://osmocom.org/projects/openbsc/wiki/Osmo-bsc) + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/osmopcu/wiki/OsmoPCU + +GIT Repository +-------------- + +You can clone from the official osmo-pcu.git repository using + + git clone git://git.osmocom.org/osmo-pcu.git + +There is a cgit interface at http://git.osmocom.org/osmo-pcu/ + +Documentation +------------- + +We provide a +[user manual](http://ftp.osmocom.org/docs/latest/osmopcu-usermanual.pdf) +as well as a +[vty reference manual](http://ftp.osmocom.org/docs/latest/osmopcu-vty-reference.pdf) + +Please note that a lot of the PCU configuration actually happens inside +the BSC, which passes this configuration via A-bis OML to the BTS, which +then in turn passes it via the PCU socket into OsmoPCU. + +Mailing List +------------ + +Discussions related to osmo-pcu are happening on the +osmocom-net-gprs at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/osmocom-net-gprs for +subscription options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-pcu can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-pcu+status:open + + +Current limitations +------------------- + + * No PFC support + * No fixed allocation support + * No extended dynamic allocation support + * No unacknowledged mode operation + * Only single slot assignment on uplink direction + * No half-duplex class support (only semi-duplex) + * No TA loop + * No power loop -- To view, visit https://gerrit.osmocom.org/2114 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1967fbbdeadb967c0c0dce2c112ac692c539da1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:51:42 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:51:42 +0000 Subject: osmo-gsm-manuals[master]: osmo-sgsn: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2015 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:52:28 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:52:28 +0000 Subject: osmo-trx[master]: Add test program to verify convolution implementation In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2104 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic702ecb356c652fbcd76bee689717fb5d3526fe9 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 16:53:58 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 16:53:58 +0000 Subject: osmo-pcu[master]: Support sending OML Alerts via BTS In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 4 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:01:29 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 17 Mar 2017 17:01:29 +0000 Subject: [MERGED] osmo-pcu[master]: Support sending OML Alerts via BTS In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Support sending OML Alerts via BTS ...................................................................... Support sending OML Alerts via BTS * extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Note: requires corresponding change If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore. Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 --- M include/osmocom/pcu/pcuif_proto.h M src/encoding.cpp M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_l1_if.h 5 files changed, 71 insertions(+), 10 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h index 944f364..88dc09e 100644 --- a/include/osmocom/pcu/pcuif_proto.h +++ b/include/osmocom/pcu/pcuif_proto.h @@ -4,6 +4,7 @@ #include #define PCU_IF_VERSION 0x07 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -15,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -41,6 +43,16 @@ #define PCU_IF_FLAG_MCS7 (1 << 26) #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) + +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); struct gsm_pcu_if_data { uint8_t sapi; @@ -150,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; diff --git a/src/encoding.cpp b/src/encoding.cpp index ea38b77..2f052a4 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -320,6 +320,13 @@ return plen; } +static inline void log_alert_exit(const char * error) +{ + LOGP(DRLCMACUL, LOGL_ERROR, error); + pcu_tx_txt_ind(PCU_OML_ALERT, error); + exit(1); +} + /* * Immediate assignment, sent on the CCCH/AGCH * see GSM 04.08, 9.1.18 and GSM 44.018, 9.1.18 + 10.5.2.16 @@ -374,11 +381,10 @@ // A zero-length LV. Just write L=0. bitvec_write_field(dest, wp,0,8); - if ((wp % 8)) { - LOGP(DRLCMACUL, LOGL_ERROR, "Length of IMM.ASS without rest " - "octets is not multiple of 8 bits, PLEASE FIX!\n"); - exit (0); - } + if ((wp % 8)) + log_alert_exit("Length of IMM.ASS without rest octets is not " + "multiple of 8 bits, PLEASE FIX!\n"); + plen = wp / 8; if (downlink) @@ -618,11 +624,11 @@ { bitvec_write_field(dest, wp,ptmsi[i],8); // PTMSI } - if ((wp % 8)) { - LOGP(DRLCMACUL, LOGL_ERROR, "Length of PAG.REQ without rest " - "octets is not multiple of 8 bits, PLEASE FIX!\n"); - exit (0); - } + + if ((wp % 8)) + log_alert_exit("Length of PAG.REQ without rest octets is not " + "multiple of 8 bits, PLEASE FIX!\n"); + plen = wp / 8; bitvec_write_field(dest, wp,0x0,1); // "L" NLN(PCH) = off bitvec_write_field(dest, wp,0x0,1); // "L" Priority1 = off diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index d542b66..d7e55e7 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -287,6 +287,9 @@ pcu_sock_state = state; + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + return 0; } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index b892597..c16ac0c 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -73,6 +73,42 @@ return msg; } +const struct value_string gsm_pcu_if_text_type_names[] = { + OSMO_VALUE_STRING(PCU_VERSION), + OSMO_VALUE_STRING(PCU_OML_ALERT), + { 0, NULL } +}; + +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...) +{ + struct gsm_pcu_if *pcu_prim; + struct gsm_pcu_if_txt_ind *txt; + va_list ap; + char *rep; + struct msgb *msg = pcu_msgb_alloc(PCU_IF_MSG_TXT_IND, 0); + if (!msg) + return -ENOMEM; + + pcu_prim = (struct gsm_pcu_if *) msg->data; + txt = &pcu_prim->u.txt_ind; + txt->type = t; + + va_start(ap, fmt); + rep = talloc_vasprintf(tall_pcu_ctx, fmt, ap); + va_end(ap); + + if (!rep) + return -ENOMEM; + + osmo_strlcpy(txt->text, rep, TXT_MAX_LEN); + talloc_free(rep); + + LOGP(DL1IF, LOGL_INFO, "Sending %s TXT as %s to BTS\n", txt->text, + get_value_string(gsm_pcu_if_text_type_names, t)); + + return pcu_sock_send(msg); +} + static int pcu_tx_act_req(uint8_t trx, uint8_t ts, uint8_t activate) { struct msgb *msg; diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index eaa0143..1618260 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef __cplusplus } #endif @@ -131,6 +132,8 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi); +int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...); + int pcu_l1if_open(void); void pcu_l1if_close(void); -- To view, visit https://gerrit.osmocom.org/2071 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7 Gerrit-PatchSet: 5 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:03:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:03:50 +0000 Subject: osmo-bts[master]: README: update some of the limitations In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2116 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifec983e02ce517d4fe17d595b65312c53b0429b7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:03:51 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:03:51 +0000 Subject: osmo-bts[master]: README: Add general project information and convert to markdown In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2115 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icd9192833e1f95758c84cad85f0f0289ff4eb32a Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:03:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:03:54 +0000 Subject: [MERGED] osmo-bts[master]: README: Add general project information and convert to markdown In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README: Add general project information and convert to markdown ...................................................................... README: Add general project information and convert to markdown Also, make sure README.md is included in EXTRA_DIST Change-Id: Icd9192833e1f95758c84cad85f0f0289ff4eb32a --- M Makefile.am D README A README.md 3 files changed, 113 insertions(+), 58 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 0c252ac..9a5e26f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,4 +12,5 @@ contrib/sysmobts-calib/sysmobts-layer1.c \ contrib/sysmobts-calib/sysmobts-layer1.h \ doc/examples/sysmo/osmo-bts.cfg \ - doc/examples/sysmobts-mgr.cfg + doc/examples/sysmobts-mgr.cfg \ + README.md diff --git a/README b/README deleted file mode 100644 index 1fe6e8c..0000000 --- a/README +++ /dev/null @@ -1,57 +0,0 @@ -= Repository for the Osmocom BTS implementation. = - -For most complete and accurate information, please refer to -https://osmocom.org/projects/osmobts/wiki - -To submit patches, please refer to -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit -(Note: github pull requests are rejected by a bot) - -== Summary == - -This code implements Layer 2 and higher of a more or less conventional GSM BTS -(Base Transceiver Station) - however, using an Abis/IP interface, rather than -the old-fashioned E1/T1. - -Specifically, this includes - * BTS-side implementation of TS 08.58 (RSL) and TS 12.21 (OML) - * BTS-side implementation of LAPDm (using libosmocore/libosmogsm) - * A somewhat separated interface between those higher layer parts and the - Layer1 interface. - -Several kinds of BTS hardware are supported: - * sysmocom sysmoBTS - * Octasic octphy - * Nutaq litecell 1.5 - * software-defined radio based osmo-bts-trx (e.g. B210) - -== Known Limitations == - -As of August 20, 2015, the following known limitations exist in this -implementation: - -=== Common Core === - * No Extended BCCH support - * System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13 - * No RATSCCH in AMR - * No OML (TS 12.21) alarms yet (temperature, ...) - * Only single-TRX BTS at this point - * Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR - * No support for frequency hopping - * No reporting of interference levels as part of TS 08.58 RF RES IND - * No error reporting in case PAGING COMMAND fails due to queue overflow - * No use of TS 08.58 BS Power and MS Power parameters - * No support of TS 08.58 MultiRate Control - * No support of TS 08.58 Supported Codec Types - * No support of Bter frame / ENHANCED MEASUREMENT REPORT - -=== osmo-bts-sysmo === - * No CSD / ECSD support (not planned) - * GSM-R frequency band supported, but no NCH/ASCI/SoLSA - * All timeslots on one TRX have to use same training sequence (TSC) - * No multi-TRX support yet, though hardware+L1 support stacking - * Makes no use of 12.21 Intave Parameters and Interference - Level Boundaries - * Doesn't yet include MAC address in Abis/IP Identity message - * MphConfig.CNF can be returned to the wrong callback. E.g. with Tx Power - and ciphering. The dispatch should take a look at the hLayer3. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a5bf9fd --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +osmo-bts - Osmocom BTS Implementation +==================================== + +This repository contains a C-language implementation of a GSM Base +Transceiver Station (BTS). It is part of the +[Osmocom](https://osmocom.org/) Open Source Mobile Communications +project. + +This code implements Layer 2 and higher of a more or less conventional GSM BTS +(Base Transceiver Station) - however, using an Abis/IP interface, rather than +the old-fashioned E1/T1. + +Specifically, this includes + * BTS-side implementation of TS 08.58 (RSL) and TS 12.21 (OML) + * BTS-side implementation of LAPDm (using libosmocore/libosmogsm) + * A somewhat separated interface between those higher layer parts and the + Layer1 interface. + +Several kinds of BTS hardware are supported: + * sysmocom sysmoBTS + * Octasic octphy + * Nutaq litecell 1.5 + * software-defined radio based osmo-bts-trx (e.g. USRP B210, UmTRX) + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/osmobts/wiki + +GIT Repository +-------------- + +You can clone from the official osmo-bts.git repository using + + git clone git://git.osmocom.org/osmo-bts.git + +There is a cgit interface at http://git.osmocom.org/osmo-bts/ + +Documentation +------------- + +We provide a +[User Manual](http://ftp.osmocom.org/docs/latest/osmobts-usermanual.pdf) +as well as a +[VTY Reference Manual](http://ftp.osmocom.org/docs/latest/osmobsc-vty-reference.pdf) +and a +[Abis refrence MAnual](http://ftp.osmocom.org/docs/latest/osmobts-abis.pdf) +describing the OsmoBTS specific A-bis dialect. + +Mailing List +------------ + +Discussions related to osmo-bts are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-bts can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-bts+status:open + +Known Limitations +================= + +As of August 20, 2015, the following known limitations exist in this +implementation: + +Common Core +----------- + + * No Extended BCCH support + * System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13 + * No RATSCCH in AMR + * No OML (TS 12.21) alarms yet (temperature, ...) + * Only single-TRX BTS at this point + * Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR + * No support for frequency hopping + * No reporting of interference levels as part of TS 08.58 RF RES IND + * No error reporting in case PAGING COMMAND fails due to queue overflow + * No use of TS 08.58 BS Power and MS Power parameters + * No support of TS 08.58 MultiRate Control + * No support of TS 08.58 Supported Codec Types + * No support of Bter frame / ENHANCED MEASUREMENT REPORT + +osmo-bts-sysmo +-------------- + + * No CSD / ECSD support (not planned) + * GSM-R frequency band supported, but no NCH/ASCI/SoLSA + * All timeslots on one TRX have to use same training sequence (TSC) + * No multi-TRX support yet, though hardware+L1 support stacking + * Makes no use of 12.21 Intave Parameters and Interference + Level Boundaries + * Doesn't yet include MAC address in Abis/IP Identity message + * MphConfig.CNF can be returned to the wrong callback. E.g. with Tx Power + and ciphering. The dispatch should take a look at the hLayer3. -- To view, visit https://gerrit.osmocom.org/2115 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icd9192833e1f95758c84cad85f0f0289ff4eb32a Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:03:55 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:03:55 +0000 Subject: [MERGED] osmo-bts[master]: README: update some of the limitations In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README: update some of the limitations ...................................................................... README: update some of the limitations Change-Id: Ifec983e02ce517d4fe17d595b65312c53b0429b7 --- M README.md 1 file changed, 20 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/README.md b/README.md index a5bf9fd..43c27b2 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Known Limitations ================= -As of August 20, 2015, the following known limitations exist in this +As of March 17, 2017, the following known limitations exist in this implementation: Common Core @@ -86,8 +86,6 @@ * No Extended BCCH support * System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13 * No RATSCCH in AMR - * No OML (TS 12.21) alarms yet (temperature, ...) - * Only single-TRX BTS at this point * Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR * No support for frequency hopping * No reporting of interference levels as part of TS 08.58 RF RES IND @@ -106,6 +104,24 @@ * No multi-TRX support yet, though hardware+L1 support stacking * Makes no use of 12.21 Intave Parameters and Interference Level Boundaries - * Doesn't yet include MAC address in Abis/IP Identity message * MphConfig.CNF can be returned to the wrong callback. E.g. with Tx Power and ciphering. The dispatch should take a look at the hLayer3. + +osmo-bts-octphy +--------------- + + * No support of EFR, HR voice codec (lack of PHY support?) + * No re-transmission of PHY primitives in case of time-out + * Link Quality / Measurement processing incomplete + * impossible to modify encryption parameters using RSL MODE MODIFY + * no clear indication of nominal transmit power, various power related + computations are likely off + * no OML attribute validation during bts_model_check_oml() + +osmo-bts-trx +------------ + + * TCH/F_PDCH cannel not working as voice (https://osmocom.org/issues/1865) + * No BER value delivered to OsmoPCU (https://osmocom.org/issues/1855) + * No 11bit RACH support (https://osmocom.org/issues/1854) + * No CBCH support (https://osmocom.org/issues/1617) -- To view, visit https://gerrit.osmocom.org/2116 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifec983e02ce517d4fe17d595b65312c53b0429b7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:05:26 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 17 Mar 2017 17:05:26 +0000 Subject: [PATCH] osmo-bts[master]: Sync protocol with OsmoPCU In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2086 to look at the new patch set (#2). Sync protocol with OsmoPCU Copy-paste changes from OsmoPCU commit 0a8fae8d141c2cfa4387ffe9b35402d5b8cc85cd. Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 --- M include/osmo-bts/pcuif_proto.h 1 file changed, 19 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/86/2086/2 diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index 5527238..88dc09e 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -1,7 +1,10 @@ #ifndef _PCUIF_PROTO_H #define _PCUIF_PROTO_H +#include + #define PCU_IF_VERSION 0x07 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -13,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -40,6 +44,16 @@ #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); + struct gsm_pcu_if_data { uint8_t sapi; uint8_t len; @@ -50,9 +64,9 @@ uint8_t ts_nr; uint8_t block_nr; int8_t rssi; - uint16_t ber10k; /*!< \brief BER in units of 0.01% */ - int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ - int16_t lqual_cb; /* !< \brief Link quality in centiBel */ + uint16_t ber10k; /*!< \brief BER in units of 0.01% */ + int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ + int16_t lqual_cb; /* !< \brief Link quality in centiBel */ } __attribute__ ((packed)); struct gsm_pcu_if_rts_req { @@ -72,7 +86,7 @@ uint32_t fn; uint16_t arfcn; uint8_t is_11bit; - uint8_t burst_type; + uint8_t burst_type; } __attribute__ ((packed)); struct gsm_pcu_if_info_trx { @@ -148,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; -- To view, visit https://gerrit.osmocom.org/2086 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:21:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:21:08 +0000 Subject: [PATCH] osmo-iuh[master]: Update README with project related information and convert t... Message-ID: Review at https://gerrit.osmocom.org/2117 Update README with project related information and convert to Markdown Also, include it in 'make dist' tarballs. Change-Id: Ia28743b7ea3510097f841f83d2eca2669b4d73ea --- M Makefile.am D README A README.md 3 files changed, 104 insertions(+), 47 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/17/2117/1 diff --git a/Makefile.am b/Makefile.am index ab8191e..447b148 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-ranap.pc -EXTRA_DIST = asn1 .version +EXTRA_DIST = asn1 .version README.md BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: diff --git a/README b/README deleted file mode 100644 index f24f676..0000000 --- a/README +++ /dev/null @@ -1,46 +0,0 @@ -Osmocom Iuh experimentation code -(C) 2015 by Harald Welte - -This code is a playground for implementing something along the lines of -the an Iuh interface of a HNB-GW. The intent is to later integrate this -with OsmoNITB + OsmoSGSN, in order to have 3G capable 'network in the -box'. - -h1. Building - -As external library dependencies, you will need -* libosmocore from git://git.osmocom.org/libosmocore -* libasn1c from git://git.osmocom.org/libasn1c -* libsctp-dev (this is the package name in Debian) -* libosmo-netif from git://git.osmocom.org/libosmo-netif (sysmocom/sctp branch) -* libosmo-sccp from git://git.osmocom.org/libosmo-sccp (sysmocom/iu branch) - -To bootstrap the build, in the root directory, run: - - autoreconf --install - -After that, run the usual - - ./configure [options] - make - [sudo] make install - -h1. Using - -Note: osmo-iuh is in active development (December 2015, January 2016) so below -statements may outdate rapidly. - -there's not much to use yet. But if you run the 'hnbgw' executable, -it will open a listening SCTP socket and wait for incoming Iuh -connections. It will accept any HNB-REGISTER-REQUEST, so the homeNodeB -should start to establish RUA and RANAP (which we haven't implemented -yet). - -h1. Regenerating C code from ASN.1 source - -In order to re-generate the C source code from the ASN.1 source, -you will need a modified asn1c which has the following features: -* APER support (the patch from Eurecom, or its forward-ported version - from the aper branch of git://git.osmocom.org/asn1c) -* support for prefixing the generated types (aper-prefix branch of - git://git.osmocom.org/asn1c) diff --git a/README.md b/README.md new file mode 100644 index 0000000..edbde9f --- /dev/null +++ b/README.md @@ -0,0 +1,103 @@ +osmo-iuh - Osmocom Iuh and HNB-GW implementation +================================================ + +This repository contains a C-language implementation of the 3GPP Iuh +interface, together with a HNB-GW (Home NodeB Gateway). You can use it +to interface Iuh-speaking femtocells/small cells to Iu-speaking MSCs and +SGSNs. + +It is part of the [Osmocom](https://osmocom.org/) Open Source Mobile +Communications project. + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/osmohnbgw/wiki + +GIT Repository +-------------- + +You can clone from the official libosmocore.git repository using + + git clone git://git.osmocom.org/osmo-iuh.git + +There is a cgit interface at http://git.osmocom.org/osmo-iuh/ + +Documentation +------------- + +There is currently no documentation beyond the wiki available on the +homepage. We would love to see somebody contributing a manual that can +be part of the osmo-gsm-manuals suite. + +Mailing List +------------ + +Discussions related to osmo-iuh are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-iuh can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-iuh+status:open + + +Building +-------- + +It is generally best to check the wiki for the most up-to-date build +instructions. + +As external library dependencies, you will need +* libosmocore from git://git.osmocom.org/libosmocore +* libasn1c from git://git.osmocom.org/libasn1c +* libsctp-dev (this is the package name in Debian) +* libosmo-netif from git://git.osmocom.org/libosmo-netif (sysmocom/sctp branch) +* libosmo-sccp from git://git.osmocom.org/libosmo-sccp (sysmocom/iu branch) + +To bootstrap the build, in the root directory, run: + + autoreconf --install + +After that, run the usual + + ./configure [options] + make + [sudo] make install + +Using +----- + +Note: osmo-iuh just left very active development (December 2015, January +2016), so your mileage may vary. + +If you run the 'hnbgw' executable, it will open a listening SCTP socket +and wait for incoming Iuh connections. It will accept any +HNB-REGISTER-REQUEST, and it will establish Iu (over SUA) connections +towards the MSC and SGSN. + +Regenerating C code from ASN.1 source +------------------------------------- + +In order to re-generate the C source code from the ASN.1 source, +you will need a modified asn1c which has the following features: +* APER support (the patch from Eurecom, or its forward-ported version + from the aper branch of git://git.osmocom.org/asn1c) +* support for prefixing the generated types (aper-prefix branch of + git://git.osmocom.org/asn1c) -- To view, visit https://gerrit.osmocom.org/2117 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia28743b7ea3510097f841f83d2eca2669b4d73ea Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:37:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:37:00 +0000 Subject: [PATCH] openggsn[master]: Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs Message-ID: Review at https://gerrit.osmocom.org/2118 Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs Change-Id: Ibbae061fda3db49f8ecda263cfc3ca6873c0b1b3 --- M Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/18/2118/1 diff --git a/Makefile.am b/Makefile.am index 960ca07..12a9a82 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,5 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgtp.pc + +EXTRA_DIST = README README.FreeBSD README.MacOSX README.Solaris -- To view, visit https://gerrit.osmocom.org/2118 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibbae061fda3db49f8ecda263cfc3ca6873c0b1b3 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:37:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:37:00 +0000 Subject: [PATCH] openggsn[master]: Update README with general project information + convert to ... Message-ID: Review at https://gerrit.osmocom.org/2119 Update README with general project information + convert to Markdown Change-Id: Ib4213388dffab125e75d9b1f7d72319e041059ea --- M Makefile.am R README.md 2 files changed, 70 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/19/2119/1 diff --git a/Makefile.am b/Makefile.am index 12a9a82..8232770 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,4 +4,4 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgtp.pc -EXTRA_DIST = README README.FreeBSD README.MacOSX README.Solaris +EXTRA_DIST = README.md README.FreeBSD README.MacOSX README.Solaris diff --git a/README b/README.md similarity index 84% rename from README rename to README.md index 9084d8f..8e4ceae 100644 --- a/README +++ b/README.md @@ -1,3 +1,61 @@ +OpenGGSN - Open Source GGSN +=========================== + +This repository contains a C-language implementation of a GGSN (Gateway +GPRS Support Node), a core network element of ETSI/3GPP cellular +networks such as GPRS, EDGE, UMTS or HSPA. + +OpenGGSN is part of the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects, even thogh it was previously developed +by Mondru AB. + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/openggsn/wiki + +GIT Repository +-------------- + +You can clone from the official libosmocore.git repository using + + git clone git://git.osmocom.org/openggsn.git + +There is a cgit interface at http://git.osmocom.org/openggsn/ + +Documentation +------------- + +There currently is no other documentation other than the wiki on the +homepage. It would be great if somebody would work towards a user +manual that can become part of the osmo-gsm-manuals project. + +Mailing List +------------ + +Discussions related to openggsn are happening on the +osmocom-net-gprs at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/osmocom-net-gprs for +subscription options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for OpenGGSN can be seen at +https://gerrit.osmocom.org/#/q/project:openggsn+status:open OPENGGSN README =============== @@ -5,19 +63,19 @@ QuickStart ========== - Requirements ------------ *Linux* -OpenGGSN was developed and tested using Redhat 8.0 and 9.0. It should -run also on other Linux distributions as well as FreeBSD, but this is +OpenGGSN was originally developed and tested using Redhat 8.0 and 9.0 +and is these days mostly developed on Debian GNU/Linux. It should run +also on other Linux distributions as well as FreeBSD, but this is untested. Compilation on Solaris 2.8 has also been verified. *Tun* -The tun driver is required for proper operation of openggsn. For linux -kernels later than 2.4.7 the driver is typically included, but need -to be configured for automatic loading: +The tun driver is required for proper operation of openggsn. For Linux +kernels later than 2.4.7 the driver is typically included, but might +need to be configured for automatic loading: 1. Add the following line to /etc/modules.conf: alias char-major-10-200 tun 2. depmod -a @@ -26,10 +84,10 @@ Installation from binary ------------------------ -rpm -i openggsn-.rpm - -This will install binaries, man pages, configuration files as well as -a Sys V init script for the ggsn. +OpenGGSN is built for common versions of Debian and Ubuntu as part of +the [Osmocom Nightly Builds](https://osmocom.org/projects/cellular-infrastructure/wiki/Nightly_Builds) +project. If you don't want to do development, it is suggested to simply +use those binary packages, rather than building yourself from source. Installation from source @@ -77,7 +135,7 @@ Support ------- -If you have any questions drop me a line at jj at openggsn.org. +Please contact the Mailing List above for community-based support. Features @@ -336,7 +394,6 @@ sgsnemu will print something like the following on the screen: -
 
   Using DNS server:      10.20.38.51 (10.20.38.51)
   Local IP address is:   10.0.0.50 (10.0.0.50)
@@ -353,8 +410,6 @@
   Waiting for response from ggsn........
 
   Received echo response. Cause value: 0
-
-
This is quite good. It means that you managed to send off an echo request to a remote GGSN, and it was friendly enough to answer you. If @@ -375,8 +430,6 @@ sgsnemu --listen 10.0.0.50 --remote 10.0.0.40 --dns 10.20.38.51 --timelimit 10 --contexts 1 --apn internet --imsi 240011234567890 --msisdn 46702123456 --createif --defaultroute sgsnemu will print something like the following on the screen: - -
 
   Using DNS server:      10.20.38.51 (10.20.38.51)
   Local IP address is:   10.0.0.50 (10.0.0.50)
@@ -399,7 +452,6 @@
   /sbin/ifconfig tun0 192.168.0.1
   /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
 
-
Now a context is established to the remote GGSN. The IP address of the context is 192.168.0.1. You should be able to ping a known address on @@ -419,11 +471,7 @@ following messages from sgsnemu: -
-
   Disconnecting PDP context #0
   Received delete PDP context response. Cause value: 128
   Deleting tun interface
-
-
-- To view, visit https://gerrit.osmocom.org/2119 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib4213388dffab125e75d9b1f7d72319e041059ea Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:37:21 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:37:21 +0000 Subject: osmo-iuh[master]: Update README with project related information and convert t... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2117 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia28743b7ea3510097f841f83d2eca2669b4d73ea Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:37:23 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:37:23 +0000 Subject: [MERGED] osmo-iuh[master]: Update README with project related information and convert t... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Update README with project related information and convert to Markdown ...................................................................... Update README with project related information and convert to Markdown Also, include it in 'make dist' tarballs. Change-Id: Ia28743b7ea3510097f841f83d2eca2669b4d73ea --- M Makefile.am D README A README.md 3 files changed, 104 insertions(+), 47 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index ab8191e..447b148 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-ranap.pc -EXTRA_DIST = asn1 .version +EXTRA_DIST = asn1 .version README.md BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: diff --git a/README b/README deleted file mode 100644 index f24f676..0000000 --- a/README +++ /dev/null @@ -1,46 +0,0 @@ -Osmocom Iuh experimentation code -(C) 2015 by Harald Welte - -This code is a playground for implementing something along the lines of -the an Iuh interface of a HNB-GW. The intent is to later integrate this -with OsmoNITB + OsmoSGSN, in order to have 3G capable 'network in the -box'. - -h1. Building - -As external library dependencies, you will need -* libosmocore from git://git.osmocom.org/libosmocore -* libasn1c from git://git.osmocom.org/libasn1c -* libsctp-dev (this is the package name in Debian) -* libosmo-netif from git://git.osmocom.org/libosmo-netif (sysmocom/sctp branch) -* libosmo-sccp from git://git.osmocom.org/libosmo-sccp (sysmocom/iu branch) - -To bootstrap the build, in the root directory, run: - - autoreconf --install - -After that, run the usual - - ./configure [options] - make - [sudo] make install - -h1. Using - -Note: osmo-iuh is in active development (December 2015, January 2016) so below -statements may outdate rapidly. - -there's not much to use yet. But if you run the 'hnbgw' executable, -it will open a listening SCTP socket and wait for incoming Iuh -connections. It will accept any HNB-REGISTER-REQUEST, so the homeNodeB -should start to establish RUA and RANAP (which we haven't implemented -yet). - -h1. Regenerating C code from ASN.1 source - -In order to re-generate the C source code from the ASN.1 source, -you will need a modified asn1c which has the following features: -* APER support (the patch from Eurecom, or its forward-ported version - from the aper branch of git://git.osmocom.org/asn1c) -* support for prefixing the generated types (aper-prefix branch of - git://git.osmocom.org/asn1c) diff --git a/README.md b/README.md new file mode 100644 index 0000000..edbde9f --- /dev/null +++ b/README.md @@ -0,0 +1,103 @@ +osmo-iuh - Osmocom Iuh and HNB-GW implementation +================================================ + +This repository contains a C-language implementation of the 3GPP Iuh +interface, together with a HNB-GW (Home NodeB Gateway). You can use it +to interface Iuh-speaking femtocells/small cells to Iu-speaking MSCs and +SGSNs. + +It is part of the [Osmocom](https://osmocom.org/) Open Source Mobile +Communications project. + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/osmohnbgw/wiki + +GIT Repository +-------------- + +You can clone from the official libosmocore.git repository using + + git clone git://git.osmocom.org/osmo-iuh.git + +There is a cgit interface at http://git.osmocom.org/osmo-iuh/ + +Documentation +------------- + +There is currently no documentation beyond the wiki available on the +homepage. We would love to see somebody contributing a manual that can +be part of the osmo-gsm-manuals suite. + +Mailing List +------------ + +Discussions related to osmo-iuh are happening on the +openbsc at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/openbsc for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for osmo-iuh can be seen at +https://gerrit.osmocom.org/#/q/project:osmo-iuh+status:open + + +Building +-------- + +It is generally best to check the wiki for the most up-to-date build +instructions. + +As external library dependencies, you will need +* libosmocore from git://git.osmocom.org/libosmocore +* libasn1c from git://git.osmocom.org/libasn1c +* libsctp-dev (this is the package name in Debian) +* libosmo-netif from git://git.osmocom.org/libosmo-netif (sysmocom/sctp branch) +* libosmo-sccp from git://git.osmocom.org/libosmo-sccp (sysmocom/iu branch) + +To bootstrap the build, in the root directory, run: + + autoreconf --install + +After that, run the usual + + ./configure [options] + make + [sudo] make install + +Using +----- + +Note: osmo-iuh just left very active development (December 2015, January +2016), so your mileage may vary. + +If you run the 'hnbgw' executable, it will open a listening SCTP socket +and wait for incoming Iuh connections. It will accept any +HNB-REGISTER-REQUEST, and it will establish Iu (over SUA) connections +towards the MSC and SGSN. + +Regenerating C code from ASN.1 source +------------------------------------- + +In order to re-generate the C source code from the ASN.1 source, +you will need a modified asn1c which has the following features: +* APER support (the patch from Eurecom, or its forward-ported version + from the aper branch of git://git.osmocom.org/asn1c) +* support for prefixing the generated types (aper-prefix branch of + git://git.osmocom.org/asn1c) -- To view, visit https://gerrit.osmocom.org/2117 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia28743b7ea3510097f841f83d2eca2669b4d73ea Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:37:46 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:37:46 +0000 Subject: libosmo-netif[master]: stream: don't crash in _close() when fd is not initialized In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2111 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:37:53 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:37:53 +0000 Subject: libosmo-netif[master]: stream: Export osmo_stream_cli_reconnect() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2113 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41314bad4a9f44e8a61b9d2ba33d1a76b25bd145 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:47:38 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:47:38 +0000 Subject: openggsn[master]: Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2118 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibbae061fda3db49f8ecda263cfc3ca6873c0b1b3 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:47:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:47:41 +0000 Subject: openggsn[master]: Update README with general project information + convert to ... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2119 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib4213388dffab125e75d9b1f7d72319e041059ea Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:47:42 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:47:42 +0000 Subject: [MERGED] openggsn[master]: Update README with general project information + convert to ... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Update README with general project information + convert to Markdown ...................................................................... Update README with general project information + convert to Markdown Change-Id: Ib4213388dffab125e75d9b1f7d72319e041059ea --- M Makefile.am R README.md 2 files changed, 70 insertions(+), 22 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 12a9a82..8232770 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,4 +4,4 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgtp.pc -EXTRA_DIST = README README.FreeBSD README.MacOSX README.Solaris +EXTRA_DIST = README.md README.FreeBSD README.MacOSX README.Solaris diff --git a/README b/README.md similarity index 84% rename from README rename to README.md index 9084d8f..8e4ceae 100644 --- a/README +++ b/README.md @@ -1,3 +1,61 @@ +OpenGGSN - Open Source GGSN +=========================== + +This repository contains a C-language implementation of a GGSN (Gateway +GPRS Support Node), a core network element of ETSI/3GPP cellular +networks such as GPRS, EDGE, UMTS or HSPA. + +OpenGGSN is part of the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects, even thogh it was previously developed +by Mondru AB. + +Homepage +-------- + +The official homepage of the project is +https://osmocom.org/projects/openggsn/wiki + +GIT Repository +-------------- + +You can clone from the official libosmocore.git repository using + + git clone git://git.osmocom.org/openggsn.git + +There is a cgit interface at http://git.osmocom.org/openggsn/ + +Documentation +------------- + +There currently is no other documentation other than the wiki on the +homepage. It would be great if somebody would work towards a user +manual that can become part of the osmo-gsm-manuals project. + +Mailing List +------------ + +Discussions related to openggsn are happening on the +osmocom-net-gprs at lists.osmocom.org mailing list, please see +https://lists.osmocom.org/mailman/listinfo/osmocom-net-gprs for +subscription options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at +https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + +We us a gerrit based patch submission/review process for managing +contributions. Please see +https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for +more details + +The current patch queue for OpenGGSN can be seen at +https://gerrit.osmocom.org/#/q/project:openggsn+status:open OPENGGSN README =============== @@ -5,19 +63,19 @@ QuickStart ========== - Requirements ------------ *Linux* -OpenGGSN was developed and tested using Redhat 8.0 and 9.0. It should -run also on other Linux distributions as well as FreeBSD, but this is +OpenGGSN was originally developed and tested using Redhat 8.0 and 9.0 +and is these days mostly developed on Debian GNU/Linux. It should run +also on other Linux distributions as well as FreeBSD, but this is untested. Compilation on Solaris 2.8 has also been verified. *Tun* -The tun driver is required for proper operation of openggsn. For linux -kernels later than 2.4.7 the driver is typically included, but need -to be configured for automatic loading: +The tun driver is required for proper operation of openggsn. For Linux +kernels later than 2.4.7 the driver is typically included, but might +need to be configured for automatic loading: 1. Add the following line to /etc/modules.conf: alias char-major-10-200 tun 2. depmod -a @@ -26,10 +84,10 @@ Installation from binary ------------------------ -rpm -i openggsn-.rpm - -This will install binaries, man pages, configuration files as well as -a Sys V init script for the ggsn. +OpenGGSN is built for common versions of Debian and Ubuntu as part of +the [Osmocom Nightly Builds](https://osmocom.org/projects/cellular-infrastructure/wiki/Nightly_Builds) +project. If you don't want to do development, it is suggested to simply +use those binary packages, rather than building yourself from source. Installation from source @@ -77,7 +135,7 @@ Support ------- -If you have any questions drop me a line at jj at openggsn.org. +Please contact the Mailing List above for community-based support. Features @@ -336,7 +394,6 @@ sgsnemu will print something like the following on the screen: -
 
   Using DNS server:      10.20.38.51 (10.20.38.51)
   Local IP address is:   10.0.0.50 (10.0.0.50)
@@ -353,8 +410,6 @@
   Waiting for response from ggsn........
 
   Received echo response. Cause value: 0
-
-
This is quite good. It means that you managed to send off an echo request to a remote GGSN, and it was friendly enough to answer you. If @@ -375,8 +430,6 @@ sgsnemu --listen 10.0.0.50 --remote 10.0.0.40 --dns 10.20.38.51 --timelimit 10 --contexts 1 --apn internet --imsi 240011234567890 --msisdn 46702123456 --createif --defaultroute sgsnemu will print something like the following on the screen: - -
 
   Using DNS server:      10.20.38.51 (10.20.38.51)
   Local IP address is:   10.0.0.50 (10.0.0.50)
@@ -399,7 +452,6 @@
   /sbin/ifconfig tun0 192.168.0.1
   /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
 
-
Now a context is established to the remote GGSN. The IP address of the context is 192.168.0.1. You should be able to ping a known address on @@ -419,11 +471,7 @@ following messages from sgsnemu: -
-
   Disconnecting PDP context #0
   Received delete PDP context response. Cause value: 128
   Deleting tun interface
-
-
-- To view, visit https://gerrit.osmocom.org/2119 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib4213388dffab125e75d9b1f7d72319e041059ea Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 17:47:42 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 17:47:42 +0000 Subject: [MERGED] openggsn[master]: Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs ...................................................................... Add MAkefile.* to EXTRA_DIST to ensure they end up in tarballs Change-Id: Ibbae061fda3db49f8ecda263cfc3ca6873c0b1b3 --- M Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 960ca07..12a9a82 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,5 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgtp.pc + +EXTRA_DIST = README README.FreeBSD README.MacOSX README.Solaris -- To view, visit https://gerrit.osmocom.org/2118 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibbae061fda3db49f8ecda263cfc3ca6873c0b1b3 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From admin at opensuse.org Fri Mar 17 19:53:01 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:53:01 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cc3ec1d9786_6ce5ddc0c330858@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 203s] | ## ---------------------- ## [ 203s] | [ 203s] | This file was extended by libosmocore config.status 0.9.6.20170317, which was [ 203s] | generated by GNU Autoconf 2.69. Invocation command line was [ 203s] | [ 203s] | CONFIG_FILES = [ 203s] | CONFIG_HEADERS = [ 203s] | CONFIG_LINKS = [ 203s] | CONFIG_COMMANDS = [ 203s] | $ ./config.status Doxyfile.core [ 203s] | [ 203s] | on lamb13 [ 203s] | [ 203s] | config.status:1156: creating Doxyfile.core [ 203s] [ 203s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 203s] make[1]: *** [override_dh_auto_test] Error 1 [ 203s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 203s] debian/rules:15: recipe for target 'build' failed [ 203s] make: *** [build] Error 2 [ 203s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 204s] [ 204s] lamb13 failed "build libosmocore_0.9.6.20170317.dsc" at Fri Mar 17 19:52:56 UTC 2017. [ 204s] [ 204s] ### VM INTERACTION START ### [ 207s] ### VM INTERACTION END ### [ 207s] [ 207s] lamb13 failed "build libosmocore_0.9.6.20170317.dsc" at Fri Mar 17 19:53:00 UTC 2017. [ 207s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:54:10 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:54:10 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cc3f1b2e148_6ce5ddc0c332348@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/i586 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 256s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 256s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 256s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 256s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 256s] CK: e740c156278705a14e1a99ba6d31334f [ 256s] RES: 7c04e86a67967fcd [ 256s] SRES: 1b9297a7 [ 256s] Kc: 10687b71e4eb94c5 [ 256s] -SQN: 281474976710655 [ 256s] +SQN: 4294967295 [ 256s] [ 256s] [ 256s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 256s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 256s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 256s] make[1]: *** [override_dh_auto_test] Error 1 [ 256s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 256s] debian/rules:15: recipe for target 'build' failed [ 256s] make: *** [build] Error 2 [ 256s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 256s] [ 256s] cloud128 failed "build libosmocore_0.9.6.20170317.dsc" at Fri Mar 17 19:54:02 UTC 2017. [ 256s] [ 256s] ### VM INTERACTION START ### [ 257s] Powering off. [ 259s] ### VM INTERACTION END ### [ 259s] [ 259s] cloud128 failed "build libosmocore_0.9.6.20170317.dsc" at Fri Mar 17 19:54:05 UTC 2017. [ 259s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:55:36 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:55:36 +0000 Subject: Build failure of network:osmocom:nightly/openggsn in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cc3f818e2ee_6d45ddc0c3097e1@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openggsn/xUbuntu_16.04/i586 Package network:osmocom:nightly/openggsn failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly openggsn Last lines of build log: [ 114s] make[3]: Entering directory '/usr/src/packages/BUILD/doc' [ 114s] make[3]: Nothing to be done for 'install-exec-am'. [ 114s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 114s] /usr/bin/install -c -m 644 ggsn.8 sgsnemu.8 '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 114s] make[3]: Leaving directory '/usr/src/packages/BUILD/doc' [ 114s] make[2]: Leaving directory '/usr/src/packages/BUILD/doc' [ 114s] make[2]: Entering directory '/usr/src/packages/BUILD' [ 114s] make[3]: Entering directory '/usr/src/packages/BUILD' [ 114s] make[3]: Nothing to be done for 'install-exec-am'. [ 114s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/lib/i386-linux-gnu/pkgconfig' [ 114s] /usr/bin/install -c -m 644 libgtp.pc '/usr/src/packages/BUILD/debian/tmp/usr/lib/i386-linux-gnu/pkgconfig' [ 114s] make[3]: Leaving directory '/usr/src/packages/BUILD' [ 114s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 114s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 114s] dh_install [ 114s] dh_installdocs [ 114s] cp: cannot stat 'README': No such file or directory [ 114s] dh_installdocs: cp --reflink=auto -a README debian/openggsn/usr/share/doc/openggsn returned exit code 1 [ 114s] debian/rules:11: recipe for target 'binary' failed [ 114s] make: *** [binary] Error 2 [ 114s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 114s] [ 114s] build81 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:55:16 UTC 2017. [ 114s] [ 114s] ### VM INTERACTION START ### [ 118s] ### VM INTERACTION END ### [ 118s] [ 118s] build81 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:55:21 UTC 2017. [ 118s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:56:10 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:56:10 +0000 Subject: Build failure of network:osmocom:nightly/openggsn in xUbuntu_16.04/x86_64 In-Reply-To: References: Message-ID: <58cc3fa9efb69_6ce5ddc0c33636a@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openggsn/xUbuntu_16.04/x86_64 Package network:osmocom:nightly/openggsn failed to build in xUbuntu_16.04/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly openggsn Last lines of build log: [ 125s] make[3]: Nothing to be done for 'install-exec-am'. [ 125s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 125s] /usr/bin/install -c -m 644 ggsn.8 sgsnemu.8 '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 125s] make[3]: Leaving directory '/usr/src/packages/BUILD/doc' [ 125s] make[2]: Leaving directory '/usr/src/packages/BUILD/doc' [ 125s] make[2]: Entering directory '/usr/src/packages/BUILD' [ 125s] make[3]: Entering directory '/usr/src/packages/BUILD' [ 125s] make[3]: Nothing to be done for 'install-exec-am'. [ 125s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig' [ 125s] /usr/bin/install -c -m 644 libgtp.pc '/usr/src/packages/BUILD/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig' [ 125s] make[3]: Leaving directory '/usr/src/packages/BUILD' [ 125s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 125s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 125s] dh_install [ 125s] dh_installdocs [ 125s] cp: cannot stat 'README': No such file or directory [ 125s] dh_installdocs: cp --reflink=auto -a README debian/openggsn/usr/share/doc/openggsn returned exit code 1 [ 125s] debian/rules:11: recipe for target 'binary' failed [ 125s] make: *** [binary] Error 2 [ 125s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 125s] [ 125s] lamb58 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:55:52 UTC 2017. [ 125s] [ 125s] ### VM INTERACTION START ### [ 128s] [ 116.313211] reboot: Power down [ 128s] ### VM INTERACTION END ### [ 128s] [ 128s] lamb58 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:55:55 UTC 2017. [ 128s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:56:27 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:56:27 +0000 Subject: Build failure of network:osmocom:nightly/openggsn in Debian_8.0/x86_64 In-Reply-To: References: Message-ID: <58cc3facca5e3_6ce5ddc0c337418@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openggsn/Debian_8.0/x86_64 Package network:osmocom:nightly/openggsn failed to build in Debian_8.0/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly openggsn Last lines of build log: [ 97s] make[3]: Nothing to be done for 'install-exec-am'. [ 97s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 97s] /usr/bin/install -c -m 644 ggsn.8 sgsnemu.8 '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 97s] make[3]: Leaving directory '/usr/src/packages/BUILD/doc' [ 97s] make[2]: Leaving directory '/usr/src/packages/BUILD/doc' [ 97s] make[2]: Entering directory '/usr/src/packages/BUILD' [ 97s] make[3]: Entering directory '/usr/src/packages/BUILD' [ 97s] make[3]: Nothing to be done for 'install-exec-am'. [ 97s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig' [ 97s] /usr/bin/install -c -m 644 libgtp.pc '/usr/src/packages/BUILD/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig' [ 97s] make[3]: Leaving directory '/usr/src/packages/BUILD' [ 97s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 97s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 97s] dh_install [ 97s] dh_installdocs [ 97s] cp: cannot stat 'README': No such file or directory [ 97s] dh_installdocs: cp -a README debian/openggsn/usr/share/doc/openggsn returned exit code 1 [ 97s] debian/rules:11: recipe for target 'binary' failed [ 97s] make: *** [binary] Error 2 [ 97s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 97s] [ 97s] build80 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:56:18 UTC 2017. [ 97s] [ 97s] ### VM INTERACTION START ### [ 98s] Powering off. [ 98s] ### VM INTERACTION END ### [ 98s] [ 98s] build80 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:56:20 UTC 2017. [ 98s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:56:27 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:56:27 +0000 Subject: Build failure of network:osmocom:nightly/openggsn in xUbuntu_16.10/x86_64 In-Reply-To: References: Message-ID: <58cc3fab263cb_6ce5ddc0c3370fc@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openggsn/xUbuntu_16.10/x86_64 Package network:osmocom:nightly/openggsn failed to build in xUbuntu_16.10/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly openggsn Last lines of build log: [ 91s] make[3]: Nothing to be done for 'install-exec-am'. [ 91s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 91s] /usr/bin/install -c -m 644 ggsn.8 sgsnemu.8 '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 91s] make[3]: Leaving directory '/usr/src/packages/BUILD/doc' [ 91s] make[2]: Leaving directory '/usr/src/packages/BUILD/doc' [ 91s] make[2]: Entering directory '/usr/src/packages/BUILD' [ 91s] make[3]: Entering directory '/usr/src/packages/BUILD' [ 91s] make[3]: Nothing to be done for 'install-exec-am'. [ 91s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig' [ 91s] /usr/bin/install -c -m 644 libgtp.pc '/usr/src/packages/BUILD/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig' [ 91s] make[3]: Leaving directory '/usr/src/packages/BUILD' [ 91s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 91s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 91s] dh_install [ 91s] dh_installdocs [ 91s] cp: cannot stat 'README': No such file or directory [ 91s] dh_installdocs: cp --reflink=auto -a README debian/openggsn/usr/share/doc/openggsn returned exit code 1 [ 91s] debian/rules:11: recipe for target 'binary' failed [ 91s] make: *** [binary] Error 2 [ 91s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 91s] [ 91s] lamb08 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:56:07 UTC 2017. [ 91s] [ 91s] ### VM INTERACTION START ### [ 95s] [ 81.315714] reboot: Power down [ 95s] ### VM INTERACTION END ### [ 95s] [ 95s] lamb08 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:56:11 UTC 2017. [ 95s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:57:01 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:57:01 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cc3fd178673_6ce5ddc0c33755c@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 441s] [ 441s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 441s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 441s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 441s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 441s] CK: e740c156278705a14e1a99ba6d31334f [ 441s] RES: 7c04e86a67967fcd [ 441s] SRES: 1b9297a7 [ 441s] Kc: 10687b71e4eb94c5 [ 441s] -SQN: 281474976710655 [ 441s] +SQN: 4294967295 [ 441s] [ 441s] [ 441s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 441s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 441s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 441s] make[1]: *** [override_dh_auto_test] Error 1 [ 441s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 441s] debian/rules:15: recipe for target 'build' failed [ 441s] make: *** [build] Error 2 [ 441s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 441s] [ 441s] wildcard1 failed "build libosmocore_0.9.6.20170317.dsc" at Fri Mar 17 19:56:50 UTC 2017. [ 441s] [ 441s] ### VM INTERACTION START ### [ 444s] ### VM INTERACTION END ### [ 444s] [ 444s] wildcard1 failed "build libosmocore_0.9.6.20170317.dsc" at Fri Mar 17 19:56:54 UTC 2017. [ 444s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 19:57:18 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 19:57:18 +0000 Subject: Build failure of network:osmocom:nightly/openggsn in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cc3fd327e38_6ce5ddc0c3376c0@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openggsn/Debian_8.0/i586 Package network:osmocom:nightly/openggsn failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly openggsn Last lines of build log: [ 146s] make[3]: Nothing to be done for 'install-exec-am'. [ 146s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 146s] /usr/bin/install -c -m 644 ggsn.8 sgsnemu.8 '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 146s] make[3]: Leaving directory '/usr/src/packages/BUILD/doc' [ 146s] make[2]: Leaving directory '/usr/src/packages/BUILD/doc' [ 146s] make[2]: Entering directory '/usr/src/packages/BUILD' [ 146s] make[3]: Entering directory '/usr/src/packages/BUILD' [ 146s] make[3]: Nothing to be done for 'install-exec-am'. [ 146s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/lib/i386-linux-gnu/pkgconfig' [ 146s] /usr/bin/install -c -m 644 libgtp.pc '/usr/src/packages/BUILD/debian/tmp/usr/lib/i386-linux-gnu/pkgconfig' [ 146s] make[3]: Leaving directory '/usr/src/packages/BUILD' [ 146s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 146s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 146s] dh_install [ 146s] dh_installdocs [ 146s] cp: cannot stat 'README': No such file or directory [ 146s] dh_installdocs: cp -a README debian/openggsn/usr/share/doc/openggsn returned exit code 1 [ 146s] debian/rules:11: recipe for target 'binary' failed [ 146s] make: *** [binary] Error 2 [ 146s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 146s] [ 146s] cloud130 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:57:01 UTC 2017. [ 146s] [ 146s] ### VM INTERACTION START ### [ 147s] Powering off. [ 148s] ### VM INTERACTION END ### [ 148s] [ 148s] cloud130 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 19:57:04 UTC 2017. [ 148s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 20:00:27 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 20:00:27 +0000 Subject: Build failure of network:osmocom:nightly/openggsn in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cc40899c92d_6ce5ddc0c33839d@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openggsn/xUbuntu_16.10/i586 Package network:osmocom:nightly/openggsn failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly openggsn Last lines of build log: [ 173s] make[3]: Nothing to be done for 'install-exec-am'. [ 173s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 173s] /usr/bin/install -c -m 644 ggsn.8 sgsnemu.8 '/usr/src/packages/BUILD/debian/tmp/usr/share/man/man8' [ 173s] make[3]: Leaving directory '/usr/src/packages/BUILD/doc' [ 173s] make[2]: Leaving directory '/usr/src/packages/BUILD/doc' [ 173s] make[2]: Entering directory '/usr/src/packages/BUILD' [ 173s] make[3]: Entering directory '/usr/src/packages/BUILD' [ 173s] make[3]: Nothing to be done for 'install-exec-am'. [ 173s] /bin/mkdir -p '/usr/src/packages/BUILD/debian/tmp/usr/lib/i386-linux-gnu/pkgconfig' [ 173s] /usr/bin/install -c -m 644 libgtp.pc '/usr/src/packages/BUILD/debian/tmp/usr/lib/i386-linux-gnu/pkgconfig' [ 173s] make[3]: Leaving directory '/usr/src/packages/BUILD' [ 173s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 173s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 173s] dh_install [ 173s] dh_installdocs [ 173s] cp: cannot stat 'README': No such file or directory [ 173s] dh_installdocs: cp --reflink=auto -a README debian/openggsn/usr/share/doc/openggsn returned exit code 1 [ 173s] debian/rules:11: recipe for target 'binary' failed [ 173s] make: *** [binary] Error 2 [ 173s] dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 [ 173s] [ 173s] cloud123 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 20:00:12 UTC 2017. [ 173s] [ 173s] ### VM INTERACTION START ### [ 177s] [ 148.689284] reboot: Power down [ 178s] ### VM INTERACTION END ### [ 178s] [ 178s] cloud123 failed "build openggsn_0.93.20170317.dsc" at Fri Mar 17 20:00:18 UTC 2017. [ 178s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 20:01:53 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 20:01:53 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cc40c1c2286_6d45ddc0c31087@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.04/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 124s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 124s] ^ [ 124s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 124s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 124s] ^ [ 124s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 124s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 124s] ^ [ 124s] Makefile:516: recipe for target 'auc.o' failed [ 124s] make[3]: *** [auc.o] Error 1 [ 124s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 124s] Makefile:405: recipe for target 'all-recursive' failed [ 124s] make[2]: *** [all-recursive] Error 1 [ 124s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 124s] Makefile:352: recipe for target 'all' failed [ 124s] make[1]: *** [all] Error 2 [ 124s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 124s] dh_auto_build: make -j1 returned exit code 2 [ 124s] debian/rules:7: recipe for target 'build' failed [ 124s] make: *** [build] Error 2 [ 124s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 124s] [ 124s] lamb16 failed "build osmo-hlr_0.0.1.20170317.dsc" at Fri Mar 17 20:01:49 UTC 2017. [ 124s] [ 124s] ### VM INTERACTION START ### [ 127s] ### VM INTERACTION END ### [ 127s] [ 127s] lamb16 failed "build osmo-hlr_0.0.1.20170317.dsc" at Fri Mar 17 20:01:52 UTC 2017. [ 127s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 20:04:27 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 20:04:27 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cc4159331d5_6ce5ddc0c33867c@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/Debian_8.0/i586 Package network:osmocom:nightly/osmo-hlr failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 130s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 130s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 130s] ^ [ 130s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 130s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 130s] ^ [ 130s] Makefile:504: recipe for target 'auc.o' failed [ 130s] make[3]: *** [auc.o] Error 1 [ 130s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 130s] Makefile:393: recipe for target 'all-recursive' failed [ 130s] make[2]: *** [all-recursive] Error 1 [ 130s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 130s] Makefile:339: recipe for target 'all' failed [ 130s] make[1]: *** [all] Error 2 [ 130s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 130s] dh_auto_build: make -j1 returned exit code 2 [ 130s] debian/rules:7: recipe for target 'build' failed [ 130s] make: *** [build] Error 2 [ 130s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 130s] [ 130s] lamb65 failed "build osmo-hlr_0.0.1.20170317.dsc" at Fri Mar 17 20:04:24 UTC 2017. [ 130s] [ 130s] ### VM INTERACTION START ### [ 131s] Powering off. [ 131s] [ 116.204652] reboot: Power down [ 131s] ### VM INTERACTION END ### [ 131s] [ 131s] lamb65 failed "build osmo-hlr_0.0.1.20170317.dsc" at Fri Mar 17 20:04:26 UTC 2017. [ 131s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 20:04:44 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 20:04:44 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cc41775b6f1_6ce5ddc0c3388a9@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 110s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 110s] ^~~~ [ 110s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 110s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 110s] ^ [ 110s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 110s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 110s] ^~~~ [ 110s] Makefile:516: recipe for target 'auc.o' failed [ 110s] make[3]: *** [auc.o] Error 1 [ 110s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 110s] Makefile:405: recipe for target 'all-recursive' failed [ 110s] make[2]: *** [all-recursive] Error 1 [ 110s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 110s] Makefile:352: recipe for target 'all' failed [ 110s] make[1]: *** [all] Error 2 [ 110s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 110s] dh_auto_build: make -j1 returned exit code 2 [ 110s] debian/rules:7: recipe for target 'build' failed [ 110s] make: *** [build] Error 2 [ 110s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 110s] [ 110s] build84 failed "build osmo-hlr_0.0.1.20170317.dsc" at Fri Mar 17 20:04:26 UTC 2017. [ 110s] [ 110s] ### VM INTERACTION START ### [ 114s] ### VM INTERACTION END ### [ 114s] [ 114s] build84 failed "build osmo-hlr_0.0.1.20170317.dsc" at Fri Mar 17 20:04:30 UTC 2017. [ 114s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Fri Mar 17 20:09:18 2017 From: admin at opensuse.org (OBS Notification) Date: Fri, 17 Mar 2017 20:09:18 +0000 Subject: Build failure of network:osmocom:nightly/openbsc in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cc4287f4207_6ce5ddc0c340145@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openbsc/xUbuntu_16.10/i586 Package network:osmocom:nightly/openbsc failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly openbsc Last lines of build log: [ 166s] be found below `tests/testsuite.dir'. [ 166s] [ 166s] Makefile:719: recipe for target 'check-local' failed [ 166s] make[5]: *** [check-local] Error 1 [ 166s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 166s] Makefile:570: recipe for target 'check-am' failed [ 166s] make[4]: *** [check-am] Error 2 [ 166s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 166s] Makefile:422: recipe for target 'check-recursive' failed [ 166s] make[3]: *** [check-recursive] Error 1 [ 166s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 166s] Makefile:486: recipe for target 'check-recursive' failed [ 166s] make[2]: *** [check-recursive] Error 1 [ 166s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 166s] Makefile:777: recipe for target 'check' failed [ 166s] make[1]: *** [check] Error 2 [ 166s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 166s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 166s] debian/rules:13: recipe for target 'build' failed [ 166s] make: *** [build] Error 2 [ 166s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 166s] [ 166s] build84 failed "build openbsc_0.15.1.20170317.dsc" at Fri Mar 17 20:08:59 UTC 2017. [ 166s] [ 166s] ### VM INTERACTION START ### [ 170s] ### VM INTERACTION END ### [ 170s] [ 170s] build84 failed "build openbsc_0.15.1.20170317.dsc" at Fri Mar 17 20:09:03 UTC 2017. [ 170s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Fri Mar 17 20:30:53 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 20:30:53 +0000 Subject: [PATCH] libosmo-netif[master]: README.md: Make sure all hyperlinks have <> Message-ID: Review at https://gerrit.osmocom.org/2120 README.md: Make sure all hyperlinks have <> Change-Id: I5a5659afde32f08b324e602b7b1f96de805ba031 --- M README.md 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/20/2120/1 diff --git a/README.md b/README.md index 6583792..b73ffe7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ -------- The official homepage of the project is -https://osmocom.org/projects/libosmo-netif + GIT Repository -------------- @@ -19,7 +19,7 @@ git clone git://git.osmocom.org/libosmo-netif.git -There is a cgit interface at http://git.osmocom.org/libosmo-netif/ +There is a cgit interface at Documentation ------------- @@ -32,7 +32,7 @@ Discussions related to libosmo-netif are happening on the openbsc at lists.osmocom.org mailing list, please see -https://lists.osmocom.org/mailman/listinfo/openbsc for subscription + for subscription options and the list archive. Please observe the [Osmocom Mailing List @@ -43,12 +43,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmo-netif can be seen at -https://gerrit.osmocom.org/#/q/project:libosmo-netif+status:open + -- To view, visit https://gerrit.osmocom.org/2120 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a5659afde32f08b324e602b7b1f96de805ba031 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 20:32:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 20:32:00 +0000 Subject: [PATCH] libosmocore[master]: README.md: Make sure all hyperlinks use <> Message-ID: Review at https://gerrit.osmocom.org/2121 README.md: Make sure all hyperlinks use <> Change-Id: Ic81b68aef010e17f6b18232064958e0d4193e192 --- M README.md 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/21/2121/1 diff --git a/README.md b/README.md index d09a4b8..623804b 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ -------- The official homepage of the project is -https://osmocom.org/projects/libosmocore/wiki/Libosmocore + GIT Repository -------------- @@ -44,21 +44,21 @@ git clone git://git.osmocom.org/libosmocore.git -There is a cgit interface at http://git.osmocom.org/libosmocore/ +There is a cgit interface at Documentation ------------- Doxygen-generated API documentation is generated during the build process, but also available online for each of the sub-libraries at -http://ftp.osmocom.org/api/latest/libosmocore/ + Mailing List ------------ Discussions related to libosmocore are happening on the openbsc at lists.osmocom.org mailing list, please see -https://lists.osmocom.org/mailman/listinfo/openbsc for subscription + for subscription options and the list archive. Please observe the [Osmocom Mailing List @@ -69,12 +69,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmocore can be seen at -https://gerrit.osmocom.org/#/q/project:libosmocore+status:open + -- To view, visit https://gerrit.osmocom.org/2121 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic81b68aef010e17f6b18232064958e0d4193e192 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:02 +0000 Subject: libosmocore[master]: README.md: Make sure all hyperlinks use <> In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2121 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic81b68aef010e17f6b18232064958e0d4193e192 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:03 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:03 +0000 Subject: [MERGED] libosmocore[master]: README.md: Make sure all hyperlinks use <> In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README.md: Make sure all hyperlinks use <> ...................................................................... README.md: Make sure all hyperlinks use <> Change-Id: Ic81b68aef010e17f6b18232064958e0d4193e192 --- M README.md 1 file changed, 7 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/README.md b/README.md index d09a4b8..623804b 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ -------- The official homepage of the project is -https://osmocom.org/projects/libosmocore/wiki/Libosmocore + GIT Repository -------------- @@ -44,21 +44,21 @@ git clone git://git.osmocom.org/libosmocore.git -There is a cgit interface at http://git.osmocom.org/libosmocore/ +There is a cgit interface at Documentation ------------- Doxygen-generated API documentation is generated during the build process, but also available online for each of the sub-libraries at -http://ftp.osmocom.org/api/latest/libosmocore/ + Mailing List ------------ Discussions related to libosmocore are happening on the openbsc at lists.osmocom.org mailing list, please see -https://lists.osmocom.org/mailman/listinfo/openbsc for subscription + for subscription options and the list archive. Please observe the [Osmocom Mailing List @@ -69,12 +69,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmocore can be seen at -https://gerrit.osmocom.org/#/q/project:libosmocore+status:open + -- To view, visit https://gerrit.osmocom.org/2121 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic81b68aef010e17f6b18232064958e0d4193e192 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:10 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:10 +0000 Subject: [MERGED] libosmocore[master]: logging: fail gracefully if log_info() was not called In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: logging: fail gracefully if log_info() was not called ...................................................................... logging: fail gracefully if log_info() was not called The logging code crashes if osmo_log_info is not set, which is typically achieved by calling log_init(). Let's fail with a reasonable assert and error message if the user forgets that. Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2 --- M src/logging.c 1 file changed, 21 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/logging.c b/src/logging.c index 6a1e929..d900340 100644 --- a/src/logging.c +++ b/src/logging.c @@ -154,6 +154,15 @@ NULL, }; +static void assert_loginfo(void) +{ + if (!osmo_log_info) { + fprintf(stderr, "ERROR: osmo_log_info == NULL! " + "You must call log_init() before using logging!\n"); + OSMO_ASSERT(osmo_log_info); + } +} + /* special magic for negative (library-internal) log subsystem numbers */ static int subsys_lib2index(int subsys) { @@ -186,6 +195,8 @@ { int i; + assert_loginfo(); + for (i = 0; i < osmo_log_info->num_cat; ++i) { if (osmo_log_info->cat[i].name == NULL) continue; @@ -208,6 +219,8 @@ int i = 0; char *mask = strdup(_mask); char *category_token = NULL; + + assert_loginfo(); /* Disable everything to enable it afterwards */ for (i = 0; i < osmo_log_info->num_cat; ++i) @@ -611,6 +624,8 @@ struct log_target *target; unsigned int i; + assert_loginfo(); + target = talloc_zero(tall_log_ctx, struct log_target); if (!target) return NULL; @@ -783,6 +798,8 @@ int size = strlen("logging level () ()") + 1; char *str; + assert_loginfo(); + for (i = 0; i < info->num_cat; i++) { if (info->cat[i].name == NULL) continue; @@ -862,6 +879,8 @@ unsigned int size = strlen(LOGGING_STR "Set the log level for a specified category\n") + 1; + + assert_loginfo(); for (i = 0; i < info->num_cat; i++) { if (info->cat[i].name == NULL) @@ -980,6 +999,8 @@ { struct log_target *tar; + assert_loginfo(); + subsys = map_subsys(subsys); /* TODO: The following could/should be cached (update on config) */ -- To view, visit https://gerrit.osmocom.org/2109 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:19 +0000 Subject: libosmo-netif[master]: README.md: Make sure all hyperlinks have <> In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2120 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5a5659afde32f08b324e602b7b1f96de805ba031 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:21 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:21 +0000 Subject: [MERGED] libosmo-netif[master]: README.md: Make sure all hyperlinks have <> In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README.md: Make sure all hyperlinks have <> ...................................................................... README.md: Make sure all hyperlinks have <> Change-Id: I5a5659afde32f08b324e602b7b1f96de805ba031 --- M README.md 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/README.md b/README.md index 6583792..b73ffe7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ -------- The official homepage of the project is -https://osmocom.org/projects/libosmo-netif + GIT Repository -------------- @@ -19,7 +19,7 @@ git clone git://git.osmocom.org/libosmo-netif.git -There is a cgit interface at http://git.osmocom.org/libosmo-netif/ +There is a cgit interface at Documentation ------------- @@ -32,7 +32,7 @@ Discussions related to libosmo-netif are happening on the openbsc at lists.osmocom.org mailing list, please see -https://lists.osmocom.org/mailman/listinfo/openbsc for subscription + for subscription options and the list archive. Please observe the [Osmocom Mailing List @@ -43,12 +43,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmo-netif can be seen at -https://gerrit.osmocom.org/#/q/project:libosmo-netif+status:open + -- To view, visit https://gerrit.osmocom.org/2120 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5a5659afde32f08b324e602b7b1f96de805ba031 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:22 +0000 Subject: [MERGED] libosmo-netif[master]: stream: Export osmo_stream_cli_reconnect() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream: Export osmo_stream_cli_reconnect() ...................................................................... stream: Export osmo_stream_cli_reconnect() In case the application is using the read-callback and a read returns 0, then the application itself would want to trigger the reconnect. This is different from the osmo_stream_cli_recv() case where the reconnect can be handled internally to the library. Change-Id: I41314bad4a9f44e8a61b9d2ba33d1a76b25bd145 --- M include/osmocom/netif/stream.h M src/stream.c 2 files changed, 2 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index 3981e41..819f1ce 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -44,6 +44,7 @@ struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli); void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli)); +void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli); struct osmo_stream_cli *osmo_stream_cli_create(void *ctx); void osmo_stream_cli_destroy(struct osmo_stream_cli *cli); diff --git a/src/stream.c b/src/stream.c index 2fca7be..f5408f8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -85,7 +85,7 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli); -static void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli) +void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli) { if (cli->reconnect_timeout < 0) { LOGP(DLINP, LOGL_DEBUG, "not reconnecting, disabled.\n"); -- To view, visit https://gerrit.osmocom.org/2113 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I41314bad4a9f44e8a61b9d2ba33d1a76b25bd145 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:22 +0000 Subject: [MERGED] libosmo-netif[master]: stream: don't crash in _close() when fd is not initialized In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream: don't crash in _close() when fd is not initialized ...................................................................... stream: don't crash in _close() when fd is not initialized We use the magic value '-1' in case the file descriptor is not yet initialized. If somebody calls osmo_stream_*_close() before this changes, we used to crash. Let's check for this and avoid a crash. Also, after close let's change the fd to -1 again to mark the fd invalidity. Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 --- M src/stream.c 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/stream.c b/src/stream.c index d72d800..93de3b7 100644 --- a/src/stream.c +++ b/src/stream.c @@ -101,8 +101,11 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli) { + if (cli->ofd.fd == -1) + return; osmo_fd_unregister(&cli->ofd); close(cli->ofd.fd); + cli->ofd.fd = -1; } static void osmo_stream_cli_read(struct osmo_stream_cli *cli) @@ -506,8 +509,11 @@ void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link) { + if (link->ofd.fd == -1) + return; osmo_fd_unregister(&link->ofd); close(link->ofd.fd); + link->ofd.fd = -1; } struct osmo_stream_srv { -- To view, visit https://gerrit.osmocom.org/2111 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3aa04999ab01cb7971ee2dad45dfc31ab4142868 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:22 +0000 Subject: [MERGED] libosmo-netif[master]: stream: When destroying, make sure to kill reconnect timer In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream: When destroying, make sure to kill reconnect timer ...................................................................... stream: When destroying, make sure to kill reconnect timer if osmo_stream_cli_destroy() is called while the reconnect timer is running, we would end up in a crash. Change-Id: If6597130f472f1e2b8d9682002250ecd54675bb0 --- M src/stream.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/stream.c b/src/stream.c index 93de3b7..2fca7be 100644 --- a/src/stream.c +++ b/src/stream.c @@ -295,6 +295,7 @@ void osmo_stream_cli_destroy(struct osmo_stream_cli *cli) { + osmo_timer_del(&cli->timer); talloc_free(cli); } -- To view, visit https://gerrit.osmocom.org/2112 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If6597130f472f1e2b8d9682002250ecd54675bb0 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:09:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:09:22 +0000 Subject: [MERGED] libosmo-netif[master]: stream_client: Actually use/honor the reconect parameter In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream_client: Actually use/honor the reconect parameter ...................................................................... stream_client: Actually use/honor the reconect parameter The reconnect behavior was likely broken in commit de3f57a8293a5b39435d6f283da23e0172bad8bb If the user requests a re-connect, we should start it. Not only in case the connection drops later, but also if the initial connection itself fails. Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b --- M src/stream.c 1 file changed, 4 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/stream.c b/src/stream.c index a30fd04..d72d800 100644 --- a/src/stream.c +++ b/src/stream.c @@ -308,8 +308,11 @@ ret = osmo_sock_init(AF_INET, SOCK_STREAM, cli->proto, cli->addr, cli->port, OSMO_SOCK_F_CONNECT); - if (ret < 0) + if (ret < 0) { + if (reconnect && errno == ECONNREFUSED) + osmo_stream_cli_reconnect(cli); return ret; + } cli->ofd.fd = ret; if (osmo_fd_register(&cli->ofd) < 0) { -- To view, visit https://gerrit.osmocom.org/2110 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:20:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:20:11 +0000 Subject: [PATCH] openpcd[master]: convert from u_int*_t to uint*_t Message-ID: Review at https://gerrit.osmocom.org/2122 convert from u_int*_t to uint*_t Change-Id: I33f6383535c5860b833f7ccb9bea122d38f28e3f --- M firmware/include/openpcd.h M firmware/include/simtrace_usb.h M firmware/include/usb_ch9.h M firmware/include/usb_dfu.h M firmware/include/usb_hid.h M firmware/scripts/usbstring.c M firmware/src/dfu/dfu.c M firmware/src/dfu/dfu.h M firmware/src/os/blinkcode.c M firmware/src/os/dbgu.c M firmware/src/os/fifo.c M firmware/src/os/fifo.h M firmware/src/os/flash.c M firmware/src/os/flash.h M firmware/src/os/pcd_enumerate.c M firmware/src/os/pio_irq.c M firmware/src/os/pio_irq.h M firmware/src/os/pit.c M firmware/src/os/pit.h M firmware/src/os/pwm.c M firmware/src/os/pwm.h M firmware/src/os/req_ctx.c M firmware/src/os/req_ctx.h M firmware/src/os/system_irq.c M firmware/src/os/system_irq.h M firmware/src/os/tc_cdiv.c M firmware/src/os/tc_cdiv.h M firmware/src/os/usb_handler.c M firmware/src/os/usb_handler.h M firmware/src/os/usbcmd_generic.c M firmware/src/os/usbcmd_generic.h M firmware/src/os/wdt.c M firmware/src/pcd.h M firmware/src/pcd/main_librfid.c M firmware/src/pcd/main_mifare.c M firmware/src/pcd/main_presence.c M firmware/src/pcd/main_pwm.c M firmware/src/pcd/main_reqa.c M firmware/src/pcd/rc632.c M firmware/src/pcd/rc632.h M firmware/src/pcd/rc632_highlevel.c M firmware/src/pcd/rc632_highlevel.h M firmware/src/picc/adc.c M firmware/src/picc/da.h M firmware/src/picc/decoder.c M firmware/src/picc/decoder.h M firmware/src/picc/decoder_miller.c M firmware/src/picc/decoder_nrzl.c M firmware/src/picc/iso14443a_manchester.c M firmware/src/picc/load_modulation.c M firmware/src/picc/load_modulation.h M firmware/src/picc/main_openpicc.c M firmware/src/picc/openpicc.c M firmware/src/picc/opicc_reg.h M firmware/src/picc/piccsim.h M firmware/src/picc/pll.c M firmware/src/picc/poti.c M firmware/src/picc/poti.h M firmware/src/picc/ssc_picc.c M firmware/src/picc/tc_cdiv_sync.c M firmware/src/picc/tc_fdt.c M firmware/src/picc/tc_fdt.h M firmware/src/simtrace/iso7816_uart.c M firmware/src/simtrace/main_factory.c M firmware/src/simtrace/prod_info.c M firmware/src/simtrace/prod_info.h M firmware/src/simtrace/sim_switch.c M firmware/src/simtrace/spi_flash.c M firmware/src/simtrace/spi_flash.h M firmware/src/simtrace/tc_etu.c M firmware/src/simtrace/tc_etu.h 71 files changed, 608 insertions(+), 607 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openpcd refs/changes/22/2122/1 diff --git a/firmware/include/openpcd.h b/firmware/include/openpcd.h index ea32764..1b3ba1c 100644 --- a/firmware/include/openpcd.h +++ b/firmware/include/openpcd.h @@ -6,12 +6,12 @@ #include struct openpcd_hdr { - u_int8_t cmd; /* command. high nibble: class, + uint8_t cmd; /* command. high nibble: class, * low nibble: cmd */ - u_int8_t flags; - u_int8_t reg; /* register */ - u_int8_t val; /* value (in case of write *) */ - u_int8_t data[0]; + uint8_t flags; + uint8_t reg; /* register */ + uint8_t val; /* value (in case of write *) */ + uint8_t data[0]; } __attribute__ ((packed)); #define OPCD_REV_LEN 16 diff --git a/firmware/include/simtrace_usb.h b/firmware/include/simtrace_usb.h index 08e4523..f76540e 100644 --- a/firmware/include/simtrace_usb.h +++ b/firmware/include/simtrace_usb.h @@ -5,10 +5,10 @@ /* this is kept compatible with OpenPCD protocol */ struct simtrace_hdr { - u_int8_t cmd; - u_int8_t flags; - u_int8_t res[2]; - u_int8_t data[0]; + uint8_t cmd; + uint8_t flags; + uint8_t res[2]; + uint8_t data[0]; } __attribute__ ((packed)); enum simtrace_usb_msgt { @@ -24,14 +24,14 @@ #define SIMTRACE_FLAG_PPS_FIDI 0x08 /* Fi/Di values in res[2] */ struct simtrace_stats { - u_int32_t no_rctx; - u_int32_t rctx_sent; - u_int32_t rst; - u_int32_t pps; - u_int32_t bytes; - u_int32_t parity_err; - u_int32_t frame_err; - u_int32_t overrun; + uint32_t no_rctx; + uint32_t rctx_sent; + uint32_t rst; + uint32_t pps; + uint32_t bytes; + uint32_t parity_err; + uint32_t frame_err; + uint32_t overrun; } stats; #endif /* SIMTRACE_USB_H */ diff --git a/firmware/include/usb_ch9.h b/firmware/include/usb_ch9.h index 46066f2..725c4a0 100644 --- a/firmware/include/usb_ch9.h +++ b/firmware/include/usb_ch9.h @@ -119,11 +119,11 @@ * such requests may be made at any time. */ struct usb_ctrlrequest { - u_int8_t bRequestType; - u_int8_t bRequest; - u_int16_t wValue; - u_int16_t wIndex; - u_int16_t wLength; + uint8_t bRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ @@ -169,8 +169,8 @@ /* All standard descriptors have these 2 fields at the beginning */ struct usb_descriptor_header { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; } __attribute__ ((packed)); @@ -178,21 +178,21 @@ /* USB_DT_DEVICE: Device descriptor */ struct usb_device_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t bcdUSB; - u_int8_t bDeviceClass; - u_int8_t bDeviceSubClass; - u_int8_t bDeviceProtocol; - u_int8_t bMaxPacketSize0; - u_int16_t idVendor; - u_int16_t idProduct; - u_int16_t bcdDevice; - u_int8_t iManufacturer; - u_int8_t iProduct; - u_int8_t iSerialNumber; - u_int8_t bNumConfigurations; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; } __attribute__ ((packed)); #define USB_DT_DEVICE_SIZE 18 @@ -231,15 +231,15 @@ * descriptors. */ struct usb_config_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wTotalLength; - u_int8_t bNumInterfaces; - u_int8_t bConfigurationValue; - u_int8_t iConfiguration; - u_int8_t bmAttributes; - u_int8_t bMaxPower; + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; } __attribute__ ((packed)); #define USB_DT_CONFIG_SIZE 9 @@ -254,10 +254,10 @@ /* USB_DT_STRING: String descriptor */ struct usb_string_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wData[0]; /* UTF-16LE encoded */ + uint16_t wData[0]; /* UTF-16LE encoded */ } __attribute__ ((packed)); /* note that "string" zero is special, it holds language codes that @@ -268,16 +268,16 @@ /* USB_DT_INTERFACE: Interface descriptor */ struct usb_interface_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bInterfaceNumber; - u_int8_t bAlternateSetting; - u_int8_t bNumEndpoints; - u_int8_t bInterfaceClass; - u_int8_t bInterfaceSubClass; - u_int8_t bInterfaceProtocol; - u_int8_t iInterface; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; } __attribute__ ((packed)); #define USB_DT_INTERFACE_SIZE 9 @@ -286,13 +286,13 @@ /* USB_DT_ENDPOINT: Endpoint descriptor */ struct usb_endpoint_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bEndpointAddress; - u_int8_t bmAttributes; - u_int16_t wMaxPacketSize; - u_int8_t bInterval; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; } __attribute__ ((packed)); #define USB_DT_ENDPOINT_SIZE 7 @@ -317,16 +317,16 @@ /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ struct usb_qualifier_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t bcdUSB; - u_int8_t bDeviceClass; - u_int8_t bDeviceSubClass; - u_int8_t bDeviceProtocol; - u_int8_t bMaxPacketSize0; - u_int8_t bNumConfigurations; - u_int8_t bRESERVED; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint8_t bNumConfigurations; + uint8_t bRESERVED; } __attribute__ ((packed)); @@ -334,10 +334,10 @@ /* USB_DT_OTG (from OTG 1.0a supplement) */ struct usb_otg_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bmAttributes; /* support for HNP, SRP, etc */ + uint8_t bmAttributes; /* support for HNP, SRP, etc */ } __attribute__ ((packed)); /* from usb_otg_descriptor.bmAttributes */ @@ -348,27 +348,27 @@ /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ struct usb_debug_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; /* bulk endpoints with 8 byte maxpacket */ - u_int8_t bDebugInEndpoint; - u_int8_t bDebugOutEndpoint; + uint8_t bDebugInEndpoint; + uint8_t bDebugOutEndpoint; }; /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */ struct usb_interface_assoc_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bFirstInterface; - u_int8_t bInterfaceCount; - u_int8_t bFunctionClass; - u_int8_t bFunctionSubClass; - u_int8_t bFunctionProtocol; - u_int8_t iFunction; + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; } __attribute__ ((packed)); @@ -378,11 +378,11 @@ * encryption types available for setting up a CC/association. */ struct usb_security_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wTotalLength; - u_int8_t bNumEncryptionTypes; + uint16_t wTotalLength; + uint8_t bNumEncryptionTypes; }; /*-------------------------------------------------------------------------*/ @@ -391,28 +391,28 @@ * may be retrieved. */ struct usb_key_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t tTKID[3]; - u_int8_t bReserved; - u_int8_t bKeyData[0]; + uint8_t tTKID[3]; + uint8_t bReserved; + uint8_t bKeyData[0]; }; /*-------------------------------------------------------------------------*/ /* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ struct usb_encryption_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bEncryptionType; + uint8_t bEncryptionType; #define USB_ENC_TYPE_UNSECURE 0 #define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */ #define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */ #define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ - u_int8_t bEncryptionValue; /* use in SET_ENCRYPTION */ - u_int8_t bAuthKeyIndex; + uint8_t bEncryptionValue; /* use in SET_ENCRYPTION */ + uint8_t bAuthKeyIndex; }; @@ -420,36 +420,36 @@ /* USB_DT_BOS: group of wireless capabilities */ struct usb_bos_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wTotalLength; - u_int8_t bNumDeviceCaps; + uint16_t wTotalLength; + uint8_t bNumDeviceCaps; }; /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ struct usb_dev_cap_header { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bDevCapabilityType; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; }; #define USB_CAP_TYPE_WIRELESS_USB 1 struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bDevCapabilityType; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; - u_int8_t bmAttributes; + uint8_t bmAttributes; #define USB_WIRELESS_P2P_DRD (1 << 1) #define USB_WIRELESS_BEACON_MASK (3 << 2) #define USB_WIRELESS_BEACON_SELF (1 << 2) #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) #define USB_WIRELESS_BEACON_NONE (3 << 2) - u_int16_t wPHYRates; /* bit rates, Mbps */ + uint16_t wPHYRates; /* bit rates, Mbps */ #define USB_WIRELESS_PHY_53 (1 << 0) /* always set */ #define USB_WIRELESS_PHY_80 (1 << 1) #define USB_WIRELESS_PHY_107 (1 << 2) /* always set */ @@ -458,10 +458,10 @@ #define USB_WIRELESS_PHY_320 (1 << 5) #define USB_WIRELESS_PHY_400 (1 << 6) #define USB_WIRELESS_PHY_480 (1 << 7) - u_int8_t bmTFITXPowerInfo; /* TFI power levels */ - u_int8_t bmFFITXPowerInfo; /* FFI power levels */ - u_int16_t bmBandGroup; - u_int8_t bReserved; + uint8_t bmTFITXPowerInfo; /* TFI power levels */ + uint8_t bmFFITXPowerInfo; /* FFI power levels */ + uint16_t bmBandGroup; + uint8_t bReserved; }; /*-------------------------------------------------------------------------*/ @@ -470,15 +470,15 @@ * each endpoint descriptor for a wireless device */ struct usb_wireless_ep_comp_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bMaxBurst; - u_int8_t bMaxSequence; - u_int16_t wMaxStreamDelay; - u_int16_t wOverTheAirPacketSize; - u_int8_t bOverTheAirInterval; - u_int8_t bmCompAttributes; + uint8_t bMaxBurst; + uint8_t bMaxSequence; + uint16_t wMaxStreamDelay; + uint16_t wOverTheAirPacketSize; + uint8_t bOverTheAirInterval; + uint8_t bmCompAttributes; #define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */ #define USB_ENDPOINT_SWITCH_NO 0 #define USB_ENDPOINT_SWITCH_SWITCH 1 @@ -492,13 +492,13 @@ * exchanging short lived session keys. The handshake depends on a CC. */ struct usb_handshake { - u_int8_t bMessageNumber; - u_int8_t bStatus; - u_int8_t tTKID[3]; - u_int8_t bReserved; - u_int8_t CDID[16]; - u_int8_t nonce[16]; - u_int8_t MIC[8]; + uint8_t bMessageNumber; + uint8_t bStatus; + uint8_t tTKID[3]; + uint8_t bReserved; + uint8_t CDID[16]; + uint8_t nonce[16]; + uint8_t MIC[8]; }; /*-------------------------------------------------------------------------*/ @@ -508,9 +508,9 @@ * wired USB!), and some devices may support CCs with multiple hosts. */ struct usb_connection_context { - u_int8_t CHID[16]; /* persistent host id */ - u_int8_t CDID[16]; /* device id (unique w/in host context) */ - u_int8_t CK[16]; /* connection key */ + uint8_t CHID[16]; /* persistent host id */ + uint8_t CDID[16]; /* device id (unique w/in host context) */ + uint8_t CK[16]; /* connection key */ }; /*-------------------------------------------------------------------------*/ diff --git a/firmware/include/usb_dfu.h b/firmware/include/usb_dfu.h index 5000edc..14a19d2 100644 --- a/firmware/include/usb_dfu.h +++ b/firmware/include/usb_dfu.h @@ -15,16 +15,16 @@ #define USB_DT_DFU 0x21 struct usb_dfu_func_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bmAttributes; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bmAttributes; #define USB_DFU_CAN_DOWNLOAD (1 << 0) #define USB_DFU_CAN_UPLOAD (1 << 1) #define USB_DFU_MANIFEST_TOL (1 << 2) #define USB_DFU_WILL_DETACH (1 << 3) - u_int16_t wDetachTimeOut; - u_int16_t wTransferSize; - u_int16_t bcdDFUVersion; + uint16_t wDetachTimeOut; + uint16_t wTransferSize; + uint16_t bcdDFUVersion; } __attribute__ ((packed)); #define USB_DT_DFU_SIZE 9 @@ -41,10 +41,10 @@ #define USB_REQ_DFU_ABORT 0x06 struct dfu_status { - u_int8_t bStatus; - u_int8_t bwPollTimeout[3]; - u_int8_t bState; - u_int8_t iString; + uint8_t bStatus; + uint8_t bwPollTimeout[3]; + uint8_t bState; + uint8_t iString; } __attribute__((packed)); #define DFU_STATUS_OK 0x00 diff --git a/firmware/include/usb_hid.h b/firmware/include/usb_hid.h index 49f5ab8..a1000c4 100644 --- a/firmware/include/usb_hid.h +++ b/firmware/include/usb_hid.h @@ -214,16 +214,16 @@ #define HID_FEATURE_REPORT 2 struct usb_hid_class_descriptor { - u_int8_t bDescriptorType; - u_int16_t wDescriptorLength; + uint8_t bDescriptorType; + uint16_t wDescriptorLength; } __attribute__ ((packed)); struct usb_hid_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int16_t bcdHID; - u_int8_t bCountryCode; - u_int8_t bNumDescriptors; + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; struct hid_class_descriptor desc[1]; } __attribute__ ((packed)); diff --git a/firmware/scripts/usbstring.c b/firmware/scripts/usbstring.c index 5724b40..31ab052 100644 --- a/firmware/scripts/usbstring.c +++ b/firmware/scripts/usbstring.c @@ -28,27 +28,28 @@ #include #include #include +#include #include #include -static int utf8_to_utf16le(const char *s, u_int16_t *cp, unsigned len) +static int utf8_to_utf16le(const char *s, uint16_t *cp, unsigned len) { int count = 0; - u_int8_t c; - u_int16_t uchar; + uint8_t c; + uint16_t uchar; /* this insists on correct encodings, though not minimal ones. * BUT it currently rejects legit 4-byte UTF-8 code points, * which need surrogate pairs. (Unicode 3.1 can use them.) */ - while (len != 0 && (c = (u_int8_t) *s++) != 0) { + while (len != 0 && (c = (uint8_t) *s++) != 0) { if (c & 0x80) { // 2-byte sequence: // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx if ((c & 0xe0) == 0xc0) { uchar = (c & 0x1f) << 6; - c = (u_int8_t) *s++; + c = (uint8_t) *s++; if ((c & 0xc0) != 0xc0) goto fail; c &= 0x3f; @@ -59,13 +60,13 @@ } else if ((c & 0xf0) == 0xe0) { uchar = (c & 0x0f) << 12; - c = (u_int8_t) *s++; + c = (uint8_t) *s++; if ((c & 0xc0) != 0xc0) goto fail; c &= 0x3f; uchar |= c << 6; - c = (u_int8_t) *s++; + c = (uint8_t) *s++; if ((c & 0xc0) != 0xc0) goto fail; c &= 0x3f; @@ -96,7 +97,7 @@ } #define COLUMNS 6 -static int print_array16(u_int16_t *buf, int len) +static int print_array16(uint16_t *buf, int len) { int i; for (i = 0; i < len; i++) { @@ -130,10 +131,10 @@ { printf( "static const struct {\n" "\tstruct usb_descriptor_header hdr;\n" - "\tu_int16_t wData[];\n" + "\tuint16_t wData[];\n" "} __attribute__((packed)) string%d = {\n" "\t.hdr = {\n" - "\t\t.bLength = sizeof(struct usb_descriptor_header) + %u * sizeof(u_int16_t),\n" + "\t\t.bLength = sizeof(struct usb_descriptor_header) + %u * sizeof(uint16_t),\n" "\t\t.bDescriptorType = USB_DT_STRING,\n" "\t},\n" "\t.wData = {", i, size); @@ -146,7 +147,7 @@ int main(int argc, char **argv) { char asciibuf[512+1]; - u_int16_t utf16buf[1024+1]; + uint16_t utf16buf[1024+1]; int len; int j, i = 1; @@ -160,7 +161,7 @@ print_structftr(); #if 0 printf("static const struct usb_string_descriptor string0 = {\n" - "\t.bLength = sizeof(string0) + 1 * sizeof(u_int16_t),\n" + "\t.bLength = sizeof(string0) + 1 * sizeof(uint16_t),\n" "\t.bDescriptorType = USB_DT_STRING,\n" "\t.wData[0] = 0x0409, /* English */\n" "};\n\n"); @@ -176,7 +177,7 @@ print_structhdr(i, len); #if 0 printf("static const struct usb_string_descriptor string%d = {\n" - "\t.bLength = sizeof(string%d) + %d * sizeof(u_int16_t),\n" + "\t.bLength = sizeof(string%d) + %d * sizeof(uint16_t),\n" "\t.bDescriptorType = USB_DT_STRING,\n" "\t.wData = {", i, i, len); #endif diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c index 9d1ad10..da5635d 100644 --- a/firmware/src/dfu/dfu.c +++ b/firmware/src/dfu/dfu.c @@ -72,9 +72,9 @@ static int past_manifest = 0; static int switch_to_ram = 0; /* IRQ handler requests main to jump to RAM */ -static u_int16_t usb_if_nr = 0; /* last SET_INTERFACE */ -static u_int16_t usb_if_alt_nr = 0; /* last SET_INTERFACE AltSetting */ -static u_int16_t usb_if_alt_nr_dnload = 0; /* AltSetting during last dnload */ +static uint16_t usb_if_nr = 0; /* last SET_INTERFACE */ +static uint16_t usb_if_alt_nr = 0; /* last SET_INTERFACE AltSetting */ +static uint16_t usb_if_alt_nr_dnload = 0; /* AltSetting during last dnload */ static void __dfufunc udp_init(void) { @@ -96,11 +96,11 @@ static void __dfufunc udp_ep0_send_zlp(void); /* Send Data through the control endpoint */ -static void __dfufunc udp_ep0_send_data(const char *pData, u_int32_t length, - u_int32_t window_length) +static void __dfufunc udp_ep0_send_data(const char *pData, uint32_t length, + uint32_t window_length) { AT91PS_UDP pUdp = AT91C_BASE_UDP; - u_int32_t cpt = 0, len_remain; + uint32_t cpt = 0, len_remain; AT91_REG csr; len_remain = MIN(length, window_length); @@ -147,12 +147,12 @@ } /* receive data from EP0 */ -static int __dfufunc udp_ep0_recv_data(u_int8_t *data, u_int16_t len) +static int __dfufunc udp_ep0_recv_data(uint8_t *data, uint16_t len) { AT91PS_UDP pUdp = AT91C_BASE_UDP; AT91_REG csr; - u_int16_t i, num_rcv; - u_int32_t num_rcv_total = 0; + uint16_t i, num_rcv; + uint32_t num_rcv_total = 0; do { /* FIXME: do we need to check whether we've been interrupted @@ -206,10 +206,10 @@ static int first_download = 1; -static u_int8_t *ptr, *ptr_max; -static __dfudata u_int8_t dfu_status; -__dfudata u_int32_t dfu_state = DFU_STATE_appIDLE; -static u_int32_t pagebuf32[AT91C_IFLASH_PAGE_SIZE/4]; +static uint8_t *ptr, *ptr_max; +static __dfudata uint8_t dfu_status; +__dfudata uint32_t dfu_state = DFU_STATE_appIDLE; +static uint32_t pagebuf32[AT91C_IFLASH_PAGE_SIZE/4]; static void chk_first_dnload_set_ptr(void) { @@ -218,25 +218,25 @@ switch (usb_if_alt_nr) { case 0: - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; ptr_max = AT91C_IFLASH + AT91C_IFLASH_SIZE - ENVIRONMENT_SIZE; break; case 1: - ptr = (u_int8_t *) AT91C_IFLASH; + ptr = (uint8_t *) AT91C_IFLASH; ptr_max = AT91C_IFLASH + SAM7DFU_SIZE; break; case 2: - ptr = (u_int8_t *) AT91C_ISRAM + SAM7DFU_RAM_SIZE; + ptr = (uint8_t *) AT91C_ISRAM + SAM7DFU_RAM_SIZE; ptr_max = AT91C_ISRAM + AT91C_ISRAM_SIZE; break; } first_download = 0; } -static int __dfufunc handle_dnload_flash(u_int16_t __unused val, u_int16_t len) +static int __dfufunc handle_dnload_flash(uint16_t __unused val, uint16_t len) { - volatile u_int32_t *p; - u_int8_t *pagebuf = (u_int8_t *) pagebuf32; + volatile uint32_t *p; + uint8_t *pagebuf = (uint8_t *) pagebuf32; int i; DEBUGE("download "); @@ -257,7 +257,7 @@ return RET_STALL; } chk_first_dnload_set_ptr(); - p = (volatile u_int32_t *)ptr; + p = (volatile uint32_t *)ptr; if (len == 0) { DEBUGP("zero-size write -> MANIFEST_SYNC "); @@ -293,13 +293,13 @@ flash_page(p-1); } } - ptr = (u_int8_t *) p; + ptr = (uint8_t *) p; #endif return RET_ZLP; } -static int __dfufunc handle_dnload_ram(u_int16_t __unused val, u_int16_t len) +static int __dfufunc handle_dnload_ram(uint16_t __unused val, uint16_t len) { DEBUGE("download "); @@ -339,7 +339,7 @@ return RET_ZLP; } -static int __dfufunc handle_dnload(u_int16_t val, u_int16_t len) +static int __dfufunc handle_dnload(uint16_t val, uint16_t len) { usb_if_alt_nr_dnload = usb_if_alt_nr; switch (usb_if_alt_nr) { @@ -350,8 +350,8 @@ } } -#define AT91C_IFLASH_END ((u_int8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE) -static __dfufunc int handle_upload(u_int16_t __unused val, u_int16_t len) +#define AT91C_IFLASH_END ((uint8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE) +static __dfufunc int handle_upload(uint16_t __unused val, uint16_t len) { DEBUGE("upload "); if (len > AT91C_IFLASH_PAGE_SIZE) { @@ -364,7 +364,7 @@ chk_first_dnload_set_ptr(); if (ptr + len > AT91C_IFLASH_END) { - len = AT91C_IFLASH_END - (u_int8_t *)ptr; + len = AT91C_IFLASH_END - (uint8_t *)ptr; first_download = 1; } @@ -377,7 +377,7 @@ static __dfufunc void handle_getstatus(void) { struct dfu_status dstat; - u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); + uint32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); DEBUGE("getstatus(fsr=0x%08x) ", fsr); @@ -416,15 +416,15 @@ static void __dfufunc handle_getstate(void) { - u_int8_t u8 = dfu_state; + uint8_t u8 = dfu_state; DEBUGE("getstate "); udp_ep0_send_data((char *)&u8, sizeof(u8), sizeof(u8)); } /* callback function for DFU requests */ -int __dfufunc dfu_ep0_handler(u_int8_t __unused req_type, u_int8_t req, - u_int16_t val, u_int16_t len) +int __dfufunc dfu_ep0_handler(uint8_t __unused req_type, uint8_t req, + uint16_t val, uint16_t len) { int rc, ret = RET_NOTHING; @@ -473,11 +473,11 @@ goto out; } dfu_state = DFU_STATE_dfuDNLOAD_SYNC; - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; ret = handle_dnload(val, len); break; case USB_REQ_DFU_UPLOAD: - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; dfu_state = DFU_STATE_dfuUPLOAD_IDLE; handle_upload(val, len); break; @@ -652,7 +652,7 @@ return 0; } -static u_int8_t cur_config; +static uint8_t cur_config; /* USB DFU Device descriptor in DFU mode */ __dfustruct const struct usb_device_descriptor dfu_dev_descriptor = { @@ -749,9 +749,9 @@ static __dfufunc void dfu_udp_ep0_handler(void) { AT91PS_UDP pUDP = AT91C_BASE_UDP; - u_int8_t bmRequestType, bRequest; - u_int16_t wValue, wIndex, wLength, wStatus; - u_int32_t csr = pUDP->UDP_CSR[0]; + uint8_t bmRequestType, bRequest; + uint16_t wValue, wIndex, wLength, wStatus; + uint32_t csr = pUDP->UDP_CSR[0]; DEBUGE("CSR=0x%04x ", csr); @@ -798,7 +798,7 @@ /* Handle supported standard device request Cf Table 9-3 in USB * speciication Rev 1.1 */ switch ((bRequest << 8) | bmRequestType) { - u_int8_t desc_type, desc_index; + uint8_t desc_type, desc_index; case STD_GET_DESCRIPTOR: DEBUGE("GET_DESCRIPTOR "); desc_type = wValue >> 8; diff --git a/firmware/src/dfu/dfu.h b/firmware/src/dfu/dfu.h index 27c63b5..fa07281 100644 --- a/firmware/src/dfu/dfu.h +++ b/firmware/src/dfu/dfu.h @@ -124,13 +124,13 @@ struct dfuapi { void (*udp_init)(void); - void (*ep0_send_data)(const char *data, u_int32_t len, u_int32_t wlen); + void (*ep0_send_data)(const char *data, uint32_t len, uint32_t wlen); void (*ep0_send_zlp)(void); void (*ep0_send_stall)(void); - int (*dfu_ep0_handler)(u_int8_t req_type, u_int8_t req, - u_int16_t val, u_int16_t len); + int (*dfu_ep0_handler)(uint8_t req_type, uint8_t req, + uint16_t val, uint16_t len); void (*dfu_switch)(void); - u_int32_t *dfu_state; + uint32_t *dfu_state; const struct usb_device_descriptor *dfu_dev_descriptor; const struct _dfu_desc *dfu_cfg_descriptor; }; diff --git a/firmware/src/os/blinkcode.c b/firmware/src/os/blinkcode.c index 22d4b25..9e88716 100644 --- a/firmware/src/os/blinkcode.c +++ b/firmware/src/os/blinkcode.c @@ -28,7 +28,7 @@ enum blinkcode_state state; int num; int cur; - u_int8_t led; + uint8_t led; }; static struct blinker blink_state[NUM_LEDS]; diff --git a/firmware/src/os/dbgu.c b/firmware/src/os/dbgu.c index 72eaa88..7f1df44 100644 --- a/firmware/src/os/dbgu.c +++ b/firmware/src/os/dbgu.c @@ -78,7 +78,7 @@ //* Object : C handler interrupt function called by the sysirq //* demultiplexer //*---------------------------------------------------------------------------- -static void DBGU_irq_handler(u_int32_t sr) +static void DBGU_irq_handler(uint32_t sr) { static char value; diff --git a/firmware/src/os/fifo.c b/firmware/src/os/fifo.c index c30ba10..40aa0d0 100644 --- a/firmware/src/os/fifo.c +++ b/firmware/src/os/fifo.c @@ -58,7 +58,7 @@ } -u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data) +uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data) { if (len > fifo_available(fifo)) { len = fifo_available(fifo); @@ -71,7 +71,7 @@ fifo->producer += len; } else { /* difficult: wrap around */ - u_int16_t chunk_len; + uint16_t chunk_len; chunk_len = fifo->size - fifo->producer; memcpy(&fifo->data[fifo->producer], data, chunk_len); @@ -86,9 +86,9 @@ } -u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data) +uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data) { - u_int16_t avail = fifo_available(fifo); + uint16_t avail = fifo_available(fifo); if (avail < len) len = avail; @@ -98,7 +98,7 @@ memcpy(data, &fifo->data[fifo->consumer], len); } else { /* difficult case: wrap */ - u_int16_t chunk_len = fifo->size - fifo->consumer; + uint16_t chunk_len = fifo->size - fifo->consumer; memcpy(data, &fifo->data[fifo->consumer], chunk_len); memcpy(data+chunk_len, &fifo->data[0], len - chunk_len); } @@ -108,8 +108,8 @@ return len; } -int fifo_init(struct fifo *fifo, u_int16_t size, - void (*cb)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data) +int fifo_init(struct fifo *fifo, uint16_t size, + void (*cb)(struct fifo *fifo, uint8_t event, void *data), void *cb_data) { if (size > sizeof(fifo->data)) return -EINVAL; diff --git a/firmware/src/os/fifo.h b/firmware/src/os/fifo.h index d91c6c2..0b2f8e7 100644 --- a/firmware/src/os/fifo.h +++ b/firmware/src/os/fifo.h @@ -6,23 +6,23 @@ #define FIFO_SIZE 1024 struct fifo { - u_int16_t size; /* actual FIFO size, can be smaller than 'data' */ - u_int16_t producer; /* index of producer */ - u_int16_t consumer; /* index of consumer */ - u_int16_t watermark; - u_int8_t irq; - u_int8_t irq_en; - u_int8_t status; - void (*callback)(struct fifo *fifo, u_int8_t event, void *data); + uint16_t size; /* actual FIFO size, can be smaller than 'data' */ + uint16_t producer; /* index of producer */ + uint16_t consumer; /* index of consumer */ + uint16_t watermark; + uint8_t irq; + uint8_t irq_en; + uint8_t status; + void (*callback)(struct fifo *fifo, uint8_t event, void *data); void *cb_data; - u_int8_t data[FIFO_SIZE]; + uint8_t data[FIFO_SIZE]; }; -extern int fifo_init(struct fifo *fifo, u_int16_t size, - void (*callback)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data); -extern u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data); -extern u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data); +extern int fifo_init(struct fifo *fifo, uint16_t size, + void (*callback)(struct fifo *fifo, uint8_t event, void *data), void *cb_data); +extern uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data); +extern uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data); extern int fifo_available(struct fifo *fifo); #endif diff --git a/firmware/src/os/flash.c b/firmware/src/os/flash.c index c729ff8..dabc033 100644 --- a/firmware/src/os/flash.c +++ b/firmware/src/os/flash.c @@ -13,34 +13,34 @@ #define EFCS_CMD_CLEAR_NVM_BIT 0xd #define EFCS_CMD_SET_SECURITY_BIT 0xf -static u_int16_t page_from_ramaddr(const void *addr) +static uint16_t page_from_ramaddr(const void *addr) { - u_int32_t ramaddr = (u_int32_t) addr; - ramaddr -= (u_int32_t) AT91C_IFLASH; + uint32_t ramaddr = (uint32_t) addr; + ramaddr -= (uint32_t) AT91C_IFLASH; return ((ramaddr >> AT91C_IFLASH_PAGE_SHIFT)); } #define PAGES_PER_LOCKREGION (AT91C_IFLASH_LOCK_REGION_SIZE>>AT91C_IFLASH_PAGE_SHIFT) #define IS_FIRST_PAGE_OF_LOCKREGION(x) ((x % PAGES_PER_LOCKREGION) == 0) #define LOCKREGION_FROM_PAGE(x) (x / PAGES_PER_LOCKREGION) -static int is_page_locked(u_int16_t page) +static int is_page_locked(uint16_t page) { - u_int16_t lockregion = LOCKREGION_FROM_PAGE(page); + uint16_t lockregion = LOCKREGION_FROM_PAGE(page); return (AT91C_BASE_MC->MC_FSR & (lockregion << 16)); } -static void unlock_page(u_int16_t page) +static void unlock_page(uint16_t page) { page &= 0x3ff; AT91F_MC_EFC_PerformCmd(AT91C_BASE_MC, AT91C_MC_FCMD_UNLOCK | AT91C_MC_CORRECT_KEY | (page << 8)); } -void flash_page(u_int8_t *addr) +void flash_page(uint8_t *addr) { - u_int16_t page = page_from_ramaddr(addr) & 0x3ff; - u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); + uint16_t page = page_from_ramaddr(addr) & 0x3ff; + uint32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); DEBUGP("flash_page(0x%x=%u) ", addr, page); if (is_page_locked(page)) { diff --git a/firmware/src/os/flash.h b/firmware/src/os/flash.h index b812714..b31d167 100644 --- a/firmware/src/os/flash.h +++ b/firmware/src/os/flash.h @@ -1,5 +1,5 @@ #ifndef _FLASH_H #define _FLASH_H -extern void flash_page(u_int8_t *addr); +extern void flash_page(uint8_t *addr); extern void flash_init(void); #endif diff --git a/firmware/src/os/pcd_enumerate.c b/firmware/src/os/pcd_enumerate.c index 403cef9..0daa2c8 100644 --- a/firmware/src/os/pcd_enumerate.c +++ b/firmware/src/os/pcd_enumerate.c @@ -94,8 +94,8 @@ static struct udp_pcd upcd; struct epstate { - u_int32_t state_busy; - u_int32_t state_pending; + uint32_t state_busy; + uint32_t state_pending; }; static const struct epstate epstate[] = { @@ -140,7 +140,7 @@ int udp_refill_ep(int ep) { - u_int16_t i; + uint16_t i; AT91PS_UDP pUDP = upcd.pUdp; struct req_ctx *rctx; unsigned int start, end; @@ -231,7 +231,7 @@ static void udp_irq(void) { - u_int32_t csr; + uint32_t csr; AT91PS_UDP pUDP = upcd.pUdp; AT91_REG isr = pUDP->UDP_ISR; @@ -270,8 +270,8 @@ udp_ep0_handler(); } if (isr & AT91C_UDP_EPINT1) { - u_int32_t cur_rcv_bank = upcd.cur_rcv_bank; - u_int16_t i, pkt_size; + uint32_t cur_rcv_bank = upcd.cur_rcv_bank; + uint16_t i, pkt_size; struct req_ctx *rctx; csr = pUDP->UDP_CSR[1]; @@ -471,9 +471,9 @@ static void udp_ep0_handler(void) { AT91PS_UDP pUDP = upcd.pUdp; - u_int8_t bmRequestType, bRequest; - u_int16_t wValue, wIndex, wLength, wStatus; - u_int32_t csr = pUDP->UDP_CSR[0]; + uint8_t bmRequestType, bRequest; + uint16_t wValue, wIndex, wLength, wStatus; + uint32_t csr = pUDP->UDP_CSR[0]; DEBUGE("CSR=0x%04x ", csr); @@ -521,7 +521,7 @@ /* Handle supported standard device request Cf Table 9-3 in USB * speciication Rev 1.1 */ switch ((bRequest << 8) | bmRequestType) { - u_int8_t desc_type, desc_index; + uint8_t desc_type, desc_index; case STD_GET_DESCRIPTOR: DEBUGE("GET_DESCRIPTOR(wValue=0x%04x, wIndex=0x%04x) ", wValue, wIndex); diff --git a/firmware/src/os/pio_irq.c b/firmware/src/os/pio_irq.c index d11bd47..921fdf3 100644 --- a/firmware/src/os/pio_irq.c +++ b/firmware/src/os/pio_irq.c @@ -27,17 +27,17 @@ struct pioirq_state { irq_handler_t *handlers[NR_PIO]; - u_int32_t usbmask; - u_int32_t usb_throttled; /* atomic? */ + uint32_t usbmask; + uint32_t usb_throttled; /* atomic? */ }; static struct pioirq_state pirqs; /* low-level handler, used by Cstartup_app.S PIOA fast forcing and * by regular interrupt handler below */ -void __ramfunc __pio_irq_demux(u_int32_t pio) +void __ramfunc __pio_irq_demux(uint32_t pio) { - u_int8_t send_usb = 0; + uint8_t send_usb = 0; int i; //DEBUGPCRF("PIO_ISR_STATUS = 0x%08x", pio); @@ -59,15 +59,15 @@ pirqs.usb_throttled = 1; } else { struct openpcd_hdr *opcdh; - u_int32_t *regmask; + uint32_t *regmask; opcdh = (struct openpcd_hdr *) irq_rctx->data; - regmask = (u_int32_t *) (irq_rctx->data + sizeof(*opcdh)); + regmask = (uint32_t *) (irq_rctx->data + sizeof(*opcdh)); opcdh->cmd = OPENPCD_CMD_PIO_IRQ; opcdh->reg = 0x00; opcdh->flags = 0x00; opcdh->val = 0x00; - irq_rctx->tot_len = sizeof(*opcdh) + sizeof(u_int32_t); + irq_rctx->tot_len = sizeof(*opcdh) + sizeof(uint32_t); req_ctx_set_state(irq_rctx, RCTX_STATE_UDP_EP3_PENDING); } } @@ -78,23 +78,23 @@ /* regular interrupt handler, in case fast forcing for PIOA disabled */ static void pio_irq_demux(void) { - u_int32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); + uint32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); __pio_irq_demux(pio); } -void pio_irq_enable(u_int32_t pio) +void pio_irq_enable(uint32_t pio) { AT91F_PIO_InterruptEnable(AT91C_BASE_PIOA, pio); } -void pio_irq_disable(u_int32_t pio) +void pio_irq_disable(uint32_t pio) { AT91F_PIO_InterruptDisable(AT91C_BASE_PIOA, pio); } -int pio_irq_register(u_int32_t pio, irq_handler_t *handler) +int pio_irq_register(uint32_t pio, irq_handler_t *handler) { - u_int8_t num = ffs(pio); + uint8_t num = ffs(pio); if (num == 0) return -EINVAL; @@ -111,9 +111,9 @@ return 0; } -void pio_irq_unregister(u_int32_t pio) +void pio_irq_unregister(uint32_t pio) { - u_int8_t num = ffs(pio); + uint8_t num = ffs(pio); if (num == 0) return; diff --git a/firmware/src/os/pio_irq.h b/firmware/src/os/pio_irq.h index 33f4656..b782821 100644 --- a/firmware/src/os/pio_irq.h +++ b/firmware/src/os/pio_irq.h @@ -2,12 +2,12 @@ #define _PIO_IRQ_H #define NR_PIO 32 -typedef void irq_handler_t(u_int32_t pio); +typedef void irq_handler_t(uint32_t pio); -extern void pio_irq_enable(u_int32_t pio); -extern void pio_irq_disable(u_int32_t pio); -extern int pio_irq_register(u_int32_t pio, irq_handler_t *func); -extern void pio_irq_unregister(u_int32_t pio); +extern void pio_irq_enable(uint32_t pio); +extern void pio_irq_disable(uint32_t pio); +extern int pio_irq_register(uint32_t pio, irq_handler_t *func); +extern void pio_irq_unregister(uint32_t pio); extern void pio_irq_init(void); #endif diff --git a/firmware/src/os/pit.c b/firmware/src/os/pit.c index 50ec19f..e442265 100644 --- a/firmware/src/os/pit.c +++ b/firmware/src/os/pit.c @@ -103,7 +103,7 @@ local_irq_restore(flags); } -static void pit_irq(u_int32_t sr) +static void pit_irq(uint32_t sr) { struct timer_list *tl, *next; @@ -125,21 +125,21 @@ } } -void pit_mdelay(u_int32_t ms) +void pit_mdelay(uint32_t ms) { - u_int32_t end; + uint32_t end; end = (AT91F_PITGetPIIR(AT91C_BASE_PITC) + ms) % 20; while (end < AT91F_PITGetPIIR(AT91C_BASE_PITC)) { } } -void mdelay(u_int32_t ms) +void mdelay(uint32_t ms) { return pit_mdelay(ms); } -void usleep(u_int32_t us) +void usleep(uint32_t us) { return; return pit_mdelay(us/1000); diff --git a/firmware/src/os/pit.h b/firmware/src/os/pit.h index 4a25cc1..4ac717e 100644 --- a/firmware/src/os/pit.h +++ b/firmware/src/os/pit.h @@ -20,6 +20,6 @@ extern int timer_del(struct timer_list *timer); extern void pit_init(void); -extern void pit_mdelay(u_int32_t ms); +extern void pit_mdelay(uint32_t ms); #endif diff --git a/firmware/src/os/pwm.c b/firmware/src/os/pwm.c index 70858bb..14b9b6c 100644 --- a/firmware/src/os/pwm.c +++ b/firmware/src/os/pwm.c @@ -42,7 +42,7 @@ static AT91PS_PWMC pwm = AT91C_BASE_PWMC; /* find highest bit set. returns bit (32..1) or 0 in case no bit set */ -static int fhs(u_int32_t val) +static int fhs(uint32_t val) { int i; @@ -55,16 +55,16 @@ } /* set frequency of PWM signal to freq */ -int pwm_freq_set(int channel, u_int32_t freq) +int pwm_freq_set(int channel, uint32_t freq) { /* in order to get maximum resolution, the pre-scaler must be set to * something like freq << 16. However, the mimimum pre-scaled frequency * we can get is MCLK (48MHz), the minimum is MCLK/(1024*255) = * 48MHz/261120 = 183Hz */ - u_int32_t overall_div; - u_int32_t presc_total; - u_int8_t cpre = 0; - u_int16_t cprd; + uint32_t overall_div; + uint32_t presc_total; + uint8_t cpre = 0; + uint16_t cprd; if (freq > MCLK) return -ERANGE; @@ -104,9 +104,9 @@ AT91F_PWMC_StopChannel(AT91C_BASE_PWMC, (1 << channel)); } -void pwm_duty_set_percent(int channel, u_int16_t duty) +void pwm_duty_set_percent(int channel, uint16_t duty) { - u_int32_t tmp = pwm->PWMC_CH[channel].PWMC_CPRDR & 0xffff; + uint32_t tmp = pwm->PWMC_CH[channel].PWMC_CPRDR & 0xffff; tmp = tmp << 16; /* extend value by 2^16 */ tmp = tmp / 100; /* tmp = 1 % of extended cprd */ @@ -120,7 +120,7 @@ static int pwm_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; - u_int32_t *freq; + uint32_t *freq; switch (poh->cmd) { case OPENPCD_CMD_PWM_ENABLE: @@ -138,7 +138,7 @@ case OPENPCD_CMD_PWM_FREQ_SET: if (rctx->tot_len < sizeof(*poh)+4) break; - freq = (u_int32_t *) ((unsigned char *) poh) + sizeof(*poh); + freq = (uint32_t *) ((unsigned char *) poh) + sizeof(*poh); pwm_freq_set(0, *freq); break; case OPENPCD_CMD_PWM_FREQ_GET: diff --git a/firmware/src/os/pwm.h b/firmware/src/os/pwm.h index 8836c32..bde34f6 100644 --- a/firmware/src/os/pwm.h +++ b/firmware/src/os/pwm.h @@ -1,10 +1,10 @@ #ifndef _PWM_H #define _PWM_H -extern void pwm_freq_set(int channel, u_int32_t freq); +extern void pwm_freq_set(int channel, uint32_t freq); extern void pwm_start(int channel); extern void pwm_stop(int channel); -extern void pwm_duty_set_percent(int channel, u_int16_t duty); +extern void pwm_duty_set_percent(int channel, uint16_t duty); extern void pwm_init(void); extern void pwm_fini(void); diff --git a/firmware/src/os/req_ctx.c b/firmware/src/os/req_ctx.c index 722c099..9aba813 100644 --- a/firmware/src/os/req_ctx.c +++ b/firmware/src/os/req_ctx.c @@ -38,8 +38,8 @@ #define NUM_REQ_CTX (NUM_RCTX_SMALL+NUM_RCTX_LARGE) -static u_int8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL]; -static u_int8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE]; +static uint8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL]; +static uint8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE]; static struct req_ctx req_ctx[NUM_REQ_CTX]; @@ -79,7 +79,7 @@ return toReturn; } -u_int8_t req_ctx_num(struct req_ctx *ctx) +uint8_t req_ctx_num(struct req_ctx *ctx) { return ctx - req_ctx; } diff --git a/firmware/src/os/req_ctx.h b/firmware/src/os/req_ctx.h index 92c21a7..2b7ca60 100644 --- a/firmware/src/os/req_ctx.h +++ b/firmware/src/os/req_ctx.h @@ -13,11 +13,11 @@ #include struct req_ctx { - volatile u_int32_t state; + volatile uint32_t state; volatile struct req_ctx *prev, *next; - u_int16_t size; - u_int16_t tot_len; - u_int8_t *data; + uint16_t size; + uint16_t tot_len; + uint8_t *data; }; #define RCTX_STATE_FREE 0 @@ -45,7 +45,7 @@ extern struct req_ctx *req_ctx_find_busy(void); extern void req_ctx_set_state(struct req_ctx *ctx, unsigned long new_state); extern void req_ctx_put(struct req_ctx *ctx); -extern u_int8_t req_ctx_num(struct req_ctx *ctx); +extern uint8_t req_ctx_num(struct req_ctx *ctx); unsigned int req_ctx_count(unsigned long state); #endif /* _REQ_CTX_H */ diff --git a/firmware/src/os/system_irq.c b/firmware/src/os/system_irq.c index 4c1da31..5f76ea8 100644 --- a/firmware/src/os/system_irq.c +++ b/firmware/src/os/system_irq.c @@ -31,9 +31,9 @@ static sysirq_hdlr *sysirq_hdlrs[AT91SAM7_SYSIRQ_COUNT]; -void sys_irq(u_int32_t previous_pc) +void sys_irq(uint32_t previous_pc) { - u_int32_t sr; + uint32_t sr; /* Somehow Atmel decided to do really stupid interrupt sharing * for commonly-used interrupts such as the timer irq */ diff --git a/firmware/src/os/system_irq.h b/firmware/src/os/system_irq.h index 195b7b9..150c378 100644 --- a/firmware/src/os/system_irq.h +++ b/firmware/src/os/system_irq.h @@ -14,7 +14,7 @@ AT91SAM7_SYSIRQ_COUNT }; -typedef void sysirq_hdlr(u_int32_t sr); +typedef void sysirq_hdlr(uint32_t sr); extern void sysirq_register(enum sysirqs irq, sysirq_hdlr *hdlr); extern void sysirq_init(void); diff --git a/firmware/src/os/tc_cdiv.c b/firmware/src/os/tc_cdiv.c index 6f06ba5..bc9d5dd 100644 --- a/firmware/src/os/tc_cdiv.c +++ b/firmware/src/os/tc_cdiv.c @@ -31,7 +31,7 @@ static AT91PS_TCB tcb = AT91C_BASE_TCB; /* set carrier divider to a specific */ -void tc_cdiv_set_divider(u_int16_t div) +void tc_cdiv_set_divider(uint16_t div) { tcb->TCB_TC0.TC_RC = div; diff --git a/firmware/src/os/tc_cdiv.h b/firmware/src/os/tc_cdiv.h index 4f2bc02..86882fb 100644 --- a/firmware/src/os/tc_cdiv.h +++ b/firmware/src/os/tc_cdiv.h @@ -7,7 +7,7 @@ static AT91PS_TCB tcb; extern void tc_cdiv_phase_add(int16_t inc); -extern void tc_cdiv_set_divider(u_int16_t div); +extern void tc_cdiv_set_divider(uint16_t div); static inline void tc_cdiv_phase_inc(void) { diff --git a/firmware/src/os/usb_handler.c b/firmware/src/os/usb_handler.c index 029891a..52abd64 100644 --- a/firmware/src/os/usb_handler.c +++ b/firmware/src/os/usb_handler.c @@ -33,13 +33,13 @@ static usb_cmd_fn *cmd_hdlrs[16]; -int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class) +int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class) { cmd_hdlrs[class] = hdlr; return 0; } -void usb_hdlr_unregister(u_int8_t class) +void usb_hdlr_unregister(uint8_t class) { cmd_hdlrs[class] = NULL; } diff --git a/firmware/src/os/usb_handler.h b/firmware/src/os/usb_handler.h index 9d5ad48..52814fd 100644 --- a/firmware/src/os/usb_handler.h +++ b/firmware/src/os/usb_handler.h @@ -18,8 +18,8 @@ typedef int usb_cmd_fn(struct req_ctx *rctx); -extern int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class); -extern void usb_hdlr_unregister(u_int8_t class); +extern int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class); +extern void usb_hdlr_unregister(uint8_t class); extern void usb_in_process(void); extern void usb_out_process(void); diff --git a/firmware/src/os/usbcmd_generic.c b/firmware/src/os/usbcmd_generic.c index aff13eb..c76bcc1 100644 --- a/firmware/src/os/usbcmd_generic.c +++ b/firmware/src/os/usbcmd_generic.c @@ -18,14 +18,14 @@ #define OPENPCD_API_VERSION (0x01) #define CONFIG_AREA_ADDR ((void*)(AT91C_IFLASH + AT91C_IFLASH_SIZE - ENVIRONMENT_SIZE)) -#define CONFIG_AREA_WORDS ( AT91C_IFLASH_PAGE_SIZE/sizeof(u_int32_t) ) +#define CONFIG_AREA_WORDS ( AT91C_IFLASH_PAGE_SIZE/sizeof(uint32_t) ) -volatile u_int32_t config_stack[ CONFIG_AREA_WORDS ]; +volatile uint32_t config_stack[ CONFIG_AREA_WORDS ]; static int gen_setenv(const void* buffer,int len) { volatile unsigned int i; - u_int32_t *dst; + uint32_t *dst; if( len >= sizeof(config_stack) ) len=sizeof(config_stack); @@ -35,7 +35,7 @@ /* retrieve current content to allow partial flashing */ /* flash changes */ - dst=(u_int32_t*)CONFIG_AREA_ADDR; + dst=(uint32_t*)CONFIG_AREA_ADDR; for(i=0;idata; struct openpcd_compile_version *ver = (struct openpcd_compile_version *)poh->data; - u_int32_t len = rctx->tot_len-sizeof(*poh); + uint32_t len = rctx->tot_len-sizeof(*poh); /* initialize transmit length to header length */ rctx->tot_len = sizeof(*poh); @@ -107,7 +107,7 @@ poh->flags |= OPENPCD_FLAG_RESPOND; #ifdef PCD rctx->tot_len += 4; - if (rc632_get_serial(NULL, (u_int32_t *)poh->data) < 0) { + if (rc632_get_serial(NULL, (uint32_t *)poh->data) < 0) { DEBUGP("ERROR) "); return USB_ERR(USB_ERR_CMD_NOT_IMPL); } diff --git a/firmware/src/os/usbcmd_generic.h b/firmware/src/os/usbcmd_generic.h index 4dd0456..61fbd36 100644 --- a/firmware/src/os/usbcmd_generic.h +++ b/firmware/src/os/usbcmd_generic.h @@ -1,6 +1,6 @@ #ifndef _USBAPI_GENERIC_H #define _USBAPI_GENERIC_H extern void usbcmd_gen_init(void); -extern int gen_setenv(void* data,u_int32_t pos,u_int32_t length); -extern int gen_getenv(void* data,u_int32_t pos,u_int32_t length); +extern int gen_setenv(void* data,uint32_t pos,uint32_t length); +extern int gen_getenv(void* data,uint32_t pos,uint32_t length); #endif diff --git a/firmware/src/os/wdt.c b/firmware/src/os/wdt.c index d5c19a3..6e5248e 100644 --- a/firmware/src/os/wdt.c +++ b/firmware/src/os/wdt.c @@ -30,7 +30,7 @@ #undef WDT_DEBUG #endif/*WDT_DEBUG*/ -static void wdt_irq(u_int32_t sr) +static void wdt_irq(uint32_t sr) { if (sr & 1) AT91F_DBGU_Frame("================> WATCHDOG EXPIRED !!!!!\n\r"); diff --git a/firmware/src/pcd.h b/firmware/src/pcd.h index 77c99b2..0a5585f 100644 --- a/firmware/src/pcd.h +++ b/firmware/src/pcd.h @@ -7,9 +7,9 @@ #include struct opcd_cmd_hdr { - u_int8_t cmd; - u_int8_t arg1; - u_int16_t arg2; + uint8_t cmd; + uint8_t arg1; + uint16_t arg2; } __attribute__ ((packed)); enum opcd_cmd { @@ -28,8 +28,8 @@ }; struct opcd_status_hdr { - u_int8_t cause, /* interrupt cause register RC632 */ - u_int8_t prim_status, /* primary status register RC632 */ + uint8_t cause, /* interrupt cause register RC632 */ + uint8_t prim_status, /* primary status register RC632 */ } __attribute__ ((packed)); #endif /* _OPENPCD_H */ diff --git a/firmware/src/pcd/main_librfid.c b/firmware/src/pcd/main_librfid.c index a5a488d..a04c446 100644 --- a/firmware/src/pcd/main_librfid.c +++ b/firmware/src/pcd/main_librfid.c @@ -59,30 +59,30 @@ } struct openpcd_l2_connectinfo { - u_int32_t proto_supported; + uint32_t proto_supported; - u_int8_t speed_rx; - u_int8_t speed_tx; + uint8_t speed_rx; + uint8_t speed_tx; - u_int8_t uid_len; - u_int8_t uid[10]; + uint8_t uid_len; + uint8_t uid[10]; } __attribute__ ((packed)); struct openpcd_proto_connectinfo { } __attribute__ ((packed)); struct openpcd_proto_tcl_connectinfo { - u_int8_t fsc; - u_int8_t fsd; - u_int8_t ta; - u_int8_t sfgt; + uint8_t fsc; + uint8_t fsd; + uint8_t ta; + uint8_t sfgt; - u_int8_t flags; - u_int8_t cid; - u_int8_t nad; + uint8_t flags; + uint8_t cid; + uint8_t nad; - u_int8_t ats_tot_len; - u_int8_t ats_snippet[0]; + uint8_t ats_tot_len; + uint8_t ats_snippet[0]; } __attribute__ ((packed)); static int init_proto(void) diff --git a/firmware/src/pcd/main_mifare.c b/firmware/src/pcd/main_mifare.c index 43729a5..8dd6420 100644 --- a/firmware/src/pcd/main_mifare.c +++ b/firmware/src/pcd/main_mifare.c @@ -40,7 +40,7 @@ static struct rfid_layer2_handle *l2h; static struct rfid_protocol_handle *ph; -static u_int8_t sector = 0; +static uint8_t sector = 0; void _init_func(void) { @@ -74,30 +74,30 @@ } struct openpcd_l2_connectinfo { - u_int32_t proto_supported; + uint32_t proto_supported; - u_int8_t speed_rx; - u_int8_t speed_tx; + uint8_t speed_rx; + uint8_t speed_tx; - u_int8_t uid_len; - u_int8_t uid[10]; + uint8_t uid_len; + uint8_t uid[10]; } __attribute__ ((packed)); struct openpcd_proto_connectinfo { } __attribute__ ((packed)); struct openpcd_proto_tcl_connectinfo { - u_int8_t fsc; - u_int8_t fsd; - u_int8_t ta; - u_int8_t sfgt; + uint8_t fsc; + uint8_t fsd; + uint8_t ta; + uint8_t sfgt; - u_int8_t flags; - u_int8_t cid; - u_int8_t nad; + uint8_t flags; + uint8_t cid; + uint8_t nad; - u_int8_t ats_tot_len; - u_int8_t ats_snippet[0]; + uint8_t ats_tot_len; + uint8_t ats_snippet[0]; } __attribute__ ((packed)); /* mifare classic helper */ diff --git a/firmware/src/pcd/main_presence.c b/firmware/src/pcd/main_presence.c index 4ead264..cca2cac 100644 --- a/firmware/src/pcd/main_presence.c +++ b/firmware/src/pcd/main_presence.c @@ -37,7 +37,7 @@ #define RAH NULL -u_int32_t delay_scan,delay_blink,last_uid,last_polled_uid; +uint32_t delay_scan,delay_blink,last_uid,last_polled_uid; static struct rfid_reader_handle *rh; static struct rfid_layer2_handle *l2h; @@ -54,10 +54,10 @@ if(last_polled_uid) { rctx->tot_len += 4; - poh->data[0]=(u_int8_t)(last_polled_uid>>24); - poh->data[1]=(u_int8_t)(last_polled_uid>>16); - poh->data[2]=(u_int8_t)(last_polled_uid>> 8); - poh->data[3]=(u_int8_t)(last_polled_uid ); + poh->data[0]=(uint8_t)(last_polled_uid>>24); + poh->data[1]=(uint8_t)(last_polled_uid>>16); + poh->data[2]=(uint8_t)(last_polled_uid>> 8); + poh->data[3]=(uint8_t)(last_polled_uid ); last_polled_uid=0; } break; @@ -124,16 +124,16 @@ void _main_func(void) { - u_int32_t uid; + uint32_t uid; int status; status = rfid_layer2_open(l2h); if (status >= 0 && l2h->uid_len==4) { - uid=((u_int32_t)l2h->uid[0]) | - ((u_int32_t)l2h->uid[1])<< 8| - ((u_int32_t)l2h->uid[2])<<16| - ((u_int32_t)l2h->uid[3])<<24; + uid=((uint32_t)l2h->uid[0]) | + ((uint32_t)l2h->uid[1])<< 8| + ((uint32_t)l2h->uid[2])<<16| + ((uint32_t)l2h->uid[3])<<24; delay_scan=100; diff --git a/firmware/src/pcd/main_pwm.c b/firmware/src/pcd/main_pwm.c index 50fd363..271daaf 100644 --- a/firmware/src/pcd/main_pwm.c +++ b/firmware/src/pcd/main_pwm.c @@ -39,14 +39,14 @@ #define RAH NULL -static u_int8_t force_100ask = 1; -static u_int8_t mod_conductance = 0x3f; -static u_int8_t cw_conductance = 0x3f; -static u_int16_t duty_percent = 22; +static uint8_t force_100ask = 1; +static uint8_t mod_conductance = 0x3f; +static uint8_t cw_conductance = 0x3f; +static uint16_t duty_percent = 22; #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static u_int32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; -static u_int8_t pwm_freq_idx = 0; +static uint32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; +static uint8_t pwm_freq_idx = 0; static void rc632_modulate_mfin() { @@ -61,11 +61,11 @@ #define COND_MANT(x) (x & 0x0f) #define COND_EXP(x) ((x & 0x30) >> 4) -static const u_int16_t rsrel_expfact[] = { 1000, 1925, 3706, 7133 }; +static const uint16_t rsrel_expfact[] = { 1000, 1925, 3706, 7133 }; -static u_int32_t calc_conduct_rel(u_int8_t inp) +static uint32_t calc_conduct_rel(uint8_t inp) { - u_int32_t cond_rel; + uint32_t cond_rel; cond_rel = COND_MANT(inp) * rsrel_expfact[COND_EXP(inp)]; cond_rel = cond_rel / 1000; @@ -73,14 +73,14 @@ return cond_rel; } -static const u_int8_t rsrel_table[] = { +static const uint8_t rsrel_table[] = { 0, 16, 32, 48, 1, 17, 2, 3, 33, 18, 4, 5, 19, 6, 7, 49, 34, 20, 8, 9, 21, 10, 11, 35, 22, 12, 13, 23, 14, 50, 36, 15, 24, 25, 37, 26, 27, 51, 38, 28, 29, 39, 30, 52, 31, 40, 41, 53, 42, 43, 54, 44, 45, 55, 46, 47, 56, 57, 58, 59, 60, 61, 62, 63 }; -static const u_int16_t cdivs[] = { 128, 64, 32, 16 }; +static const uint16_t cdivs[] = { 128, 64, 32, 16 }; static int cdiv_idx = 0; static void help(void) diff --git a/firmware/src/pcd/main_reqa.c b/firmware/src/pcd/main_reqa.c index 717926a..ae4b4a1 100644 --- a/firmware/src/pcd/main_reqa.c +++ b/firmware/src/pcd/main_reqa.c @@ -83,25 +83,25 @@ 0x00, 0xff, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, }; -static void reg_inc(u_int8_t reg) +static void reg_inc(uint8_t reg) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(RAH, reg, &val); opcd_rc632_reg_write(RAH, reg, val++); DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val); } -static void reg_dec(u_int8_t reg) +static void reg_dec(uint8_t reg) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(RAH, reg, &val); opcd_rc632_reg_write(RAH, reg, val--); DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val); } -static u_int8_t ana_out_sel; -static u_int8_t mfout_sel; -static u_int8_t speed_idx; +static uint8_t ana_out_sel; +static uint8_t mfout_sel; +static uint8_t speed_idx; static void help(void) { @@ -114,7 +114,7 @@ "{: dev cdiv }: inc cdiv"); } -static u_int16_t cdivs[] = { 128, 64, 32, 16 }; +static uint16_t cdivs[] = { 128, 64, 32, 16 }; int _main_dbgu(char key) { diff --git a/firmware/src/pcd/rc632.c b/firmware/src/pcd/rc632.c index 731574c..41fee19 100644 --- a/firmware/src/pcd/rc632.c +++ b/firmware/src/pcd/rc632.c @@ -72,7 +72,7 @@ /* SPI irq handler */ static void spi_irq(void) { - u_int32_t status = pSPI->SPI_SR; + uint32_t status = pSPI->SPI_SR; DEBUGPSPIIRQ("spi_irq: 0x%08x ", status); @@ -95,8 +95,8 @@ } #ifdef SPI_USES_DMA -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len) { DEBUGPSPI("DMA Xfer tx=%s\r\n", hexdump(tx_data, tx_len)); if (*rx_len < tx_len) { @@ -129,12 +129,12 @@ } #else /* stupid polling transceiver routine */ -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len) { - u_int16_t tx_cur = 0; - u_int16_t rx_len_max = 0; - u_int16_t rx_cnt = 0; + uint16_t tx_cur = 0; + uint16_t rx_len_max = 0; + uint16_t rx_cnt = 0; /* disable RC632 interrupt because it wants to do SPI transactions */ AT91F_AIC_DisableIt(AT91C_BASE_AIC, OPENPCD_IRQ_RC632); @@ -148,8 +148,8 @@ //AT91F_SPI_Enable(pSPI); while (1) { - u_int32_t sr = pSPI->SPI_SR; - u_int8_t tmp; + uint32_t sr = pSPI->SPI_SR; + uint8_t tmp; if (sr & AT91C_SPI_RDRF) { tmp = pSPI->SPI_RDR; rx_cnt++; @@ -181,8 +181,8 @@ /* static buffers used by RC632 access primitives below. * Since we only have one */ -static u_int8_t spi_outbuf[SPI_MAX_XFER_LEN]; -static u_int8_t spi_inbuf[SPI_MAX_XFER_LEN]; +static uint8_t spi_outbuf[SPI_MAX_XFER_LEN]; +static uint8_t spi_inbuf[SPI_MAX_XFER_LEN]; #define FIFO_ADDR (RC632_REG_FIFO_DATA << 1) @@ -191,9 +191,9 @@ /* RC632 access primitives */ int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t data) + uint8_t addr, uint8_t data) { - u_int16_t rx_len = 2; + uint16_t rx_len = 2; DEBUG632("[0x%02x] <= 0x%02x", addr, data); @@ -208,13 +208,13 @@ #define RC632_REGSET_START 0x10 #define RC632_REGSET_END 0x3f #define RC632_REGSET_MAXSIZE (RC632_REGSET_END-RC632_REGSET_START) -static u_int8_t regset_buf[RC632_REGSET_MAXSIZE * 2]; +static uint8_t regset_buf[RC632_REGSET_MAXSIZE * 2]; int opcd_rc632_reg_write_set(struct rfid_asic_handle *hdl, - u_int8_t *regs, int len) + uint8_t *regs, int len) { - u_int8_t i, j = 0; - u_int16_t rx_len; + uint8_t i, j = 0; + uint16_t rx_len; if (len > RC632_REGSET_MAXSIZE) return -E2BIG; @@ -232,9 +232,9 @@ } int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, - u_int8_t len, u_int8_t *data, u_int8_t flags) + uint8_t len, uint8_t *data, uint8_t flags) { - u_int16_t rx_len = sizeof(spi_inbuf); + uint16_t rx_len = sizeof(spi_inbuf); if (len > sizeof(spi_outbuf)-1) len = sizeof(spi_outbuf)-1; @@ -247,9 +247,9 @@ } int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t *val) + uint8_t addr, uint8_t *val) { - u_int16_t rx_len = 2; + uint16_t rx_len = 2; addr = (addr << 1) & 0x7e; @@ -265,12 +265,12 @@ } int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, - u_int8_t max_len, u_int8_t *data) + uint8_t max_len, uint8_t *data) { int ret; - u_int8_t fifo_length; - u_int8_t i; - u_int16_t rx_len; + uint8_t fifo_length; + uint8_t i; + uint16_t rx_len; ret = opcd_rc632_reg_read(hdl, RC632_REG_FIFO_LENGTH, &fifo_length); if (ret < 0) @@ -296,9 +296,9 @@ } int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits) + uint8_t reg, uint8_t bits) { - u_int8_t val; + uint8_t val; int ret; ret = opcd_rc632_reg_read(hdl, reg, &val); @@ -311,9 +311,9 @@ } int opcd_rc632_clear_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits) + uint8_t reg, uint8_t bits) { - u_int8_t val; + uint8_t val; int ret; ret = opcd_rc632_reg_read(hdl, reg, &val); @@ -331,7 +331,7 @@ { struct req_ctx *irq_rctx; struct openpcd_hdr *irq_opcdh; - u_int8_t cause; + uint8_t cause; /* CL RC632 has interrupted us */ opcd_rc632_reg_read(NULL, RC632_REG_INTERRUPT_RQ, &cause); @@ -392,7 +392,7 @@ AT91F_AIC_EnableIt(AT91C_BASE_AIC, OPENPCD_IRQ_RC632); } -void rc632_power(u_int8_t up) +void rc632_power(uint8_t up) { DEBUGPCRF("powering %s RC632", up ? "up" : "down"); if (up) @@ -414,7 +414,7 @@ /* wait for startup phase to finish */ while (1) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(NULL, RC632_REG_COMMAND, &val); if (val == 0x00) break; @@ -427,7 +427,7 @@ static int rc632_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; - u_int16_t len = rctx->tot_len-sizeof(*poh); + uint16_t len = rctx->tot_len-sizeof(*poh); /* initialize transmit length to header length */ rctx->tot_len = sizeof(*poh); @@ -443,7 +443,7 @@ /* FIFO read always has to provoke a response */ poh->flags &= OPENPCD_FLAG_RESPOND; { - u_int16_t req_len = poh->val, remain_len = req_len, pih_len; + uint16_t req_len = poh->val, remain_len = req_len, pih_len; #if 0 if (req_len > MAX_PAYLOAD_LEN) { pih_len = MAX_PAYLOAD_LEN; @@ -598,9 +598,9 @@ #ifdef DEBUG static int rc632_reg_write_verify(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t val) + uint8_t reg, uint8_t val) { - u_int8_t tmp; + uint8_t tmp; opcd_rc632_reg_write(hdl, reg, val); opcd_rc632_reg_read(hdl, reg, &tmp); @@ -612,11 +612,11 @@ int rc632_dump(void) { - u_int8_t i; - u_int16_t rx_len = sizeof(spi_inbuf); + uint8_t i; + uint16_t rx_len = sizeof(spi_inbuf); for (i = 0; i <= 0x3f; i++) { - u_int8_t reg = i; + uint8_t reg = i; if (reg == RC632_REG_FIFO_DATA) reg = 0x3e; diff --git a/firmware/src/pcd/rc632.h b/firmware/src/pcd/rc632.h index 5081f42..d9dfecd 100644 --- a/firmware/src/pcd/rc632.h +++ b/firmware/src/pcd/rc632.h @@ -7,17 +7,17 @@ #include extern int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t data); + uint8_t addr, uint8_t data); extern int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, - u_int8_t len, u_int8_t *data, u_int8_t flags); + uint8_t len, uint8_t *data, uint8_t flags); extern int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t *val); + uint8_t addr, uint8_t *val); extern int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, - u_int8_t max_len, u_int8_t *data); + uint8_t max_len, uint8_t *data); extern int opcd_rc632_clear_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits); + uint8_t reg, uint8_t bits); extern int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits); + uint8_t reg, uint8_t bits); extern void rc632_init(void); extern void rc632_exit(void); @@ -27,6 +27,6 @@ extern int rc632_test(struct rfid_asic_handle *hdl); extern int rc632_dump(void); -extern void rc632_power(u_int8_t up); +extern void rc632_power(uint8_t up); #endif diff --git a/firmware/src/pcd/rc632_highlevel.c b/firmware/src/pcd/rc632_highlevel.c index 14a2a2a..af101b7 100644 --- a/firmware/src/pcd/rc632_highlevel.c +++ b/firmware/src/pcd/rc632_highlevel.c @@ -49,10 +49,10 @@ static int rc632_set_bit_mask(struct rfid_asic_handle *handle, - u_int8_t reg, u_int8_t mask, u_int8_t val) + uint8_t reg, uint8_t mask, uint8_t val) { int ret; - u_int8_t tmp; + uint8_t tmp; ret = opcd_rc632_reg_read(handle, reg, &tmp); if (ret < 0) @@ -98,10 +98,10 @@ int rc632_write_eeprom(struct rfid_asic_handle *handle, - u_int16_t addr, u_int8_t len, u_int8_t *data) + uint16_t addr, uint8_t len, uint8_t *data) { - u_int8_t sndbuf[MAX_WRITE_LEN + 2]; - u_int8_t reg; + uint8_t sndbuf[MAX_WRITE_LEN + 2]; + uint8_t reg; int ret; if (len > MAX_WRITE_LEN) @@ -146,11 +146,11 @@ } int -rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, - u_int8_t *recvbuf) +rc632_read_eeprom(struct rfid_asic_handle *handle, uint16_t addr, uint8_t len, + uint8_t *recvbuf) { - u_int8_t sndbuf[3]; - u_int8_t err; + uint8_t sndbuf[3]; + uint8_t err; int ret; sndbuf[0] = (addr & 0xff); @@ -187,8 +187,8 @@ #define RC632_E2_RS_MAX_P 14 int rc632_get_serial(struct rfid_asic_handle *handle, - u_int32_t *serial) + uint32_t *serial) { return rc632_read_eeprom(handle, RC632_E2_PRODUCT_SERIAL, - 4, (u_int8_t *)serial); + 4, (uint8_t *)serial); } diff --git a/firmware/src/pcd/rc632_highlevel.h b/firmware/src/pcd/rc632_highlevel.h index 40e80e0..169f47a 100644 --- a/firmware/src/pcd/rc632_highlevel.h +++ b/firmware/src/pcd/rc632_highlevel.h @@ -11,9 +11,9 @@ rc632_turn_off_rf(struct rfid_asic_handle *handle); int -rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, - u_int8_t *recvbuf); +rc632_read_eeprom(struct rfid_asic_handle *handle, uint16_t addr, uint8_t len, + uint8_t *recvbuf); int rc632_get_serial(struct rfid_asic_handle *handle, - u_int32_t *serial); + uint32_t *serial); #endif /* _RC632_HIGHLEVEL_H */ diff --git a/firmware/src/picc/adc.c b/firmware/src/picc/adc.c index f350a49..7950cce 100644 --- a/firmware/src/picc/adc.c +++ b/firmware/src/picc/adc.c @@ -57,7 +57,7 @@ static void adc_irq(void) { - u_int32_t sr = adc->ADC_SR; + uint32_t sr = adc->ADC_SR; struct req_ctx *rctx = adc_state.rctx; DEBUGADC("adc_irq(SR=0x%08x, IMR=0x%08x, state=%u): ", @@ -102,12 +102,12 @@ } #if 0 -u_int16_t adc_read_fieldstr(void) +uint16_t adc_read_fieldstr(void) { return adc->ADC_CDR4; } -u_int16_T adc_read_pll_dem(void) +uint16_T adc_read_pll_dem(void) { return adc } diff --git a/firmware/src/picc/da.h b/firmware/src/picc/da.h index e264e2b..45e9a99 100644 --- a/firmware/src/picc/da.h +++ b/firmware/src/picc/da.h @@ -1,7 +1,7 @@ #ifndef _DA_H #define _DA_H -extern void da_comp_carr(u_int8_t position); +extern void da_comp_carr(uint8_t position); extern void da_init(void); #endif diff --git a/firmware/src/picc/decoder.c b/firmware/src/picc/decoder.c index bdd910e..0d2909f 100644 --- a/firmware/src/picc/decoder.c +++ b/firmware/src/picc/decoder.c @@ -25,10 +25,10 @@ static struct decoder_algo *decoder_algo[DECODER_NUM_ALGOS]; -static int get_next_data(struct decoder_state *st, u_int8_t *data) +static int get_next_data(struct decoder_state *st, uint8_t *data) { - u_int8_t parity_sample; - u_int32_t bytesample; + uint8_t parity_sample; + uint32_t bytesample; bytesample = st->algo->get_next_bytesample(st, &parity_sample); @@ -36,7 +36,7 @@ } /* iterate over sample buffer (size N bytes) and decode data */ -int decoder_decode(u_int8_t algo, const char *sample_buf, +int decoder_decode(uint8_t algo, const char *sample_buf, int sample_buf_size, char *data_buf) { int i, ret; @@ -46,7 +46,7 @@ return -EINVAL; st.buf = sample_buf; - st.buf32 = (u_int32_t *) st.buf; + st.buf32 = (uint32_t *) st.buf; st.bit_ofs = 0; st.algo = decoder_algo[algo]; diff --git a/firmware/src/picc/decoder.h b/firmware/src/picc/decoder.h index aef0e20..06ff42e 100644 --- a/firmware/src/picc/decoder.h +++ b/firmware/src/picc/decoder.h @@ -4,22 +4,22 @@ struct decoder_state; struct decoder_algo { - u_int8_t oversampling_rate; - u_int8_t bits_per_sampled_char; - u_int32_t bytesample_mask; - int (*decode_sample)(const u_int32_t sample, u_int8_t data); - u_int32_t (*get_next_bytesample)(struct decoder_state *st, u_int8_t *parity_sample); + uint8_t oversampling_rate; + uint8_t bits_per_sampled_char; + uint32_t bytesample_mask; + int (*decode_sample)(const uint32_t sample, uint8_t data); + uint32_t (*get_next_bytesample)(struct decoder_state *st, uint8_t *parity_sample); }; struct decoder_state { struct decoder_algo *algo; - u_int8_t bit_ofs; + uint8_t bit_ofs; const char *buf; - const u_int32_t *buf32; + const uint32_t *buf32; }; extern int decoder_register(int algnum, struct decoder_algo *algo); -extern int decoder_decode(u_int8_t algo, const char *sample_buf, +extern int decoder_decode(uint8_t algo, const char *sample_buf, int sample_buf_size, char *data_buf); #define DECODER_MILLER 0 diff --git a/firmware/src/picc/decoder_miller.c b/firmware/src/picc/decoder_miller.c index cc62672..96c9bed 100644 --- a/firmware/src/picc/decoder_miller.c +++ b/firmware/src/picc/decoder_miller.c @@ -55,7 +55,7 @@ #define SEQ_Z 0x1 /* decode a single sampled bit */ -static u_int8_t miller_decode_sampled_bit(u_int32_t sampled_bit) +static uint8_t miller_decode_sampled_bit(uint32_t sampled_bit) { switch (sampled_bit) { case SEQ_X: @@ -73,13 +73,13 @@ } /* decode a single 32bit data sample of an 8bit miller encoded word */ -static int miller_decode_sample(u_int32_t sample, u_int8_t *data) +static int miller_decode_sample(uint32_t sample, uint8_t *data) { - u_int8_t ret = 0; + uint8_t ret = 0; unsigned int i; for (i = 0; i < sizeof(sample)/OVERSAMPLING_RATE; i++) { - u_int8_t bit = miller_decode_sampled_bit(sample & 0xf); + uint8_t bit = miller_decode_sampled_bit(sample & 0xf); if (bit == 1) ret |= 1; @@ -98,10 +98,10 @@ return ret; } -static u_int32_t get_next_bytesample(struct decoder_state *ms, - u_int8_t *parity_sample) +static uint32_t get_next_bytesample(struct decoder_state *ms, + uint8_t *parity_sample) { - u_int32_t ret = 0; + uint32_t ret = 0; /* get remaining bits from the current word */ ret = *(ms->buf32) >> ms->bit_ofs; diff --git a/firmware/src/picc/decoder_nrzl.c b/firmware/src/picc/decoder_nrzl.c index 136a9c8..8307bcd 100644 --- a/firmware/src/picc/decoder_nrzl.c +++ b/firmware/src/picc/decoder_nrzl.c @@ -60,12 +60,12 @@ /* currently this code will only work with oversampling_rate == 1 */ #define OVERSAMPLING_RATE 1 -static u_int32_t get_next_bytesample(struct decoder_state *st, - u_int8_t *parity_sample) +static uint32_t get_next_bytesample(struct decoder_state *st, + uint8_t *parity_sample) { - u_int32_t ret = 0; - u_int8_t bits_per_sampled_char = st->algo->bits_per_sampled_char; - u_int8_t bytesample_mask = st->algo->bytesample_mask; + uint32_t ret = 0; + uint8_t bits_per_sampled_char = st->algo->bits_per_sampled_char; + uint8_t bytesample_mask = st->algo->bytesample_mask; /* FIXME: shift start and stop bit into parity_sample and just * return plain 8-bit data word */ @@ -83,7 +83,7 @@ return ret & bytesample_mask; } -static int nrzl_decode_sample(const u_int32_t sample, u_int8_t *data) +static int nrzl_decode_sample(const uint32_t sample, uint8_t *data) { *data = (sample >> 1) & 0xff; diff --git a/firmware/src/picc/iso14443a_manchester.c b/firmware/src/picc/iso14443a_manchester.c index f9eba1e..15a61ac 100644 --- a/firmware/src/picc/iso14443a_manchester.c +++ b/firmware/src/picc/iso14443a_manchester.c @@ -46,7 +46,7 @@ #define MANCHESTER_SEQ_E 0x5500 #define MANCHESTER_SEQ_F 0x5555 -static u_int32_t manchester_sample_size(u_int8_t frame_bytelen) +static uint32_t manchester_sample_size(uint8_t frame_bytelen) { /* 16 bits (2 bytes) per bit => 16 bytes samples per data byte, * plus 16bit (2 bytes) parity per data byte @@ -60,13 +60,13 @@ struct manch_enc_state { const char *data; char *samples; - u_int16_t *samples16; + uint16_t *samples16; }; -static void manchester_enc_byte(struct manch_enc_state *mencs, u_int8_t data) +static void manchester_enc_byte(struct manch_enc_state *mencs, uint8_t data) { int i; - u_int8_t sum_1 = 0; + uint8_t sum_1 = 0; /* append 8 sample blobs, one for each bit */ for (i = 0; i < 8; i++) { @@ -86,8 +86,8 @@ mencs->samples16++ } -int manchester_encode(char *sample_buf, u_int16_t sample_buf_len, - const char *data, u_int8_t data_len) +int manchester_encode(char *sample_buf, uint16_t sample_buf_len, + const char *data, uint8_t data_len) { int i, enc_size; struct manch_enc_state mencs @@ -112,10 +112,10 @@ #define BPSK_SPEED_212 -static u_int32_t bpsk_sample_size(u_int8_t frame_bytelen) +static uint32_t bpsk_sample_size(uint8_t frame_bytelen) -int bpsk_encode(char *sample_buf, u_int16_t sample_buf_len, - const char *data, u_int8_t data_len) +int bpsk_encode(char *sample_buf, uint16_t sample_buf_len, + const char *data, uint8_t data_len) { /* burst of 32 sub carrier cycles */ memset(sample_buf, 0x55, 8); diff --git a/firmware/src/picc/load_modulation.c b/firmware/src/picc/load_modulation.c index 576bc74..acefe98 100644 --- a/firmware/src/picc/load_modulation.c +++ b/firmware/src/picc/load_modulation.c @@ -23,7 +23,7 @@ #include "../openpcd.h" -void load_mod_level(u_int8_t level) +void load_mod_level(uint8_t level) { if (level > 3) level = 3; diff --git a/firmware/src/picc/load_modulation.h b/firmware/src/picc/load_modulation.h index 71f9d6f..59fc9cb 100644 --- a/firmware/src/picc/load_modulation.h +++ b/firmware/src/picc/load_modulation.h @@ -1,7 +1,7 @@ #ifndef _LOAD_MODULATION_H #define _LOAD_MODULATION_H -extern void load_mod_level(u_int8_t level); +extern void load_mod_level(uint8_t level); extern void load_mod_init(void); #endif diff --git a/firmware/src/picc/main_openpicc.c b/firmware/src/picc/main_openpicc.c index 93ca4b6..da9378f 100644 --- a/firmware/src/picc/main_openpicc.c +++ b/firmware/src/picc/main_openpicc.c @@ -35,15 +35,15 @@ #include #include -static const u_int16_t cdivs[] = { 8192, 2048, 1024, 512, 128, 64, 32, 16 }; -static u_int8_t cdiv_idx = 6; +static const uint16_t cdivs[] = { 8192, 2048, 1024, 512, 128, 64, 32, 16 }; +static uint8_t cdiv_idx = 6; -static u_int16_t duty_percent = 22; +static uint16_t duty_percent = 22; #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static u_int32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; -static u_int8_t pwm_freq_idx = 0; +static uint32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; +static uint8_t pwm_freq_idx = 0; -static u_int8_t load_mod = 0; +static uint8_t load_mod = 0; #define DA_BASELINE 192 @@ -88,10 +88,10 @@ int _main_dbgu(char key) { - static u_int8_t poti = DA_BASELINE; - static u_int8_t pll_inh = 1; - static u_int8_t ssc_mode = 1; - static u_int8_t sync_enabled = 0; + static uint8_t poti = DA_BASELINE; + static uint8_t pll_inh = 1; + static uint8_t ssc_mode = 1; + static uint8_t sync_enabled = 0; DEBUGPCRF("main_dbgu"); diff --git a/firmware/src/picc/openpicc.c b/firmware/src/picc/openpicc.c index 54139a9..61db217 100644 --- a/firmware/src/picc/openpicc.c +++ b/firmware/src/picc/openpicc.c @@ -16,7 +16,7 @@ #ifdef DEBUG /* Our registers, including their power-up default values */ -static u_int16_t opicc_regs[_OPICC_NUM_REGS] = { +static uint16_t opicc_regs[_OPICC_NUM_REGS] = { [OPICC_REG_14443A_UIDLEN] = 4, [OPICC_REG_14443A_FDT0] = 1236, [OPICC_REG_14443A_FDT1] = 1172, @@ -30,14 +30,14 @@ [OPICC_REG_RX_COMP_LEVEL] = 0, }; -u_int16_t opicc_reg_read(enum opicc_reg reg) +uint16_t opicc_reg_read(enum opicc_reg reg) { if (reg < _OPICC_NUM_REGS) return opicc_regs[reg]; return 0; } -void opicc_reg_write(enum opicc_reg reg, u_int16_t val) +void opicc_reg_write(enum opicc_reg reg, uint16_t val) { if (reg < _OPICC_NUM_REGS) opicc_regs[reg] = val; @@ -52,7 +52,7 @@ static int opicc_reg_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) &rctx->data[0]; - u_int16_t *val16 = (u_int16_t *) poh->data; + uint16_t *val16 = (uint16_t *) poh->data; poh->val = 0; rctx->tot_len = sizeof(*poh); @@ -60,11 +60,11 @@ switch (poh->cmd) { case OPENPCD_CMD_PICC_REG_READ: *val16 = opicc_reg_read(poh->reg); - rctx->tot_len += sizeof(u_int16_t); + rctx->tot_len += sizeof(uint16_t); poh->flags |= OPENPCD_FLAG_RESPOND; break; case OPENPCD_CMD_PICC_REG_WRITE: - if (rctx->tot_len < sizeof(*poh) + sizeof(u_int16_t)) { + if (rctx->tot_len < sizeof(*poh) + sizeof(uint16_t)) { /* we only have an 8bit write */ opicc_reg_write(poh->reg, poh->val); } else diff --git a/firmware/src/picc/opicc_reg.h b/firmware/src/picc/opicc_reg.h index adc9305..3402057 100644 --- a/firmware/src/picc/opicc_reg.h +++ b/firmware/src/picc/opicc_reg.h @@ -5,10 +5,10 @@ #include #ifdef DEBUG -u_int16_t opicc_reg_read(enum opicc_reg reg); -void opicc_reg_write(enum opicc_reg reg, u_int16_t val); +uint16_t opicc_reg_read(enum opicc_reg reg); +void opicc_reg_write(enum opicc_reg reg, uint16_t val); #else -u_int16_t opicc_regs[_OPICC_NUM_REGS]; +uint16_t opicc_regs[_OPICC_NUM_REGS]; #define opicc_reg_read(x) (opicc_regs[x]) #define opicc_reg_write(x, y) (opicc_regs[x] = y) #endif diff --git a/firmware/src/picc/piccsim.h b/firmware/src/picc/piccsim.h index 3cf6514..ddbb224 100644 --- a/firmware/src/picc/piccsim.h +++ b/firmware/src/picc/piccsim.h @@ -4,19 +4,19 @@ struct piccsim_state { enum rfid_layer2_id l2prot; unsigned char uid[10]; - u_int8_t uid_len; + uint8_t uid_len; union { struct { enum iso14443a_state state; enum iso14443a_level level; - u_int32_t flags; + uint32_t flags; } iso14443a; struct { } iso14443b; } l2; union { - u_int32_t flags; + uint32_t flags; } proto; } diff --git a/firmware/src/picc/pll.c b/firmware/src/picc/pll.c index e48911d..9a413a8 100644 --- a/firmware/src/picc/pll.c +++ b/firmware/src/picc/pll.c @@ -38,7 +38,7 @@ return AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_LOCK); } -static void pll_lock_change_cb(u_int32_t pio) +static void pll_lock_change_cb(uint32_t pio) { DEBUGPCRF("PLL LOCK: %d", pll_is_locked()); #if 1 diff --git a/firmware/src/picc/poti.c b/firmware/src/picc/poti.c index e5701dc..1901124 100644 --- a/firmware/src/picc/poti.c +++ b/firmware/src/picc/poti.c @@ -25,7 +25,7 @@ static const AT91PS_SPI spi = AT91C_BASE_SPI; -void poti_comp_carr(u_int8_t position) +void poti_comp_carr(uint8_t position) { volatile int i; diff --git a/firmware/src/picc/poti.h b/firmware/src/picc/poti.h index 92ec00d..0d238a3 100644 --- a/firmware/src/picc/poti.h +++ b/firmware/src/picc/poti.h @@ -1,7 +1,7 @@ #ifndef _POTI_H #define _POTI_H -extern void poti_comp_carr(u_int8_t position); +extern void poti_comp_carr(uint8_t position); extern void poti_init(void); #endif diff --git a/firmware/src/picc/ssc_picc.c b/firmware/src/picc/ssc_picc.c index 8ec6f79..b7455e5 100644 --- a/firmware/src/picc/ssc_picc.c +++ b/firmware/src/picc/ssc_picc.c @@ -62,7 +62,7 @@ }; static struct ssc_state ssc_state; -static const u_int16_t ssc_dmasize[] = { +static const uint16_t ssc_dmasize[] = { [SSC_MODE_NONE] = 16, [SSC_MODE_14443A_SHORT] = 16, /* 64 bytes */ [SSC_MODE_14443A_STANDARD] = 16, /* 64 bytes */ @@ -91,8 +91,8 @@ void ssc_rx_mode_set(enum ssc_mode ssc_mode) { - u_int8_t data_len, num_data, sync_len; - u_int32_t start_cond; + uint8_t data_len, num_data, sync_len; + uint32_t start_cond; /* disable Rx and all Rx interrupt sources */ AT91F_SSC_DisableRx(AT91C_BASE_SSC); @@ -151,8 +151,8 @@ static void ssc_tx_mode_set(enum ssc_mode ssc_mode) { - u_int8_t data_len, num_data, sync_len; - u_int32_t start_cond; + uint8_t data_len, num_data, sync_len; + uint32_t start_cond; /* disable Tx */ AT91F_SSC_DisableTx(AT91C_BASE_SSC); @@ -308,7 +308,7 @@ static void __ramfunc ssc_irq(void) { - u_int32_t ssc_sr = ssc->SSC_SR; + uint32_t ssc_sr = ssc->SSC_SR; int i, *tmp, emptyframe = 0; DEBUGP("ssc_sr=0x%08x, mode=%u: ", ssc_sr, ssc_state.mode); @@ -327,7 +327,7 @@ /* Experimental start SSC on frame, stop on FFFFFFFF */ if (ssc_state.mode == SSC_MODE_CONTINUOUS) { //ssc->SSC_RCMR = (ssc->SSC_RCMR & ~AT91C_SSC_START) | AT91C_SSC_START_CONTINOUS; - tmp = (u_int32_t*)ssc_state.rx_ctx[0]->data; + tmp = (uint32_t*)ssc_state.rx_ctx[0]->data; for(i = ssc_state.rx_ctx[0]->size / 4; i >= 0 ; i--) { if( *tmp++ == 0xFFFFFFFF ) { *(tmp-1) = 0xAAAAAAAA; // debug marker @@ -345,7 +345,7 @@ #endif /* Ignore empty frames */ if (ssc_state.mode == SSC_MODE_CONTINUOUS) { - tmp = (u_int32_t*)ssc_state.rx_ctx[0]->data + MAX_HDRSIZE; + tmp = (uint32_t*)ssc_state.rx_ctx[0]->data + MAX_HDRSIZE; emptyframe = 1; for(i = (ssc_state.rx_ctx[0]->size-MAX_HDRSIZE) / 4 - 8/*WTF?*/; i > 0; i--) { if( *tmp++ != 0xFFFFFFFF ) { @@ -417,7 +417,7 @@ if (ssc_sr & AT91C_SSC_RXSYN) DEBUGP("RXSYN "); if (ssc_sr & AT91C_SSC_RXRDY) { - u_int32_t sample = ssc->SSC_RHR; + uint32_t sample = ssc->SSC_RHR; DEBUGP("RXRDY=0x%08x ", sample); /* Try to set FDT compare register ASAP */ if (sample == REQA) { diff --git a/firmware/src/picc/tc_cdiv_sync.c b/firmware/src/picc/tc_cdiv_sync.c index e83ae88..6d6e1e9 100644 --- a/firmware/src/picc/tc_cdiv_sync.c +++ b/firmware/src/picc/tc_cdiv_sync.c @@ -7,9 +7,9 @@ //#define USE_IRQ -static u_int8_t enabled; +static uint8_t enabled; -static void pio_data_change(u_int32_t pio) +static void pio_data_change(uint32_t pio) { DEBUGP("PIO_FRAME_IRQ: "); /* we get one interrupt for each change. If now, after the @@ -46,7 +46,7 @@ void tc_cdiv_sync_reset(void) { if (enabled) { - u_int32_t tmp = *AT91C_PIOA_ISR; + uint32_t tmp = *AT91C_PIOA_ISR; volatile int i; DEBUGPCRF("CDIV_SYNC_FLOP"); diff --git a/firmware/src/picc/tc_fdt.c b/firmware/src/picc/tc_fdt.c index 1651b32..8b4b867 100644 --- a/firmware/src/picc/tc_fdt.c +++ b/firmware/src/picc/tc_fdt.c @@ -39,7 +39,7 @@ static AT91PS_TC tcfdt = AT91C_BASE_TC2; -void tc_fdt_set(u_int16_t count) +void tc_fdt_set(uint16_t count) { tcfdt->TC_RA = count; } @@ -47,14 +47,14 @@ /* 'count' number of carrier cycles after the last modulation pause, * we deem the frame to have ended */ -void tc_frame_end_set(u_int16_t count) +void tc_frame_end_set(uint16_t count) { tcfdt->TC_RB = count; } static void tc_fdt_irq(void) { - u_int32_t sr = tcfdt->TC_SR; + uint32_t sr = tcfdt->TC_SR; DEBUGP("tc_fdt_irq: TC2_SR=0x%08x TC2_CV=0x%08x ", sr, tcfdt->TC_CV); diff --git a/firmware/src/picc/tc_fdt.h b/firmware/src/picc/tc_fdt.h index b39b935..db0a5c2 100644 --- a/firmware/src/picc/tc_fdt.h +++ b/firmware/src/picc/tc_fdt.h @@ -4,6 +4,6 @@ #include extern void tc_fdt_init(void); -extern void tc_fdt_set(u_int16_t count); +extern void tc_fdt_set(uint16_t count); #endif diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c index 9e8ace9..aa85d6e 100644 --- a/firmware/src/simtrace/iso7816_uart.c +++ b/firmware/src/simtrace/iso7816_uart.c @@ -85,22 +85,22 @@ struct iso7816_3_handle { enum iso7816_3_state state; - u_int8_t fi; - u_int8_t di; - u_int8_t wi; - u_int32_t waiting_time; + uint8_t fi; + uint8_t di; + uint8_t wi; + uint32_t waiting_time; enum atr_state atr_state; - u_int8_t atr_idx; - u_int8_t atr_hist_len; - u_int8_t atr_last_td; - u_int8_t atr[64]; + uint8_t atr_idx; + uint8_t atr_hist_len; + uint8_t atr_last_td; + uint8_t atr[64]; - u_int16_t prot_t_supported; + uint16_t prot_t_supported; enum pts_state pts_state; - u_int8_t pts_req[6]; - u_int8_t pts_resp[6]; + uint8_t pts_req[6]; + uint8_t pts_resp[6]; struct simtrace_hdr sh; @@ -114,13 +114,13 @@ /* Table 6 from ISO 7816-3 */ -static const u_int16_t fi_table[] = { +static const uint16_t fi_table[] = { 372, 372, 558, 744, 1116, 1488, 1860, 0, 0, 512, 768, 1024, 1536, 2048, 0, 0 }; /* Table 7 from ISO 7816-3 */ -static const u_int8_t di_table[] = { +static const uint8_t di_table[] = { 0, 1, 2, 4, 8, 16, 32, 64, 12, 20, 2, 4, 8, 16, 32, 64, }; @@ -154,9 +154,9 @@ } /* compute the F/D ratio based on Fi and Di values */ -static int compute_fidi_ratio(u_int8_t fi, u_int8_t di) +static int compute_fidi_ratio(uint8_t fi, uint8_t di) { - u_int16_t f, d; + uint16_t f, d; int ret; if (fi >= ARRAY_SIZE(fi_table) || @@ -314,7 +314,7 @@ } /* determine the next ATR state based on received interface byte */ -static enum atr_state next_intb_state(struct iso7816_3_handle *ih, u_int8_t ch) +static enum atr_state next_intb_state(struct iso7816_3_handle *ih, uint8_t ch) { switch (ih->atr_state) { case ATR_S_WAIT_TD: @@ -359,7 +359,7 @@ /* process an incomng ATR byte */ static enum iso7816_3_state -process_byte_atr(struct iso7816_3_handle *ih, u_int8_t byte) +process_byte_atr(struct iso7816_3_handle *ih, uint8_t byte) { /* add byte to ATR buffer */ ih->atr[ih->atr_idx] = byte; @@ -412,9 +412,9 @@ /* Determine the next PTS state */ static enum pts_state next_pts_state(struct iso7816_3_handle *ih) { - u_int8_t is_resp = ih->pts_state & 0x10; - u_int8_t sstate = ih->pts_state & 0x0f; - u_int8_t *pts_ptr; + uint8_t is_resp = ih->pts_state & 0x10; + uint8_t sstate = ih->pts_state & 0x0f; + uint8_t *pts_ptr; if (!is_resp) pts_ptr = ih->pts_req; @@ -453,7 +453,7 @@ } static enum iso7816_3_state -process_byte_pts(struct iso7816_3_handle *ih, u_int8_t byte) +process_byte_pts(struct iso7816_3_handle *ih, uint8_t byte) { switch (ih->pts_state) { case PTS_S_WAIT_REQ_PTSS: @@ -510,7 +510,7 @@ return ISO7816_S_IN_PTS; } -static void process_byte(struct iso7816_3_handle *ih, u_int8_t byte) +static void process_byte(struct iso7816_3_handle *ih, uint8_t byte) { int new_state = -1; struct req_ctx *rctx; @@ -589,7 +589,7 @@ void iso_uart_idleflush(void) { static struct req_ctx *last_req = NULL; - static u_int16_t last_len = 0; + static uint16_t last_len = 0; if (last_req == isoh.rctx && last_len == isoh.rctx->tot_len && @@ -603,8 +603,8 @@ static __ramfunc void usart_irq(void) { - u_int32_t csr = usart->US_CSR; - u_int8_t octet; + uint32_t csr = usart->US_CSR; + uint8_t octet; //DEBUGP("USART IRQ, CSR=0x%08x\n", csr); @@ -620,7 +620,7 @@ } if (csr & (AT91C_US_PARE|AT91C_US_FRAME|AT91C_US_OVRE)) { - u_int8_t nb_err = usart->US_NER; + uint8_t nb_err = usart->US_NER; /* FIXME: some error has occurrerd */ //DEBUGP("NER=%02x ", nb_err); /* clear the status */ @@ -641,7 +641,7 @@ } /* handler for the RST input pin state change */ -static void reset_pin_irq(u_int32_t pio) +static void reset_pin_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, pio)) { /* make sure to flush pending req_ctx */ @@ -659,7 +659,7 @@ void iso_uart_dump(void) { - u_int32_t csr = usart->US_CSR; + uint32_t csr = usart->US_CSR; DEBUGPCR("USART CSR=0x%08x", csr); } diff --git a/firmware/src/simtrace/main_factory.c b/firmware/src/simtrace/main_factory.c index 7a491ed..502feb2 100644 --- a/firmware/src/simtrace/main_factory.c +++ b/firmware/src/simtrace/main_factory.c @@ -72,7 +72,7 @@ break; case 'P': { - u_int32_t version; + uint32_t version; int rc = prod_info_get(&version, NULL); if (rc >= 0) DEBUGPCR("Version: 0x%08x\n", version); diff --git a/firmware/src/simtrace/prod_info.c b/firmware/src/simtrace/prod_info.c index 87ef6e2..ef2e8eb 100644 --- a/firmware/src/simtrace/prod_info.c +++ b/firmware/src/simtrace/prod_info.c @@ -38,17 +38,17 @@ struct simtrace_prod_info { /* magic value */ - u_int32_t magic; + uint32_t magic; /* unix timestamp of production date (0=unknown) */ - u_int32_t production_ts; + uint32_t production_ts; /* hardware version */ - u_int32_t version; + uint32_t version; /* re-works applied */ - u_int32_t reworks; + uint32_t reworks; } __attribute__((packed)); -int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks) +int prod_info_write(uint32_t ts, uint32_t version, uint32_t reworks) { struct simtrace_prod_info pi = { .magic = PRODINFO_MAGIC, @@ -56,8 +56,8 @@ .version = version, .reworks = reworks, }; - u_int8_t *pi8 = (u_int8_t *) π - u_int32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); + uint8_t *pi8 = (uint8_t *) π + uint32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); unsigned int rc; int i; @@ -80,12 +80,12 @@ return rc; } -int prod_info_get(u_int32_t *ver, u_int32_t *reworks) +int prod_info_get(uint32_t *ver, uint32_t *reworks) { struct simtrace_prod_info pi; - u_int32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); + uint32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); - spiflash_otp_read(addr, (u_int8_t *) &pi, sizeof(pi)); + spiflash_otp_read(addr, (uint8_t *) &pi, sizeof(pi)); if (pi.magic != PRODINFO_MAGIC) return -1; diff --git a/firmware/src/simtrace/prod_info.h b/firmware/src/simtrace/prod_info.h index 7a12421..796ee7a 100644 --- a/firmware/src/simtrace/prod_info.h +++ b/firmware/src/simtrace/prod_info.h @@ -6,7 +6,7 @@ ((c & 0xff) << 0)) -int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks); -int prod_info_get(u_int32_t *ver, u_int32_t *reworks); +int prod_info_write(uint32_t ts, uint32_t version, uint32_t reworks); +int prod_info_get(uint32_t *ver, uint32_t *reworks); #endif diff --git a/firmware/src/simtrace/sim_switch.c b/firmware/src/simtrace/sim_switch.c index 90067ac..36f9f0c 100644 --- a/firmware/src/simtrace/sim_switch.c +++ b/firmware/src/simtrace/sim_switch.c @@ -48,7 +48,7 @@ AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SC_SW); } -static void sw_sim_irq(u_int32_t pio) +static void sw_sim_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, SIMTRACE_PIO_SW_SIM)) @@ -57,7 +57,7 @@ DEBUGPCR("SIM card removed"); } -static void vcc_phone_irq(u_int32_t pio) +static void vcc_phone_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_PHONE)) { DEBUGPCR("VCC_PHONE off"); diff --git a/firmware/src/simtrace/spi_flash.c b/firmware/src/simtrace/spi_flash.c index ffda1b2..10c6fa7 100644 --- a/firmware/src/simtrace/spi_flash.c +++ b/firmware/src/simtrace/spi_flash.c @@ -88,15 +88,15 @@ static __ramfunc void spi_irq(void) { - u_int32_t status = pSPI->SPI_SR; + uint32_t status = pSPI->SPI_SR; AT91F_AIC_ClearIt(AT91C_BASE_AIC, AT91C_ID_SPI); } -static const u_int8_t chipid_s25fl032p[3] = { 0x01, 0x02, 0x15 }; +static const uint8_t chipid_s25fl032p[3] = { 0x01, 0x02, 0x15 }; -static u_int8_t chip_id[3]; -static u_int32_t otp_supported; +static uint8_t chip_id[3]; +static uint32_t otp_supported; void spiflash_init(void) { @@ -141,13 +141,13 @@ otp_supported = 1; } -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len, u_int16_t rx_skip) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len, uint16_t rx_skip) { - u_int16_t tx_cur = 0; - u_int16_t rx_len_max = 0; - u_int16_t rx_cnt = 0; - u_int8_t tmp; + uint16_t tx_cur = 0; + uint16_t rx_len_max = 0; + uint16_t rx_cnt = 0; + uint8_t tmp; DEBUGPSPI("spi_transceive: enter(tx_len=%u) ", tx_len); @@ -161,7 +161,7 @@ //AT91F_SPI_Enable(pSPI); while (1) { - u_int32_t sr = pSPI->SPI_SR; + uint32_t sr = pSPI->SPI_SR; if (sr & AT91C_SPI_RDRF) { tmp = pSPI->SPI_RDR; rx_cnt++; @@ -199,11 +199,11 @@ return 0; } -void spiflash_get_id(u_int8_t *id) +void spiflash_get_id(uint8_t *id) { - const u_int8_t tx_data[] = { SPIF_CMD_RDID, 0, 0, 0 }; - u_int8_t rx_data[] = { 0,0,0,0 }; - u_int16_t rx_len = sizeof(rx_data); + const uint8_t tx_data[] = { SPIF_CMD_RDID, 0, 0, 0 }; + uint8_t rx_data[] = { 0,0,0,0 }; + uint16_t rx_len = sizeof(rx_data); spi_transceive(tx_data, sizeof(tx_data), rx_data, &rx_len, 1); DEBUGPSPI("SPI ID: %02x %02x %02x\r\n", @@ -213,9 +213,9 @@ int spiflash_read_status(void) { - const u_int8_t tx_data[] = { SPIF_CMD_RDSR, 0 }; - u_int8_t rx_data[1]; - u_int16_t rx_len = sizeof(rx_data); + const uint8_t tx_data[] = { SPIF_CMD_RDSR, 0 }; + uint8_t rx_data[1]; + uint16_t rx_len = sizeof(rx_data); spi_transceive(tx_data, sizeof(tx_data), rx_data, &rx_len, 1); @@ -226,14 +226,14 @@ void spiflash_clear_status(void) { - const u_int8_t tx_data[] = { SPIF_CMD_CLSR }; + const uint8_t tx_data[] = { SPIF_CMD_CLSR }; spi_transceive(tx_data, sizeof(tx_data), NULL, 0, 0); } int spiflash_write_enable(int enable) { - u_int8_t tx_data[1]; + uint8_t tx_data[1]; if (enable) tx_data[0] = SPIF_CMD_WREN; @@ -245,9 +245,9 @@ return 0; } -int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len) +int spiflash_otp_read(uint32_t otp_addr, uint8_t *out, uint16_t rx_len) { - u_int8_t tx_data[] = { SPIF_CMD_OTPR, 0, 0, 0, 0 }; + uint8_t tx_data[] = { SPIF_CMD_OTPR, 0, 0, 0, 0 }; if (!otp_supported) { DEBUGP("OTP not supported!\r\n"); @@ -269,9 +269,9 @@ return rx_len; } -int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data) +int spiflash_otp_write(uint32_t otp_addr, uint8_t data) { - u_int8_t tx_data[] = { SPIF_CMD_OTPP, 0, 0, 0, 0 }; + uint8_t tx_data[] = { SPIF_CMD_OTPP, 0, 0, 0, 0 }; if (!otp_supported) { DEBUGP("OTP not supported!\r\n"); @@ -293,7 +293,7 @@ return 0; } -static int otp_region2addr(u_int8_t region) +static int otp_region2addr(uint8_t region) { /* see Figure 10.1 of S25FL032P data sheet */ if (region > 31 || region < 1) @@ -308,7 +308,7 @@ return 0x112; } -static int otp_region2bit(u_int8_t region) +static int otp_region2bit(uint8_t region) { /* see Figure 10.1 of S25FL032P data sheet */ if (region > 31 || region < 1) @@ -323,10 +323,10 @@ return region - 1; } -int spiflash_otp_get_lock(u_int8_t region) +int spiflash_otp_get_lock(uint8_t region) { - u_int32_t addr; - u_int8_t bit, data; + uint32_t addr; + uint8_t bit, data; if (region > 31 || region < 1) return -1; @@ -342,10 +342,10 @@ return 0; } -int spiflash_otp_set_lock(u_int8_t region) +int spiflash_otp_set_lock(uint8_t region) { - u_int32_t addr; - u_int8_t bit; + uint32_t addr; + uint8_t bit; if (region > 31 || region < 1) return -1; diff --git a/firmware/src/simtrace/spi_flash.h b/firmware/src/simtrace/spi_flash.h index d823130..1654eec 100644 --- a/firmware/src/simtrace/spi_flash.h +++ b/firmware/src/simtrace/spi_flash.h @@ -6,14 +6,14 @@ #define OTP_ADDR(x) (0x114 + ( ((x) - 1) * 16 ) ) void spiflash_init(void); -void spiflash_get_id(u_int8_t *id); +void spiflash_get_id(uint8_t *id); int spiflash_read_status(void); void spiflash_clear_status(void); void spiflash_write_protect(int on); int spiflash_write_enable(int enable); -int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len); -int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data); -int spiflash_otp_get_lock(u_int8_t region); -int spiflash_otp_set_lock(u_int8_t region); +int spiflash_otp_read(uint32_t otp_addr, uint8_t *out, uint16_t rx_len); +int spiflash_otp_write(uint32_t otp_addr, uint8_t data); +int spiflash_otp_get_lock(uint8_t region); +int spiflash_otp_set_lock(uint8_t region); #endif diff --git a/firmware/src/simtrace/tc_etu.c b/firmware/src/simtrace/tc_etu.c index fc52033..88be665 100644 --- a/firmware/src/simtrace/tc_etu.c +++ b/firmware/src/simtrace/tc_etu.c @@ -26,14 +26,14 @@ static AT91PS_TCB tcb; static AT91PS_TC tcetu = AT91C_BASE_TC0; -static u_int16_t waiting_time = 9600; -static u_int16_t clocks_per_etu = 372; -static u_int16_t wait_events; +static uint16_t waiting_time = 9600; +static uint16_t clocks_per_etu = 372; +static uint16_t wait_events; static __ramfunc void tc_etu_irq(void) { - u_int32_t sr = tcetu->TC_SR; - static u_int16_t nr_events; + uint32_t sr = tcetu->TC_SR; + static uint16_t nr_events; if (sr & AT91C_TC_ETRGS) { /* external trigger, i.e. we have seen a bit on I/O */ @@ -73,14 +73,14 @@ tcetu->TC_RC = clocks_per_etu * 12; } -void tc_etu_set_wtime(u_int16_t wtime) +void tc_etu_set_wtime(uint16_t wtime) { waiting_time = wtime; recalc_nr_events(); //DEBUGPCR("wtime=%u, actually waiting %u", wtime, wait_events * 12); } -void tc_etu_set_etu(u_int16_t etu) +void tc_etu_set_etu(uint16_t etu) { clocks_per_etu = etu; recalc_nr_events(); diff --git a/firmware/src/simtrace/tc_etu.h b/firmware/src/simtrace/tc_etu.h index 59d9031..ee1458d 100644 --- a/firmware/src/simtrace/tc_etu.h +++ b/firmware/src/simtrace/tc_etu.h @@ -1,4 +1,4 @@ -void tc_etu_set_wtime(u_int16_t wtime); -void tc_etu_set_etu(u_int16_t etu); +void tc_etu_set_wtime(uint16_t wtime); +void tc_etu_set_etu(uint16_t etu); void tc_etu_init(void); -- To view, visit https://gerrit.osmocom.org/2122 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33f6383535c5860b833f7ccb9bea122d38f28e3f Gerrit-PatchSet: 1 Gerrit-Project: openpcd Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:20:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:20:11 +0000 Subject: [PATCH] openpcd[master]: add README.md Message-ID: Review at https://gerrit.osmocom.org/2123 add README.md Change-Id: Ib2c4fc8b20812f698c75041f75cd0076f5354af2 --- A README.md 1 file changed, 58 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openpcd refs/changes/23/2123/1 diff --git a/README.md b/README.md new file mode 100644 index 0000000..130d9e0 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +OpenPCD, OpenPICC and SIMtrace device firmware +============================================== + +This repository contains the C-language firmware of a couple of +different USB devices that share nothing in common but the fact that +they contain and Atmel AT91SAM7S microcontroller and that Harald Welte +was involved in their development. + +The OpenPCD 1.x and OpenPICC 1.x devices are pretty much obsolete these +days, so SAM7S based SIMtrace 1.x is the only relevant platform these +days. + +[Osmocom](https://osmocom.org/) +[SIMtrace](https://osmocom.org/projects/simtrace) is a USB-attached +peripheral device that is primarily used to sniff the traffic between a +SIM/USIM card and a Phone or cellular modem. + +Homepage +-------- + +The official homepage of the project is + + +GIT Repository +-------------- + +You can clone from the official openpcd.git repository using + + git clone git://git.osmocom.org/openpcd.git + +There is a cgit interface at + +Documentation +------------- + +Ther homepage (see above) contains a wiki with information as well as +the SIMtrace user manual. + +Mailing List +------------ + +Discussions related to SIMtrace are happening on the +simtrace at lists.osmocom.org mailing list, please see + for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at + + +We use accept code/patch submissions via e-mail to the above-mentioned +mailing list. -- To view, visit https://gerrit.osmocom.org/2123 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib2c4fc8b20812f698c75041f75cd0076f5354af2 Gerrit-PatchSet: 1 Gerrit-Project: openpcd Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:31:46 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:31:46 +0000 Subject: [PATCH] osmo-sim-auth[master]: Update README file with general information and convert to M... Message-ID: Review at https://gerrit.osmocom.org/2124 Update README file with general information and convert to Markdown Change-Id: Ic9f95c073b17bfe689dea7672c67e5c081c01dae --- R README.md 1 file changed, 63 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sim-auth refs/changes/24/2124/1 diff --git a/README b/README.md similarity index 72% rename from README rename to README.md index fe46693..e532a87 100644 --- a/README +++ b/README.md @@ -1,10 +1,50 @@ -= osmo-sim-auth = +# osmo-sim-auth This is a small script that can be used with a PC-based smart card reader to obtain GSM/UMTS authentication parameters from a SIM/USIM card. -== prerequisites == +osmo-sim-auth is part of the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects. + +## iHomepage + +The official homepage of the project is + + +## GIT Repository + +You can clone from the official osmo-sim-auth.git repository using + + git clone git://git.osmocom.org/osmo-sim-auth.git + +There is a cgit interface at + +## Mailing List + +Discussions related to osmo-sim-auth are happening on the +openbsc at lists.osmocom.org mailing list, please see + for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +## Contributing + +Our coding standards are described at + + +We us a gerrit based patch submission/review process for managing +contributions. Please see + for +more details + +The current patch queue for osmo-sim-auth can be seen at + + +## prerequisites We assume that you have @@ -12,7 +52,7 @@ * Installed python program and pyscard library -=== smart card reader === +### smart card reader Any reader supported by pcsc-lite will work. However, a reader compatible with the USB CCID device class is much recommended. @@ -20,7 +60,7 @@ Please verify that the hardware and driver setup is working, e.g. by using the 'pcsc_scan' tool included with pcsc-lite. You should get an output like: -{{{ +``` V 1.4.17 (c) 2001-2009, Ludovic Rousseau Compiled with PC/SC lite version: 1.5.5 Scanning present readers... @@ -32,12 +72,12 @@ ATR: 3B 9F 95 80 1F C7 80 31 E0 73 FE 21 13 57 12 29 11 02 01 00 00 C2 ATR: 3B 9F 95 80 1F C7 80 31 E0 73 FE 21 13 57 12 29 11 02 01 00 00 C2 -}}} +``` plus many more lines of output decoding the ATR. -If you only get -{{{ +If you only get +``` PC/SC device scanner V 1.4.17 (c) 2001-2009, Ludovic Rousseau Compiled with PC/SC lite version: 1.5.5 @@ -47,7 +87,7 @@ Wed Dec 7 01:35:08 2011 Reader 0: OmniKey CardMan 5121 00 00 Card state: Card removed, -}}} +``` then your card was not detected in the reader. @@ -55,17 +95,17 @@ setup are likely wrong. -=== pyscard === +### pyscard pyscard can be installed from packages of major Linux distributions. If you want to build it from source, it is available from -http://pyscard.sourceforge.net/ + -== running osmo-sim-auth == +## running osmo-sim-auth -{{{ +``` $ ./osmo-sim-auth.py --help Usage: osmo-sim-auth.py [options] @@ -75,13 +115,13 @@ -r RAND, --rand=RAND RAND parameter from AuC -d, --debug Enable debug output -s, --sim SIM mode (default: USIM) -}}} +``` you can run the program in two modes: * running GSM authentication (classic SIM card protocol) * running UMTS authentication (USIM card protocol) -=== classic GSM authentication === +### classic GSM authentication This mode will use the "RUN GSM ALGORITHM" command as specified in GMS TS 11.11 @@ -90,16 +130,16 @@ * the 16 byte RAND value from the AuC (-r) as 32 hex digits * the '-s' flag to enable SIM mode -{{{ +``` $ ./osmo-sim-auth.py -r 00000000000000000000000000000000 -s Testing SIM card with IMSI 901700000000403 GSM Authentication SRES: 215fdb4d Kc: 6de816a759a42912 -}}} +``` -=== UMTS authentication === +### UMTS authentication This mode will use the "AUTHENTICATE" command as specified in 3GPP TS 31.102 @@ -108,7 +148,7 @@ * the 16 byte RAND value from the AuC (-r) as 32 hex digits * the 16 byte AUTN value from the AuC (-a) as 32 hex digits -==== successful operation ==== +#### successful operation In this case, the tool will output the following values obtained from the card: @@ -121,7 +161,7 @@ context" in order to obtain the SRES result. This value would be used if a 3G/2G dual-mode phone registers on a 2G network. -{{{ +``` python ./osmo-sim-auth.py -r 00000000000000000000000000000000 -a ec9320c2c2000000e1dd22c1ad3e2d3d [+] UICC AID found: found [AID 1] 3GPP || USIM || (255, 134) || (255, 255) || (137, 255, @@ -139,15 +179,15 @@ GSM Authentication SRES: 215fdb4d Kc: 6de816a759a42912 -}}} +``` -==== synchronization required ==== +#### synchronization required In this case, the AUTHENTICATE command will return the AUTS parameter, which has to be sent to the AuC in order to re-synchronzie the SQN counter which is kept in both the USIM as well as the AuC. -{{{ +``` ./osmo-sim-auth.py -r 00000000000000000000000000000000 -a ec9320c2c2120000c8b7de2a3449f1bd [+] UICC AID found: found [AID 1] 3GPP || USIM || (255, 134) || (255, 255) || (137, 255, @@ -162,4 +202,4 @@ GSM Authentication SRES: 215fdb4d Kc: 6de816a759a42912 -}}} +``` -- To view, visit https://gerrit.osmocom.org/2124 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic9f95c073b17bfe689dea7672c67e5c081c01dae Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:31:58 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:31:58 +0000 Subject: openpcd[master]: add README.md In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/2123 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib2c4fc8b20812f698c75041f75cd0076f5354af2 Gerrit-PatchSet: 1 Gerrit-Project: openpcd Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:32:05 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:32:05 +0000 Subject: openpcd[master]: convert from u_int*_t to uint*_t In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/2122 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I33f6383535c5860b833f7ccb9bea122d38f28e3f Gerrit-PatchSet: 1 Gerrit-Project: openpcd Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:32:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:32:08 +0000 Subject: [MERGED] openpcd[master]: convert from u_int*_t to uint*_t In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: convert from u_int*_t to uint*_t ...................................................................... convert from u_int*_t to uint*_t Change-Id: I33f6383535c5860b833f7ccb9bea122d38f28e3f --- M firmware/include/openpcd.h M firmware/include/simtrace_usb.h M firmware/include/usb_ch9.h M firmware/include/usb_dfu.h M firmware/include/usb_hid.h M firmware/scripts/usbstring.c M firmware/src/dfu/dfu.c M firmware/src/dfu/dfu.h M firmware/src/os/blinkcode.c M firmware/src/os/dbgu.c M firmware/src/os/fifo.c M firmware/src/os/fifo.h M firmware/src/os/flash.c M firmware/src/os/flash.h M firmware/src/os/pcd_enumerate.c M firmware/src/os/pio_irq.c M firmware/src/os/pio_irq.h M firmware/src/os/pit.c M firmware/src/os/pit.h M firmware/src/os/pwm.c M firmware/src/os/pwm.h M firmware/src/os/req_ctx.c M firmware/src/os/req_ctx.h M firmware/src/os/system_irq.c M firmware/src/os/system_irq.h M firmware/src/os/tc_cdiv.c M firmware/src/os/tc_cdiv.h M firmware/src/os/usb_handler.c M firmware/src/os/usb_handler.h M firmware/src/os/usbcmd_generic.c M firmware/src/os/usbcmd_generic.h M firmware/src/os/wdt.c M firmware/src/pcd.h M firmware/src/pcd/main_librfid.c M firmware/src/pcd/main_mifare.c M firmware/src/pcd/main_presence.c M firmware/src/pcd/main_pwm.c M firmware/src/pcd/main_reqa.c M firmware/src/pcd/rc632.c M firmware/src/pcd/rc632.h M firmware/src/pcd/rc632_highlevel.c M firmware/src/pcd/rc632_highlevel.h M firmware/src/picc/adc.c M firmware/src/picc/da.h M firmware/src/picc/decoder.c M firmware/src/picc/decoder.h M firmware/src/picc/decoder_miller.c M firmware/src/picc/decoder_nrzl.c M firmware/src/picc/iso14443a_manchester.c M firmware/src/picc/load_modulation.c M firmware/src/picc/load_modulation.h M firmware/src/picc/main_openpicc.c M firmware/src/picc/openpicc.c M firmware/src/picc/opicc_reg.h M firmware/src/picc/piccsim.h M firmware/src/picc/pll.c M firmware/src/picc/poti.c M firmware/src/picc/poti.h M firmware/src/picc/ssc_picc.c M firmware/src/picc/tc_cdiv_sync.c M firmware/src/picc/tc_fdt.c M firmware/src/picc/tc_fdt.h M firmware/src/simtrace/iso7816_uart.c M firmware/src/simtrace/main_factory.c M firmware/src/simtrace/prod_info.c M firmware/src/simtrace/prod_info.h M firmware/src/simtrace/sim_switch.c M firmware/src/simtrace/spi_flash.c M firmware/src/simtrace/spi_flash.h M firmware/src/simtrace/tc_etu.c M firmware/src/simtrace/tc_etu.h 71 files changed, 608 insertions(+), 607 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/firmware/include/openpcd.h b/firmware/include/openpcd.h index ea32764..1b3ba1c 100644 --- a/firmware/include/openpcd.h +++ b/firmware/include/openpcd.h @@ -6,12 +6,12 @@ #include struct openpcd_hdr { - u_int8_t cmd; /* command. high nibble: class, + uint8_t cmd; /* command. high nibble: class, * low nibble: cmd */ - u_int8_t flags; - u_int8_t reg; /* register */ - u_int8_t val; /* value (in case of write *) */ - u_int8_t data[0]; + uint8_t flags; + uint8_t reg; /* register */ + uint8_t val; /* value (in case of write *) */ + uint8_t data[0]; } __attribute__ ((packed)); #define OPCD_REV_LEN 16 diff --git a/firmware/include/simtrace_usb.h b/firmware/include/simtrace_usb.h index 08e4523..f76540e 100644 --- a/firmware/include/simtrace_usb.h +++ b/firmware/include/simtrace_usb.h @@ -5,10 +5,10 @@ /* this is kept compatible with OpenPCD protocol */ struct simtrace_hdr { - u_int8_t cmd; - u_int8_t flags; - u_int8_t res[2]; - u_int8_t data[0]; + uint8_t cmd; + uint8_t flags; + uint8_t res[2]; + uint8_t data[0]; } __attribute__ ((packed)); enum simtrace_usb_msgt { @@ -24,14 +24,14 @@ #define SIMTRACE_FLAG_PPS_FIDI 0x08 /* Fi/Di values in res[2] */ struct simtrace_stats { - u_int32_t no_rctx; - u_int32_t rctx_sent; - u_int32_t rst; - u_int32_t pps; - u_int32_t bytes; - u_int32_t parity_err; - u_int32_t frame_err; - u_int32_t overrun; + uint32_t no_rctx; + uint32_t rctx_sent; + uint32_t rst; + uint32_t pps; + uint32_t bytes; + uint32_t parity_err; + uint32_t frame_err; + uint32_t overrun; } stats; #endif /* SIMTRACE_USB_H */ diff --git a/firmware/include/usb_ch9.h b/firmware/include/usb_ch9.h index 46066f2..725c4a0 100644 --- a/firmware/include/usb_ch9.h +++ b/firmware/include/usb_ch9.h @@ -119,11 +119,11 @@ * such requests may be made at any time. */ struct usb_ctrlrequest { - u_int8_t bRequestType; - u_int8_t bRequest; - u_int16_t wValue; - u_int16_t wIndex; - u_int16_t wLength; + uint8_t bRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ @@ -169,8 +169,8 @@ /* All standard descriptors have these 2 fields at the beginning */ struct usb_descriptor_header { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; } __attribute__ ((packed)); @@ -178,21 +178,21 @@ /* USB_DT_DEVICE: Device descriptor */ struct usb_device_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t bcdUSB; - u_int8_t bDeviceClass; - u_int8_t bDeviceSubClass; - u_int8_t bDeviceProtocol; - u_int8_t bMaxPacketSize0; - u_int16_t idVendor; - u_int16_t idProduct; - u_int16_t bcdDevice; - u_int8_t iManufacturer; - u_int8_t iProduct; - u_int8_t iSerialNumber; - u_int8_t bNumConfigurations; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; } __attribute__ ((packed)); #define USB_DT_DEVICE_SIZE 18 @@ -231,15 +231,15 @@ * descriptors. */ struct usb_config_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wTotalLength; - u_int8_t bNumInterfaces; - u_int8_t bConfigurationValue; - u_int8_t iConfiguration; - u_int8_t bmAttributes; - u_int8_t bMaxPower; + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; } __attribute__ ((packed)); #define USB_DT_CONFIG_SIZE 9 @@ -254,10 +254,10 @@ /* USB_DT_STRING: String descriptor */ struct usb_string_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wData[0]; /* UTF-16LE encoded */ + uint16_t wData[0]; /* UTF-16LE encoded */ } __attribute__ ((packed)); /* note that "string" zero is special, it holds language codes that @@ -268,16 +268,16 @@ /* USB_DT_INTERFACE: Interface descriptor */ struct usb_interface_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bInterfaceNumber; - u_int8_t bAlternateSetting; - u_int8_t bNumEndpoints; - u_int8_t bInterfaceClass; - u_int8_t bInterfaceSubClass; - u_int8_t bInterfaceProtocol; - u_int8_t iInterface; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; } __attribute__ ((packed)); #define USB_DT_INTERFACE_SIZE 9 @@ -286,13 +286,13 @@ /* USB_DT_ENDPOINT: Endpoint descriptor */ struct usb_endpoint_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bEndpointAddress; - u_int8_t bmAttributes; - u_int16_t wMaxPacketSize; - u_int8_t bInterval; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; } __attribute__ ((packed)); #define USB_DT_ENDPOINT_SIZE 7 @@ -317,16 +317,16 @@ /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ struct usb_qualifier_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t bcdUSB; - u_int8_t bDeviceClass; - u_int8_t bDeviceSubClass; - u_int8_t bDeviceProtocol; - u_int8_t bMaxPacketSize0; - u_int8_t bNumConfigurations; - u_int8_t bRESERVED; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint8_t bNumConfigurations; + uint8_t bRESERVED; } __attribute__ ((packed)); @@ -334,10 +334,10 @@ /* USB_DT_OTG (from OTG 1.0a supplement) */ struct usb_otg_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bmAttributes; /* support for HNP, SRP, etc */ + uint8_t bmAttributes; /* support for HNP, SRP, etc */ } __attribute__ ((packed)); /* from usb_otg_descriptor.bmAttributes */ @@ -348,27 +348,27 @@ /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ struct usb_debug_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; /* bulk endpoints with 8 byte maxpacket */ - u_int8_t bDebugInEndpoint; - u_int8_t bDebugOutEndpoint; + uint8_t bDebugInEndpoint; + uint8_t bDebugOutEndpoint; }; /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */ struct usb_interface_assoc_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bFirstInterface; - u_int8_t bInterfaceCount; - u_int8_t bFunctionClass; - u_int8_t bFunctionSubClass; - u_int8_t bFunctionProtocol; - u_int8_t iFunction; + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; } __attribute__ ((packed)); @@ -378,11 +378,11 @@ * encryption types available for setting up a CC/association. */ struct usb_security_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wTotalLength; - u_int8_t bNumEncryptionTypes; + uint16_t wTotalLength; + uint8_t bNumEncryptionTypes; }; /*-------------------------------------------------------------------------*/ @@ -391,28 +391,28 @@ * may be retrieved. */ struct usb_key_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t tTKID[3]; - u_int8_t bReserved; - u_int8_t bKeyData[0]; + uint8_t tTKID[3]; + uint8_t bReserved; + uint8_t bKeyData[0]; }; /*-------------------------------------------------------------------------*/ /* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ struct usb_encryption_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bEncryptionType; + uint8_t bEncryptionType; #define USB_ENC_TYPE_UNSECURE 0 #define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */ #define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */ #define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ - u_int8_t bEncryptionValue; /* use in SET_ENCRYPTION */ - u_int8_t bAuthKeyIndex; + uint8_t bEncryptionValue; /* use in SET_ENCRYPTION */ + uint8_t bAuthKeyIndex; }; @@ -420,36 +420,36 @@ /* USB_DT_BOS: group of wireless capabilities */ struct usb_bos_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int16_t wTotalLength; - u_int8_t bNumDeviceCaps; + uint16_t wTotalLength; + uint8_t bNumDeviceCaps; }; /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ struct usb_dev_cap_header { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bDevCapabilityType; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; }; #define USB_CAP_TYPE_WIRELESS_USB 1 struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bDevCapabilityType; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; - u_int8_t bmAttributes; + uint8_t bmAttributes; #define USB_WIRELESS_P2P_DRD (1 << 1) #define USB_WIRELESS_BEACON_MASK (3 << 2) #define USB_WIRELESS_BEACON_SELF (1 << 2) #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) #define USB_WIRELESS_BEACON_NONE (3 << 2) - u_int16_t wPHYRates; /* bit rates, Mbps */ + uint16_t wPHYRates; /* bit rates, Mbps */ #define USB_WIRELESS_PHY_53 (1 << 0) /* always set */ #define USB_WIRELESS_PHY_80 (1 << 1) #define USB_WIRELESS_PHY_107 (1 << 2) /* always set */ @@ -458,10 +458,10 @@ #define USB_WIRELESS_PHY_320 (1 << 5) #define USB_WIRELESS_PHY_400 (1 << 6) #define USB_WIRELESS_PHY_480 (1 << 7) - u_int8_t bmTFITXPowerInfo; /* TFI power levels */ - u_int8_t bmFFITXPowerInfo; /* FFI power levels */ - u_int16_t bmBandGroup; - u_int8_t bReserved; + uint8_t bmTFITXPowerInfo; /* TFI power levels */ + uint8_t bmFFITXPowerInfo; /* FFI power levels */ + uint16_t bmBandGroup; + uint8_t bReserved; }; /*-------------------------------------------------------------------------*/ @@ -470,15 +470,15 @@ * each endpoint descriptor for a wireless device */ struct usb_wireless_ep_comp_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; - u_int8_t bMaxBurst; - u_int8_t bMaxSequence; - u_int16_t wMaxStreamDelay; - u_int16_t wOverTheAirPacketSize; - u_int8_t bOverTheAirInterval; - u_int8_t bmCompAttributes; + uint8_t bMaxBurst; + uint8_t bMaxSequence; + uint16_t wMaxStreamDelay; + uint16_t wOverTheAirPacketSize; + uint8_t bOverTheAirInterval; + uint8_t bmCompAttributes; #define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */ #define USB_ENDPOINT_SWITCH_NO 0 #define USB_ENDPOINT_SWITCH_SWITCH 1 @@ -492,13 +492,13 @@ * exchanging short lived session keys. The handshake depends on a CC. */ struct usb_handshake { - u_int8_t bMessageNumber; - u_int8_t bStatus; - u_int8_t tTKID[3]; - u_int8_t bReserved; - u_int8_t CDID[16]; - u_int8_t nonce[16]; - u_int8_t MIC[8]; + uint8_t bMessageNumber; + uint8_t bStatus; + uint8_t tTKID[3]; + uint8_t bReserved; + uint8_t CDID[16]; + uint8_t nonce[16]; + uint8_t MIC[8]; }; /*-------------------------------------------------------------------------*/ @@ -508,9 +508,9 @@ * wired USB!), and some devices may support CCs with multiple hosts. */ struct usb_connection_context { - u_int8_t CHID[16]; /* persistent host id */ - u_int8_t CDID[16]; /* device id (unique w/in host context) */ - u_int8_t CK[16]; /* connection key */ + uint8_t CHID[16]; /* persistent host id */ + uint8_t CDID[16]; /* device id (unique w/in host context) */ + uint8_t CK[16]; /* connection key */ }; /*-------------------------------------------------------------------------*/ diff --git a/firmware/include/usb_dfu.h b/firmware/include/usb_dfu.h index 5000edc..14a19d2 100644 --- a/firmware/include/usb_dfu.h +++ b/firmware/include/usb_dfu.h @@ -15,16 +15,16 @@ #define USB_DT_DFU 0x21 struct usb_dfu_func_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bmAttributes; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bmAttributes; #define USB_DFU_CAN_DOWNLOAD (1 << 0) #define USB_DFU_CAN_UPLOAD (1 << 1) #define USB_DFU_MANIFEST_TOL (1 << 2) #define USB_DFU_WILL_DETACH (1 << 3) - u_int16_t wDetachTimeOut; - u_int16_t wTransferSize; - u_int16_t bcdDFUVersion; + uint16_t wDetachTimeOut; + uint16_t wTransferSize; + uint16_t bcdDFUVersion; } __attribute__ ((packed)); #define USB_DT_DFU_SIZE 9 @@ -41,10 +41,10 @@ #define USB_REQ_DFU_ABORT 0x06 struct dfu_status { - u_int8_t bStatus; - u_int8_t bwPollTimeout[3]; - u_int8_t bState; - u_int8_t iString; + uint8_t bStatus; + uint8_t bwPollTimeout[3]; + uint8_t bState; + uint8_t iString; } __attribute__((packed)); #define DFU_STATUS_OK 0x00 diff --git a/firmware/include/usb_hid.h b/firmware/include/usb_hid.h index 49f5ab8..a1000c4 100644 --- a/firmware/include/usb_hid.h +++ b/firmware/include/usb_hid.h @@ -214,16 +214,16 @@ #define HID_FEATURE_REPORT 2 struct usb_hid_class_descriptor { - u_int8_t bDescriptorType; - u_int16_t wDescriptorLength; + uint8_t bDescriptorType; + uint16_t wDescriptorLength; } __attribute__ ((packed)); struct usb_hid_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int16_t bcdHID; - u_int8_t bCountryCode; - u_int8_t bNumDescriptors; + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; struct hid_class_descriptor desc[1]; } __attribute__ ((packed)); diff --git a/firmware/scripts/usbstring.c b/firmware/scripts/usbstring.c index 5724b40..31ab052 100644 --- a/firmware/scripts/usbstring.c +++ b/firmware/scripts/usbstring.c @@ -28,27 +28,28 @@ #include #include #include +#include #include #include -static int utf8_to_utf16le(const char *s, u_int16_t *cp, unsigned len) +static int utf8_to_utf16le(const char *s, uint16_t *cp, unsigned len) { int count = 0; - u_int8_t c; - u_int16_t uchar; + uint8_t c; + uint16_t uchar; /* this insists on correct encodings, though not minimal ones. * BUT it currently rejects legit 4-byte UTF-8 code points, * which need surrogate pairs. (Unicode 3.1 can use them.) */ - while (len != 0 && (c = (u_int8_t) *s++) != 0) { + while (len != 0 && (c = (uint8_t) *s++) != 0) { if (c & 0x80) { // 2-byte sequence: // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx if ((c & 0xe0) == 0xc0) { uchar = (c & 0x1f) << 6; - c = (u_int8_t) *s++; + c = (uint8_t) *s++; if ((c & 0xc0) != 0xc0) goto fail; c &= 0x3f; @@ -59,13 +60,13 @@ } else if ((c & 0xf0) == 0xe0) { uchar = (c & 0x0f) << 12; - c = (u_int8_t) *s++; + c = (uint8_t) *s++; if ((c & 0xc0) != 0xc0) goto fail; c &= 0x3f; uchar |= c << 6; - c = (u_int8_t) *s++; + c = (uint8_t) *s++; if ((c & 0xc0) != 0xc0) goto fail; c &= 0x3f; @@ -96,7 +97,7 @@ } #define COLUMNS 6 -static int print_array16(u_int16_t *buf, int len) +static int print_array16(uint16_t *buf, int len) { int i; for (i = 0; i < len; i++) { @@ -130,10 +131,10 @@ { printf( "static const struct {\n" "\tstruct usb_descriptor_header hdr;\n" - "\tu_int16_t wData[];\n" + "\tuint16_t wData[];\n" "} __attribute__((packed)) string%d = {\n" "\t.hdr = {\n" - "\t\t.bLength = sizeof(struct usb_descriptor_header) + %u * sizeof(u_int16_t),\n" + "\t\t.bLength = sizeof(struct usb_descriptor_header) + %u * sizeof(uint16_t),\n" "\t\t.bDescriptorType = USB_DT_STRING,\n" "\t},\n" "\t.wData = {", i, size); @@ -146,7 +147,7 @@ int main(int argc, char **argv) { char asciibuf[512+1]; - u_int16_t utf16buf[1024+1]; + uint16_t utf16buf[1024+1]; int len; int j, i = 1; @@ -160,7 +161,7 @@ print_structftr(); #if 0 printf("static const struct usb_string_descriptor string0 = {\n" - "\t.bLength = sizeof(string0) + 1 * sizeof(u_int16_t),\n" + "\t.bLength = sizeof(string0) + 1 * sizeof(uint16_t),\n" "\t.bDescriptorType = USB_DT_STRING,\n" "\t.wData[0] = 0x0409, /* English */\n" "};\n\n"); @@ -176,7 +177,7 @@ print_structhdr(i, len); #if 0 printf("static const struct usb_string_descriptor string%d = {\n" - "\t.bLength = sizeof(string%d) + %d * sizeof(u_int16_t),\n" + "\t.bLength = sizeof(string%d) + %d * sizeof(uint16_t),\n" "\t.bDescriptorType = USB_DT_STRING,\n" "\t.wData = {", i, i, len); #endif diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c index 9d1ad10..da5635d 100644 --- a/firmware/src/dfu/dfu.c +++ b/firmware/src/dfu/dfu.c @@ -72,9 +72,9 @@ static int past_manifest = 0; static int switch_to_ram = 0; /* IRQ handler requests main to jump to RAM */ -static u_int16_t usb_if_nr = 0; /* last SET_INTERFACE */ -static u_int16_t usb_if_alt_nr = 0; /* last SET_INTERFACE AltSetting */ -static u_int16_t usb_if_alt_nr_dnload = 0; /* AltSetting during last dnload */ +static uint16_t usb_if_nr = 0; /* last SET_INTERFACE */ +static uint16_t usb_if_alt_nr = 0; /* last SET_INTERFACE AltSetting */ +static uint16_t usb_if_alt_nr_dnload = 0; /* AltSetting during last dnload */ static void __dfufunc udp_init(void) { @@ -96,11 +96,11 @@ static void __dfufunc udp_ep0_send_zlp(void); /* Send Data through the control endpoint */ -static void __dfufunc udp_ep0_send_data(const char *pData, u_int32_t length, - u_int32_t window_length) +static void __dfufunc udp_ep0_send_data(const char *pData, uint32_t length, + uint32_t window_length) { AT91PS_UDP pUdp = AT91C_BASE_UDP; - u_int32_t cpt = 0, len_remain; + uint32_t cpt = 0, len_remain; AT91_REG csr; len_remain = MIN(length, window_length); @@ -147,12 +147,12 @@ } /* receive data from EP0 */ -static int __dfufunc udp_ep0_recv_data(u_int8_t *data, u_int16_t len) +static int __dfufunc udp_ep0_recv_data(uint8_t *data, uint16_t len) { AT91PS_UDP pUdp = AT91C_BASE_UDP; AT91_REG csr; - u_int16_t i, num_rcv; - u_int32_t num_rcv_total = 0; + uint16_t i, num_rcv; + uint32_t num_rcv_total = 0; do { /* FIXME: do we need to check whether we've been interrupted @@ -206,10 +206,10 @@ static int first_download = 1; -static u_int8_t *ptr, *ptr_max; -static __dfudata u_int8_t dfu_status; -__dfudata u_int32_t dfu_state = DFU_STATE_appIDLE; -static u_int32_t pagebuf32[AT91C_IFLASH_PAGE_SIZE/4]; +static uint8_t *ptr, *ptr_max; +static __dfudata uint8_t dfu_status; +__dfudata uint32_t dfu_state = DFU_STATE_appIDLE; +static uint32_t pagebuf32[AT91C_IFLASH_PAGE_SIZE/4]; static void chk_first_dnload_set_ptr(void) { @@ -218,25 +218,25 @@ switch (usb_if_alt_nr) { case 0: - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; ptr_max = AT91C_IFLASH + AT91C_IFLASH_SIZE - ENVIRONMENT_SIZE; break; case 1: - ptr = (u_int8_t *) AT91C_IFLASH; + ptr = (uint8_t *) AT91C_IFLASH; ptr_max = AT91C_IFLASH + SAM7DFU_SIZE; break; case 2: - ptr = (u_int8_t *) AT91C_ISRAM + SAM7DFU_RAM_SIZE; + ptr = (uint8_t *) AT91C_ISRAM + SAM7DFU_RAM_SIZE; ptr_max = AT91C_ISRAM + AT91C_ISRAM_SIZE; break; } first_download = 0; } -static int __dfufunc handle_dnload_flash(u_int16_t __unused val, u_int16_t len) +static int __dfufunc handle_dnload_flash(uint16_t __unused val, uint16_t len) { - volatile u_int32_t *p; - u_int8_t *pagebuf = (u_int8_t *) pagebuf32; + volatile uint32_t *p; + uint8_t *pagebuf = (uint8_t *) pagebuf32; int i; DEBUGE("download "); @@ -257,7 +257,7 @@ return RET_STALL; } chk_first_dnload_set_ptr(); - p = (volatile u_int32_t *)ptr; + p = (volatile uint32_t *)ptr; if (len == 0) { DEBUGP("zero-size write -> MANIFEST_SYNC "); @@ -293,13 +293,13 @@ flash_page(p-1); } } - ptr = (u_int8_t *) p; + ptr = (uint8_t *) p; #endif return RET_ZLP; } -static int __dfufunc handle_dnload_ram(u_int16_t __unused val, u_int16_t len) +static int __dfufunc handle_dnload_ram(uint16_t __unused val, uint16_t len) { DEBUGE("download "); @@ -339,7 +339,7 @@ return RET_ZLP; } -static int __dfufunc handle_dnload(u_int16_t val, u_int16_t len) +static int __dfufunc handle_dnload(uint16_t val, uint16_t len) { usb_if_alt_nr_dnload = usb_if_alt_nr; switch (usb_if_alt_nr) { @@ -350,8 +350,8 @@ } } -#define AT91C_IFLASH_END ((u_int8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE) -static __dfufunc int handle_upload(u_int16_t __unused val, u_int16_t len) +#define AT91C_IFLASH_END ((uint8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE) +static __dfufunc int handle_upload(uint16_t __unused val, uint16_t len) { DEBUGE("upload "); if (len > AT91C_IFLASH_PAGE_SIZE) { @@ -364,7 +364,7 @@ chk_first_dnload_set_ptr(); if (ptr + len > AT91C_IFLASH_END) { - len = AT91C_IFLASH_END - (u_int8_t *)ptr; + len = AT91C_IFLASH_END - (uint8_t *)ptr; first_download = 1; } @@ -377,7 +377,7 @@ static __dfufunc void handle_getstatus(void) { struct dfu_status dstat; - u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); + uint32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); DEBUGE("getstatus(fsr=0x%08x) ", fsr); @@ -416,15 +416,15 @@ static void __dfufunc handle_getstate(void) { - u_int8_t u8 = dfu_state; + uint8_t u8 = dfu_state; DEBUGE("getstate "); udp_ep0_send_data((char *)&u8, sizeof(u8), sizeof(u8)); } /* callback function for DFU requests */ -int __dfufunc dfu_ep0_handler(u_int8_t __unused req_type, u_int8_t req, - u_int16_t val, u_int16_t len) +int __dfufunc dfu_ep0_handler(uint8_t __unused req_type, uint8_t req, + uint16_t val, uint16_t len) { int rc, ret = RET_NOTHING; @@ -473,11 +473,11 @@ goto out; } dfu_state = DFU_STATE_dfuDNLOAD_SYNC; - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; ret = handle_dnload(val, len); break; case USB_REQ_DFU_UPLOAD: - ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE; + ptr = (uint8_t *) AT91C_IFLASH + SAM7DFU_SIZE; dfu_state = DFU_STATE_dfuUPLOAD_IDLE; handle_upload(val, len); break; @@ -652,7 +652,7 @@ return 0; } -static u_int8_t cur_config; +static uint8_t cur_config; /* USB DFU Device descriptor in DFU mode */ __dfustruct const struct usb_device_descriptor dfu_dev_descriptor = { @@ -749,9 +749,9 @@ static __dfufunc void dfu_udp_ep0_handler(void) { AT91PS_UDP pUDP = AT91C_BASE_UDP; - u_int8_t bmRequestType, bRequest; - u_int16_t wValue, wIndex, wLength, wStatus; - u_int32_t csr = pUDP->UDP_CSR[0]; + uint8_t bmRequestType, bRequest; + uint16_t wValue, wIndex, wLength, wStatus; + uint32_t csr = pUDP->UDP_CSR[0]; DEBUGE("CSR=0x%04x ", csr); @@ -798,7 +798,7 @@ /* Handle supported standard device request Cf Table 9-3 in USB * speciication Rev 1.1 */ switch ((bRequest << 8) | bmRequestType) { - u_int8_t desc_type, desc_index; + uint8_t desc_type, desc_index; case STD_GET_DESCRIPTOR: DEBUGE("GET_DESCRIPTOR "); desc_type = wValue >> 8; diff --git a/firmware/src/dfu/dfu.h b/firmware/src/dfu/dfu.h index 27c63b5..fa07281 100644 --- a/firmware/src/dfu/dfu.h +++ b/firmware/src/dfu/dfu.h @@ -124,13 +124,13 @@ struct dfuapi { void (*udp_init)(void); - void (*ep0_send_data)(const char *data, u_int32_t len, u_int32_t wlen); + void (*ep0_send_data)(const char *data, uint32_t len, uint32_t wlen); void (*ep0_send_zlp)(void); void (*ep0_send_stall)(void); - int (*dfu_ep0_handler)(u_int8_t req_type, u_int8_t req, - u_int16_t val, u_int16_t len); + int (*dfu_ep0_handler)(uint8_t req_type, uint8_t req, + uint16_t val, uint16_t len); void (*dfu_switch)(void); - u_int32_t *dfu_state; + uint32_t *dfu_state; const struct usb_device_descriptor *dfu_dev_descriptor; const struct _dfu_desc *dfu_cfg_descriptor; }; diff --git a/firmware/src/os/blinkcode.c b/firmware/src/os/blinkcode.c index 22d4b25..9e88716 100644 --- a/firmware/src/os/blinkcode.c +++ b/firmware/src/os/blinkcode.c @@ -28,7 +28,7 @@ enum blinkcode_state state; int num; int cur; - u_int8_t led; + uint8_t led; }; static struct blinker blink_state[NUM_LEDS]; diff --git a/firmware/src/os/dbgu.c b/firmware/src/os/dbgu.c index 72eaa88..7f1df44 100644 --- a/firmware/src/os/dbgu.c +++ b/firmware/src/os/dbgu.c @@ -78,7 +78,7 @@ //* Object : C handler interrupt function called by the sysirq //* demultiplexer //*---------------------------------------------------------------------------- -static void DBGU_irq_handler(u_int32_t sr) +static void DBGU_irq_handler(uint32_t sr) { static char value; diff --git a/firmware/src/os/fifo.c b/firmware/src/os/fifo.c index c30ba10..40aa0d0 100644 --- a/firmware/src/os/fifo.c +++ b/firmware/src/os/fifo.c @@ -58,7 +58,7 @@ } -u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data) +uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data) { if (len > fifo_available(fifo)) { len = fifo_available(fifo); @@ -71,7 +71,7 @@ fifo->producer += len; } else { /* difficult: wrap around */ - u_int16_t chunk_len; + uint16_t chunk_len; chunk_len = fifo->size - fifo->producer; memcpy(&fifo->data[fifo->producer], data, chunk_len); @@ -86,9 +86,9 @@ } -u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data) +uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data) { - u_int16_t avail = fifo_available(fifo); + uint16_t avail = fifo_available(fifo); if (avail < len) len = avail; @@ -98,7 +98,7 @@ memcpy(data, &fifo->data[fifo->consumer], len); } else { /* difficult case: wrap */ - u_int16_t chunk_len = fifo->size - fifo->consumer; + uint16_t chunk_len = fifo->size - fifo->consumer; memcpy(data, &fifo->data[fifo->consumer], chunk_len); memcpy(data+chunk_len, &fifo->data[0], len - chunk_len); } @@ -108,8 +108,8 @@ return len; } -int fifo_init(struct fifo *fifo, u_int16_t size, - void (*cb)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data) +int fifo_init(struct fifo *fifo, uint16_t size, + void (*cb)(struct fifo *fifo, uint8_t event, void *data), void *cb_data) { if (size > sizeof(fifo->data)) return -EINVAL; diff --git a/firmware/src/os/fifo.h b/firmware/src/os/fifo.h index d91c6c2..0b2f8e7 100644 --- a/firmware/src/os/fifo.h +++ b/firmware/src/os/fifo.h @@ -6,23 +6,23 @@ #define FIFO_SIZE 1024 struct fifo { - u_int16_t size; /* actual FIFO size, can be smaller than 'data' */ - u_int16_t producer; /* index of producer */ - u_int16_t consumer; /* index of consumer */ - u_int16_t watermark; - u_int8_t irq; - u_int8_t irq_en; - u_int8_t status; - void (*callback)(struct fifo *fifo, u_int8_t event, void *data); + uint16_t size; /* actual FIFO size, can be smaller than 'data' */ + uint16_t producer; /* index of producer */ + uint16_t consumer; /* index of consumer */ + uint16_t watermark; + uint8_t irq; + uint8_t irq_en; + uint8_t status; + void (*callback)(struct fifo *fifo, uint8_t event, void *data); void *cb_data; - u_int8_t data[FIFO_SIZE]; + uint8_t data[FIFO_SIZE]; }; -extern int fifo_init(struct fifo *fifo, u_int16_t size, - void (*callback)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data); -extern u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data); -extern u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data); +extern int fifo_init(struct fifo *fifo, uint16_t size, + void (*callback)(struct fifo *fifo, uint8_t event, void *data), void *cb_data); +extern uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data); +extern uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data); extern int fifo_available(struct fifo *fifo); #endif diff --git a/firmware/src/os/flash.c b/firmware/src/os/flash.c index c729ff8..dabc033 100644 --- a/firmware/src/os/flash.c +++ b/firmware/src/os/flash.c @@ -13,34 +13,34 @@ #define EFCS_CMD_CLEAR_NVM_BIT 0xd #define EFCS_CMD_SET_SECURITY_BIT 0xf -static u_int16_t page_from_ramaddr(const void *addr) +static uint16_t page_from_ramaddr(const void *addr) { - u_int32_t ramaddr = (u_int32_t) addr; - ramaddr -= (u_int32_t) AT91C_IFLASH; + uint32_t ramaddr = (uint32_t) addr; + ramaddr -= (uint32_t) AT91C_IFLASH; return ((ramaddr >> AT91C_IFLASH_PAGE_SHIFT)); } #define PAGES_PER_LOCKREGION (AT91C_IFLASH_LOCK_REGION_SIZE>>AT91C_IFLASH_PAGE_SHIFT) #define IS_FIRST_PAGE_OF_LOCKREGION(x) ((x % PAGES_PER_LOCKREGION) == 0) #define LOCKREGION_FROM_PAGE(x) (x / PAGES_PER_LOCKREGION) -static int is_page_locked(u_int16_t page) +static int is_page_locked(uint16_t page) { - u_int16_t lockregion = LOCKREGION_FROM_PAGE(page); + uint16_t lockregion = LOCKREGION_FROM_PAGE(page); return (AT91C_BASE_MC->MC_FSR & (lockregion << 16)); } -static void unlock_page(u_int16_t page) +static void unlock_page(uint16_t page) { page &= 0x3ff; AT91F_MC_EFC_PerformCmd(AT91C_BASE_MC, AT91C_MC_FCMD_UNLOCK | AT91C_MC_CORRECT_KEY | (page << 8)); } -void flash_page(u_int8_t *addr) +void flash_page(uint8_t *addr) { - u_int16_t page = page_from_ramaddr(addr) & 0x3ff; - u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); + uint16_t page = page_from_ramaddr(addr) & 0x3ff; + uint32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC); DEBUGP("flash_page(0x%x=%u) ", addr, page); if (is_page_locked(page)) { diff --git a/firmware/src/os/flash.h b/firmware/src/os/flash.h index b812714..b31d167 100644 --- a/firmware/src/os/flash.h +++ b/firmware/src/os/flash.h @@ -1,5 +1,5 @@ #ifndef _FLASH_H #define _FLASH_H -extern void flash_page(u_int8_t *addr); +extern void flash_page(uint8_t *addr); extern void flash_init(void); #endif diff --git a/firmware/src/os/pcd_enumerate.c b/firmware/src/os/pcd_enumerate.c index 403cef9..0daa2c8 100644 --- a/firmware/src/os/pcd_enumerate.c +++ b/firmware/src/os/pcd_enumerate.c @@ -94,8 +94,8 @@ static struct udp_pcd upcd; struct epstate { - u_int32_t state_busy; - u_int32_t state_pending; + uint32_t state_busy; + uint32_t state_pending; }; static const struct epstate epstate[] = { @@ -140,7 +140,7 @@ int udp_refill_ep(int ep) { - u_int16_t i; + uint16_t i; AT91PS_UDP pUDP = upcd.pUdp; struct req_ctx *rctx; unsigned int start, end; @@ -231,7 +231,7 @@ static void udp_irq(void) { - u_int32_t csr; + uint32_t csr; AT91PS_UDP pUDP = upcd.pUdp; AT91_REG isr = pUDP->UDP_ISR; @@ -270,8 +270,8 @@ udp_ep0_handler(); } if (isr & AT91C_UDP_EPINT1) { - u_int32_t cur_rcv_bank = upcd.cur_rcv_bank; - u_int16_t i, pkt_size; + uint32_t cur_rcv_bank = upcd.cur_rcv_bank; + uint16_t i, pkt_size; struct req_ctx *rctx; csr = pUDP->UDP_CSR[1]; @@ -471,9 +471,9 @@ static void udp_ep0_handler(void) { AT91PS_UDP pUDP = upcd.pUdp; - u_int8_t bmRequestType, bRequest; - u_int16_t wValue, wIndex, wLength, wStatus; - u_int32_t csr = pUDP->UDP_CSR[0]; + uint8_t bmRequestType, bRequest; + uint16_t wValue, wIndex, wLength, wStatus; + uint32_t csr = pUDP->UDP_CSR[0]; DEBUGE("CSR=0x%04x ", csr); @@ -521,7 +521,7 @@ /* Handle supported standard device request Cf Table 9-3 in USB * speciication Rev 1.1 */ switch ((bRequest << 8) | bmRequestType) { - u_int8_t desc_type, desc_index; + uint8_t desc_type, desc_index; case STD_GET_DESCRIPTOR: DEBUGE("GET_DESCRIPTOR(wValue=0x%04x, wIndex=0x%04x) ", wValue, wIndex); diff --git a/firmware/src/os/pio_irq.c b/firmware/src/os/pio_irq.c index d11bd47..921fdf3 100644 --- a/firmware/src/os/pio_irq.c +++ b/firmware/src/os/pio_irq.c @@ -27,17 +27,17 @@ struct pioirq_state { irq_handler_t *handlers[NR_PIO]; - u_int32_t usbmask; - u_int32_t usb_throttled; /* atomic? */ + uint32_t usbmask; + uint32_t usb_throttled; /* atomic? */ }; static struct pioirq_state pirqs; /* low-level handler, used by Cstartup_app.S PIOA fast forcing and * by regular interrupt handler below */ -void __ramfunc __pio_irq_demux(u_int32_t pio) +void __ramfunc __pio_irq_demux(uint32_t pio) { - u_int8_t send_usb = 0; + uint8_t send_usb = 0; int i; //DEBUGPCRF("PIO_ISR_STATUS = 0x%08x", pio); @@ -59,15 +59,15 @@ pirqs.usb_throttled = 1; } else { struct openpcd_hdr *opcdh; - u_int32_t *regmask; + uint32_t *regmask; opcdh = (struct openpcd_hdr *) irq_rctx->data; - regmask = (u_int32_t *) (irq_rctx->data + sizeof(*opcdh)); + regmask = (uint32_t *) (irq_rctx->data + sizeof(*opcdh)); opcdh->cmd = OPENPCD_CMD_PIO_IRQ; opcdh->reg = 0x00; opcdh->flags = 0x00; opcdh->val = 0x00; - irq_rctx->tot_len = sizeof(*opcdh) + sizeof(u_int32_t); + irq_rctx->tot_len = sizeof(*opcdh) + sizeof(uint32_t); req_ctx_set_state(irq_rctx, RCTX_STATE_UDP_EP3_PENDING); } } @@ -78,23 +78,23 @@ /* regular interrupt handler, in case fast forcing for PIOA disabled */ static void pio_irq_demux(void) { - u_int32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); + uint32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); __pio_irq_demux(pio); } -void pio_irq_enable(u_int32_t pio) +void pio_irq_enable(uint32_t pio) { AT91F_PIO_InterruptEnable(AT91C_BASE_PIOA, pio); } -void pio_irq_disable(u_int32_t pio) +void pio_irq_disable(uint32_t pio) { AT91F_PIO_InterruptDisable(AT91C_BASE_PIOA, pio); } -int pio_irq_register(u_int32_t pio, irq_handler_t *handler) +int pio_irq_register(uint32_t pio, irq_handler_t *handler) { - u_int8_t num = ffs(pio); + uint8_t num = ffs(pio); if (num == 0) return -EINVAL; @@ -111,9 +111,9 @@ return 0; } -void pio_irq_unregister(u_int32_t pio) +void pio_irq_unregister(uint32_t pio) { - u_int8_t num = ffs(pio); + uint8_t num = ffs(pio); if (num == 0) return; diff --git a/firmware/src/os/pio_irq.h b/firmware/src/os/pio_irq.h index 33f4656..b782821 100644 --- a/firmware/src/os/pio_irq.h +++ b/firmware/src/os/pio_irq.h @@ -2,12 +2,12 @@ #define _PIO_IRQ_H #define NR_PIO 32 -typedef void irq_handler_t(u_int32_t pio); +typedef void irq_handler_t(uint32_t pio); -extern void pio_irq_enable(u_int32_t pio); -extern void pio_irq_disable(u_int32_t pio); -extern int pio_irq_register(u_int32_t pio, irq_handler_t *func); -extern void pio_irq_unregister(u_int32_t pio); +extern void pio_irq_enable(uint32_t pio); +extern void pio_irq_disable(uint32_t pio); +extern int pio_irq_register(uint32_t pio, irq_handler_t *func); +extern void pio_irq_unregister(uint32_t pio); extern void pio_irq_init(void); #endif diff --git a/firmware/src/os/pit.c b/firmware/src/os/pit.c index 50ec19f..e442265 100644 --- a/firmware/src/os/pit.c +++ b/firmware/src/os/pit.c @@ -103,7 +103,7 @@ local_irq_restore(flags); } -static void pit_irq(u_int32_t sr) +static void pit_irq(uint32_t sr) { struct timer_list *tl, *next; @@ -125,21 +125,21 @@ } } -void pit_mdelay(u_int32_t ms) +void pit_mdelay(uint32_t ms) { - u_int32_t end; + uint32_t end; end = (AT91F_PITGetPIIR(AT91C_BASE_PITC) + ms) % 20; while (end < AT91F_PITGetPIIR(AT91C_BASE_PITC)) { } } -void mdelay(u_int32_t ms) +void mdelay(uint32_t ms) { return pit_mdelay(ms); } -void usleep(u_int32_t us) +void usleep(uint32_t us) { return; return pit_mdelay(us/1000); diff --git a/firmware/src/os/pit.h b/firmware/src/os/pit.h index 4a25cc1..4ac717e 100644 --- a/firmware/src/os/pit.h +++ b/firmware/src/os/pit.h @@ -20,6 +20,6 @@ extern int timer_del(struct timer_list *timer); extern void pit_init(void); -extern void pit_mdelay(u_int32_t ms); +extern void pit_mdelay(uint32_t ms); #endif diff --git a/firmware/src/os/pwm.c b/firmware/src/os/pwm.c index 70858bb..14b9b6c 100644 --- a/firmware/src/os/pwm.c +++ b/firmware/src/os/pwm.c @@ -42,7 +42,7 @@ static AT91PS_PWMC pwm = AT91C_BASE_PWMC; /* find highest bit set. returns bit (32..1) or 0 in case no bit set */ -static int fhs(u_int32_t val) +static int fhs(uint32_t val) { int i; @@ -55,16 +55,16 @@ } /* set frequency of PWM signal to freq */ -int pwm_freq_set(int channel, u_int32_t freq) +int pwm_freq_set(int channel, uint32_t freq) { /* in order to get maximum resolution, the pre-scaler must be set to * something like freq << 16. However, the mimimum pre-scaled frequency * we can get is MCLK (48MHz), the minimum is MCLK/(1024*255) = * 48MHz/261120 = 183Hz */ - u_int32_t overall_div; - u_int32_t presc_total; - u_int8_t cpre = 0; - u_int16_t cprd; + uint32_t overall_div; + uint32_t presc_total; + uint8_t cpre = 0; + uint16_t cprd; if (freq > MCLK) return -ERANGE; @@ -104,9 +104,9 @@ AT91F_PWMC_StopChannel(AT91C_BASE_PWMC, (1 << channel)); } -void pwm_duty_set_percent(int channel, u_int16_t duty) +void pwm_duty_set_percent(int channel, uint16_t duty) { - u_int32_t tmp = pwm->PWMC_CH[channel].PWMC_CPRDR & 0xffff; + uint32_t tmp = pwm->PWMC_CH[channel].PWMC_CPRDR & 0xffff; tmp = tmp << 16; /* extend value by 2^16 */ tmp = tmp / 100; /* tmp = 1 % of extended cprd */ @@ -120,7 +120,7 @@ static int pwm_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; - u_int32_t *freq; + uint32_t *freq; switch (poh->cmd) { case OPENPCD_CMD_PWM_ENABLE: @@ -138,7 +138,7 @@ case OPENPCD_CMD_PWM_FREQ_SET: if (rctx->tot_len < sizeof(*poh)+4) break; - freq = (u_int32_t *) ((unsigned char *) poh) + sizeof(*poh); + freq = (uint32_t *) ((unsigned char *) poh) + sizeof(*poh); pwm_freq_set(0, *freq); break; case OPENPCD_CMD_PWM_FREQ_GET: diff --git a/firmware/src/os/pwm.h b/firmware/src/os/pwm.h index 8836c32..bde34f6 100644 --- a/firmware/src/os/pwm.h +++ b/firmware/src/os/pwm.h @@ -1,10 +1,10 @@ #ifndef _PWM_H #define _PWM_H -extern void pwm_freq_set(int channel, u_int32_t freq); +extern void pwm_freq_set(int channel, uint32_t freq); extern void pwm_start(int channel); extern void pwm_stop(int channel); -extern void pwm_duty_set_percent(int channel, u_int16_t duty); +extern void pwm_duty_set_percent(int channel, uint16_t duty); extern void pwm_init(void); extern void pwm_fini(void); diff --git a/firmware/src/os/req_ctx.c b/firmware/src/os/req_ctx.c index 722c099..9aba813 100644 --- a/firmware/src/os/req_ctx.c +++ b/firmware/src/os/req_ctx.c @@ -38,8 +38,8 @@ #define NUM_REQ_CTX (NUM_RCTX_SMALL+NUM_RCTX_LARGE) -static u_int8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL]; -static u_int8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE]; +static uint8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL]; +static uint8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE]; static struct req_ctx req_ctx[NUM_REQ_CTX]; @@ -79,7 +79,7 @@ return toReturn; } -u_int8_t req_ctx_num(struct req_ctx *ctx) +uint8_t req_ctx_num(struct req_ctx *ctx) { return ctx - req_ctx; } diff --git a/firmware/src/os/req_ctx.h b/firmware/src/os/req_ctx.h index 92c21a7..2b7ca60 100644 --- a/firmware/src/os/req_ctx.h +++ b/firmware/src/os/req_ctx.h @@ -13,11 +13,11 @@ #include struct req_ctx { - volatile u_int32_t state; + volatile uint32_t state; volatile struct req_ctx *prev, *next; - u_int16_t size; - u_int16_t tot_len; - u_int8_t *data; + uint16_t size; + uint16_t tot_len; + uint8_t *data; }; #define RCTX_STATE_FREE 0 @@ -45,7 +45,7 @@ extern struct req_ctx *req_ctx_find_busy(void); extern void req_ctx_set_state(struct req_ctx *ctx, unsigned long new_state); extern void req_ctx_put(struct req_ctx *ctx); -extern u_int8_t req_ctx_num(struct req_ctx *ctx); +extern uint8_t req_ctx_num(struct req_ctx *ctx); unsigned int req_ctx_count(unsigned long state); #endif /* _REQ_CTX_H */ diff --git a/firmware/src/os/system_irq.c b/firmware/src/os/system_irq.c index 4c1da31..5f76ea8 100644 --- a/firmware/src/os/system_irq.c +++ b/firmware/src/os/system_irq.c @@ -31,9 +31,9 @@ static sysirq_hdlr *sysirq_hdlrs[AT91SAM7_SYSIRQ_COUNT]; -void sys_irq(u_int32_t previous_pc) +void sys_irq(uint32_t previous_pc) { - u_int32_t sr; + uint32_t sr; /* Somehow Atmel decided to do really stupid interrupt sharing * for commonly-used interrupts such as the timer irq */ diff --git a/firmware/src/os/system_irq.h b/firmware/src/os/system_irq.h index 195b7b9..150c378 100644 --- a/firmware/src/os/system_irq.h +++ b/firmware/src/os/system_irq.h @@ -14,7 +14,7 @@ AT91SAM7_SYSIRQ_COUNT }; -typedef void sysirq_hdlr(u_int32_t sr); +typedef void sysirq_hdlr(uint32_t sr); extern void sysirq_register(enum sysirqs irq, sysirq_hdlr *hdlr); extern void sysirq_init(void); diff --git a/firmware/src/os/tc_cdiv.c b/firmware/src/os/tc_cdiv.c index 6f06ba5..bc9d5dd 100644 --- a/firmware/src/os/tc_cdiv.c +++ b/firmware/src/os/tc_cdiv.c @@ -31,7 +31,7 @@ static AT91PS_TCB tcb = AT91C_BASE_TCB; /* set carrier divider to a specific */ -void tc_cdiv_set_divider(u_int16_t div) +void tc_cdiv_set_divider(uint16_t div) { tcb->TCB_TC0.TC_RC = div; diff --git a/firmware/src/os/tc_cdiv.h b/firmware/src/os/tc_cdiv.h index 4f2bc02..86882fb 100644 --- a/firmware/src/os/tc_cdiv.h +++ b/firmware/src/os/tc_cdiv.h @@ -7,7 +7,7 @@ static AT91PS_TCB tcb; extern void tc_cdiv_phase_add(int16_t inc); -extern void tc_cdiv_set_divider(u_int16_t div); +extern void tc_cdiv_set_divider(uint16_t div); static inline void tc_cdiv_phase_inc(void) { diff --git a/firmware/src/os/usb_handler.c b/firmware/src/os/usb_handler.c index 029891a..52abd64 100644 --- a/firmware/src/os/usb_handler.c +++ b/firmware/src/os/usb_handler.c @@ -33,13 +33,13 @@ static usb_cmd_fn *cmd_hdlrs[16]; -int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class) +int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class) { cmd_hdlrs[class] = hdlr; return 0; } -void usb_hdlr_unregister(u_int8_t class) +void usb_hdlr_unregister(uint8_t class) { cmd_hdlrs[class] = NULL; } diff --git a/firmware/src/os/usb_handler.h b/firmware/src/os/usb_handler.h index 9d5ad48..52814fd 100644 --- a/firmware/src/os/usb_handler.h +++ b/firmware/src/os/usb_handler.h @@ -18,8 +18,8 @@ typedef int usb_cmd_fn(struct req_ctx *rctx); -extern int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class); -extern void usb_hdlr_unregister(u_int8_t class); +extern int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class); +extern void usb_hdlr_unregister(uint8_t class); extern void usb_in_process(void); extern void usb_out_process(void); diff --git a/firmware/src/os/usbcmd_generic.c b/firmware/src/os/usbcmd_generic.c index aff13eb..c76bcc1 100644 --- a/firmware/src/os/usbcmd_generic.c +++ b/firmware/src/os/usbcmd_generic.c @@ -18,14 +18,14 @@ #define OPENPCD_API_VERSION (0x01) #define CONFIG_AREA_ADDR ((void*)(AT91C_IFLASH + AT91C_IFLASH_SIZE - ENVIRONMENT_SIZE)) -#define CONFIG_AREA_WORDS ( AT91C_IFLASH_PAGE_SIZE/sizeof(u_int32_t) ) +#define CONFIG_AREA_WORDS ( AT91C_IFLASH_PAGE_SIZE/sizeof(uint32_t) ) -volatile u_int32_t config_stack[ CONFIG_AREA_WORDS ]; +volatile uint32_t config_stack[ CONFIG_AREA_WORDS ]; static int gen_setenv(const void* buffer,int len) { volatile unsigned int i; - u_int32_t *dst; + uint32_t *dst; if( len >= sizeof(config_stack) ) len=sizeof(config_stack); @@ -35,7 +35,7 @@ /* retrieve current content to allow partial flashing */ /* flash changes */ - dst=(u_int32_t*)CONFIG_AREA_ADDR; + dst=(uint32_t*)CONFIG_AREA_ADDR; for(i=0;idata; struct openpcd_compile_version *ver = (struct openpcd_compile_version *)poh->data; - u_int32_t len = rctx->tot_len-sizeof(*poh); + uint32_t len = rctx->tot_len-sizeof(*poh); /* initialize transmit length to header length */ rctx->tot_len = sizeof(*poh); @@ -107,7 +107,7 @@ poh->flags |= OPENPCD_FLAG_RESPOND; #ifdef PCD rctx->tot_len += 4; - if (rc632_get_serial(NULL, (u_int32_t *)poh->data) < 0) { + if (rc632_get_serial(NULL, (uint32_t *)poh->data) < 0) { DEBUGP("ERROR) "); return USB_ERR(USB_ERR_CMD_NOT_IMPL); } diff --git a/firmware/src/os/usbcmd_generic.h b/firmware/src/os/usbcmd_generic.h index 4dd0456..61fbd36 100644 --- a/firmware/src/os/usbcmd_generic.h +++ b/firmware/src/os/usbcmd_generic.h @@ -1,6 +1,6 @@ #ifndef _USBAPI_GENERIC_H #define _USBAPI_GENERIC_H extern void usbcmd_gen_init(void); -extern int gen_setenv(void* data,u_int32_t pos,u_int32_t length); -extern int gen_getenv(void* data,u_int32_t pos,u_int32_t length); +extern int gen_setenv(void* data,uint32_t pos,uint32_t length); +extern int gen_getenv(void* data,uint32_t pos,uint32_t length); #endif diff --git a/firmware/src/os/wdt.c b/firmware/src/os/wdt.c index d5c19a3..6e5248e 100644 --- a/firmware/src/os/wdt.c +++ b/firmware/src/os/wdt.c @@ -30,7 +30,7 @@ #undef WDT_DEBUG #endif/*WDT_DEBUG*/ -static void wdt_irq(u_int32_t sr) +static void wdt_irq(uint32_t sr) { if (sr & 1) AT91F_DBGU_Frame("================> WATCHDOG EXPIRED !!!!!\n\r"); diff --git a/firmware/src/pcd.h b/firmware/src/pcd.h index 77c99b2..0a5585f 100644 --- a/firmware/src/pcd.h +++ b/firmware/src/pcd.h @@ -7,9 +7,9 @@ #include struct opcd_cmd_hdr { - u_int8_t cmd; - u_int8_t arg1; - u_int16_t arg2; + uint8_t cmd; + uint8_t arg1; + uint16_t arg2; } __attribute__ ((packed)); enum opcd_cmd { @@ -28,8 +28,8 @@ }; struct opcd_status_hdr { - u_int8_t cause, /* interrupt cause register RC632 */ - u_int8_t prim_status, /* primary status register RC632 */ + uint8_t cause, /* interrupt cause register RC632 */ + uint8_t prim_status, /* primary status register RC632 */ } __attribute__ ((packed)); #endif /* _OPENPCD_H */ diff --git a/firmware/src/pcd/main_librfid.c b/firmware/src/pcd/main_librfid.c index a5a488d..a04c446 100644 --- a/firmware/src/pcd/main_librfid.c +++ b/firmware/src/pcd/main_librfid.c @@ -59,30 +59,30 @@ } struct openpcd_l2_connectinfo { - u_int32_t proto_supported; + uint32_t proto_supported; - u_int8_t speed_rx; - u_int8_t speed_tx; + uint8_t speed_rx; + uint8_t speed_tx; - u_int8_t uid_len; - u_int8_t uid[10]; + uint8_t uid_len; + uint8_t uid[10]; } __attribute__ ((packed)); struct openpcd_proto_connectinfo { } __attribute__ ((packed)); struct openpcd_proto_tcl_connectinfo { - u_int8_t fsc; - u_int8_t fsd; - u_int8_t ta; - u_int8_t sfgt; + uint8_t fsc; + uint8_t fsd; + uint8_t ta; + uint8_t sfgt; - u_int8_t flags; - u_int8_t cid; - u_int8_t nad; + uint8_t flags; + uint8_t cid; + uint8_t nad; - u_int8_t ats_tot_len; - u_int8_t ats_snippet[0]; + uint8_t ats_tot_len; + uint8_t ats_snippet[0]; } __attribute__ ((packed)); static int init_proto(void) diff --git a/firmware/src/pcd/main_mifare.c b/firmware/src/pcd/main_mifare.c index 43729a5..8dd6420 100644 --- a/firmware/src/pcd/main_mifare.c +++ b/firmware/src/pcd/main_mifare.c @@ -40,7 +40,7 @@ static struct rfid_layer2_handle *l2h; static struct rfid_protocol_handle *ph; -static u_int8_t sector = 0; +static uint8_t sector = 0; void _init_func(void) { @@ -74,30 +74,30 @@ } struct openpcd_l2_connectinfo { - u_int32_t proto_supported; + uint32_t proto_supported; - u_int8_t speed_rx; - u_int8_t speed_tx; + uint8_t speed_rx; + uint8_t speed_tx; - u_int8_t uid_len; - u_int8_t uid[10]; + uint8_t uid_len; + uint8_t uid[10]; } __attribute__ ((packed)); struct openpcd_proto_connectinfo { } __attribute__ ((packed)); struct openpcd_proto_tcl_connectinfo { - u_int8_t fsc; - u_int8_t fsd; - u_int8_t ta; - u_int8_t sfgt; + uint8_t fsc; + uint8_t fsd; + uint8_t ta; + uint8_t sfgt; - u_int8_t flags; - u_int8_t cid; - u_int8_t nad; + uint8_t flags; + uint8_t cid; + uint8_t nad; - u_int8_t ats_tot_len; - u_int8_t ats_snippet[0]; + uint8_t ats_tot_len; + uint8_t ats_snippet[0]; } __attribute__ ((packed)); /* mifare classic helper */ diff --git a/firmware/src/pcd/main_presence.c b/firmware/src/pcd/main_presence.c index 4ead264..cca2cac 100644 --- a/firmware/src/pcd/main_presence.c +++ b/firmware/src/pcd/main_presence.c @@ -37,7 +37,7 @@ #define RAH NULL -u_int32_t delay_scan,delay_blink,last_uid,last_polled_uid; +uint32_t delay_scan,delay_blink,last_uid,last_polled_uid; static struct rfid_reader_handle *rh; static struct rfid_layer2_handle *l2h; @@ -54,10 +54,10 @@ if(last_polled_uid) { rctx->tot_len += 4; - poh->data[0]=(u_int8_t)(last_polled_uid>>24); - poh->data[1]=(u_int8_t)(last_polled_uid>>16); - poh->data[2]=(u_int8_t)(last_polled_uid>> 8); - poh->data[3]=(u_int8_t)(last_polled_uid ); + poh->data[0]=(uint8_t)(last_polled_uid>>24); + poh->data[1]=(uint8_t)(last_polled_uid>>16); + poh->data[2]=(uint8_t)(last_polled_uid>> 8); + poh->data[3]=(uint8_t)(last_polled_uid ); last_polled_uid=0; } break; @@ -124,16 +124,16 @@ void _main_func(void) { - u_int32_t uid; + uint32_t uid; int status; status = rfid_layer2_open(l2h); if (status >= 0 && l2h->uid_len==4) { - uid=((u_int32_t)l2h->uid[0]) | - ((u_int32_t)l2h->uid[1])<< 8| - ((u_int32_t)l2h->uid[2])<<16| - ((u_int32_t)l2h->uid[3])<<24; + uid=((uint32_t)l2h->uid[0]) | + ((uint32_t)l2h->uid[1])<< 8| + ((uint32_t)l2h->uid[2])<<16| + ((uint32_t)l2h->uid[3])<<24; delay_scan=100; diff --git a/firmware/src/pcd/main_pwm.c b/firmware/src/pcd/main_pwm.c index 50fd363..271daaf 100644 --- a/firmware/src/pcd/main_pwm.c +++ b/firmware/src/pcd/main_pwm.c @@ -39,14 +39,14 @@ #define RAH NULL -static u_int8_t force_100ask = 1; -static u_int8_t mod_conductance = 0x3f; -static u_int8_t cw_conductance = 0x3f; -static u_int16_t duty_percent = 22; +static uint8_t force_100ask = 1; +static uint8_t mod_conductance = 0x3f; +static uint8_t cw_conductance = 0x3f; +static uint16_t duty_percent = 22; #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static u_int32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; -static u_int8_t pwm_freq_idx = 0; +static uint32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; +static uint8_t pwm_freq_idx = 0; static void rc632_modulate_mfin() { @@ -61,11 +61,11 @@ #define COND_MANT(x) (x & 0x0f) #define COND_EXP(x) ((x & 0x30) >> 4) -static const u_int16_t rsrel_expfact[] = { 1000, 1925, 3706, 7133 }; +static const uint16_t rsrel_expfact[] = { 1000, 1925, 3706, 7133 }; -static u_int32_t calc_conduct_rel(u_int8_t inp) +static uint32_t calc_conduct_rel(uint8_t inp) { - u_int32_t cond_rel; + uint32_t cond_rel; cond_rel = COND_MANT(inp) * rsrel_expfact[COND_EXP(inp)]; cond_rel = cond_rel / 1000; @@ -73,14 +73,14 @@ return cond_rel; } -static const u_int8_t rsrel_table[] = { +static const uint8_t rsrel_table[] = { 0, 16, 32, 48, 1, 17, 2, 3, 33, 18, 4, 5, 19, 6, 7, 49, 34, 20, 8, 9, 21, 10, 11, 35, 22, 12, 13, 23, 14, 50, 36, 15, 24, 25, 37, 26, 27, 51, 38, 28, 29, 39, 30, 52, 31, 40, 41, 53, 42, 43, 54, 44, 45, 55, 46, 47, 56, 57, 58, 59, 60, 61, 62, 63 }; -static const u_int16_t cdivs[] = { 128, 64, 32, 16 }; +static const uint16_t cdivs[] = { 128, 64, 32, 16 }; static int cdiv_idx = 0; static void help(void) diff --git a/firmware/src/pcd/main_reqa.c b/firmware/src/pcd/main_reqa.c index 717926a..ae4b4a1 100644 --- a/firmware/src/pcd/main_reqa.c +++ b/firmware/src/pcd/main_reqa.c @@ -83,25 +83,25 @@ 0x00, 0xff, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, }; -static void reg_inc(u_int8_t reg) +static void reg_inc(uint8_t reg) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(RAH, reg, &val); opcd_rc632_reg_write(RAH, reg, val++); DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val); } -static void reg_dec(u_int8_t reg) +static void reg_dec(uint8_t reg) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(RAH, reg, &val); opcd_rc632_reg_write(RAH, reg, val--); DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val); } -static u_int8_t ana_out_sel; -static u_int8_t mfout_sel; -static u_int8_t speed_idx; +static uint8_t ana_out_sel; +static uint8_t mfout_sel; +static uint8_t speed_idx; static void help(void) { @@ -114,7 +114,7 @@ "{: dev cdiv }: inc cdiv"); } -static u_int16_t cdivs[] = { 128, 64, 32, 16 }; +static uint16_t cdivs[] = { 128, 64, 32, 16 }; int _main_dbgu(char key) { diff --git a/firmware/src/pcd/rc632.c b/firmware/src/pcd/rc632.c index 731574c..41fee19 100644 --- a/firmware/src/pcd/rc632.c +++ b/firmware/src/pcd/rc632.c @@ -72,7 +72,7 @@ /* SPI irq handler */ static void spi_irq(void) { - u_int32_t status = pSPI->SPI_SR; + uint32_t status = pSPI->SPI_SR; DEBUGPSPIIRQ("spi_irq: 0x%08x ", status); @@ -95,8 +95,8 @@ } #ifdef SPI_USES_DMA -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len) { DEBUGPSPI("DMA Xfer tx=%s\r\n", hexdump(tx_data, tx_len)); if (*rx_len < tx_len) { @@ -129,12 +129,12 @@ } #else /* stupid polling transceiver routine */ -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len) { - u_int16_t tx_cur = 0; - u_int16_t rx_len_max = 0; - u_int16_t rx_cnt = 0; + uint16_t tx_cur = 0; + uint16_t rx_len_max = 0; + uint16_t rx_cnt = 0; /* disable RC632 interrupt because it wants to do SPI transactions */ AT91F_AIC_DisableIt(AT91C_BASE_AIC, OPENPCD_IRQ_RC632); @@ -148,8 +148,8 @@ //AT91F_SPI_Enable(pSPI); while (1) { - u_int32_t sr = pSPI->SPI_SR; - u_int8_t tmp; + uint32_t sr = pSPI->SPI_SR; + uint8_t tmp; if (sr & AT91C_SPI_RDRF) { tmp = pSPI->SPI_RDR; rx_cnt++; @@ -181,8 +181,8 @@ /* static buffers used by RC632 access primitives below. * Since we only have one */ -static u_int8_t spi_outbuf[SPI_MAX_XFER_LEN]; -static u_int8_t spi_inbuf[SPI_MAX_XFER_LEN]; +static uint8_t spi_outbuf[SPI_MAX_XFER_LEN]; +static uint8_t spi_inbuf[SPI_MAX_XFER_LEN]; #define FIFO_ADDR (RC632_REG_FIFO_DATA << 1) @@ -191,9 +191,9 @@ /* RC632 access primitives */ int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t data) + uint8_t addr, uint8_t data) { - u_int16_t rx_len = 2; + uint16_t rx_len = 2; DEBUG632("[0x%02x] <= 0x%02x", addr, data); @@ -208,13 +208,13 @@ #define RC632_REGSET_START 0x10 #define RC632_REGSET_END 0x3f #define RC632_REGSET_MAXSIZE (RC632_REGSET_END-RC632_REGSET_START) -static u_int8_t regset_buf[RC632_REGSET_MAXSIZE * 2]; +static uint8_t regset_buf[RC632_REGSET_MAXSIZE * 2]; int opcd_rc632_reg_write_set(struct rfid_asic_handle *hdl, - u_int8_t *regs, int len) + uint8_t *regs, int len) { - u_int8_t i, j = 0; - u_int16_t rx_len; + uint8_t i, j = 0; + uint16_t rx_len; if (len > RC632_REGSET_MAXSIZE) return -E2BIG; @@ -232,9 +232,9 @@ } int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, - u_int8_t len, u_int8_t *data, u_int8_t flags) + uint8_t len, uint8_t *data, uint8_t flags) { - u_int16_t rx_len = sizeof(spi_inbuf); + uint16_t rx_len = sizeof(spi_inbuf); if (len > sizeof(spi_outbuf)-1) len = sizeof(spi_outbuf)-1; @@ -247,9 +247,9 @@ } int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t *val) + uint8_t addr, uint8_t *val) { - u_int16_t rx_len = 2; + uint16_t rx_len = 2; addr = (addr << 1) & 0x7e; @@ -265,12 +265,12 @@ } int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, - u_int8_t max_len, u_int8_t *data) + uint8_t max_len, uint8_t *data) { int ret; - u_int8_t fifo_length; - u_int8_t i; - u_int16_t rx_len; + uint8_t fifo_length; + uint8_t i; + uint16_t rx_len; ret = opcd_rc632_reg_read(hdl, RC632_REG_FIFO_LENGTH, &fifo_length); if (ret < 0) @@ -296,9 +296,9 @@ } int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits) + uint8_t reg, uint8_t bits) { - u_int8_t val; + uint8_t val; int ret; ret = opcd_rc632_reg_read(hdl, reg, &val); @@ -311,9 +311,9 @@ } int opcd_rc632_clear_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits) + uint8_t reg, uint8_t bits) { - u_int8_t val; + uint8_t val; int ret; ret = opcd_rc632_reg_read(hdl, reg, &val); @@ -331,7 +331,7 @@ { struct req_ctx *irq_rctx; struct openpcd_hdr *irq_opcdh; - u_int8_t cause; + uint8_t cause; /* CL RC632 has interrupted us */ opcd_rc632_reg_read(NULL, RC632_REG_INTERRUPT_RQ, &cause); @@ -392,7 +392,7 @@ AT91F_AIC_EnableIt(AT91C_BASE_AIC, OPENPCD_IRQ_RC632); } -void rc632_power(u_int8_t up) +void rc632_power(uint8_t up) { DEBUGPCRF("powering %s RC632", up ? "up" : "down"); if (up) @@ -414,7 +414,7 @@ /* wait for startup phase to finish */ while (1) { - u_int8_t val; + uint8_t val; opcd_rc632_reg_read(NULL, RC632_REG_COMMAND, &val); if (val == 0x00) break; @@ -427,7 +427,7 @@ static int rc632_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) rctx->data; - u_int16_t len = rctx->tot_len-sizeof(*poh); + uint16_t len = rctx->tot_len-sizeof(*poh); /* initialize transmit length to header length */ rctx->tot_len = sizeof(*poh); @@ -443,7 +443,7 @@ /* FIFO read always has to provoke a response */ poh->flags &= OPENPCD_FLAG_RESPOND; { - u_int16_t req_len = poh->val, remain_len = req_len, pih_len; + uint16_t req_len = poh->val, remain_len = req_len, pih_len; #if 0 if (req_len > MAX_PAYLOAD_LEN) { pih_len = MAX_PAYLOAD_LEN; @@ -598,9 +598,9 @@ #ifdef DEBUG static int rc632_reg_write_verify(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t val) + uint8_t reg, uint8_t val) { - u_int8_t tmp; + uint8_t tmp; opcd_rc632_reg_write(hdl, reg, val); opcd_rc632_reg_read(hdl, reg, &tmp); @@ -612,11 +612,11 @@ int rc632_dump(void) { - u_int8_t i; - u_int16_t rx_len = sizeof(spi_inbuf); + uint8_t i; + uint16_t rx_len = sizeof(spi_inbuf); for (i = 0; i <= 0x3f; i++) { - u_int8_t reg = i; + uint8_t reg = i; if (reg == RC632_REG_FIFO_DATA) reg = 0x3e; diff --git a/firmware/src/pcd/rc632.h b/firmware/src/pcd/rc632.h index 5081f42..d9dfecd 100644 --- a/firmware/src/pcd/rc632.h +++ b/firmware/src/pcd/rc632.h @@ -7,17 +7,17 @@ #include extern int opcd_rc632_reg_write(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t data); + uint8_t addr, uint8_t data); extern int opcd_rc632_fifo_write(struct rfid_asic_handle *hdl, - u_int8_t len, u_int8_t *data, u_int8_t flags); + uint8_t len, uint8_t *data, uint8_t flags); extern int opcd_rc632_reg_read(struct rfid_asic_handle *hdl, - u_int8_t addr, u_int8_t *val); + uint8_t addr, uint8_t *val); extern int opcd_rc632_fifo_read(struct rfid_asic_handle *hdl, - u_int8_t max_len, u_int8_t *data); + uint8_t max_len, uint8_t *data); extern int opcd_rc632_clear_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits); + uint8_t reg, uint8_t bits); extern int opcd_rc632_set_bits(struct rfid_asic_handle *hdl, - u_int8_t reg, u_int8_t bits); + uint8_t reg, uint8_t bits); extern void rc632_init(void); extern void rc632_exit(void); @@ -27,6 +27,6 @@ extern int rc632_test(struct rfid_asic_handle *hdl); extern int rc632_dump(void); -extern void rc632_power(u_int8_t up); +extern void rc632_power(uint8_t up); #endif diff --git a/firmware/src/pcd/rc632_highlevel.c b/firmware/src/pcd/rc632_highlevel.c index 14a2a2a..af101b7 100644 --- a/firmware/src/pcd/rc632_highlevel.c +++ b/firmware/src/pcd/rc632_highlevel.c @@ -49,10 +49,10 @@ static int rc632_set_bit_mask(struct rfid_asic_handle *handle, - u_int8_t reg, u_int8_t mask, u_int8_t val) + uint8_t reg, uint8_t mask, uint8_t val) { int ret; - u_int8_t tmp; + uint8_t tmp; ret = opcd_rc632_reg_read(handle, reg, &tmp); if (ret < 0) @@ -98,10 +98,10 @@ int rc632_write_eeprom(struct rfid_asic_handle *handle, - u_int16_t addr, u_int8_t len, u_int8_t *data) + uint16_t addr, uint8_t len, uint8_t *data) { - u_int8_t sndbuf[MAX_WRITE_LEN + 2]; - u_int8_t reg; + uint8_t sndbuf[MAX_WRITE_LEN + 2]; + uint8_t reg; int ret; if (len > MAX_WRITE_LEN) @@ -146,11 +146,11 @@ } int -rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, - u_int8_t *recvbuf) +rc632_read_eeprom(struct rfid_asic_handle *handle, uint16_t addr, uint8_t len, + uint8_t *recvbuf) { - u_int8_t sndbuf[3]; - u_int8_t err; + uint8_t sndbuf[3]; + uint8_t err; int ret; sndbuf[0] = (addr & 0xff); @@ -187,8 +187,8 @@ #define RC632_E2_RS_MAX_P 14 int rc632_get_serial(struct rfid_asic_handle *handle, - u_int32_t *serial) + uint32_t *serial) { return rc632_read_eeprom(handle, RC632_E2_PRODUCT_SERIAL, - 4, (u_int8_t *)serial); + 4, (uint8_t *)serial); } diff --git a/firmware/src/pcd/rc632_highlevel.h b/firmware/src/pcd/rc632_highlevel.h index 40e80e0..169f47a 100644 --- a/firmware/src/pcd/rc632_highlevel.h +++ b/firmware/src/pcd/rc632_highlevel.h @@ -11,9 +11,9 @@ rc632_turn_off_rf(struct rfid_asic_handle *handle); int -rc632_read_eeprom(struct rfid_asic_handle *handle, u_int16_t addr, u_int8_t len, - u_int8_t *recvbuf); +rc632_read_eeprom(struct rfid_asic_handle *handle, uint16_t addr, uint8_t len, + uint8_t *recvbuf); int rc632_get_serial(struct rfid_asic_handle *handle, - u_int32_t *serial); + uint32_t *serial); #endif /* _RC632_HIGHLEVEL_H */ diff --git a/firmware/src/picc/adc.c b/firmware/src/picc/adc.c index f350a49..7950cce 100644 --- a/firmware/src/picc/adc.c +++ b/firmware/src/picc/adc.c @@ -57,7 +57,7 @@ static void adc_irq(void) { - u_int32_t sr = adc->ADC_SR; + uint32_t sr = adc->ADC_SR; struct req_ctx *rctx = adc_state.rctx; DEBUGADC("adc_irq(SR=0x%08x, IMR=0x%08x, state=%u): ", @@ -102,12 +102,12 @@ } #if 0 -u_int16_t adc_read_fieldstr(void) +uint16_t adc_read_fieldstr(void) { return adc->ADC_CDR4; } -u_int16_T adc_read_pll_dem(void) +uint16_T adc_read_pll_dem(void) { return adc } diff --git a/firmware/src/picc/da.h b/firmware/src/picc/da.h index e264e2b..45e9a99 100644 --- a/firmware/src/picc/da.h +++ b/firmware/src/picc/da.h @@ -1,7 +1,7 @@ #ifndef _DA_H #define _DA_H -extern void da_comp_carr(u_int8_t position); +extern void da_comp_carr(uint8_t position); extern void da_init(void); #endif diff --git a/firmware/src/picc/decoder.c b/firmware/src/picc/decoder.c index bdd910e..0d2909f 100644 --- a/firmware/src/picc/decoder.c +++ b/firmware/src/picc/decoder.c @@ -25,10 +25,10 @@ static struct decoder_algo *decoder_algo[DECODER_NUM_ALGOS]; -static int get_next_data(struct decoder_state *st, u_int8_t *data) +static int get_next_data(struct decoder_state *st, uint8_t *data) { - u_int8_t parity_sample; - u_int32_t bytesample; + uint8_t parity_sample; + uint32_t bytesample; bytesample = st->algo->get_next_bytesample(st, &parity_sample); @@ -36,7 +36,7 @@ } /* iterate over sample buffer (size N bytes) and decode data */ -int decoder_decode(u_int8_t algo, const char *sample_buf, +int decoder_decode(uint8_t algo, const char *sample_buf, int sample_buf_size, char *data_buf) { int i, ret; @@ -46,7 +46,7 @@ return -EINVAL; st.buf = sample_buf; - st.buf32 = (u_int32_t *) st.buf; + st.buf32 = (uint32_t *) st.buf; st.bit_ofs = 0; st.algo = decoder_algo[algo]; diff --git a/firmware/src/picc/decoder.h b/firmware/src/picc/decoder.h index aef0e20..06ff42e 100644 --- a/firmware/src/picc/decoder.h +++ b/firmware/src/picc/decoder.h @@ -4,22 +4,22 @@ struct decoder_state; struct decoder_algo { - u_int8_t oversampling_rate; - u_int8_t bits_per_sampled_char; - u_int32_t bytesample_mask; - int (*decode_sample)(const u_int32_t sample, u_int8_t data); - u_int32_t (*get_next_bytesample)(struct decoder_state *st, u_int8_t *parity_sample); + uint8_t oversampling_rate; + uint8_t bits_per_sampled_char; + uint32_t bytesample_mask; + int (*decode_sample)(const uint32_t sample, uint8_t data); + uint32_t (*get_next_bytesample)(struct decoder_state *st, uint8_t *parity_sample); }; struct decoder_state { struct decoder_algo *algo; - u_int8_t bit_ofs; + uint8_t bit_ofs; const char *buf; - const u_int32_t *buf32; + const uint32_t *buf32; }; extern int decoder_register(int algnum, struct decoder_algo *algo); -extern int decoder_decode(u_int8_t algo, const char *sample_buf, +extern int decoder_decode(uint8_t algo, const char *sample_buf, int sample_buf_size, char *data_buf); #define DECODER_MILLER 0 diff --git a/firmware/src/picc/decoder_miller.c b/firmware/src/picc/decoder_miller.c index cc62672..96c9bed 100644 --- a/firmware/src/picc/decoder_miller.c +++ b/firmware/src/picc/decoder_miller.c @@ -55,7 +55,7 @@ #define SEQ_Z 0x1 /* decode a single sampled bit */ -static u_int8_t miller_decode_sampled_bit(u_int32_t sampled_bit) +static uint8_t miller_decode_sampled_bit(uint32_t sampled_bit) { switch (sampled_bit) { case SEQ_X: @@ -73,13 +73,13 @@ } /* decode a single 32bit data sample of an 8bit miller encoded word */ -static int miller_decode_sample(u_int32_t sample, u_int8_t *data) +static int miller_decode_sample(uint32_t sample, uint8_t *data) { - u_int8_t ret = 0; + uint8_t ret = 0; unsigned int i; for (i = 0; i < sizeof(sample)/OVERSAMPLING_RATE; i++) { - u_int8_t bit = miller_decode_sampled_bit(sample & 0xf); + uint8_t bit = miller_decode_sampled_bit(sample & 0xf); if (bit == 1) ret |= 1; @@ -98,10 +98,10 @@ return ret; } -static u_int32_t get_next_bytesample(struct decoder_state *ms, - u_int8_t *parity_sample) +static uint32_t get_next_bytesample(struct decoder_state *ms, + uint8_t *parity_sample) { - u_int32_t ret = 0; + uint32_t ret = 0; /* get remaining bits from the current word */ ret = *(ms->buf32) >> ms->bit_ofs; diff --git a/firmware/src/picc/decoder_nrzl.c b/firmware/src/picc/decoder_nrzl.c index 136a9c8..8307bcd 100644 --- a/firmware/src/picc/decoder_nrzl.c +++ b/firmware/src/picc/decoder_nrzl.c @@ -60,12 +60,12 @@ /* currently this code will only work with oversampling_rate == 1 */ #define OVERSAMPLING_RATE 1 -static u_int32_t get_next_bytesample(struct decoder_state *st, - u_int8_t *parity_sample) +static uint32_t get_next_bytesample(struct decoder_state *st, + uint8_t *parity_sample) { - u_int32_t ret = 0; - u_int8_t bits_per_sampled_char = st->algo->bits_per_sampled_char; - u_int8_t bytesample_mask = st->algo->bytesample_mask; + uint32_t ret = 0; + uint8_t bits_per_sampled_char = st->algo->bits_per_sampled_char; + uint8_t bytesample_mask = st->algo->bytesample_mask; /* FIXME: shift start and stop bit into parity_sample and just * return plain 8-bit data word */ @@ -83,7 +83,7 @@ return ret & bytesample_mask; } -static int nrzl_decode_sample(const u_int32_t sample, u_int8_t *data) +static int nrzl_decode_sample(const uint32_t sample, uint8_t *data) { *data = (sample >> 1) & 0xff; diff --git a/firmware/src/picc/iso14443a_manchester.c b/firmware/src/picc/iso14443a_manchester.c index f9eba1e..15a61ac 100644 --- a/firmware/src/picc/iso14443a_manchester.c +++ b/firmware/src/picc/iso14443a_manchester.c @@ -46,7 +46,7 @@ #define MANCHESTER_SEQ_E 0x5500 #define MANCHESTER_SEQ_F 0x5555 -static u_int32_t manchester_sample_size(u_int8_t frame_bytelen) +static uint32_t manchester_sample_size(uint8_t frame_bytelen) { /* 16 bits (2 bytes) per bit => 16 bytes samples per data byte, * plus 16bit (2 bytes) parity per data byte @@ -60,13 +60,13 @@ struct manch_enc_state { const char *data; char *samples; - u_int16_t *samples16; + uint16_t *samples16; }; -static void manchester_enc_byte(struct manch_enc_state *mencs, u_int8_t data) +static void manchester_enc_byte(struct manch_enc_state *mencs, uint8_t data) { int i; - u_int8_t sum_1 = 0; + uint8_t sum_1 = 0; /* append 8 sample blobs, one for each bit */ for (i = 0; i < 8; i++) { @@ -86,8 +86,8 @@ mencs->samples16++ } -int manchester_encode(char *sample_buf, u_int16_t sample_buf_len, - const char *data, u_int8_t data_len) +int manchester_encode(char *sample_buf, uint16_t sample_buf_len, + const char *data, uint8_t data_len) { int i, enc_size; struct manch_enc_state mencs @@ -112,10 +112,10 @@ #define BPSK_SPEED_212 -static u_int32_t bpsk_sample_size(u_int8_t frame_bytelen) +static uint32_t bpsk_sample_size(uint8_t frame_bytelen) -int bpsk_encode(char *sample_buf, u_int16_t sample_buf_len, - const char *data, u_int8_t data_len) +int bpsk_encode(char *sample_buf, uint16_t sample_buf_len, + const char *data, uint8_t data_len) { /* burst of 32 sub carrier cycles */ memset(sample_buf, 0x55, 8); diff --git a/firmware/src/picc/load_modulation.c b/firmware/src/picc/load_modulation.c index 576bc74..acefe98 100644 --- a/firmware/src/picc/load_modulation.c +++ b/firmware/src/picc/load_modulation.c @@ -23,7 +23,7 @@ #include "../openpcd.h" -void load_mod_level(u_int8_t level) +void load_mod_level(uint8_t level) { if (level > 3) level = 3; diff --git a/firmware/src/picc/load_modulation.h b/firmware/src/picc/load_modulation.h index 71f9d6f..59fc9cb 100644 --- a/firmware/src/picc/load_modulation.h +++ b/firmware/src/picc/load_modulation.h @@ -1,7 +1,7 @@ #ifndef _LOAD_MODULATION_H #define _LOAD_MODULATION_H -extern void load_mod_level(u_int8_t level); +extern void load_mod_level(uint8_t level); extern void load_mod_init(void); #endif diff --git a/firmware/src/picc/main_openpicc.c b/firmware/src/picc/main_openpicc.c index 93ca4b6..da9378f 100644 --- a/firmware/src/picc/main_openpicc.c +++ b/firmware/src/picc/main_openpicc.c @@ -35,15 +35,15 @@ #include #include -static const u_int16_t cdivs[] = { 8192, 2048, 1024, 512, 128, 64, 32, 16 }; -static u_int8_t cdiv_idx = 6; +static const uint16_t cdivs[] = { 8192, 2048, 1024, 512, 128, 64, 32, 16 }; +static uint8_t cdiv_idx = 6; -static u_int16_t duty_percent = 22; +static uint16_t duty_percent = 22; #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static u_int32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; -static u_int8_t pwm_freq_idx = 0; +static uint32_t pwm_freq[] = { 105937, 211875, 423750, 847500 }; +static uint8_t pwm_freq_idx = 0; -static u_int8_t load_mod = 0; +static uint8_t load_mod = 0; #define DA_BASELINE 192 @@ -88,10 +88,10 @@ int _main_dbgu(char key) { - static u_int8_t poti = DA_BASELINE; - static u_int8_t pll_inh = 1; - static u_int8_t ssc_mode = 1; - static u_int8_t sync_enabled = 0; + static uint8_t poti = DA_BASELINE; + static uint8_t pll_inh = 1; + static uint8_t ssc_mode = 1; + static uint8_t sync_enabled = 0; DEBUGPCRF("main_dbgu"); diff --git a/firmware/src/picc/openpicc.c b/firmware/src/picc/openpicc.c index 54139a9..61db217 100644 --- a/firmware/src/picc/openpicc.c +++ b/firmware/src/picc/openpicc.c @@ -16,7 +16,7 @@ #ifdef DEBUG /* Our registers, including their power-up default values */ -static u_int16_t opicc_regs[_OPICC_NUM_REGS] = { +static uint16_t opicc_regs[_OPICC_NUM_REGS] = { [OPICC_REG_14443A_UIDLEN] = 4, [OPICC_REG_14443A_FDT0] = 1236, [OPICC_REG_14443A_FDT1] = 1172, @@ -30,14 +30,14 @@ [OPICC_REG_RX_COMP_LEVEL] = 0, }; -u_int16_t opicc_reg_read(enum opicc_reg reg) +uint16_t opicc_reg_read(enum opicc_reg reg) { if (reg < _OPICC_NUM_REGS) return opicc_regs[reg]; return 0; } -void opicc_reg_write(enum opicc_reg reg, u_int16_t val) +void opicc_reg_write(enum opicc_reg reg, uint16_t val) { if (reg < _OPICC_NUM_REGS) opicc_regs[reg] = val; @@ -52,7 +52,7 @@ static int opicc_reg_usb_in(struct req_ctx *rctx) { struct openpcd_hdr *poh = (struct openpcd_hdr *) &rctx->data[0]; - u_int16_t *val16 = (u_int16_t *) poh->data; + uint16_t *val16 = (uint16_t *) poh->data; poh->val = 0; rctx->tot_len = sizeof(*poh); @@ -60,11 +60,11 @@ switch (poh->cmd) { case OPENPCD_CMD_PICC_REG_READ: *val16 = opicc_reg_read(poh->reg); - rctx->tot_len += sizeof(u_int16_t); + rctx->tot_len += sizeof(uint16_t); poh->flags |= OPENPCD_FLAG_RESPOND; break; case OPENPCD_CMD_PICC_REG_WRITE: - if (rctx->tot_len < sizeof(*poh) + sizeof(u_int16_t)) { + if (rctx->tot_len < sizeof(*poh) + sizeof(uint16_t)) { /* we only have an 8bit write */ opicc_reg_write(poh->reg, poh->val); } else diff --git a/firmware/src/picc/opicc_reg.h b/firmware/src/picc/opicc_reg.h index adc9305..3402057 100644 --- a/firmware/src/picc/opicc_reg.h +++ b/firmware/src/picc/opicc_reg.h @@ -5,10 +5,10 @@ #include #ifdef DEBUG -u_int16_t opicc_reg_read(enum opicc_reg reg); -void opicc_reg_write(enum opicc_reg reg, u_int16_t val); +uint16_t opicc_reg_read(enum opicc_reg reg); +void opicc_reg_write(enum opicc_reg reg, uint16_t val); #else -u_int16_t opicc_regs[_OPICC_NUM_REGS]; +uint16_t opicc_regs[_OPICC_NUM_REGS]; #define opicc_reg_read(x) (opicc_regs[x]) #define opicc_reg_write(x, y) (opicc_regs[x] = y) #endif diff --git a/firmware/src/picc/piccsim.h b/firmware/src/picc/piccsim.h index 3cf6514..ddbb224 100644 --- a/firmware/src/picc/piccsim.h +++ b/firmware/src/picc/piccsim.h @@ -4,19 +4,19 @@ struct piccsim_state { enum rfid_layer2_id l2prot; unsigned char uid[10]; - u_int8_t uid_len; + uint8_t uid_len; union { struct { enum iso14443a_state state; enum iso14443a_level level; - u_int32_t flags; + uint32_t flags; } iso14443a; struct { } iso14443b; } l2; union { - u_int32_t flags; + uint32_t flags; } proto; } diff --git a/firmware/src/picc/pll.c b/firmware/src/picc/pll.c index e48911d..9a413a8 100644 --- a/firmware/src/picc/pll.c +++ b/firmware/src/picc/pll.c @@ -38,7 +38,7 @@ return AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_LOCK); } -static void pll_lock_change_cb(u_int32_t pio) +static void pll_lock_change_cb(uint32_t pio) { DEBUGPCRF("PLL LOCK: %d", pll_is_locked()); #if 1 diff --git a/firmware/src/picc/poti.c b/firmware/src/picc/poti.c index e5701dc..1901124 100644 --- a/firmware/src/picc/poti.c +++ b/firmware/src/picc/poti.c @@ -25,7 +25,7 @@ static const AT91PS_SPI spi = AT91C_BASE_SPI; -void poti_comp_carr(u_int8_t position) +void poti_comp_carr(uint8_t position) { volatile int i; diff --git a/firmware/src/picc/poti.h b/firmware/src/picc/poti.h index 92ec00d..0d238a3 100644 --- a/firmware/src/picc/poti.h +++ b/firmware/src/picc/poti.h @@ -1,7 +1,7 @@ #ifndef _POTI_H #define _POTI_H -extern void poti_comp_carr(u_int8_t position); +extern void poti_comp_carr(uint8_t position); extern void poti_init(void); #endif diff --git a/firmware/src/picc/ssc_picc.c b/firmware/src/picc/ssc_picc.c index 8ec6f79..b7455e5 100644 --- a/firmware/src/picc/ssc_picc.c +++ b/firmware/src/picc/ssc_picc.c @@ -62,7 +62,7 @@ }; static struct ssc_state ssc_state; -static const u_int16_t ssc_dmasize[] = { +static const uint16_t ssc_dmasize[] = { [SSC_MODE_NONE] = 16, [SSC_MODE_14443A_SHORT] = 16, /* 64 bytes */ [SSC_MODE_14443A_STANDARD] = 16, /* 64 bytes */ @@ -91,8 +91,8 @@ void ssc_rx_mode_set(enum ssc_mode ssc_mode) { - u_int8_t data_len, num_data, sync_len; - u_int32_t start_cond; + uint8_t data_len, num_data, sync_len; + uint32_t start_cond; /* disable Rx and all Rx interrupt sources */ AT91F_SSC_DisableRx(AT91C_BASE_SSC); @@ -151,8 +151,8 @@ static void ssc_tx_mode_set(enum ssc_mode ssc_mode) { - u_int8_t data_len, num_data, sync_len; - u_int32_t start_cond; + uint8_t data_len, num_data, sync_len; + uint32_t start_cond; /* disable Tx */ AT91F_SSC_DisableTx(AT91C_BASE_SSC); @@ -308,7 +308,7 @@ static void __ramfunc ssc_irq(void) { - u_int32_t ssc_sr = ssc->SSC_SR; + uint32_t ssc_sr = ssc->SSC_SR; int i, *tmp, emptyframe = 0; DEBUGP("ssc_sr=0x%08x, mode=%u: ", ssc_sr, ssc_state.mode); @@ -327,7 +327,7 @@ /* Experimental start SSC on frame, stop on FFFFFFFF */ if (ssc_state.mode == SSC_MODE_CONTINUOUS) { //ssc->SSC_RCMR = (ssc->SSC_RCMR & ~AT91C_SSC_START) | AT91C_SSC_START_CONTINOUS; - tmp = (u_int32_t*)ssc_state.rx_ctx[0]->data; + tmp = (uint32_t*)ssc_state.rx_ctx[0]->data; for(i = ssc_state.rx_ctx[0]->size / 4; i >= 0 ; i--) { if( *tmp++ == 0xFFFFFFFF ) { *(tmp-1) = 0xAAAAAAAA; // debug marker @@ -345,7 +345,7 @@ #endif /* Ignore empty frames */ if (ssc_state.mode == SSC_MODE_CONTINUOUS) { - tmp = (u_int32_t*)ssc_state.rx_ctx[0]->data + MAX_HDRSIZE; + tmp = (uint32_t*)ssc_state.rx_ctx[0]->data + MAX_HDRSIZE; emptyframe = 1; for(i = (ssc_state.rx_ctx[0]->size-MAX_HDRSIZE) / 4 - 8/*WTF?*/; i > 0; i--) { if( *tmp++ != 0xFFFFFFFF ) { @@ -417,7 +417,7 @@ if (ssc_sr & AT91C_SSC_RXSYN) DEBUGP("RXSYN "); if (ssc_sr & AT91C_SSC_RXRDY) { - u_int32_t sample = ssc->SSC_RHR; + uint32_t sample = ssc->SSC_RHR; DEBUGP("RXRDY=0x%08x ", sample); /* Try to set FDT compare register ASAP */ if (sample == REQA) { diff --git a/firmware/src/picc/tc_cdiv_sync.c b/firmware/src/picc/tc_cdiv_sync.c index e83ae88..6d6e1e9 100644 --- a/firmware/src/picc/tc_cdiv_sync.c +++ b/firmware/src/picc/tc_cdiv_sync.c @@ -7,9 +7,9 @@ //#define USE_IRQ -static u_int8_t enabled; +static uint8_t enabled; -static void pio_data_change(u_int32_t pio) +static void pio_data_change(uint32_t pio) { DEBUGP("PIO_FRAME_IRQ: "); /* we get one interrupt for each change. If now, after the @@ -46,7 +46,7 @@ void tc_cdiv_sync_reset(void) { if (enabled) { - u_int32_t tmp = *AT91C_PIOA_ISR; + uint32_t tmp = *AT91C_PIOA_ISR; volatile int i; DEBUGPCRF("CDIV_SYNC_FLOP"); diff --git a/firmware/src/picc/tc_fdt.c b/firmware/src/picc/tc_fdt.c index 1651b32..8b4b867 100644 --- a/firmware/src/picc/tc_fdt.c +++ b/firmware/src/picc/tc_fdt.c @@ -39,7 +39,7 @@ static AT91PS_TC tcfdt = AT91C_BASE_TC2; -void tc_fdt_set(u_int16_t count) +void tc_fdt_set(uint16_t count) { tcfdt->TC_RA = count; } @@ -47,14 +47,14 @@ /* 'count' number of carrier cycles after the last modulation pause, * we deem the frame to have ended */ -void tc_frame_end_set(u_int16_t count) +void tc_frame_end_set(uint16_t count) { tcfdt->TC_RB = count; } static void tc_fdt_irq(void) { - u_int32_t sr = tcfdt->TC_SR; + uint32_t sr = tcfdt->TC_SR; DEBUGP("tc_fdt_irq: TC2_SR=0x%08x TC2_CV=0x%08x ", sr, tcfdt->TC_CV); diff --git a/firmware/src/picc/tc_fdt.h b/firmware/src/picc/tc_fdt.h index b39b935..db0a5c2 100644 --- a/firmware/src/picc/tc_fdt.h +++ b/firmware/src/picc/tc_fdt.h @@ -4,6 +4,6 @@ #include extern void tc_fdt_init(void); -extern void tc_fdt_set(u_int16_t count); +extern void tc_fdt_set(uint16_t count); #endif diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c index 9e8ace9..aa85d6e 100644 --- a/firmware/src/simtrace/iso7816_uart.c +++ b/firmware/src/simtrace/iso7816_uart.c @@ -85,22 +85,22 @@ struct iso7816_3_handle { enum iso7816_3_state state; - u_int8_t fi; - u_int8_t di; - u_int8_t wi; - u_int32_t waiting_time; + uint8_t fi; + uint8_t di; + uint8_t wi; + uint32_t waiting_time; enum atr_state atr_state; - u_int8_t atr_idx; - u_int8_t atr_hist_len; - u_int8_t atr_last_td; - u_int8_t atr[64]; + uint8_t atr_idx; + uint8_t atr_hist_len; + uint8_t atr_last_td; + uint8_t atr[64]; - u_int16_t prot_t_supported; + uint16_t prot_t_supported; enum pts_state pts_state; - u_int8_t pts_req[6]; - u_int8_t pts_resp[6]; + uint8_t pts_req[6]; + uint8_t pts_resp[6]; struct simtrace_hdr sh; @@ -114,13 +114,13 @@ /* Table 6 from ISO 7816-3 */ -static const u_int16_t fi_table[] = { +static const uint16_t fi_table[] = { 372, 372, 558, 744, 1116, 1488, 1860, 0, 0, 512, 768, 1024, 1536, 2048, 0, 0 }; /* Table 7 from ISO 7816-3 */ -static const u_int8_t di_table[] = { +static const uint8_t di_table[] = { 0, 1, 2, 4, 8, 16, 32, 64, 12, 20, 2, 4, 8, 16, 32, 64, }; @@ -154,9 +154,9 @@ } /* compute the F/D ratio based on Fi and Di values */ -static int compute_fidi_ratio(u_int8_t fi, u_int8_t di) +static int compute_fidi_ratio(uint8_t fi, uint8_t di) { - u_int16_t f, d; + uint16_t f, d; int ret; if (fi >= ARRAY_SIZE(fi_table) || @@ -314,7 +314,7 @@ } /* determine the next ATR state based on received interface byte */ -static enum atr_state next_intb_state(struct iso7816_3_handle *ih, u_int8_t ch) +static enum atr_state next_intb_state(struct iso7816_3_handle *ih, uint8_t ch) { switch (ih->atr_state) { case ATR_S_WAIT_TD: @@ -359,7 +359,7 @@ /* process an incomng ATR byte */ static enum iso7816_3_state -process_byte_atr(struct iso7816_3_handle *ih, u_int8_t byte) +process_byte_atr(struct iso7816_3_handle *ih, uint8_t byte) { /* add byte to ATR buffer */ ih->atr[ih->atr_idx] = byte; @@ -412,9 +412,9 @@ /* Determine the next PTS state */ static enum pts_state next_pts_state(struct iso7816_3_handle *ih) { - u_int8_t is_resp = ih->pts_state & 0x10; - u_int8_t sstate = ih->pts_state & 0x0f; - u_int8_t *pts_ptr; + uint8_t is_resp = ih->pts_state & 0x10; + uint8_t sstate = ih->pts_state & 0x0f; + uint8_t *pts_ptr; if (!is_resp) pts_ptr = ih->pts_req; @@ -453,7 +453,7 @@ } static enum iso7816_3_state -process_byte_pts(struct iso7816_3_handle *ih, u_int8_t byte) +process_byte_pts(struct iso7816_3_handle *ih, uint8_t byte) { switch (ih->pts_state) { case PTS_S_WAIT_REQ_PTSS: @@ -510,7 +510,7 @@ return ISO7816_S_IN_PTS; } -static void process_byte(struct iso7816_3_handle *ih, u_int8_t byte) +static void process_byte(struct iso7816_3_handle *ih, uint8_t byte) { int new_state = -1; struct req_ctx *rctx; @@ -589,7 +589,7 @@ void iso_uart_idleflush(void) { static struct req_ctx *last_req = NULL; - static u_int16_t last_len = 0; + static uint16_t last_len = 0; if (last_req == isoh.rctx && last_len == isoh.rctx->tot_len && @@ -603,8 +603,8 @@ static __ramfunc void usart_irq(void) { - u_int32_t csr = usart->US_CSR; - u_int8_t octet; + uint32_t csr = usart->US_CSR; + uint8_t octet; //DEBUGP("USART IRQ, CSR=0x%08x\n", csr); @@ -620,7 +620,7 @@ } if (csr & (AT91C_US_PARE|AT91C_US_FRAME|AT91C_US_OVRE)) { - u_int8_t nb_err = usart->US_NER; + uint8_t nb_err = usart->US_NER; /* FIXME: some error has occurrerd */ //DEBUGP("NER=%02x ", nb_err); /* clear the status */ @@ -641,7 +641,7 @@ } /* handler for the RST input pin state change */ -static void reset_pin_irq(u_int32_t pio) +static void reset_pin_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, pio)) { /* make sure to flush pending req_ctx */ @@ -659,7 +659,7 @@ void iso_uart_dump(void) { - u_int32_t csr = usart->US_CSR; + uint32_t csr = usart->US_CSR; DEBUGPCR("USART CSR=0x%08x", csr); } diff --git a/firmware/src/simtrace/main_factory.c b/firmware/src/simtrace/main_factory.c index 7a491ed..502feb2 100644 --- a/firmware/src/simtrace/main_factory.c +++ b/firmware/src/simtrace/main_factory.c @@ -72,7 +72,7 @@ break; case 'P': { - u_int32_t version; + uint32_t version; int rc = prod_info_get(&version, NULL); if (rc >= 0) DEBUGPCR("Version: 0x%08x\n", version); diff --git a/firmware/src/simtrace/prod_info.c b/firmware/src/simtrace/prod_info.c index 87ef6e2..ef2e8eb 100644 --- a/firmware/src/simtrace/prod_info.c +++ b/firmware/src/simtrace/prod_info.c @@ -38,17 +38,17 @@ struct simtrace_prod_info { /* magic value */ - u_int32_t magic; + uint32_t magic; /* unix timestamp of production date (0=unknown) */ - u_int32_t production_ts; + uint32_t production_ts; /* hardware version */ - u_int32_t version; + uint32_t version; /* re-works applied */ - u_int32_t reworks; + uint32_t reworks; } __attribute__((packed)); -int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks) +int prod_info_write(uint32_t ts, uint32_t version, uint32_t reworks) { struct simtrace_prod_info pi = { .magic = PRODINFO_MAGIC, @@ -56,8 +56,8 @@ .version = version, .reworks = reworks, }; - u_int8_t *pi8 = (u_int8_t *) π - u_int32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); + uint8_t *pi8 = (uint8_t *) π + uint32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); unsigned int rc; int i; @@ -80,12 +80,12 @@ return rc; } -int prod_info_get(u_int32_t *ver, u_int32_t *reworks) +int prod_info_get(uint32_t *ver, uint32_t *reworks) { struct simtrace_prod_info pi; - u_int32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); + uint32_t addr = OTP_ADDR(OTP_REGION_PRODINFO); - spiflash_otp_read(addr, (u_int8_t *) &pi, sizeof(pi)); + spiflash_otp_read(addr, (uint8_t *) &pi, sizeof(pi)); if (pi.magic != PRODINFO_MAGIC) return -1; diff --git a/firmware/src/simtrace/prod_info.h b/firmware/src/simtrace/prod_info.h index 7a12421..796ee7a 100644 --- a/firmware/src/simtrace/prod_info.h +++ b/firmware/src/simtrace/prod_info.h @@ -6,7 +6,7 @@ ((c & 0xff) << 0)) -int prod_info_write(u_int32_t ts, u_int32_t version, u_int32_t reworks); -int prod_info_get(u_int32_t *ver, u_int32_t *reworks); +int prod_info_write(uint32_t ts, uint32_t version, uint32_t reworks); +int prod_info_get(uint32_t *ver, uint32_t *reworks); #endif diff --git a/firmware/src/simtrace/sim_switch.c b/firmware/src/simtrace/sim_switch.c index 90067ac..36f9f0c 100644 --- a/firmware/src/simtrace/sim_switch.c +++ b/firmware/src/simtrace/sim_switch.c @@ -48,7 +48,7 @@ AT91F_PIO_SetOutput(AT91C_BASE_PIOA, SIMTRACE_PIO_SC_SW); } -static void sw_sim_irq(u_int32_t pio) +static void sw_sim_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, SIMTRACE_PIO_SW_SIM)) @@ -57,7 +57,7 @@ DEBUGPCR("SIM card removed"); } -static void vcc_phone_irq(u_int32_t pio) +static void vcc_phone_irq(uint32_t pio) { if (!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, SIMTRACE_PIO_VCC_PHONE)) { DEBUGPCR("VCC_PHONE off"); diff --git a/firmware/src/simtrace/spi_flash.c b/firmware/src/simtrace/spi_flash.c index ffda1b2..10c6fa7 100644 --- a/firmware/src/simtrace/spi_flash.c +++ b/firmware/src/simtrace/spi_flash.c @@ -88,15 +88,15 @@ static __ramfunc void spi_irq(void) { - u_int32_t status = pSPI->SPI_SR; + uint32_t status = pSPI->SPI_SR; AT91F_AIC_ClearIt(AT91C_BASE_AIC, AT91C_ID_SPI); } -static const u_int8_t chipid_s25fl032p[3] = { 0x01, 0x02, 0x15 }; +static const uint8_t chipid_s25fl032p[3] = { 0x01, 0x02, 0x15 }; -static u_int8_t chip_id[3]; -static u_int32_t otp_supported; +static uint8_t chip_id[3]; +static uint32_t otp_supported; void spiflash_init(void) { @@ -141,13 +141,13 @@ otp_supported = 1; } -static int spi_transceive(const u_int8_t *tx_data, u_int16_t tx_len, - u_int8_t *rx_data, u_int16_t *rx_len, u_int16_t rx_skip) +static int spi_transceive(const uint8_t *tx_data, uint16_t tx_len, + uint8_t *rx_data, uint16_t *rx_len, uint16_t rx_skip) { - u_int16_t tx_cur = 0; - u_int16_t rx_len_max = 0; - u_int16_t rx_cnt = 0; - u_int8_t tmp; + uint16_t tx_cur = 0; + uint16_t rx_len_max = 0; + uint16_t rx_cnt = 0; + uint8_t tmp; DEBUGPSPI("spi_transceive: enter(tx_len=%u) ", tx_len); @@ -161,7 +161,7 @@ //AT91F_SPI_Enable(pSPI); while (1) { - u_int32_t sr = pSPI->SPI_SR; + uint32_t sr = pSPI->SPI_SR; if (sr & AT91C_SPI_RDRF) { tmp = pSPI->SPI_RDR; rx_cnt++; @@ -199,11 +199,11 @@ return 0; } -void spiflash_get_id(u_int8_t *id) +void spiflash_get_id(uint8_t *id) { - const u_int8_t tx_data[] = { SPIF_CMD_RDID, 0, 0, 0 }; - u_int8_t rx_data[] = { 0,0,0,0 }; - u_int16_t rx_len = sizeof(rx_data); + const uint8_t tx_data[] = { SPIF_CMD_RDID, 0, 0, 0 }; + uint8_t rx_data[] = { 0,0,0,0 }; + uint16_t rx_len = sizeof(rx_data); spi_transceive(tx_data, sizeof(tx_data), rx_data, &rx_len, 1); DEBUGPSPI("SPI ID: %02x %02x %02x\r\n", @@ -213,9 +213,9 @@ int spiflash_read_status(void) { - const u_int8_t tx_data[] = { SPIF_CMD_RDSR, 0 }; - u_int8_t rx_data[1]; - u_int16_t rx_len = sizeof(rx_data); + const uint8_t tx_data[] = { SPIF_CMD_RDSR, 0 }; + uint8_t rx_data[1]; + uint16_t rx_len = sizeof(rx_data); spi_transceive(tx_data, sizeof(tx_data), rx_data, &rx_len, 1); @@ -226,14 +226,14 @@ void spiflash_clear_status(void) { - const u_int8_t tx_data[] = { SPIF_CMD_CLSR }; + const uint8_t tx_data[] = { SPIF_CMD_CLSR }; spi_transceive(tx_data, sizeof(tx_data), NULL, 0, 0); } int spiflash_write_enable(int enable) { - u_int8_t tx_data[1]; + uint8_t tx_data[1]; if (enable) tx_data[0] = SPIF_CMD_WREN; @@ -245,9 +245,9 @@ return 0; } -int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len) +int spiflash_otp_read(uint32_t otp_addr, uint8_t *out, uint16_t rx_len) { - u_int8_t tx_data[] = { SPIF_CMD_OTPR, 0, 0, 0, 0 }; + uint8_t tx_data[] = { SPIF_CMD_OTPR, 0, 0, 0, 0 }; if (!otp_supported) { DEBUGP("OTP not supported!\r\n"); @@ -269,9 +269,9 @@ return rx_len; } -int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data) +int spiflash_otp_write(uint32_t otp_addr, uint8_t data) { - u_int8_t tx_data[] = { SPIF_CMD_OTPP, 0, 0, 0, 0 }; + uint8_t tx_data[] = { SPIF_CMD_OTPP, 0, 0, 0, 0 }; if (!otp_supported) { DEBUGP("OTP not supported!\r\n"); @@ -293,7 +293,7 @@ return 0; } -static int otp_region2addr(u_int8_t region) +static int otp_region2addr(uint8_t region) { /* see Figure 10.1 of S25FL032P data sheet */ if (region > 31 || region < 1) @@ -308,7 +308,7 @@ return 0x112; } -static int otp_region2bit(u_int8_t region) +static int otp_region2bit(uint8_t region) { /* see Figure 10.1 of S25FL032P data sheet */ if (region > 31 || region < 1) @@ -323,10 +323,10 @@ return region - 1; } -int spiflash_otp_get_lock(u_int8_t region) +int spiflash_otp_get_lock(uint8_t region) { - u_int32_t addr; - u_int8_t bit, data; + uint32_t addr; + uint8_t bit, data; if (region > 31 || region < 1) return -1; @@ -342,10 +342,10 @@ return 0; } -int spiflash_otp_set_lock(u_int8_t region) +int spiflash_otp_set_lock(uint8_t region) { - u_int32_t addr; - u_int8_t bit; + uint32_t addr; + uint8_t bit; if (region > 31 || region < 1) return -1; diff --git a/firmware/src/simtrace/spi_flash.h b/firmware/src/simtrace/spi_flash.h index d823130..1654eec 100644 --- a/firmware/src/simtrace/spi_flash.h +++ b/firmware/src/simtrace/spi_flash.h @@ -6,14 +6,14 @@ #define OTP_ADDR(x) (0x114 + ( ((x) - 1) * 16 ) ) void spiflash_init(void); -void spiflash_get_id(u_int8_t *id); +void spiflash_get_id(uint8_t *id); int spiflash_read_status(void); void spiflash_clear_status(void); void spiflash_write_protect(int on); int spiflash_write_enable(int enable); -int spiflash_otp_read(u_int32_t otp_addr, u_int8_t *out, u_int16_t rx_len); -int spiflash_otp_write(u_int32_t otp_addr, u_int8_t data); -int spiflash_otp_get_lock(u_int8_t region); -int spiflash_otp_set_lock(u_int8_t region); +int spiflash_otp_read(uint32_t otp_addr, uint8_t *out, uint16_t rx_len); +int spiflash_otp_write(uint32_t otp_addr, uint8_t data); +int spiflash_otp_get_lock(uint8_t region); +int spiflash_otp_set_lock(uint8_t region); #endif diff --git a/firmware/src/simtrace/tc_etu.c b/firmware/src/simtrace/tc_etu.c index fc52033..88be665 100644 --- a/firmware/src/simtrace/tc_etu.c +++ b/firmware/src/simtrace/tc_etu.c @@ -26,14 +26,14 @@ static AT91PS_TCB tcb; static AT91PS_TC tcetu = AT91C_BASE_TC0; -static u_int16_t waiting_time = 9600; -static u_int16_t clocks_per_etu = 372; -static u_int16_t wait_events; +static uint16_t waiting_time = 9600; +static uint16_t clocks_per_etu = 372; +static uint16_t wait_events; static __ramfunc void tc_etu_irq(void) { - u_int32_t sr = tcetu->TC_SR; - static u_int16_t nr_events; + uint32_t sr = tcetu->TC_SR; + static uint16_t nr_events; if (sr & AT91C_TC_ETRGS) { /* external trigger, i.e. we have seen a bit on I/O */ @@ -73,14 +73,14 @@ tcetu->TC_RC = clocks_per_etu * 12; } -void tc_etu_set_wtime(u_int16_t wtime) +void tc_etu_set_wtime(uint16_t wtime) { waiting_time = wtime; recalc_nr_events(); //DEBUGPCR("wtime=%u, actually waiting %u", wtime, wait_events * 12); } -void tc_etu_set_etu(u_int16_t etu) +void tc_etu_set_etu(uint16_t etu) { clocks_per_etu = etu; recalc_nr_events(); diff --git a/firmware/src/simtrace/tc_etu.h b/firmware/src/simtrace/tc_etu.h index 59d9031..ee1458d 100644 --- a/firmware/src/simtrace/tc_etu.h +++ b/firmware/src/simtrace/tc_etu.h @@ -1,4 +1,4 @@ -void tc_etu_set_wtime(u_int16_t wtime); -void tc_etu_set_etu(u_int16_t etu); +void tc_etu_set_wtime(uint16_t wtime); +void tc_etu_set_etu(uint16_t etu); void tc_etu_init(void); -- To view, visit https://gerrit.osmocom.org/2122 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I33f6383535c5860b833f7ccb9bea122d38f28e3f Gerrit-PatchSet: 1 Gerrit-Project: openpcd Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:32:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:32:08 +0000 Subject: [MERGED] openpcd[master]: add README.md In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: add README.md ...................................................................... add README.md Change-Id: Ib2c4fc8b20812f698c75041f75cd0076f5354af2 --- A README.md 1 file changed, 58 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/README.md b/README.md new file mode 100644 index 0000000..130d9e0 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +OpenPCD, OpenPICC and SIMtrace device firmware +============================================== + +This repository contains the C-language firmware of a couple of +different USB devices that share nothing in common but the fact that +they contain and Atmel AT91SAM7S microcontroller and that Harald Welte +was involved in their development. + +The OpenPCD 1.x and OpenPICC 1.x devices are pretty much obsolete these +days, so SAM7S based SIMtrace 1.x is the only relevant platform these +days. + +[Osmocom](https://osmocom.org/) +[SIMtrace](https://osmocom.org/projects/simtrace) is a USB-attached +peripheral device that is primarily used to sniff the traffic between a +SIM/USIM card and a Phone or cellular modem. + +Homepage +-------- + +The official homepage of the project is + + +GIT Repository +-------------- + +You can clone from the official openpcd.git repository using + + git clone git://git.osmocom.org/openpcd.git + +There is a cgit interface at + +Documentation +------------- + +Ther homepage (see above) contains a wiki with information as well as +the SIMtrace user manual. + +Mailing List +------------ + +Discussions related to SIMtrace are happening on the +simtrace at lists.osmocom.org mailing list, please see + for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +Contributing +------------ + +Our coding standards are described at + + +We use accept code/patch submissions via e-mail to the above-mentioned +mailing list. -- To view, visit https://gerrit.osmocom.org/2123 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib2c4fc8b20812f698c75041f75cd0076f5354af2 Gerrit-PatchSet: 1 Gerrit-Project: openpcd Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:32:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:32:19 +0000 Subject: osmo-sim-auth[master]: Update README file with general information and convert to M... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/2124 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic9f95c073b17bfe689dea7672c67e5c081c01dae Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 17 21:32:20 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 17 Mar 2017 21:32:20 +0000 Subject: [MERGED] osmo-sim-auth[master]: Update README file with general information and convert to M... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Update README file with general information and convert to Markdown ...................................................................... Update README file with general information and convert to Markdown Change-Id: Ic9f95c073b17bfe689dea7672c67e5c081c01dae --- R README.md 1 file changed, 63 insertions(+), 23 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/README b/README.md similarity index 72% rename from README rename to README.md index fe46693..e532a87 100644 --- a/README +++ b/README.md @@ -1,10 +1,50 @@ -= osmo-sim-auth = +# osmo-sim-auth This is a small script that can be used with a PC-based smart card reader to obtain GSM/UMTS authentication parameters from a SIM/USIM card. -== prerequisites == +osmo-sim-auth is part of the [Osmocom](https://osmocom.org/) Open Source +Mobile Communications projects. + +## iHomepage + +The official homepage of the project is + + +## GIT Repository + +You can clone from the official osmo-sim-auth.git repository using + + git clone git://git.osmocom.org/osmo-sim-auth.git + +There is a cgit interface at + +## Mailing List + +Discussions related to osmo-sim-auth are happening on the +openbsc at lists.osmocom.org mailing list, please see + for subscription +options and the list archive. + +Please observe the [Osmocom Mailing List +Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) +when posting. + +## Contributing + +Our coding standards are described at + + +We us a gerrit based patch submission/review process for managing +contributions. Please see + for +more details + +The current patch queue for osmo-sim-auth can be seen at + + +## prerequisites We assume that you have @@ -12,7 +52,7 @@ * Installed python program and pyscard library -=== smart card reader === +### smart card reader Any reader supported by pcsc-lite will work. However, a reader compatible with the USB CCID device class is much recommended. @@ -20,7 +60,7 @@ Please verify that the hardware and driver setup is working, e.g. by using the 'pcsc_scan' tool included with pcsc-lite. You should get an output like: -{{{ +``` V 1.4.17 (c) 2001-2009, Ludovic Rousseau Compiled with PC/SC lite version: 1.5.5 Scanning present readers... @@ -32,12 +72,12 @@ ATR: 3B 9F 95 80 1F C7 80 31 E0 73 FE 21 13 57 12 29 11 02 01 00 00 C2 ATR: 3B 9F 95 80 1F C7 80 31 E0 73 FE 21 13 57 12 29 11 02 01 00 00 C2 -}}} +``` plus many more lines of output decoding the ATR. -If you only get -{{{ +If you only get +``` PC/SC device scanner V 1.4.17 (c) 2001-2009, Ludovic Rousseau Compiled with PC/SC lite version: 1.5.5 @@ -47,7 +87,7 @@ Wed Dec 7 01:35:08 2011 Reader 0: OmniKey CardMan 5121 00 00 Card state: Card removed, -}}} +``` then your card was not detected in the reader. @@ -55,17 +95,17 @@ setup are likely wrong. -=== pyscard === +### pyscard pyscard can be installed from packages of major Linux distributions. If you want to build it from source, it is available from -http://pyscard.sourceforge.net/ + -== running osmo-sim-auth == +## running osmo-sim-auth -{{{ +``` $ ./osmo-sim-auth.py --help Usage: osmo-sim-auth.py [options] @@ -75,13 +115,13 @@ -r RAND, --rand=RAND RAND parameter from AuC -d, --debug Enable debug output -s, --sim SIM mode (default: USIM) -}}} +``` you can run the program in two modes: * running GSM authentication (classic SIM card protocol) * running UMTS authentication (USIM card protocol) -=== classic GSM authentication === +### classic GSM authentication This mode will use the "RUN GSM ALGORITHM" command as specified in GMS TS 11.11 @@ -90,16 +130,16 @@ * the 16 byte RAND value from the AuC (-r) as 32 hex digits * the '-s' flag to enable SIM mode -{{{ +``` $ ./osmo-sim-auth.py -r 00000000000000000000000000000000 -s Testing SIM card with IMSI 901700000000403 GSM Authentication SRES: 215fdb4d Kc: 6de816a759a42912 -}}} +``` -=== UMTS authentication === +### UMTS authentication This mode will use the "AUTHENTICATE" command as specified in 3GPP TS 31.102 @@ -108,7 +148,7 @@ * the 16 byte RAND value from the AuC (-r) as 32 hex digits * the 16 byte AUTN value from the AuC (-a) as 32 hex digits -==== successful operation ==== +#### successful operation In this case, the tool will output the following values obtained from the card: @@ -121,7 +161,7 @@ context" in order to obtain the SRES result. This value would be used if a 3G/2G dual-mode phone registers on a 2G network. -{{{ +``` python ./osmo-sim-auth.py -r 00000000000000000000000000000000 -a ec9320c2c2000000e1dd22c1ad3e2d3d [+] UICC AID found: found [AID 1] 3GPP || USIM || (255, 134) || (255, 255) || (137, 255, @@ -139,15 +179,15 @@ GSM Authentication SRES: 215fdb4d Kc: 6de816a759a42912 -}}} +``` -==== synchronization required ==== +#### synchronization required In this case, the AUTHENTICATE command will return the AUTS parameter, which has to be sent to the AuC in order to re-synchronzie the SQN counter which is kept in both the USIM as well as the AuC. -{{{ +``` ./osmo-sim-auth.py -r 00000000000000000000000000000000 -a ec9320c2c2120000c8b7de2a3449f1bd [+] UICC AID found: found [AID 1] 3GPP || USIM || (255, 134) || (255, 255) || (137, 255, @@ -162,4 +202,4 @@ GSM Authentication SRES: 215fdb4d Kc: 6de816a759a42912 -}}} +``` -- To view, visit https://gerrit.osmocom.org/2124 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic9f95c073b17bfe689dea7672c67e5c081c01dae Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte From gerrit-no-reply at lists.osmocom.org Sat Mar 18 02:14:11 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Sat, 18 Mar 2017 02:14:11 +0000 Subject: [PATCH] osmo-trx[master]: CommonLibs: Remove unused files. Message-ID: Review at https://gerrit.osmocom.org/2125 CommonLibs: Remove unused files. Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 --- M CommonLibs/Configuration.cpp D CommonLibs/F16.h D CommonLibs/F16Test.cpp M CommonLibs/Logger.cpp M CommonLibs/Logger.h M CommonLibs/Makefile.am D CommonLibs/MemoryLeak.h D CommonLibs/Regexp.h D CommonLibs/RegexpTest.cpp D CommonLibs/Reporting.cpp D CommonLibs/Reporting.h D CommonLibs/ScalarTypes.h D CommonLibs/URLEncode.cpp D CommonLibs/URLEncode.h D CommonLibs/URLEncodeTest.cpp D CommonLibs/Utils.cpp D CommonLibs/Utils.h 17 files changed, 43 insertions(+), 1,313 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/25/2125/1 diff --git a/CommonLibs/Configuration.cpp b/CommonLibs/Configuration.cpp index 8cbfcb0..bfff893 100644 --- a/CommonLibs/Configuration.cpp +++ b/CommonLibs/Configuration.cpp @@ -53,6 +53,23 @@ ")" }; +static std::string replaceAll(const std::string input, const std::string search, const std::string replace) +{ + std::string output = input; + int index = 0; + + while (true) { + index = output.find(search, index); + if (index == std::string::npos) { + break; + } + + output.replace(index, replace.length(), replace); + index += replace.length(); + } + + return output; +} float ConfigurationRecord::floatNumber() const @@ -259,8 +276,8 @@ ss << "% END AUTO-GENERATED CONTENT" << endl; ss << endl; - string tmp = Utils::replaceAll(ss.str(), "^", "\\^"); - return Utils::replaceAll(tmp, "_", "\\_"); + string tmp = replaceAll(ss.str(), "^", "\\^"); + return replaceAll(tmp, "_", "\\_"); } bool ConfigurationTable::defines(const string& key) diff --git a/CommonLibs/F16.h b/CommonLibs/F16.h deleted file mode 100644 index aa292f0..0000000 --- a/CommonLibs/F16.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -* Copyright 2009 Free Software Foundation, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - -#ifndef F16_H -#define F16_H - -#include -#include - - - -/** Round a float to the appropriate F16 value. */ -inline int32_t _f16_round(float f) -{ - if (f>0.0F) return (int32_t)(f+0.5F); - if (f<0.0F) return (int32_t)(f-0.5F); - return 0; -} - - - -/** A class for F15.16 fixed point arithmetic with saturation. */ -class F16 { - - - private: - - int32_t mV; - - - public: - - F16() {} - - F16(int i) { mV = i<<16; } - F16(float f) { mV = _f16_round(f*65536.0F); } - F16(double f) { mV = _f16_round((float)f*65536.0F); } - - int32_t& raw() { return mV; } - const int32_t& raw() const { return mV; } - - float f() const { return mV/65536.0F; } - - //operator float() const { return mV/65536.0F; } - //operator int() const { return mV>>16; } - - F16 operator=(float f) - { - mV = _f16_round(f*65536.0F); - return *this; - } - - F16 operator=(int i) - { - mV = i<<16; - return *this; - } - - F16 operator=(const F16& other) - { - mV = other.mV; - return mV; - } - - F16 operator+(const F16& other) const - { - F16 retVal; - retVal.mV = mV + other.mV; - return retVal; - } - - F16& operator+=(const F16& other) - { - mV += other.mV; - return *this; - } - - F16 operator-(const F16& other) const - { - F16 retVal; - retVal.mV = mV - other.mV; - return retVal; - } - - F16& operator-=(const F16& other) - { - mV -= other.mV; - return *this; - } - - F16 operator*(const F16& other) const - { - F16 retVal; - int64_t p = (int64_t)mV * (int64_t)other.mV; - retVal.mV = p>>16; - return retVal; - } - - F16& operator*=(const F16& other) - { - int64_t p = (int64_t)mV * (int64_t)other.mV; - mV = p>>16; - return *this; - } - - F16 operator*(float f) const - { - F16 retVal; - retVal.mV = mV * f; - return retVal; - } - - F16& operator*=(float f) - { - mV *= f; - return *this; - } - - F16 operator/(const F16& other) const - { - F16 retVal; - int64_t pV = (int64_t)mV << 16; - retVal.mV = pV / other.mV; - return retVal; - } - - F16& operator/=(const F16& other) - { - int64_t pV = (int64_t)mV << 16; - mV = pV / other.mV; - return *this; - } - - F16 operator/(float f) const - { - F16 retVal; - retVal.mV = mV / f; - return retVal; - } - - F16& operator/=(float f) - { - mV /= f; - return *this; - } - - bool operator>(const F16& other) const - { - return mV>other.mV; - } - - bool operator<(const F16& other) const - { - return mV(float f) const - { - return (mV/65536.0F) > f; - } - - bool operator<(float f) const - { - return (mV/65536.0F) < f; - } - - bool operator==(float f) const - { - return (mV/65536.0F) == f; - } - -}; - - - -inline std::ostream& operator<<(std::ostream& os, const F16& v) -{ - os << v.f(); - return os; -} - -#endif - diff --git a/CommonLibs/F16Test.cpp b/CommonLibs/F16Test.cpp deleted file mode 100644 index 7f3c84d..0000000 --- a/CommonLibs/F16Test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright 2009 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#include "F16.h" - - -#include - -using namespace std; - -int main(int argc, char **argv) -{ - - F16 a = 2.5; - F16 b = 1.5; - F16 c = 2.5 * 1.5; - F16 d = c + a; - F16 e = 10; - cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl; - - a *= 3; - b *= 0.3; - c *= e; - cout << a << ' ' << b << ' ' << c << ' ' << d << endl; - - a /= 3; - b /= 0.3; - c = d * 0.05; - cout << a << ' ' << b << ' ' << c << ' ' << d << endl; - - F16 f = a/d; - cout << f << ' ' << f+0.5 << endl; -} diff --git a/CommonLibs/Logger.cpp b/CommonLibs/Logger.cpp index 82391cc..4879122 100644 --- a/CommonLibs/Logger.cpp +++ b/CommonLibs/Logger.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // For gettimeofday #include "Configuration.h" #include "Logger.h" @@ -111,6 +112,26 @@ return level; } +static std::string format(const char *fmt, ...) +{ + va_list ap; + char buf[300]; + va_start(ap,fmt); + int n = vsnprintf(buf,300,fmt,ap); + va_end(ap); + if (n >= (300-4)) { strcpy(&buf[(300-4)],"..."); } + return std::string(buf); +} + +const std::string timestr() +{ + struct timeval tv; + struct tm tm; + gettimeofday(&tv,NULL); + localtime_r(&tv.tv_sec,&tm); + unsigned tenths = tv.tv_usec / 100000; // Rounding down is ok. + return format(" %02d:%02d:%02d.%1d",tm.tm_hour,tm.tm_min,tm.tm_sec,tenths); +} int getLoggingLevel(const char* filename) { diff --git a/CommonLibs/Logger.h b/CommonLibs/Logger.h index 9667f36..7e492e5 100644 --- a/CommonLibs/Logger.h +++ b/CommonLibs/Logger.h @@ -83,7 +83,6 @@ #include "Threads.h" // must be after defines above, if these files are to be allowed to use LOG() -#include "Utils.h" /** A C++ stream-based thread-safe logger. @@ -123,6 +122,7 @@ std::list gGetLoggerAlarms(); ///< Get a copy of the recent alarm list. +const std::string timestr(); // A timestamp to print in messages. /**@ Global control and initialization of the logging system. */ //@{ diff --git a/CommonLibs/Makefile.am b/CommonLibs/Makefile.am index ed9cf29..f0f1061 100644 --- a/CommonLibs/Makefile.am +++ b/CommonLibs/Makefile.am @@ -36,24 +36,18 @@ Sockets.cpp \ Threads.cpp \ Timeval.cpp \ - Reporting.cpp \ Logger.cpp \ Configuration.cpp \ - sqlite3util.cpp \ - URLEncode.cpp \ - Utils.cpp + sqlite3util.cpp noinst_PROGRAMS = \ BitVectorTest \ InterthreadTest \ SocketsTest \ TimevalTest \ - RegexpTest \ VectorTest \ ConfigurationTest \ - LogTest \ - URLEncodeTest \ - F16Test + LogTest # ReportingTest @@ -64,18 +58,10 @@ Sockets.h \ Threads.h \ Timeval.h \ - Regexp.h \ Vector.h \ Configuration.h \ - Reporting.h \ - F16.h \ - URLEncode.h \ - Utils.h \ Logger.h \ sqlite3util.h - -URLEncodeTest_SOURCES = URLEncodeTest.cpp -URLEncodeTest_LDADD = libcommon.la BitVectorTest_SOURCES = BitVectorTest.cpp BitVectorTest_LDADD = libcommon.la $(SQLITE3_LIBS) @@ -94,9 +80,6 @@ VectorTest_SOURCES = VectorTest.cpp VectorTest_LDADD = libcommon.la $(SQLITE3_LIBS) -RegexpTest_SOURCES = RegexpTest.cpp -RegexpTest_LDADD = libcommon.la - ConfigurationTest_SOURCES = ConfigurationTest.cpp ConfigurationTest_LDADD = libcommon.la $(SQLITE3_LIBS) @@ -105,8 +88,6 @@ LogTest_SOURCES = LogTest.cpp LogTest_LDADD = libcommon.la $(SQLITE3_LIBS) - -F16Test_SOURCES = F16Test.cpp MOSTLYCLEANFILES += testSource testDestination diff --git a/CommonLibs/MemoryLeak.h b/CommonLibs/MemoryLeak.h deleted file mode 100644 index 4948534..0000000 --- a/CommonLibs/MemoryLeak.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ -#ifndef _MEMORYLEAK_ -#define _MEMORYLEAK_ 1 -#include -#include "ScalarTypes.h" -#include "Logger.h" - -namespace Utils { - -struct MemStats { - // Enumerates the classes that are checked. - // Redundancies are ok, for example, we check BitVector and also - // several descendants of BitVector. - enum MemoryNames { - mZeroIsUnused, - mVector, - mVectorData, - mBitVector, - mByteVector, - mByteVectorData, - mRLCRawBlock, - mRLCUplinkDataBlock, - mRLCMessage, - mRLCMsgPacketDownlinkDummyControlBlock, // Redundant with RLCMessage - mTBF, - mLlcEngine, - mSgsnDownlinkMsg, - mRachInfo, - mPdpPdu, - mFECDispatchInfo, - mL3Frame, - msignalVector, - mSoftVector, - mScramblingCode, - mURlcDownSdu, - mURlcPdu, - // Must be last: - mMax, - }; - int mMemTotal[mMax]; // In elements, not bytes. - int mMemNow[mMax]; - const char *mMemName[mMax]; - MemStats(); - void memChkNew(MemoryNames memIndex, const char *id); - void memChkDel(MemoryNames memIndex, const char *id); - void text(std::ostream &os); - // We would prefer to use an unordered_map, but that requires special compile switches. - // What a super great language. - typedef std::map MemMapType; - MemMapType mMemMap; -}; -extern struct MemStats gMemStats; -extern int gMemLeakDebug; - -// This is a memory leak detector. -// Use by putting RN_MEMCHKNEW and RN_MEMCHKDEL in class constructors/destructors, -// or use the DEFINE_MEMORY_LEAK_DETECTOR class and add the defined class -// as an ancestor to the class to be memory leak checked. - -struct MemLabel { - std::string mccKey; - virtual ~MemLabel() { - Int_z &tmp = Utils::gMemStats.mMemMap[mccKey]; tmp = tmp - 1; - } -}; - -#if RN_DISABLE_MEMORY_LEAK_TEST -#define RN_MEMCHKNEW(type) -#define RN_MEMCHKDEL(type) -#define RN_MEMLOG(type,ptr) -#define DEFINE_MEMORY_LEAK_DETECTOR_CLASS(subClass,checkerClass) \ - struct checkerClass {}; -#else - -#define RN_MEMCHKNEW(type) { Utils::gMemStats.memChkNew(Utils::MemStats::m##type,#type); } -#define RN_MEMCHKDEL(type) { Utils::gMemStats.memChkDel(Utils::MemStats::m##type,#type); } - -#define RN_MEMLOG(type,ptr) { \ - static std::string key = format("%s_%s:%d",#type,__FILE__,__LINE__); \ - (ptr)->/* MemCheck##type:: */ mccKey = key; \ - Utils::gMemStats.mMemMap[key]++; \ - } - -// TODO: The above assumes that checkclass is MemCheck ## subClass -#define DEFINE_MEMORY_LEAK_DETECTOR_CLASS(subClass,checkerClass) \ - struct checkerClass : public virtual Utils::MemLabel { \ - checkerClass() { RN_MEMCHKNEW(subClass); } \ - virtual ~checkerClass() { \ - RN_MEMCHKDEL(subClass); \ - } \ - }; - -#endif - -} // namespace Utils - -#endif diff --git a/CommonLibs/Regexp.h b/CommonLibs/Regexp.h deleted file mode 100644 index 3ff1e97..0000000 --- a/CommonLibs/Regexp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright 2008 Free Software Foundation, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - -#ifndef REGEXPW_H -#define REGEXPW_H - -#include -#include -#include - - - -class Regexp { - - private: - - regex_t mRegex; - - - public: - - Regexp(const char* regexp, int flags=REG_EXTENDED) - { - int result = regcomp(&mRegex, regexp, flags); - if (result) { - char msg[256]; - regerror(result,&mRegex,msg,255); - std::cerr << "Regexp compilation of " << regexp << " failed: " << msg << std::endl; - abort(); - } - } - - ~Regexp() - { regfree(&mRegex); } - - bool match(const char *text, int flags=0) const - { return regexec(&mRegex, text, 0, NULL, flags)==0; } - -}; - - -#endif diff --git a/CommonLibs/RegexpTest.cpp b/CommonLibs/RegexpTest.cpp deleted file mode 100644 index 748be49..0000000 --- a/CommonLibs/RegexpTest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright 2008 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - - -#include "Regexp.h" -#include - -using namespace std; - - -int main(int argc, char *argv[]) -{ - - Regexp email("^[[:graph:]]+@[[:graph:]]+ "); - Regexp simple("^dburgess@"); - - const char text1[] = "dburgess at jcis.net test message"; - const char text2[] = "no address text message"; - - cout << email.match(text1) << " " << text1 << endl; - cout << email.match(text2) << " " << text2 << endl; - - cout << simple.match(text1) << " " << text1 << endl; - cout << simple.match(text2) << " " << text2 << endl; -} diff --git a/CommonLibs/Reporting.cpp b/CommonLibs/Reporting.cpp deleted file mode 100644 index 3ea7eed..0000000 --- a/CommonLibs/Reporting.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**@file Module for performance-reporting mechanisms. */ -/* -* Copyright 2012 Range Networks, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#include "Reporting.h" -#include "Logger.h" -#include -#include - -static const char* createReportingTable = { - "CREATE TABLE IF NOT EXISTS REPORTING (" - "NAME TEXT UNIQUE NOT NULL, " - "VALUE INTEGER DEFAULT 0, " - "CLEAREDTIME INTEGER NOT NULL, " - "UPDATETIME INTEGER DEFAULT 0 " - ")" -}; - - -ReportingTable::ReportingTable(const char* filename) -{ - gLogEarly(LOG_INFO | mFacility, "opening reporting table from path %s", filename); - // Connect to the database. - int rc = sqlite3_open(filename,&mDB); - if (rc) { - gLogEarly(LOG_EMERG | mFacility, "cannot open reporting database at %s, error message: %s", filename, sqlite3_errmsg(mDB)); - sqlite3_close(mDB); - mDB = NULL; - return; - } - // Create the table, if needed. - if (!sqlite3_command(mDB,createReportingTable)) { - gLogEarly(LOG_EMERG | mFacility, "cannot create reporting table in database at %s, error message: %s", filename, sqlite3_errmsg(mDB)); - } -} - - -bool ReportingTable::create(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"INSERT OR IGNORE INTO REPORTING (NAME,CLEAREDTIME) VALUES (\"%s\",%ld)", paramName, time(NULL)); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot create reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - - -bool ReportingTable::incr(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=VALUE+1, UPDATETIME=%ld WHERE NAME=\"%s\"", time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot increment reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - - -bool ReportingTable::max(const char* paramName, unsigned newVal) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=MAX(VALUE,%u), UPDATETIME=%ld WHERE NAME=\"%s\"", newVal, time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot maximize reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - -bool ReportingTable::clear(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=0, UPDATETIME=0, CLEAREDTIME=%ld WHERE NAME=\"%s\"", time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot clear reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - -bool ReportingTable::create(const char* baseName, unsigned minIndex, unsigned maxIndex) -{ - size_t sz = strlen(baseName); - for (unsigned i = minIndex; i<=maxIndex; i++) { - char name[sz+10]; - sprintf(name,"%s.%u",baseName,i); - if (!create(name)) return false; - } - return true; -} - -bool ReportingTable::incr(const char* baseName, unsigned index) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return incr(name); -} - - -bool ReportingTable::max(const char* baseName, unsigned index, unsigned newVal) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return max(name,newVal); -} - - -bool ReportingTable::clear(const char* baseName, unsigned index) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return clear(name); -} - - - - diff --git a/CommonLibs/Reporting.h b/CommonLibs/Reporting.h deleted file mode 100644 index 1878618..0000000 --- a/CommonLibs/Reporting.h +++ /dev/null @@ -1,86 +0,0 @@ -/**@file Module for performance-reporting mechanisms. */ -/* -* Copyright 2012 Range Networks, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#ifndef REPORTING_H -#define REPORTING_H - -#include -#include - - -/** - Collect performance statistics into a database. - Parameters are counters or max/min trackers, all integer. -*/ -class ReportingTable { - - private: - - sqlite3* mDB; ///< database connection - int mFacility; ///< rsyslogd facility - - - - public: - - /** - Open the database connection; - create the table if it does not exist yet. - */ - ReportingTable(const char* filename); - - /** Create a new parameter. */ - bool create(const char* paramName); - - /** Create an indexed parameter set. */ - bool create(const char* baseBame, unsigned minIndex, unsigned maxIndex); - - /** Increment a counter. */ - bool incr(const char* paramName); - - /** Increment an indexed counter. */ - bool incr(const char* baseName, unsigned index); - - /** Take a max of a parameter. */ - bool max(const char* paramName, unsigned newVal); - - /** Take a max of an indexed parameter. */ - bool max(const char* paramName, unsigned index, unsigned newVal); - - /** Clear a value. */ - bool clear(const char* paramName); - - /** Clear an indexed value. */ - bool clear(const char* paramName, unsigned index); - - /** Dump the database to a stream. */ - void dump(std::ostream&) const; - -}; - -#endif - - -// vim: ts=4 sw=4 diff --git a/CommonLibs/ScalarTypes.h b/CommonLibs/ScalarTypes.h deleted file mode 100644 index 077d889..0000000 --- a/CommonLibs/ScalarTypes.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#ifndef SCALARTYPES_H -#define SCALARTYPES_H -#include // For size_t -#include -//#include "GSMCommon.h" // Was included for Z100Timer - -// We dont bother to define *= /= etc.; you'll have to convert: a*=b; to: a=a*b; -#define _INITIALIZED_SCALAR_BASE_FUNCS(Classname,Basetype,Init) \ - Classname() : value(Init) {} \ - Classname(Basetype wvalue) { value = wvalue; } /* Can set from basetype. */ \ - operator Basetype(void) const { return value; } /* Converts from basetype. */ \ - Basetype operator=(Basetype wvalue) { return value = wvalue; } \ - Basetype* operator&() { return &value; } - -#define _INITIALIZED_SCALAR_ARITH_FUNCS(Basetype) \ - Basetype operator++() { return ++value; } \ - Basetype operator++(int) { return value++; } \ - Basetype operator--() { return --value; } \ - Basetype operator--(int) { return value--; } \ - Basetype operator+=(Basetype wvalue) { return value = value + wvalue; } \ - Basetype operator-=(Basetype wvalue) { return value = value - wvalue; } - -#define _INITIALIZED_SCALAR_FUNCS(Classname,Basetype,Init) \ - _INITIALIZED_SCALAR_BASE_FUNCS(Classname,Basetype,Init) \ - _INITIALIZED_SCALAR_ARITH_FUNCS(Basetype) - - -#define _DECLARE_SCALAR_TYPE(Classname_i,Classname_z,Basetype) \ - template \ - struct Classname_i { \ - Basetype value; \ - _INITIALIZED_SCALAR_FUNCS(Classname_i,Basetype,Init) \ - }; \ - typedef Classname_i<0> Classname_z; - - -// Usage: -// Where 'classname' is one of the types listed below, then: -// classname_z specifies a zero initialized type; -// classname_i initializes the type to the specified value. -// We also define Float_z. -_DECLARE_SCALAR_TYPE(Int_i, Int_z, int) -_DECLARE_SCALAR_TYPE(Char_i, Char_z, signed char) -_DECLARE_SCALAR_TYPE(Int16_i, Int16_z, int16_t) -_DECLARE_SCALAR_TYPE(Int32_i, Int32_z, int32_t) -_DECLARE_SCALAR_TYPE(UInt_i, UInt_z, unsigned) -_DECLARE_SCALAR_TYPE(UChar_i, UChar_z, unsigned char) -_DECLARE_SCALAR_TYPE(UInt16_i, UInt16_z, uint16_t) -_DECLARE_SCALAR_TYPE(UInt32_i, UInt32_z, uint32_t) -_DECLARE_SCALAR_TYPE(Size_t_i, Size_t_z, size_t) - -// Bool is special because it cannot accept some arithmetic funcs -//_DECLARE_SCALAR_TYPE(Bool_i, Bool_z, bool) -template -struct Bool_i { - bool value; - _INITIALIZED_SCALAR_BASE_FUNCS(Bool_i,bool,Init) -}; -typedef Bool_i<0> Bool_z; - -// float is special, because C++ does not permit the template initalization: -struct Float_z { - float value; - _INITIALIZED_SCALAR_FUNCS(Float_z,float,0) -}; -struct Double_z { - double value; - _INITIALIZED_SCALAR_FUNCS(Double_z,double,0) -}; - - -class ItemWithValueAndWidth { - public: - virtual unsigned getValue() const = 0; - virtual unsigned getWidth() const = 0; -}; - -// A Range Networks Field with a specified width. -// See RLCMessages.h for examples. -template -class Field_i : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field_i,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - -// Synonym for Field_i, but no way to do it. -template -class Field_z : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field_z,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - -// This is an uninitialized field. -template -class Field : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - - -// A Z100Timer with an initial value specified. -//template -//class Z100Timer_i : public GSM::Z100Timer { -// public: -// Z100Timer_i() : GSM::Z100Timer(Init) {} -//}; - -#endif diff --git a/CommonLibs/URLEncode.cpp b/CommonLibs/URLEncode.cpp deleted file mode 100644 index cdf38dd..0000000 --- a/CommonLibs/URLEncode.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2011, Range Networks, Inc. */ - -#include -#include -#include -#include - -using namespace std; - -//based on javascript encodeURIComponent() -string URLEncode(const string &c) -{ - static const char *digits = "01234567890ABCDEF"; - string retVal=""; - for (size_t i=0; i>4) & 0x0f]; - retVal += digits[ch & 0x0f]; - } - } - return retVal; -} - diff --git a/CommonLibs/URLEncode.h b/CommonLibs/URLEncode.h deleted file mode 100644 index 558ced9..0000000 --- a/CommonLibs/URLEncode.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Copyright 2011 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - - -# include - -std::string URLEncode(const std::string&); diff --git a/CommonLibs/URLEncodeTest.cpp b/CommonLibs/URLEncodeTest.cpp deleted file mode 100644 index dbc4630..0000000 --- a/CommonLibs/URLEncodeTest.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -#include "URLEncode.h" -#include -#include - - -using namespace std; - - -int main(int argc, char *argv[]) -{ - - string test = string("Testing: !@#$%^&*() " __DATE__ " " __TIME__); - cout << test << endl; - cout << URLEncode(test) << endl; -} - diff --git a/CommonLibs/Utils.cpp b/CommonLibs/Utils.cpp deleted file mode 100644 index 1da95fa..0000000 --- a/CommonLibs/Utils.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#include // For usleep -#include // For gettimeofday -#include // For vsnprintf -#include // For ostream -#include // For ostringstream -#include // For strcpy -//#include "GSMCommon.h" -#include "Utils.h" -#include "MemoryLeak.h" - -namespace Utils { - -MemStats gMemStats; -int gMemLeakDebug = 0; - -MemStats::MemStats() -{ - memset(mMemNow,0,sizeof(mMemNow)); - memset(mMemTotal,0,sizeof(mMemTotal)); - memset(mMemName,0,sizeof(mMemName)); -} - -void MemStats::text(std::ostream &os) -{ - os << "Structs current total:\n"; - for (int i = 0; i < mMax; i++) { - os << "\t" << (mMemName[i] ? mMemName[i] : "unknown") << " " << mMemNow[i] << " " << mMemTotal[i] << "\n"; - } -} - -void MemStats::memChkNew(MemoryNames memIndex, const char *id) -{ - /*std::cout << "new " #type "\n";*/ - mMemNow[memIndex]++; - mMemTotal[memIndex]++; - mMemName[memIndex] = id; -} - -void MemStats::memChkDel(MemoryNames memIndex, const char *id) -{ - /*std::cout << "del " #type "\n";*/ - mMemNow[memIndex]--; - if (mMemNow[memIndex] < 0) { - LOG(ERR) << "Memory underflow on type "<= (300-4)) { strcpy(&buf[(300-4)],"..."); } - os << buf; - return os; -} - -std::string format(const char *fmt, ...) -{ - va_list ap; - char buf[300]; - va_start(ap,fmt); - int n = vsnprintf(buf,300,fmt,ap); - va_end(ap); - if (n >= (300-4)) { strcpy(&buf[(300-4)],"..."); } - return std::string(buf); -} - -// Return time in seconds with high resolution. -// Note: In the past I found this to be a surprisingly expensive system call in linux. -double timef() -{ - struct timeval tv; - gettimeofday(&tv,NULL); - return tv.tv_usec / 1000000.0 + tv.tv_sec; -} - -const std::string timestr() -{ - struct timeval tv; - struct tm tm; - gettimeofday(&tv,NULL); - localtime_r(&tv.tv_sec,&tm); - unsigned tenths = tv.tv_usec / 100000; // Rounding down is ok. - return format(" %02d:%02d:%02d.%1d",tm.tm_hour,tm.tm_min,tm.tm_sec,tenths); -} - -// High resolution sleep for the specified time. -// Return FALSE if time is already past. -void sleepf(double howlong) -{ - if (howlong <= 0.00001) return; // Less than 10 usecs, forget it. - usleep((useconds_t) (1000000.0 * howlong)); -} - -//bool sleepuntil(double untilwhen) -//{ - //double now = timef(); - //double howlong = untilwhen - now; // Fractional time in seconds. - // We are not worrying about overflow because all times should be in the near future. - //if (howlong <= 0.00001) return false; // Less than 10 usecs, forget it. - //sleepf(sleeptime); -//} - -std::string Text2Str::str() const -{ - std::ostringstream ss; - text(ss); - return ss.str(); -} - -std::ostream& operator<<(std::ostream& os, const Text2Str *val) -{ - std::ostringstream ss; - if (val) { - val->text(ss); - os << ss.str(); - } else { - os << "(null)"; - } - return os; -} - -// Greatest Common Denominator. -// This is by Doug Brown. -int gcd(int x, int y) -{ - if (x > y) { - return x % y == 0 ? y : gcd(y, x % y); - } else { - return y % x == 0 ? x : gcd(x, y % x); - } -} - - -// Split a C string into an argc,argv array in place; the input string is modified. -// Returns argc, and places results in argv, up to maxargc elements. -// The final argv receives the rest of the input string from maxargc on, -// even if it contains additional splitchars. -// The correct idiom for use is to make a copy of your string, like this: -// char *copy = strcpy((char*)alloca(the_string.length()+1),the_string.c_str()); -// char *argv[2]; -// int argc = cstrSplit(copy,argv,2,NULL); -// If you want to detect the error of too many arguments, add 1 to argv, like this: -// char *argv[3]; -// int argc = cstrSplit(copy,argv,3,NULL); -// if (argc == 3) { error("too many arguments"; } -int cstrSplit(char *in, char **pargv,int maxargc, const char *splitchars) -{ - if (splitchars == NULL) { splitchars = " \t\r\n"; } // Default is any space. - int argc = 0; - while (argc < maxargc) { - while (*in && strchr(splitchars,*in)) {in++;} // scan past any splitchars - if (! *in) return argc; // return if finished. - pargv[argc++] = in; // save ptr to start of arg. - in = strpbrk(in,splitchars); // go to end of arg. - if (!in) return argc; // return if finished. - *in++ = 0; // zero terminate this arg. - } - return argc; -} - -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } - -std::string replaceAll(const std::string input, const std::string search, const std::string replace) -{ - std::string output = input; - int index = 0; - - while (true) { - index = output.find(search, index); - if (index == std::string::npos) { - break; - } - - output.replace(index, replace.length(), replace); - index += replace.length(); - } - - return output; -} - -}; diff --git a/CommonLibs/Utils.h b/CommonLibs/Utils.h deleted file mode 100644 index 0bc738e..0000000 --- a/CommonLibs/Utils.h +++ /dev/null @@ -1,148 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#ifndef GPRSUTILS_H -#define GPRSUTILS_H -#include -#include -#include -#include -#include // for sqrtf -#include "Logger.h" - - -namespace Utils { - -extern double timef(); // high resolution time -extern const std::string timestr(); // A timestamp to print in messages. -extern void sleepf(double howlong); // high resolution sleep -extern int gcd(int x, int y); - -// It is irritating to create a string just to interface to the brain-damaged -// C++ stream class, but this is only used for debug messages. -std::string format(const char *fmt, ...) __attribute__((format (printf,1,2))); - -int cstrSplit(char *in, char **pargv,int maxargc, const char *splitchars=NULL); - -// For classes with a text() function, provide a function to return a String, -// and also a standard << stream function that takes a pointer to the object. -// We dont provide the function that takes a reference to the object -// because it is too highly overloaded and generally doesnt work. -class Text2Str { - public: - virtual void text(std::ostream &os) const = 0; - std::string str() const; -}; -std::ostream& operator<<(std::ostream& os, const Text2Str *val); - -#if 0 -// Generic Activity Timer. Lots of controls to make everybody happy. -class ATimer { - double mStart; - //bool mActive; - double mLimitTime; - public: - ATimer() : mStart(0), mLimitTime(0) { } - ATimer(double wLimitTime) : mStart(0), mLimitTime(wLimitTime) { } - void start() { mStart=timef(); } - void stop() { mStart=0; } - bool active() { return !!mStart; } - double elapsed() { return timef() - mStart; } - bool expired() { return elapsed() > mLimitTime; } -}; -#endif - - -struct BitSet { - unsigned mBits; - void setBit(unsigned whichbit) { mBits |= 1< struct Statistic { - Type mCurrent, mMin, mMax; // min,max optional initialization so you can print before adding any values. - unsigned mCnt; - double mSum; - //double mSum2; // sum of squares. - // (Type) cast needed in case Type is an enum, stupid language. - Statistic() : mCurrent((Type)0), mMin((Type)0), mMax((Type)0), mCnt(0), mSum(0) /*,mSum2(0)*/ {} - // Set the current value and add a statisical point. - void addPoint(Type val) { - mCurrent = val; - if (mCnt == 0 || val < mMin) {mMin = val;} - if (mCnt == 0 || val > mMax) {mMax = val;} - mCnt++; - mSum += val; - //mSum2 += val * val; - } - Type getCurrent() const { // Return current value. - return mCnt ? mCurrent : 0; - } - double getAvg() const { // Return average. - return mCnt==0 ? 0 : mSum/mCnt; - }; - //float getSD() const { // Return standard deviation. Use low precision square root function. - // return mCnt==0 ? 0 : sqrtf(mCnt * mSum2 - mSum*mSum) / mCnt; - //} - - void text(std::ostream &os) const { // Print everything in parens. - os << "("< &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); - - -// Yes, they botched and left this out: -std::ostream& operator<<(std::ostream& os, std::ostringstream& ss); - -std::ostream &osprintf(std::ostream &os, const char *fmt, ...) __attribute__((format (printf,2,3))); - -std::string replaceAll(const std::string input, const std::string search, const std::string replace); - -}; // namespace - -using namespace Utils; - -#endif -- To view, visit https://gerrit.osmocom.org/2125 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Sat Mar 18 02:14:12 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Sat, 18 Mar 2017 02:14:12 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Typo sybols -> symbols Message-ID: Review at https://gerrit.osmocom.org/2126 sigProcLib: Typo sybols -> symbols Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a --- M Transceiver52M/sigProcLib.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/26/2126/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index a361eff..2a22e49 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1124,7 +1124,7 @@ * Modulate 8-PSK burst. When empty pulse shaping (rotation only) * is enabled, the output vector length will be bit sequence length * times the SPS value. When pulse shaping is enabled, the output - * vector length is fixed at 625 samples (156.25 sybols at 4 SPS). + * vector length is fixed at 625 samples (156.25 symbols at 4 SPS). * Pulse shaped bit sequences that go beyond one burst are truncated. * Pulse shaping at anything but 4 SPS is not supported. */ -- To view, visit https://gerrit.osmocom.org/2126 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Sat Mar 18 02:14:12 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Sat, 18 Mar 2017 02:14:12 +0000 Subject: [PATCH] osmo-trx[master]: radioBuffer: Remove extra ; at the end of inline function de... Message-ID: Review at https://gerrit.osmocom.org/2127 radioBuffer: Remove extra ; at the end of inline function definitions. Change-Id: I8911adf0a0bb1ae828ac9cdf1a76c904639f6c06 --- M Transceiver52M/radioBuffer.h 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/27/2127/1 diff --git a/Transceiver52M/radioBuffer.h b/Transceiver52M/radioBuffer.h index afb6e63..e5aa315 100644 --- a/Transceiver52M/radioBuffer.h +++ b/Transceiver52M/radioBuffer.h @@ -9,10 +9,10 @@ ~RadioBuffer(); - const size_t getSegmentLen() { return segmentLen; }; - const size_t getNumSegments() { return numSegments; }; - const size_t getAvailSamples() { return availSamples; }; - const size_t getAvailSegments() { return availSamples / segmentLen; }; + const size_t getSegmentLen() { return segmentLen; } + const size_t getNumSegments() { return numSegments; } + const size_t getAvailSamples() { return availSamples; } + const size_t getAvailSegments() { return availSamples / segmentLen; } const size_t getFreeSamples() { -- To view, visit https://gerrit.osmocom.org/2127 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8911adf0a0bb1ae828ac9cdf1a76c904639f6c06 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Sat Mar 18 02:14:13 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Sat, 18 Mar 2017 02:14:13 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Fix documentation, sync argument names in .cpp a... Message-ID: Review at https://gerrit.osmocom.org/2128 sigProcLib: Fix documentation, sync argument names in .cpp and .h files. Documentation in sigProcLib.h was noticeably out of sync with the actual implementation - e.g. not all arguments were documented and arguments which are already removed are still in the documentation. Also argument names were different between declaration in .h and implementation in .cpp which was confusing. I've fixed this for detect*Burst() functions. Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 49 insertions(+), 47 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/28/2128/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 2a22e49..c1cf12e 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1876,22 +1876,22 @@ * head: Search 8 symbols before target * tail: Search 8 symbols + maximum expected delay */ -int detectRACHBurst(signalVector &rxBurst, - float thresh, +int detectRACHBurst(signalVector &burst, + float threshold, int sps, - complex &, + complex &litude, float &toa, - unsigned maxTOA) + unsigned max_toa) { int rc, target, head, tail; CorrelationSequence *sync; target = 8 + 40; head = 8; - tail = 8 + maxTOA; + tail = 8 + max_toa; sync = gRACHSequence; - rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, + rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, target, head, tail, sync); return rc; @@ -1905,8 +1905,8 @@ * head: Search 6 symbols before target * tail: Search 6 symbols + maximum expected delay */ -int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh, - int sps, complex &, float &toa, unsigned max_toa) +int analyzeTrafficBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; CorrelationSequence *sync; @@ -1919,13 +1919,13 @@ tail = 6 + max_toa; sync = gMidambles[tsc]; - rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, + rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, target, head, tail, sync); return rc; } -int detectEdgeBurst(signalVector &rxBurst, unsigned tsc, float thresh, - int sps, complex &, float &toa, unsigned max_toa) +int detectEdgeBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; CorrelationSequence *sync; @@ -1938,7 +1938,7 @@ tail = 6 + max_toa; sync = gEdgeMidambles[tsc]; - rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, + rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, target, head, tail, sync); return rc; } diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index b4aee93..1b646cd 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -189,69 +189,71 @@ float *avgPwr = NULL); /** - RACH correlator/detector. - @param rxBurst The received GSM burst of interest. - @param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + RACH aka Access Burst correlator/detector. + @param burst The received GSM burst of interest. + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received RACH burst. - @param TOA The estimate time-of-arrival of received RACH burst. - @param maxTOA The maximum expected time-of-arrival - @return positive if threshold value is reached, negative on error, zero otherwise + @param toa The estimate time-of-arrival of received RACH burst. + @param max_toa The maximum expected time-of-arrival + @return 1 if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected */ -int detectRACHBurst(signalVector &rxBurst, - float detectThreshold, +int detectRACHBurst(signalVector &burst, + float threshold, int sps, complex &litude, - float &TOA, - unsigned maxTOA); + float &toa, + unsigned max_toa); /** - Normal burst correlator, detector, channel estimator. + GMSK Normal Burst correlator/detector. @param rxBurst The received GSM burst of interest. - - @param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received TSC burst. - @param TOA The estimate time-of-arrival of received TSC burst. - @param maxTOA The maximum expected time-of-arrival - @param requestChannel Set to true if channel estimation is desired. - @param channelResponse The estimated channel. - @param channelResponseOffset The time offset b/w the first sample of the channel response and the reported TOA. - @return positive if threshold value is reached, negative on error, zero otherwise + @param toa The estimate time-of-arrival of received TSC burst. + @param max_toa The maximum expected time-of-arrival + @return 1 if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected */ -int analyzeTrafficBurst(signalVector &rxBurst, - unsigned TSC, - float detectThreshold, +int analyzeTrafficBurst(signalVector &burst, + unsigned tsc, + float threshold, int sps, complex &litude, - float &TOA, - unsigned maxTOA); + float &toa, + unsigned max_toa); /** - EDGE burst detector + EDGE/8-PSK Normal Burst correlator/detector @param burst The received GSM burst of interest - - @param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received TSC burst. - @param TOA The estimate time-of-arrival of received TSC burst. - @param maxTOA The maximum expected time-of-arrival - @return positive if threshold value is reached, negative on error, zero otherwise + @param toa The estimate time-of-arrival of received TSC burst. + @param max_toa The maximum expected time-of-arrival + @return 1 if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected */ int detectEdgeBurst(signalVector &burst, - unsigned TSC, - float detectThreshold, + unsigned tsc, + float threshold, int sps, complex &litude, - float &TOA, - unsigned maxTOA); + float &toa, + unsigned max_toa); /** Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ - signalVector *downsampleBurst(signalVector &burst); /** -- To view, visit https://gerrit.osmocom.org/2128 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Sat Mar 18 03:09:02 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Sat, 18 Mar 2017 03:09:02 +0000 Subject: [PATCH] osmo-trx[master]: CommonLibs: Remove unused files. In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2125 to look at the new patch set (#2). CommonLibs: Remove unused files. Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 --- M CommonLibs/Configuration.cpp D CommonLibs/F16.h D CommonLibs/F16Test.cpp M CommonLibs/Logger.cpp M CommonLibs/Logger.h M CommonLibs/Makefile.am D CommonLibs/MemoryLeak.h D CommonLibs/Regexp.h D CommonLibs/RegexpTest.cpp D CommonLibs/Reporting.cpp D CommonLibs/Reporting.h D CommonLibs/ScalarTypes.h D CommonLibs/URLEncode.cpp D CommonLibs/URLEncode.h D CommonLibs/URLEncodeTest.cpp D CommonLibs/Utils.cpp D CommonLibs/Utils.h 17 files changed, 49 insertions(+), 1,313 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/25/2125/2 diff --git a/CommonLibs/Configuration.cpp b/CommonLibs/Configuration.cpp index 8cbfcb0..bfff893 100644 --- a/CommonLibs/Configuration.cpp +++ b/CommonLibs/Configuration.cpp @@ -53,6 +53,23 @@ ")" }; +static std::string replaceAll(const std::string input, const std::string search, const std::string replace) +{ + std::string output = input; + int index = 0; + + while (true) { + index = output.find(search, index); + if (index == std::string::npos) { + break; + } + + output.replace(index, replace.length(), replace); + index += replace.length(); + } + + return output; +} float ConfigurationRecord::floatNumber() const @@ -259,8 +276,8 @@ ss << "% END AUTO-GENERATED CONTENT" << endl; ss << endl; - string tmp = Utils::replaceAll(ss.str(), "^", "\\^"); - return Utils::replaceAll(tmp, "_", "\\_"); + string tmp = replaceAll(ss.str(), "^", "\\^"); + return replaceAll(tmp, "_", "\\_"); } bool ConfigurationTable::defines(const string& key) diff --git a/CommonLibs/F16.h b/CommonLibs/F16.h deleted file mode 100644 index aa292f0..0000000 --- a/CommonLibs/F16.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -* Copyright 2009 Free Software Foundation, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - -#ifndef F16_H -#define F16_H - -#include -#include - - - -/** Round a float to the appropriate F16 value. */ -inline int32_t _f16_round(float f) -{ - if (f>0.0F) return (int32_t)(f+0.5F); - if (f<0.0F) return (int32_t)(f-0.5F); - return 0; -} - - - -/** A class for F15.16 fixed point arithmetic with saturation. */ -class F16 { - - - private: - - int32_t mV; - - - public: - - F16() {} - - F16(int i) { mV = i<<16; } - F16(float f) { mV = _f16_round(f*65536.0F); } - F16(double f) { mV = _f16_round((float)f*65536.0F); } - - int32_t& raw() { return mV; } - const int32_t& raw() const { return mV; } - - float f() const { return mV/65536.0F; } - - //operator float() const { return mV/65536.0F; } - //operator int() const { return mV>>16; } - - F16 operator=(float f) - { - mV = _f16_round(f*65536.0F); - return *this; - } - - F16 operator=(int i) - { - mV = i<<16; - return *this; - } - - F16 operator=(const F16& other) - { - mV = other.mV; - return mV; - } - - F16 operator+(const F16& other) const - { - F16 retVal; - retVal.mV = mV + other.mV; - return retVal; - } - - F16& operator+=(const F16& other) - { - mV += other.mV; - return *this; - } - - F16 operator-(const F16& other) const - { - F16 retVal; - retVal.mV = mV - other.mV; - return retVal; - } - - F16& operator-=(const F16& other) - { - mV -= other.mV; - return *this; - } - - F16 operator*(const F16& other) const - { - F16 retVal; - int64_t p = (int64_t)mV * (int64_t)other.mV; - retVal.mV = p>>16; - return retVal; - } - - F16& operator*=(const F16& other) - { - int64_t p = (int64_t)mV * (int64_t)other.mV; - mV = p>>16; - return *this; - } - - F16 operator*(float f) const - { - F16 retVal; - retVal.mV = mV * f; - return retVal; - } - - F16& operator*=(float f) - { - mV *= f; - return *this; - } - - F16 operator/(const F16& other) const - { - F16 retVal; - int64_t pV = (int64_t)mV << 16; - retVal.mV = pV / other.mV; - return retVal; - } - - F16& operator/=(const F16& other) - { - int64_t pV = (int64_t)mV << 16; - mV = pV / other.mV; - return *this; - } - - F16 operator/(float f) const - { - F16 retVal; - retVal.mV = mV / f; - return retVal; - } - - F16& operator/=(float f) - { - mV /= f; - return *this; - } - - bool operator>(const F16& other) const - { - return mV>other.mV; - } - - bool operator<(const F16& other) const - { - return mV(float f) const - { - return (mV/65536.0F) > f; - } - - bool operator<(float f) const - { - return (mV/65536.0F) < f; - } - - bool operator==(float f) const - { - return (mV/65536.0F) == f; - } - -}; - - - -inline std::ostream& operator<<(std::ostream& os, const F16& v) -{ - os << v.f(); - return os; -} - -#endif - diff --git a/CommonLibs/F16Test.cpp b/CommonLibs/F16Test.cpp deleted file mode 100644 index 7f3c84d..0000000 --- a/CommonLibs/F16Test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright 2009 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#include "F16.h" - - -#include - -using namespace std; - -int main(int argc, char **argv) -{ - - F16 a = 2.5; - F16 b = 1.5; - F16 c = 2.5 * 1.5; - F16 d = c + a; - F16 e = 10; - cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl; - - a *= 3; - b *= 0.3; - c *= e; - cout << a << ' ' << b << ' ' << c << ' ' << d << endl; - - a /= 3; - b /= 0.3; - c = d * 0.05; - cout << a << ' ' << b << ' ' << c << ' ' << d << endl; - - F16 f = a/d; - cout << f << ' ' << f+0.5 << endl; -} diff --git a/CommonLibs/Logger.cpp b/CommonLibs/Logger.cpp index 82391cc..4e4dbbc 100644 --- a/CommonLibs/Logger.cpp +++ b/CommonLibs/Logger.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // For gettimeofday #include "Configuration.h" #include "Logger.h" @@ -111,6 +112,31 @@ return level; } +static std::string format(const char *fmt, ...) +{ + va_list ap; + char buf[300]; + va_start(ap,fmt); + int n = vsnprintf(buf,300,fmt,ap); + va_end(ap); + if (n >= (300-4)) { strcpy(&buf[(300-4)],"..."); } + return std::string(buf); +} + +const std::string timestr() +{ + struct timeval tv; + struct tm tm; + gettimeofday(&tv,NULL); + localtime_r(&tv.tv_sec,&tm); + unsigned tenths = tv.tv_usec / 100000; // Rounding down is ok. + return format(" %02d:%02d:%02d.%1d",tm.tm_hour,tm.tm_min,tm.tm_sec,tenths); +} + +std::ostream& operator<<(std::ostream& os, std::ostringstream& ss) +{ + return os << ss.str(); +} int getLoggingLevel(const char* filename) { diff --git a/CommonLibs/Logger.h b/CommonLibs/Logger.h index 9667f36..68c5a9b 100644 --- a/CommonLibs/Logger.h +++ b/CommonLibs/Logger.h @@ -83,7 +83,6 @@ #include "Threads.h" // must be after defines above, if these files are to be allowed to use LOG() -#include "Utils.h" /** A C++ stream-based thread-safe logger. @@ -123,6 +122,8 @@ std::list gGetLoggerAlarms(); ///< Get a copy of the recent alarm list. +const std::string timestr(); // A timestamp to print in messages. +std::ostream& operator<<(std::ostream& os, std::ostringstream& ss); /**@ Global control and initialization of the logging system. */ //@{ diff --git a/CommonLibs/Makefile.am b/CommonLibs/Makefile.am index ed9cf29..f0f1061 100644 --- a/CommonLibs/Makefile.am +++ b/CommonLibs/Makefile.am @@ -36,24 +36,18 @@ Sockets.cpp \ Threads.cpp \ Timeval.cpp \ - Reporting.cpp \ Logger.cpp \ Configuration.cpp \ - sqlite3util.cpp \ - URLEncode.cpp \ - Utils.cpp + sqlite3util.cpp noinst_PROGRAMS = \ BitVectorTest \ InterthreadTest \ SocketsTest \ TimevalTest \ - RegexpTest \ VectorTest \ ConfigurationTest \ - LogTest \ - URLEncodeTest \ - F16Test + LogTest # ReportingTest @@ -64,18 +58,10 @@ Sockets.h \ Threads.h \ Timeval.h \ - Regexp.h \ Vector.h \ Configuration.h \ - Reporting.h \ - F16.h \ - URLEncode.h \ - Utils.h \ Logger.h \ sqlite3util.h - -URLEncodeTest_SOURCES = URLEncodeTest.cpp -URLEncodeTest_LDADD = libcommon.la BitVectorTest_SOURCES = BitVectorTest.cpp BitVectorTest_LDADD = libcommon.la $(SQLITE3_LIBS) @@ -94,9 +80,6 @@ VectorTest_SOURCES = VectorTest.cpp VectorTest_LDADD = libcommon.la $(SQLITE3_LIBS) -RegexpTest_SOURCES = RegexpTest.cpp -RegexpTest_LDADD = libcommon.la - ConfigurationTest_SOURCES = ConfigurationTest.cpp ConfigurationTest_LDADD = libcommon.la $(SQLITE3_LIBS) @@ -105,8 +88,6 @@ LogTest_SOURCES = LogTest.cpp LogTest_LDADD = libcommon.la $(SQLITE3_LIBS) - -F16Test_SOURCES = F16Test.cpp MOSTLYCLEANFILES += testSource testDestination diff --git a/CommonLibs/MemoryLeak.h b/CommonLibs/MemoryLeak.h deleted file mode 100644 index 4948534..0000000 --- a/CommonLibs/MemoryLeak.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ -#ifndef _MEMORYLEAK_ -#define _MEMORYLEAK_ 1 -#include -#include "ScalarTypes.h" -#include "Logger.h" - -namespace Utils { - -struct MemStats { - // Enumerates the classes that are checked. - // Redundancies are ok, for example, we check BitVector and also - // several descendants of BitVector. - enum MemoryNames { - mZeroIsUnused, - mVector, - mVectorData, - mBitVector, - mByteVector, - mByteVectorData, - mRLCRawBlock, - mRLCUplinkDataBlock, - mRLCMessage, - mRLCMsgPacketDownlinkDummyControlBlock, // Redundant with RLCMessage - mTBF, - mLlcEngine, - mSgsnDownlinkMsg, - mRachInfo, - mPdpPdu, - mFECDispatchInfo, - mL3Frame, - msignalVector, - mSoftVector, - mScramblingCode, - mURlcDownSdu, - mURlcPdu, - // Must be last: - mMax, - }; - int mMemTotal[mMax]; // In elements, not bytes. - int mMemNow[mMax]; - const char *mMemName[mMax]; - MemStats(); - void memChkNew(MemoryNames memIndex, const char *id); - void memChkDel(MemoryNames memIndex, const char *id); - void text(std::ostream &os); - // We would prefer to use an unordered_map, but that requires special compile switches. - // What a super great language. - typedef std::map MemMapType; - MemMapType mMemMap; -}; -extern struct MemStats gMemStats; -extern int gMemLeakDebug; - -// This is a memory leak detector. -// Use by putting RN_MEMCHKNEW and RN_MEMCHKDEL in class constructors/destructors, -// or use the DEFINE_MEMORY_LEAK_DETECTOR class and add the defined class -// as an ancestor to the class to be memory leak checked. - -struct MemLabel { - std::string mccKey; - virtual ~MemLabel() { - Int_z &tmp = Utils::gMemStats.mMemMap[mccKey]; tmp = tmp - 1; - } -}; - -#if RN_DISABLE_MEMORY_LEAK_TEST -#define RN_MEMCHKNEW(type) -#define RN_MEMCHKDEL(type) -#define RN_MEMLOG(type,ptr) -#define DEFINE_MEMORY_LEAK_DETECTOR_CLASS(subClass,checkerClass) \ - struct checkerClass {}; -#else - -#define RN_MEMCHKNEW(type) { Utils::gMemStats.memChkNew(Utils::MemStats::m##type,#type); } -#define RN_MEMCHKDEL(type) { Utils::gMemStats.memChkDel(Utils::MemStats::m##type,#type); } - -#define RN_MEMLOG(type,ptr) { \ - static std::string key = format("%s_%s:%d",#type,__FILE__,__LINE__); \ - (ptr)->/* MemCheck##type:: */ mccKey = key; \ - Utils::gMemStats.mMemMap[key]++; \ - } - -// TODO: The above assumes that checkclass is MemCheck ## subClass -#define DEFINE_MEMORY_LEAK_DETECTOR_CLASS(subClass,checkerClass) \ - struct checkerClass : public virtual Utils::MemLabel { \ - checkerClass() { RN_MEMCHKNEW(subClass); } \ - virtual ~checkerClass() { \ - RN_MEMCHKDEL(subClass); \ - } \ - }; - -#endif - -} // namespace Utils - -#endif diff --git a/CommonLibs/Regexp.h b/CommonLibs/Regexp.h deleted file mode 100644 index 3ff1e97..0000000 --- a/CommonLibs/Regexp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright 2008 Free Software Foundation, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - -#ifndef REGEXPW_H -#define REGEXPW_H - -#include -#include -#include - - - -class Regexp { - - private: - - regex_t mRegex; - - - public: - - Regexp(const char* regexp, int flags=REG_EXTENDED) - { - int result = regcomp(&mRegex, regexp, flags); - if (result) { - char msg[256]; - regerror(result,&mRegex,msg,255); - std::cerr << "Regexp compilation of " << regexp << " failed: " << msg << std::endl; - abort(); - } - } - - ~Regexp() - { regfree(&mRegex); } - - bool match(const char *text, int flags=0) const - { return regexec(&mRegex, text, 0, NULL, flags)==0; } - -}; - - -#endif diff --git a/CommonLibs/RegexpTest.cpp b/CommonLibs/RegexpTest.cpp deleted file mode 100644 index 748be49..0000000 --- a/CommonLibs/RegexpTest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright 2008 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - - -#include "Regexp.h" -#include - -using namespace std; - - -int main(int argc, char *argv[]) -{ - - Regexp email("^[[:graph:]]+@[[:graph:]]+ "); - Regexp simple("^dburgess@"); - - const char text1[] = "dburgess at jcis.net test message"; - const char text2[] = "no address text message"; - - cout << email.match(text1) << " " << text1 << endl; - cout << email.match(text2) << " " << text2 << endl; - - cout << simple.match(text1) << " " << text1 << endl; - cout << simple.match(text2) << " " << text2 << endl; -} diff --git a/CommonLibs/Reporting.cpp b/CommonLibs/Reporting.cpp deleted file mode 100644 index 3ea7eed..0000000 --- a/CommonLibs/Reporting.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**@file Module for performance-reporting mechanisms. */ -/* -* Copyright 2012 Range Networks, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#include "Reporting.h" -#include "Logger.h" -#include -#include - -static const char* createReportingTable = { - "CREATE TABLE IF NOT EXISTS REPORTING (" - "NAME TEXT UNIQUE NOT NULL, " - "VALUE INTEGER DEFAULT 0, " - "CLEAREDTIME INTEGER NOT NULL, " - "UPDATETIME INTEGER DEFAULT 0 " - ")" -}; - - -ReportingTable::ReportingTable(const char* filename) -{ - gLogEarly(LOG_INFO | mFacility, "opening reporting table from path %s", filename); - // Connect to the database. - int rc = sqlite3_open(filename,&mDB); - if (rc) { - gLogEarly(LOG_EMERG | mFacility, "cannot open reporting database at %s, error message: %s", filename, sqlite3_errmsg(mDB)); - sqlite3_close(mDB); - mDB = NULL; - return; - } - // Create the table, if needed. - if (!sqlite3_command(mDB,createReportingTable)) { - gLogEarly(LOG_EMERG | mFacility, "cannot create reporting table in database at %s, error message: %s", filename, sqlite3_errmsg(mDB)); - } -} - - -bool ReportingTable::create(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"INSERT OR IGNORE INTO REPORTING (NAME,CLEAREDTIME) VALUES (\"%s\",%ld)", paramName, time(NULL)); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot create reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - - -bool ReportingTable::incr(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=VALUE+1, UPDATETIME=%ld WHERE NAME=\"%s\"", time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot increment reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - - -bool ReportingTable::max(const char* paramName, unsigned newVal) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=MAX(VALUE,%u), UPDATETIME=%ld WHERE NAME=\"%s\"", newVal, time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot maximize reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - -bool ReportingTable::clear(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=0, UPDATETIME=0, CLEAREDTIME=%ld WHERE NAME=\"%s\"", time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot clear reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - -bool ReportingTable::create(const char* baseName, unsigned minIndex, unsigned maxIndex) -{ - size_t sz = strlen(baseName); - for (unsigned i = minIndex; i<=maxIndex; i++) { - char name[sz+10]; - sprintf(name,"%s.%u",baseName,i); - if (!create(name)) return false; - } - return true; -} - -bool ReportingTable::incr(const char* baseName, unsigned index) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return incr(name); -} - - -bool ReportingTable::max(const char* baseName, unsigned index, unsigned newVal) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return max(name,newVal); -} - - -bool ReportingTable::clear(const char* baseName, unsigned index) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return clear(name); -} - - - - diff --git a/CommonLibs/Reporting.h b/CommonLibs/Reporting.h deleted file mode 100644 index 1878618..0000000 --- a/CommonLibs/Reporting.h +++ /dev/null @@ -1,86 +0,0 @@ -/**@file Module for performance-reporting mechanisms. */ -/* -* Copyright 2012 Range Networks, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#ifndef REPORTING_H -#define REPORTING_H - -#include -#include - - -/** - Collect performance statistics into a database. - Parameters are counters or max/min trackers, all integer. -*/ -class ReportingTable { - - private: - - sqlite3* mDB; ///< database connection - int mFacility; ///< rsyslogd facility - - - - public: - - /** - Open the database connection; - create the table if it does not exist yet. - */ - ReportingTable(const char* filename); - - /** Create a new parameter. */ - bool create(const char* paramName); - - /** Create an indexed parameter set. */ - bool create(const char* baseBame, unsigned minIndex, unsigned maxIndex); - - /** Increment a counter. */ - bool incr(const char* paramName); - - /** Increment an indexed counter. */ - bool incr(const char* baseName, unsigned index); - - /** Take a max of a parameter. */ - bool max(const char* paramName, unsigned newVal); - - /** Take a max of an indexed parameter. */ - bool max(const char* paramName, unsigned index, unsigned newVal); - - /** Clear a value. */ - bool clear(const char* paramName); - - /** Clear an indexed value. */ - bool clear(const char* paramName, unsigned index); - - /** Dump the database to a stream. */ - void dump(std::ostream&) const; - -}; - -#endif - - -// vim: ts=4 sw=4 diff --git a/CommonLibs/ScalarTypes.h b/CommonLibs/ScalarTypes.h deleted file mode 100644 index 077d889..0000000 --- a/CommonLibs/ScalarTypes.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#ifndef SCALARTYPES_H -#define SCALARTYPES_H -#include // For size_t -#include -//#include "GSMCommon.h" // Was included for Z100Timer - -// We dont bother to define *= /= etc.; you'll have to convert: a*=b; to: a=a*b; -#define _INITIALIZED_SCALAR_BASE_FUNCS(Classname,Basetype,Init) \ - Classname() : value(Init) {} \ - Classname(Basetype wvalue) { value = wvalue; } /* Can set from basetype. */ \ - operator Basetype(void) const { return value; } /* Converts from basetype. */ \ - Basetype operator=(Basetype wvalue) { return value = wvalue; } \ - Basetype* operator&() { return &value; } - -#define _INITIALIZED_SCALAR_ARITH_FUNCS(Basetype) \ - Basetype operator++() { return ++value; } \ - Basetype operator++(int) { return value++; } \ - Basetype operator--() { return --value; } \ - Basetype operator--(int) { return value--; } \ - Basetype operator+=(Basetype wvalue) { return value = value + wvalue; } \ - Basetype operator-=(Basetype wvalue) { return value = value - wvalue; } - -#define _INITIALIZED_SCALAR_FUNCS(Classname,Basetype,Init) \ - _INITIALIZED_SCALAR_BASE_FUNCS(Classname,Basetype,Init) \ - _INITIALIZED_SCALAR_ARITH_FUNCS(Basetype) - - -#define _DECLARE_SCALAR_TYPE(Classname_i,Classname_z,Basetype) \ - template \ - struct Classname_i { \ - Basetype value; \ - _INITIALIZED_SCALAR_FUNCS(Classname_i,Basetype,Init) \ - }; \ - typedef Classname_i<0> Classname_z; - - -// Usage: -// Where 'classname' is one of the types listed below, then: -// classname_z specifies a zero initialized type; -// classname_i initializes the type to the specified value. -// We also define Float_z. -_DECLARE_SCALAR_TYPE(Int_i, Int_z, int) -_DECLARE_SCALAR_TYPE(Char_i, Char_z, signed char) -_DECLARE_SCALAR_TYPE(Int16_i, Int16_z, int16_t) -_DECLARE_SCALAR_TYPE(Int32_i, Int32_z, int32_t) -_DECLARE_SCALAR_TYPE(UInt_i, UInt_z, unsigned) -_DECLARE_SCALAR_TYPE(UChar_i, UChar_z, unsigned char) -_DECLARE_SCALAR_TYPE(UInt16_i, UInt16_z, uint16_t) -_DECLARE_SCALAR_TYPE(UInt32_i, UInt32_z, uint32_t) -_DECLARE_SCALAR_TYPE(Size_t_i, Size_t_z, size_t) - -// Bool is special because it cannot accept some arithmetic funcs -//_DECLARE_SCALAR_TYPE(Bool_i, Bool_z, bool) -template -struct Bool_i { - bool value; - _INITIALIZED_SCALAR_BASE_FUNCS(Bool_i,bool,Init) -}; -typedef Bool_i<0> Bool_z; - -// float is special, because C++ does not permit the template initalization: -struct Float_z { - float value; - _INITIALIZED_SCALAR_FUNCS(Float_z,float,0) -}; -struct Double_z { - double value; - _INITIALIZED_SCALAR_FUNCS(Double_z,double,0) -}; - - -class ItemWithValueAndWidth { - public: - virtual unsigned getValue() const = 0; - virtual unsigned getWidth() const = 0; -}; - -// A Range Networks Field with a specified width. -// See RLCMessages.h for examples. -template -class Field_i : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field_i,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - -// Synonym for Field_i, but no way to do it. -template -class Field_z : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field_z,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - -// This is an uninitialized field. -template -class Field : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - - -// A Z100Timer with an initial value specified. -//template -//class Z100Timer_i : public GSM::Z100Timer { -// public: -// Z100Timer_i() : GSM::Z100Timer(Init) {} -//}; - -#endif diff --git a/CommonLibs/URLEncode.cpp b/CommonLibs/URLEncode.cpp deleted file mode 100644 index cdf38dd..0000000 --- a/CommonLibs/URLEncode.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2011, Range Networks, Inc. */ - -#include -#include -#include -#include - -using namespace std; - -//based on javascript encodeURIComponent() -string URLEncode(const string &c) -{ - static const char *digits = "01234567890ABCDEF"; - string retVal=""; - for (size_t i=0; i>4) & 0x0f]; - retVal += digits[ch & 0x0f]; - } - } - return retVal; -} - diff --git a/CommonLibs/URLEncode.h b/CommonLibs/URLEncode.h deleted file mode 100644 index 558ced9..0000000 --- a/CommonLibs/URLEncode.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Copyright 2011 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - - -# include - -std::string URLEncode(const std::string&); diff --git a/CommonLibs/URLEncodeTest.cpp b/CommonLibs/URLEncodeTest.cpp deleted file mode 100644 index dbc4630..0000000 --- a/CommonLibs/URLEncodeTest.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -#include "URLEncode.h" -#include -#include - - -using namespace std; - - -int main(int argc, char *argv[]) -{ - - string test = string("Testing: !@#$%^&*() " __DATE__ " " __TIME__); - cout << test << endl; - cout << URLEncode(test) << endl; -} - diff --git a/CommonLibs/Utils.cpp b/CommonLibs/Utils.cpp deleted file mode 100644 index 1da95fa..0000000 --- a/CommonLibs/Utils.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#include // For usleep -#include // For gettimeofday -#include // For vsnprintf -#include // For ostream -#include // For ostringstream -#include // For strcpy -//#include "GSMCommon.h" -#include "Utils.h" -#include "MemoryLeak.h" - -namespace Utils { - -MemStats gMemStats; -int gMemLeakDebug = 0; - -MemStats::MemStats() -{ - memset(mMemNow,0,sizeof(mMemNow)); - memset(mMemTotal,0,sizeof(mMemTotal)); - memset(mMemName,0,sizeof(mMemName)); -} - -void MemStats::text(std::ostream &os) -{ - os << "Structs current total:\n"; - for (int i = 0; i < mMax; i++) { - os << "\t" << (mMemName[i] ? mMemName[i] : "unknown") << " " << mMemNow[i] << " " << mMemTotal[i] << "\n"; - } -} - -void MemStats::memChkNew(MemoryNames memIndex, const char *id) -{ - /*std::cout << "new " #type "\n";*/ - mMemNow[memIndex]++; - mMemTotal[memIndex]++; - mMemName[memIndex] = id; -} - -void MemStats::memChkDel(MemoryNames memIndex, const char *id) -{ - /*std::cout << "del " #type "\n";*/ - mMemNow[memIndex]--; - if (mMemNow[memIndex] < 0) { - LOG(ERR) << "Memory underflow on type "<= (300-4)) { strcpy(&buf[(300-4)],"..."); } - os << buf; - return os; -} - -std::string format(const char *fmt, ...) -{ - va_list ap; - char buf[300]; - va_start(ap,fmt); - int n = vsnprintf(buf,300,fmt,ap); - va_end(ap); - if (n >= (300-4)) { strcpy(&buf[(300-4)],"..."); } - return std::string(buf); -} - -// Return time in seconds with high resolution. -// Note: In the past I found this to be a surprisingly expensive system call in linux. -double timef() -{ - struct timeval tv; - gettimeofday(&tv,NULL); - return tv.tv_usec / 1000000.0 + tv.tv_sec; -} - -const std::string timestr() -{ - struct timeval tv; - struct tm tm; - gettimeofday(&tv,NULL); - localtime_r(&tv.tv_sec,&tm); - unsigned tenths = tv.tv_usec / 100000; // Rounding down is ok. - return format(" %02d:%02d:%02d.%1d",tm.tm_hour,tm.tm_min,tm.tm_sec,tenths); -} - -// High resolution sleep for the specified time. -// Return FALSE if time is already past. -void sleepf(double howlong) -{ - if (howlong <= 0.00001) return; // Less than 10 usecs, forget it. - usleep((useconds_t) (1000000.0 * howlong)); -} - -//bool sleepuntil(double untilwhen) -//{ - //double now = timef(); - //double howlong = untilwhen - now; // Fractional time in seconds. - // We are not worrying about overflow because all times should be in the near future. - //if (howlong <= 0.00001) return false; // Less than 10 usecs, forget it. - //sleepf(sleeptime); -//} - -std::string Text2Str::str() const -{ - std::ostringstream ss; - text(ss); - return ss.str(); -} - -std::ostream& operator<<(std::ostream& os, const Text2Str *val) -{ - std::ostringstream ss; - if (val) { - val->text(ss); - os << ss.str(); - } else { - os << "(null)"; - } - return os; -} - -// Greatest Common Denominator. -// This is by Doug Brown. -int gcd(int x, int y) -{ - if (x > y) { - return x % y == 0 ? y : gcd(y, x % y); - } else { - return y % x == 0 ? x : gcd(x, y % x); - } -} - - -// Split a C string into an argc,argv array in place; the input string is modified. -// Returns argc, and places results in argv, up to maxargc elements. -// The final argv receives the rest of the input string from maxargc on, -// even if it contains additional splitchars. -// The correct idiom for use is to make a copy of your string, like this: -// char *copy = strcpy((char*)alloca(the_string.length()+1),the_string.c_str()); -// char *argv[2]; -// int argc = cstrSplit(copy,argv,2,NULL); -// If you want to detect the error of too many arguments, add 1 to argv, like this: -// char *argv[3]; -// int argc = cstrSplit(copy,argv,3,NULL); -// if (argc == 3) { error("too many arguments"; } -int cstrSplit(char *in, char **pargv,int maxargc, const char *splitchars) -{ - if (splitchars == NULL) { splitchars = " \t\r\n"; } // Default is any space. - int argc = 0; - while (argc < maxargc) { - while (*in && strchr(splitchars,*in)) {in++;} // scan past any splitchars - if (! *in) return argc; // return if finished. - pargv[argc++] = in; // save ptr to start of arg. - in = strpbrk(in,splitchars); // go to end of arg. - if (!in) return argc; // return if finished. - *in++ = 0; // zero terminate this arg. - } - return argc; -} - -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } - -std::string replaceAll(const std::string input, const std::string search, const std::string replace) -{ - std::string output = input; - int index = 0; - - while (true) { - index = output.find(search, index); - if (index == std::string::npos) { - break; - } - - output.replace(index, replace.length(), replace); - index += replace.length(); - } - - return output; -} - -}; diff --git a/CommonLibs/Utils.h b/CommonLibs/Utils.h deleted file mode 100644 index 0bc738e..0000000 --- a/CommonLibs/Utils.h +++ /dev/null @@ -1,148 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#ifndef GPRSUTILS_H -#define GPRSUTILS_H -#include -#include -#include -#include -#include // for sqrtf -#include "Logger.h" - - -namespace Utils { - -extern double timef(); // high resolution time -extern const std::string timestr(); // A timestamp to print in messages. -extern void sleepf(double howlong); // high resolution sleep -extern int gcd(int x, int y); - -// It is irritating to create a string just to interface to the brain-damaged -// C++ stream class, but this is only used for debug messages. -std::string format(const char *fmt, ...) __attribute__((format (printf,1,2))); - -int cstrSplit(char *in, char **pargv,int maxargc, const char *splitchars=NULL); - -// For classes with a text() function, provide a function to return a String, -// and also a standard << stream function that takes a pointer to the object. -// We dont provide the function that takes a reference to the object -// because it is too highly overloaded and generally doesnt work. -class Text2Str { - public: - virtual void text(std::ostream &os) const = 0; - std::string str() const; -}; -std::ostream& operator<<(std::ostream& os, const Text2Str *val); - -#if 0 -// Generic Activity Timer. Lots of controls to make everybody happy. -class ATimer { - double mStart; - //bool mActive; - double mLimitTime; - public: - ATimer() : mStart(0), mLimitTime(0) { } - ATimer(double wLimitTime) : mStart(0), mLimitTime(wLimitTime) { } - void start() { mStart=timef(); } - void stop() { mStart=0; } - bool active() { return !!mStart; } - double elapsed() { return timef() - mStart; } - bool expired() { return elapsed() > mLimitTime; } -}; -#endif - - -struct BitSet { - unsigned mBits; - void setBit(unsigned whichbit) { mBits |= 1< struct Statistic { - Type mCurrent, mMin, mMax; // min,max optional initialization so you can print before adding any values. - unsigned mCnt; - double mSum; - //double mSum2; // sum of squares. - // (Type) cast needed in case Type is an enum, stupid language. - Statistic() : mCurrent((Type)0), mMin((Type)0), mMax((Type)0), mCnt(0), mSum(0) /*,mSum2(0)*/ {} - // Set the current value and add a statisical point. - void addPoint(Type val) { - mCurrent = val; - if (mCnt == 0 || val < mMin) {mMin = val;} - if (mCnt == 0 || val > mMax) {mMax = val;} - mCnt++; - mSum += val; - //mSum2 += val * val; - } - Type getCurrent() const { // Return current value. - return mCnt ? mCurrent : 0; - } - double getAvg() const { // Return average. - return mCnt==0 ? 0 : mSum/mCnt; - }; - //float getSD() const { // Return standard deviation. Use low precision square root function. - // return mCnt==0 ? 0 : sqrtf(mCnt * mSum2 - mSum*mSum) / mCnt; - //} - - void text(std::ostream &os) const { // Print everything in parens. - os << "("< &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); - - -// Yes, they botched and left this out: -std::ostream& operator<<(std::ostream& os, std::ostringstream& ss); - -std::ostream &osprintf(std::ostream &os, const char *fmt, ...) __attribute__((format (printf,2,3))); - -std::string replaceAll(const std::string input, const std::string search, const std::string replace); - -}; // namespace - -using namespace Utils; - -#endif -- To view, visit https://gerrit.osmocom.org/2125 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:23:46 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:23:46 +0000 Subject: [PATCH] openggsn[master]: track README.md rename in spec file and debian/docs Message-ID: Review at https://gerrit.osmocom.org/2129 track README.md rename in spec file and debian/docs When README was renamed to README.md, the debian and rpm packaging information was not updated. Change-Id: I3fb3016defb74cf4e9c0a363f70eff9d6f71a5f5 --- M debian/docs M openggsn.spec.in 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/29/2129/1 diff --git a/debian/docs b/debian/docs index 50bd824..8913f46 100644 --- a/debian/docs +++ b/debian/docs @@ -1,2 +1,2 @@ NEWS -README +README.md diff --git a/openggsn.spec.in b/openggsn.spec.in index 3ee319e..f15866e 100644 --- a/openggsn.spec.in +++ b/openggsn.spec.in @@ -63,7 +63,7 @@ %dir /var/lib/ggsn /var/lib/ggsn/gsn_restart -%doc AUTHORS COPYING INSTALL NEWS README +%doc AUTHORS COPYING INSTALL NEWS README.md %doc examples/ggsn.conf %doc examples/sgsnemu.conf %doc examples/ggsn.init -- To view, visit https://gerrit.osmocom.org/2129 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3fb3016defb74cf4e9c0a363f70eff9d6f71a5f5 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:25:15 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:25:15 +0000 Subject: openggsn[master]: track README.md rename in spec file and debian/docs In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2129 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3fb3016defb74cf4e9c0a363f70eff9d6f71a5f5 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:25:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:25:16 +0000 Subject: [MERGED] openggsn[master]: track README.md rename in spec file and debian/docs In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: track README.md rename in spec file and debian/docs ...................................................................... track README.md rename in spec file and debian/docs When README was renamed to README.md, the debian and rpm packaging information was not updated. Change-Id: I3fb3016defb74cf4e9c0a363f70eff9d6f71a5f5 --- M debian/docs M openggsn.spec.in 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/docs b/debian/docs index 50bd824..8913f46 100644 --- a/debian/docs +++ b/debian/docs @@ -1,2 +1,2 @@ NEWS -README +README.md diff --git a/openggsn.spec.in b/openggsn.spec.in index 3ee319e..f15866e 100644 --- a/openggsn.spec.in +++ b/openggsn.spec.in @@ -63,7 +63,7 @@ %dir /var/lib/ggsn /var/lib/ggsn/gsn_restart -%doc AUTHORS COPYING INSTALL NEWS README +%doc AUTHORS COPYING INSTALL NEWS README.md %doc examples/ggsn.conf %doc examples/sgsnemu.conf %doc examples/ggsn.init -- To view, visit https://gerrit.osmocom.org/2129 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3fb3016defb74cf4e9c0a363f70eff9d6f71a5f5 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:25:39 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:25:39 +0000 Subject: osmo-trx[master]: radioBuffer: Remove extra ; at the end of inline function de... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2127 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8911adf0a0bb1ae828ac9cdf1a76c904639f6c06 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:25:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:25:48 +0000 Subject: osmo-trx[master]: CommonLibs: Remove unused files. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2125 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:25:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:25:59 +0000 Subject: osmo-trx[master]: sigProcLib: Typo sybols -> symbols In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2126 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:26:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:26:14 +0000 Subject: osmo-trx[master]: sigProcLib: Fix documentation, sync argument names in .cpp a... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2128 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 13:45:52 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 13:45:52 +0000 Subject: [MERGED] osmo-gsm-manuals[master]: osmo-sgsn: Update VTY command reference In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-sgsn: Update VTY command reference ...................................................................... osmo-sgsn: Update VTY command reference Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 --- M OsmoSGSN/vty/sgsn_vty_additions.xml M OsmoSGSN/vty/sgsn_vty_reference.xml 2 files changed, 665 insertions(+), 17 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/OsmoSGSN/vty/sgsn_vty_additions.xml b/OsmoSGSN/vty/sgsn_vty_additions.xml index c9de19a..dd26dba 100644 --- a/OsmoSGSN/vty/sgsn_vty_additions.xml +++ b/OsmoSGSN/vty/sgsn_vty_additions.xml @@ -1,5 +1,5 @@ - + SGSN Configuration Node Configure the remote GGSN, access-control and other diff --git a/OsmoSGSN/vty/sgsn_vty_reference.xml b/OsmoSGSN/vty/sgsn_vty_reference.xml index 15a4237..5ec0121 100644 --- a/OsmoSGSN/vty/sgsn_vty_reference.xml +++ b/OsmoSGSN/vty/sgsn_vty_reference.xml @@ -102,6 +102,24 @@
+ + + + + + + + + + + + + + + + + + @@ -118,7 +136,7 @@ - + @@ -132,6 +150,10 @@ + + + + @@ -139,10 +161,13 @@ - + + + + - + @@ -158,6 +183,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -188,6 +236,13 @@ + + + + + + + @@ -254,6 +309,17 @@ + + + + + + + + + + + @@ -433,6 +499,24 @@ + + + + + + + + + + + + + + + + + + @@ -449,7 +533,7 @@ - + @@ -463,6 +547,10 @@ + + + + @@ -470,10 +558,13 @@ - + + + + - + @@ -489,6 +580,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -519,6 +633,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -596,6 +781,17 @@ + + + + + + + + + + + @@ -845,9 +1041,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -936,7 +1181,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -950,6 +1213,10 @@ + + + + @@ -957,10 +1224,13 @@ - + + + + - + @@ -1037,6 +1307,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1048,8 +1435,14 @@ + + + + + + - + @@ -1211,7 +1604,7 @@ - + @@ -1262,7 +1655,15 @@ - + + + + + + + + + @@ -1344,12 +1745,259 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + -- To view, visit https://gerrit.osmocom.org/2015 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6585144addd8501226572eda6f55db19d0e31c54 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Sat Mar 18 14:04:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 14:04:34 +0000 Subject: [MERGED] osmo-gsm-manuals[master]: osmo-sgsn: improve auth-policy explaination In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-sgsn: improve auth-policy explaination ...................................................................... osmo-sgsn: improve auth-policy explaination The explaination of the access policy is a bit unclear. Users that come from osmo-nitb might have trouble to grasp the functionality of the access control list based approack correctly. Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 38 insertions(+), 14 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index a933d1b..9551267 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -70,24 +70,35 @@ [[auth-pol]] === Authorization Policy -Authorization determines whether a particular subscriber can access -your network or not. +The authorization policy controls by which rules a subscriber is accepted or +rejected. The possible options range from accepting just all subscribers without +further checking, to a fine grained access-control, handled by an external HLR. -The following 4 authorization policy options are available: +accept-all:: All subscribers that attempt to attach to the GPRS network are +accepted without further checking. This option is intended to be used for +testing in a controlled environment only. A wide-open network may attract +subscribers from foreign networks and disrupt their service. It is highly +recommended to pick one of the options below. -`accept-all`: All IMSIs will be accepted. +remote:: This option allows to connect OsmoSGSN to an external HLR via the +GSUP protocol. This will be the preferred option in larger networks. -`acl-only`: Accept only IMSIs, which are explicitly white-listed -by the Access Control List (ACL), and the rest will be rejected. +acl-only:: If no external HLR is available, the network operator has the +option to control the access using an access control list. The access control +list contains the IMSI numbers of the allowed subscribers. This method offers +fine grained access control and is ideal for small networks and lab test +environments. -`closed`: Accept only home network subscribers. -The combination of MCC and MNC fully identifies a subscriber's -home network, also known as a Home Network Identity (HNI, i.e. -MCC and MNC found at the start of the IMSI, e.g. MCC 901 and -MNC 700 with IMSI 901700000003080). The ACL is also heeded. +closed:: This policy mode softens the strict *acl-only* only mode by also +implicitly accepting home network subscribers. The decision is made by the MCC +and MNC part of the IMSI number. The combination of MCC and MNC fully identifies +a subscribers home network, also known as a Home Network Identity (HNI, i.e. +MCC and MNC found at the start of the IMSI, e.g. MCC 901 and MNC 700 with +IMSI 901700000003080). -`remote`: GSUP protocol is used to remotely access a HLR. -Only remote subscription data will be used. +NOTE: The policy mode *closed* must not be confused with the equally named +policy that is defined for osmo-nitb! + .Example: Assign or change authorization policy: ---- @@ -105,6 +116,18 @@ <2> Saves current changes to cofiguration to make this policy persistent +.Example: Access control list: +---- +sgsn + auth-policy acl-only <1> + imsi-acl add 001010000000003 + imsi-acl add 001010000000002 + imsi-acl add 001010000000001 + imsi-acl add 901700000000068 <2> +---- +<1> Set the authorization policy +<2> Add as many subscribers as required + === Subscriber Configuration As opposed to OsmoNITB, OsmoSGSN does not feature a built-in HLR. @@ -112,7 +135,8 @@ It can thus operate only in the following two modes: . Accessing an external HLR (or HLR gateway) via the GSUP protocol -. Accepting subscribers based on internal ACL (access control list) +. Accepting subscribers based on internal ACL (access control list), + see also <> ==== Accessing an external HLR via GSUP -- To view, visit https://gerrit.osmocom.org/2016 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaae3035c4de3cb082f097441eff99289ee6dfc53 Gerrit-PatchSet: 4 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sat Mar 18 16:54:41 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 16:54:41 +0000 Subject: [MERGED] osmo-gsm-manuals[master]: osmo-sgsn: Explain TCP/IP header compression In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-sgsn: Explain TCP/IP header compression ...................................................................... osmo-sgsn: Explain TCP/IP header compression The does not mention TCP/IP header compression yet. This commit adds some info about it Change-Id: I98408e72020a474d378e39263a933eb7567de146 --- M OsmoSGSN/chapters/configuration.adoc 1 file changed, 80 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/OsmoSGSN/chapters/configuration.adoc b/OsmoSGSN/chapters/configuration.adoc index 9551267..22d28dd 100644 --- a/OsmoSGSN/chapters/configuration.adoc +++ b/OsmoSGSN/chapters/configuration.adoc @@ -223,3 +223,83 @@ |pdp-terminate|Forced PDP context termination during MM context release |pdp-free|Release of the PDP context memory |=== + + +=== User traffic compression + +In order to save optimize GPRS bandwith, OsmoSGSN implements header and data +compression schemes. The compression will reduce the packet length in order +to save radio bandwith. + +==== Header compression + +On TCP/IP connections, each packet is prepended with a fairly long TCP/IP +header. The header contains a lot of static information that never changes +throughout the connection. (source and destination address, port numbers etc.) +OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also +known as SLHC. This type of header compression removes the TCP/IP header +entirely and replaces it with a shorter version, that only contains the +information that is absolutely necessary to identify and check the packet. +The receiving part then restores the original header and forwards it to higher +layers. + +*compression rfc1144 passive*:: +TCP/IP header compression has to be actively requested by the modem. The +network will not promote compression by itself. This is the recommended mode +of operation. + +*compression rfc1144 active slots <1-256>*:: +TCP/IP header compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The number of slots is the maximum number +of packet headers per subscriber that can be stored in the codebook. + +.Example: Accept compression if requested: +---- +sgsn + compression rfc1144 passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression rfc1144 active slots 8 +---- + +NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression +scheme. TCP/IP options may render RFC1144 ineffective if variable data is +encoded into the option section of the TCP/IP packet. (e.g. TCP option 8, +Timestamp) + + +==== Data compression + +Data compression works on the raw packet data, including the header part of the +packet. If enabled, header compression is applied before first data compression +is applied. OsmoSGSN implements the V.42bis data compression scheme. + +*compression rfc1144 passive*:: +V42bis data compression has to be actively requested by the modem. The network +will not promote compression by itself. This is the recommended mode of +operation. + +*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*:: +V42bis data compression is actively promoted by the network. Modems may still +actively request different compression parameters or reject the offered +compression parameters entirely. The direction configures which sides are +allowed to send compressed packets. For most cases, compressing 'both' +directions will be the preferred option. The following to parameters configure +the codebook size by the maxium number ('codewords') and size ('strlen') of +entries. + +.Example: Accept compression if requested: +---- +sgsn + compression v42bis passive +---- + +.Example: Actively promote compression: +---- +sgsn + compression v42bis active direction both codewords 512 strlen 20 +---- -- To view, visit https://gerrit.osmocom.org/2020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I98408e72020a474d378e39263a933eb7567de146 Gerrit-PatchSet: 5 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sat Mar 18 16:58:15 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 16:58:15 +0000 Subject: [PATCH] libsmpp34[master]: README.md: Make sure all hyperlinks use <> Message-ID: Review at https://gerrit.osmocom.org/2130 README.md: Make sure all hyperlinks use <> Change-Id: Iebc3f9b60004b4c17f0a35b90c2b226a8f357a10 --- M README.md 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/30/2130/1 diff --git a/README.md b/README.md index 5c0e8af..2bca502 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ -------- The official homepage of the Osmocom version of the library is -http://osmocom.org/projects/libsmpp34 + while the original upstream project is found at -https://sourceforge.net/projects/c-open-smpp-34/ + GIT Repository -------------- @@ -26,14 +26,14 @@ git clone git://git.osmocom.org/libsmpp34.git -There is a cgit interface at http://git.osmocom.org/libsmpp34/ +There is a cgit interface at Documentation ------------- API documentation is generated during the build process, but also available online from the upstream project at -http://c-open-smpp-34.sourceforge.net/out-1.10/web/c-open-libsmpp34_en/index.html + Mailing List ------------ @@ -51,12 +51,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmocore can be seen at -https://gerrit.osmocom.org/#/q/project:libsmpp34+status:open + -- To view, visit https://gerrit.osmocom.org/2130 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iebc3f9b60004b4c17f0a35b90c2b226a8f357a10 Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sat Mar 18 16:59:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 16:59:16 +0000 Subject: libsmpp34[master]: README.md: Make sure all hyperlinks use <> In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2130 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iebc3f9b60004b4c17f0a35b90c2b226a8f357a10 Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 16:59:18 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 16:59:18 +0000 Subject: [MERGED] libsmpp34[master]: README.md: Make sure all hyperlinks use <> In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README.md: Make sure all hyperlinks use <> ...................................................................... README.md: Make sure all hyperlinks use <> Change-Id: Iebc3f9b60004b4c17f0a35b90c2b226a8f357a10 --- M README.md 1 file changed, 7 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/README.md b/README.md index 5c0e8af..2bca502 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ -------- The official homepage of the Osmocom version of the library is -http://osmocom.org/projects/libsmpp34 + while the original upstream project is found at -https://sourceforge.net/projects/c-open-smpp-34/ + GIT Repository -------------- @@ -26,14 +26,14 @@ git clone git://git.osmocom.org/libsmpp34.git -There is a cgit interface at http://git.osmocom.org/libsmpp34/ +There is a cgit interface at Documentation ------------- API documentation is generated during the build process, but also available online from the upstream project at -http://c-open-smpp-34.sourceforge.net/out-1.10/web/c-open-libsmpp34_en/index.html + Mailing List ------------ @@ -51,12 +51,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmocore can be seen at -https://gerrit.osmocom.org/#/q/project:libsmpp34+status:open + -- To view, visit https://gerrit.osmocom.org/2130 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iebc3f9b60004b4c17f0a35b90c2b226a8f357a10 Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sat Mar 18 16:59:29 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 16:59:29 +0000 Subject: [PATCH] libosmo-abis[master]: README.md: Use <> around all hyperlinks to render them as li... Message-ID: Review at https://gerrit.osmocom.org/2131 README.md: Use <> around all hyperlinks to render them as links in cgit Change-Id: I4b1004d5275972249d463083e0c2af41dc46dad2 --- M README.md 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/31/2131/1 diff --git a/README.md b/README.md index 5278563..c5df874 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ -------- The official homepage of the project is -https://osmocom.org/projects/libosmo-abis + GIT Repository -------------- @@ -31,7 +31,7 @@ git clone git://git.osmocom.org/libosmo-abis.git -There is a cgit interface at http://git.osmocom.org/libosmo-abis/ +There is a cgit interface at Documentation ------------- @@ -44,7 +44,7 @@ Discussions related to libosmo-abis are happening on the openbsc at lists.osmocom.org mailing list, please see -https://lists.osmocom.org/mailman/listinfo/openbsc for subscription + for subscription options and the list archive. Please observe the [Osmocom Mailing List @@ -55,12 +55,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmo-abis can be seen at -https://gerrit.osmocom.org/#/q/project:libosmo-abis+status:open + -- To view, visit https://gerrit.osmocom.org/2131 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b1004d5275972249d463083e0c2af41dc46dad2 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sat Mar 18 17:00:05 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 17:00:05 +0000 Subject: libosmo-abis[master]: README.md: Use <> around all hyperlinks to render them as li... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/2131 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b1004d5275972249d463083e0c2af41dc46dad2 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Mar 18 17:00:07 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 18 Mar 2017 17:00:07 +0000 Subject: [MERGED] libosmo-abis[master]: README.md: Use <> around all hyperlinks to render them as li... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: README.md: Use <> around all hyperlinks to render them as links in cgit ...................................................................... README.md: Use <> around all hyperlinks to render them as links in cgit Change-Id: I4b1004d5275972249d463083e0c2af41dc46dad2 --- M README.md 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/README.md b/README.md index 5278563..c5df874 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ -------- The official homepage of the project is -https://osmocom.org/projects/libosmo-abis + GIT Repository -------------- @@ -31,7 +31,7 @@ git clone git://git.osmocom.org/libosmo-abis.git -There is a cgit interface at http://git.osmocom.org/libosmo-abis/ +There is a cgit interface at Documentation ------------- @@ -44,7 +44,7 @@ Discussions related to libosmo-abis are happening on the openbsc at lists.osmocom.org mailing list, please see -https://lists.osmocom.org/mailman/listinfo/openbsc for subscription + for subscription options and the list archive. Please observe the [Osmocom Mailing List @@ -55,12 +55,12 @@ ------------ Our coding standards are described at -https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards + We us a gerrit based patch submission/review process for managing contributions. Please see -https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for + for more details The current patch queue for libosmo-abis can be seen at -https://gerrit.osmocom.org/#/q/project:libosmo-abis+status:open + -- To view, visit https://gerrit.osmocom.org/2131 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4b1004d5275972249d463083e0c2af41dc46dad2 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From admin at opensuse.org Sat Mar 18 19:53:42 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 19:53:42 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cd90503c1f9_6d45ddc0c381250@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/i586 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 167s] | This file was extended by libosmocore config.status 0.9.6.20170318, which was [ 167s] | generated by GNU Autoconf 2.69. Invocation command line was [ 167s] | [ 167s] | CONFIG_FILES = [ 167s] | CONFIG_HEADERS = [ 167s] | CONFIG_LINKS = [ 167s] | CONFIG_COMMANDS = [ 167s] | $ ./config.status Doxyfile.core [ 167s] | [ 167s] | on wildcard2 [ 167s] | [ 167s] | config.status:1152: creating Doxyfile.core [ 167s] [ 167s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 167s] make[1]: *** [override_dh_auto_test] Error 1 [ 167s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 167s] debian/rules:15: recipe for target 'build' failed [ 167s] make: *** [build] Error 2 [ 167s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 167s] [ 167s] wildcard2 failed "build libosmocore_0.9.6.20170318.dsc" at Sat Mar 18 19:53:38 UTC 2017. [ 167s] [ 167s] ### VM INTERACTION START ### [ 168s] Powering off. [ 168s] [ 150.951910] reboot: Power down [ 169s] ### VM INTERACTION END ### [ 169s] [ 169s] wildcard2 failed "build libosmocore_0.9.6.20170318.dsc" at Sat Mar 18 19:53:41 UTC 2017. [ 169s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 18 19:53:59 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 19:53:59 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cd907882236_6ce5ddc0c4145f5@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 178s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 178s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 178s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 178s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 178s] CK: e740c156278705a14e1a99ba6d31334f [ 178s] RES: 7c04e86a67967fcd [ 178s] SRES: 1b9297a7 [ 178s] Kc: 10687b71e4eb94c5 [ 178s] -SQN: 281474976710655 [ 178s] +SQN: 4294967295 [ 178s] [ 178s] [ 178s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 178s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 178s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 178s] make[1]: *** [override_dh_auto_test] Error 1 [ 178s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 178s] debian/rules:15: recipe for target 'build' failed [ 178s] make: *** [build] Error 2 [ 178s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 178s] [ 178s] lamb54 failed "build libosmocore_0.9.6.20170318.dsc" at Sat Mar 18 19:53:52 UTC 2017. [ 178s] [ 178s] ### VM INTERACTION START ### [ 181s] [ 167.261306] reboot: Power down [ 181s] ### VM INTERACTION END ### [ 181s] [ 181s] lamb54 failed "build libosmocore_0.9.6.20170318.dsc" at Sat Mar 18 19:53:56 UTC 2017. [ 181s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 18 19:54:17 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 19:54:17 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cd907978de0_6ce5ddc0c414630@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 194s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 194s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 194s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 194s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 194s] CK: e740c156278705a14e1a99ba6d31334f [ 194s] RES: 7c04e86a67967fcd [ 194s] SRES: 1b9297a7 [ 194s] Kc: 10687b71e4eb94c5 [ 194s] -SQN: 281474976710655 [ 194s] +SQN: 4294967295 [ 194s] [ 194s] [ 194s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 194s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 194s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 194s] make[1]: *** [override_dh_auto_test] Error 1 [ 194s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 194s] debian/rules:15: recipe for target 'build' failed [ 194s] make: *** [build] Error 2 [ 194s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 194s] [ 194s] lamb62 failed "build libosmocore_0.9.6.20170318.dsc" at Sat Mar 18 19:54:11 UTC 2017. [ 194s] [ 194s] ### VM INTERACTION START ### [ 196s] [ 183.081648] reboot: Power down [ 197s] ### VM INTERACTION END ### [ 197s] [ 197s] lamb62 failed "build libosmocore_0.9.6.20170318.dsc" at Sat Mar 18 19:54:15 UTC 2017. [ 197s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 18 20:00:51 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 20:00:51 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cd92436bf29_6ce5ddc0c4148d6@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.04/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 103s] ^ [ 103s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 103s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 103s] ^ [ 103s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 103s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 103s] ^ [ 103s] Makefile:516: recipe for target 'auc.o' failed [ 103s] make[3]: *** [auc.o] Error 1 [ 103s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 103s] Makefile:405: recipe for target 'all-recursive' failed [ 103s] make[2]: *** [all-recursive] Error 1 [ 103s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 103s] Makefile:352: recipe for target 'all' failed [ 103s] make[1]: *** [all] Error 2 [ 103s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 103s] dh_auto_build: make -j1 returned exit code 2 [ 103s] debian/rules:7: recipe for target 'build' failed [ 103s] make: *** [build] Error 2 [ 103s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 103s] [ 103s] lamb15 failed "build osmo-hlr_0.0.1.20170318.dsc" at Sat Mar 18 20:00:41 UTC 2017. [ 103s] [ 103s] ### VM INTERACTION START ### [ 106s] [ 93.190040] reboot: Power down [ 106s] ### VM INTERACTION END ### [ 106s] [ 106s] lamb15 failed "build osmo-hlr_0.0.1.20170318.dsc" at Sat Mar 18 20:00:45 UTC 2017. [ 106s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 18 20:01:42 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 20:01:42 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cd925054ee3_6ce5ddc0c41491d@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/Debian_8.0/i586 Package network:osmocom:nightly/osmo-hlr failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 99s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 99s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 99s] ^ [ 99s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 99s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 99s] ^ [ 99s] Makefile:504: recipe for target 'auc.o' failed [ 99s] make[3]: *** [auc.o] Error 1 [ 99s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 99s] Makefile:393: recipe for target 'all-recursive' failed [ 99s] make[2]: *** [all-recursive] Error 1 [ 99s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 99s] Makefile:339: recipe for target 'all' failed [ 99s] make[1]: *** [all] Error 2 [ 99s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 99s] dh_auto_build: make -j1 returned exit code 2 [ 99s] debian/rules:7: recipe for target 'build' failed [ 99s] make: *** [build] Error 2 [ 99s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 99s] [ 99s] lamb54 failed "build osmo-hlr_0.0.1.20170318.dsc" at Sat Mar 18 20:01:26 UTC 2017. [ 99s] [ 99s] ### VM INTERACTION START ### [ 100s] Powering off. [ 100s] [ 86.536899] reboot: Power down [ 100s] ### VM INTERACTION END ### [ 100s] [ 100s] lamb54 failed "build osmo-hlr_0.0.1.20170318.dsc" at Sat Mar 18 20:01:28 UTC 2017. [ 100s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 18 20:03:07 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 20:03:07 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cd92897721a_6ce5ddc0c415458@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 131s] ^~~~ [ 131s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 131s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 131s] ^ [ 131s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 131s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 131s] ^~~~ [ 131s] Makefile:516: recipe for target 'auc.o' failed [ 131s] make[3]: *** [auc.o] Error 1 [ 131s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 131s] Makefile:405: recipe for target 'all-recursive' failed [ 131s] make[2]: *** [all-recursive] Error 1 [ 131s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 131s] Makefile:352: recipe for target 'all' failed [ 131s] make[1]: *** [all] Error 2 [ 131s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 131s] dh_auto_build: make -j1 returned exit code 2 [ 131s] debian/rules:7: recipe for target 'build' failed [ 131s] make: *** [build] Error 2 [ 131s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 131s] [ 131s] lamb65 failed "build osmo-hlr_0.0.1.20170318.dsc" at Sat Mar 18 20:02:55 UTC 2017. [ 131s] [ 131s] ### VM INTERACTION START ### [ 135s] [ 121.620531] reboot: Power down [ 135s] ### VM INTERACTION END ### [ 135s] [ 135s] lamb65 failed "build osmo-hlr_0.0.1.20170318.dsc" at Sat Mar 18 20:02:58 UTC 2017. [ 135s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sat Mar 18 20:05:41 2017 From: admin at opensuse.org (OBS Notification) Date: Sat, 18 Mar 2017 20:05:41 +0000 Subject: Build failure of network:osmocom:nightly/openbsc in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cd93401da29_6d45ddc0c382148@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openbsc/xUbuntu_16.10/i586 Package network:osmocom:nightly/openbsc failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly openbsc Last lines of build log: [ 100s] [ 100s] Makefile:719: recipe for target 'check-local' failed [ 100s] make[5]: *** [check-local] Error 1 [ 100s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 100s] Makefile:570: recipe for target 'check-am' failed [ 100s] make[4]: *** [check-am] Error 2 [ 100s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 100s] Makefile:422: recipe for target 'check-recursive' failed [ 100s] make[3]: *** [check-recursive] Error 1 [ 100s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 100s] Makefile:486: recipe for target 'check-recursive' failed [ 100s] make[2]: *** [check-recursive] Error 1 [ 100s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 100s] Makefile:777: recipe for target 'check' failed [ 100s] make[1]: *** [check] Error 2 [ 100s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 100s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 100s] debian/rules:13: recipe for target 'build' failed [ 100s] make: *** [build] Error 2 [ 100s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 100s] [ 100s] build72 failed "build openbsc_0.15.1.20170318.dsc" at Sat Mar 18 20:05:31 UTC 2017. [ 100s] [ 100s] ### VM INTERACTION START ### [ 103s] [ 93.285477] reboot: Power down [ 103s] ### VM INTERACTION END ### [ 103s] [ 103s] build72 failed "build openbsc_0.15.1.20170318.dsc" at Sat Mar 18 20:05:34 UTC 2017. [ 103s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Sun Mar 19 18:13:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 19 Mar 2017 18:13:48 +0000 Subject: [PATCH] libosmo-netif[master]: steam client: Ensure client is notified on reconnection Message-ID: Review at https://gerrit.osmocom.org/2132 steam client: Ensure client is notified on reconnection without setting the BSC_FD_* flags prior to reconnection, the re-connect would happen silently and the client program not be notified via the connect_cb(). Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 --- M src/stream.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/32/2132/1 diff --git a/src/stream.c b/src/stream.c index f5408f8..287e297 100644 --- a/src/stream.c +++ b/src/stream.c @@ -340,6 +340,7 @@ switch(cli->state) { case STREAM_CLI_STATE_CONNECTING: + cli->ofd.when |= BSC_FD_READ | BSC_FD_WRITE; osmo_stream_cli_open2(cli, 1); break; default: -- To view, visit https://gerrit.osmocom.org/2132 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From admin at opensuse.org Sun Mar 19 19:52:40 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 19:52:40 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cee1aa58d6e_6d45ddc0c43755@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.10/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 179s] RAND: 6a61050765caa32c90371370e5d6dc2d [ 179s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 179s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 179s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 179s] CK: e740c156278705a14e1a99ba6d31334f [ 179s] RES: 7c04e86a67967fcd [ 179s] SRES: 1b9297a7 [ 179s] Kc: 10687b71e4eb94c5 [ 179s] -SQN: 281474976710655 [ 179s] +SQN: 4294967295 [ 179s] [ 179s] [ 179s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 180s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 180s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 180s] make[1]: *** [override_dh_auto_test] Error 1 [ 180s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 180s] debian/rules:15: recipe for target 'build' failed [ 180s] make: *** [build] Error 2 [ 180s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 180s] [ 180s] lamb66 failed "build libosmocore_0.9.6.20170319.dsc" at Sun Mar 19 19:52:25 UTC 2017. [ 180s] [ 180s] ### VM INTERACTION START ### [ 182s] [ 168.349521] reboot: Power down [ 182s] ### VM INTERACTION END ### [ 182s] [ 182s] lamb66 failed "build libosmocore_0.9.6.20170319.dsc" at Sun Mar 19 19:52:29 UTC 2017. [ 182s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 19 19:53:31 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 19:53:31 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cee1c6e49d6_6d45ddc0c437622@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/xUbuntu_16.04/i586 Package network:osmocom:nightly/libosmocore failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 224s] | This file was extended by libosmocore config.status 0.9.6.20170319, which was [ 224s] | generated by GNU Autoconf 2.69. Invocation command line was [ 224s] | [ 224s] | CONFIG_FILES = [ 224s] | CONFIG_HEADERS = [ 224s] | CONFIG_LINKS = [ 224s] | CONFI[ 201.661895] serial8250: too much work for irq4 [ 224s] G_COMMANDS = [ 224s] | $ ./config.status Doxyfile.core [ 224s] | [ 224s] | on cloud130 [ 224s] | [ 224s] | config.status:1156: creating Doxyfile.core [ 224s] [ 224s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 224s] make[1]: *** [override_dh_auto_test] Error 1 [ 224s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 224s] debian/rules:15: recipe for target 'build' failed [ 224s] make: *** [build] Error 2 [ 224s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 224s] [ 224s] cloud130 failed "build libosmocore_0.9.6.20170319.dsc" at Sun Mar 19 19:53:21 UTC 2017. [ 224s] [ 224s] ### VM INTERACTION START ### [ 227s] [ 204.875134] reboot: Power down [ 229s] ### VM INTERACTION END ### [ 229s] [ 229s] cloud130 failed "build libosmocore_0.9.6.20170319.dsc" at Sun Mar 19 19:53:26 UTC 2017. [ 229s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 19 19:53:31 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 19:53:31 +0000 Subject: Build failure of network:osmocom:nightly/libosmocore in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cee1c753532_6d45ddc0c43777c@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmocore/Debian_8.0/i586 Package network:osmocom:nightly/libosmocore failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly libosmocore Last lines of build log: [ 224s] -AUTN: afb993e4f4b8000069cdeebb4a4b5b58 [ 224s] +AUTN: 504693e4f4b80000e3963072c50f0b91 [ 224s] IK: c348c2fe2f3e1fb37a7ae1638163bd98 [ 224s] CK: e740c156278705a14e1a99ba6d31334f [ 224s] RES: 7c04e86a67967fcd [ 224s] SRES: 1b9297a7 [ 224s] Kc: 10687b71e4eb94c5 [ 224s] -SQN: 281474976710655 [ 224s] +SQN: 4294967295 [ 224s] [ 224s] [ 224s] > osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c [ 224s] 40. testsuite.at:253: 40. osmo-auc-gen (testsuite.at:253): FAILED (testsuite.at:257) [ 224s] debian/rules:26: recipe for target 'override_dh_auto_test' failed [ 224s] make[1]: *** [override_dh_auto_test] Error 1 [ 224s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 224s] debian/rules:15: recipe for target 'build' failed [ 224s] make: *** [build] Error 2 [ 224s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 224s] [ 224s] cloud119 failed "build libosmocore_0.9.6.20170319.dsc" at Sun Mar 19 19:53:25 UTC 2017. [ 224s] [ 224s] ### VM INTERACTION START ### [ 225s] Powering off. [ 226s] [ 202.607849] reboot: Power down [ 227s] ### VM INTERACTION END ### [ 227s] [ 227s] cloud119 failed "build libosmocore_0.9.6.20170319.dsc" at Sun Mar 19 19:53:29 UTC 2017. [ 227s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 19 19:58:06 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 19:58:06 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cee2f82c278_6ce5ddc0c456179@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.10/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 79s] ^~~~ [ 79s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 79s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 79s] ^ [ 79s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 79s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 79s] ^~~~ [ 79s] Makefile:516: recipe for target 'auc.o' failed [ 79s] make[3]: *** [auc.o] Error 1 [ 79s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 79s] Makefile:405: recipe for target 'all-recursive' failed [ 79s] make[2]: *** [all-recursive] Error 1 [ 79s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 79s] Makefile:352: recipe for target 'all' failed [ 79s] make[1]: *** [all] Error 2 [ 79s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 79s] dh_auto_build: make -j1 returned exit code 2 [ 79s] debian/rules:7: recipe for target 'build' failed [ 79s] make: *** [build] Error 2 [ 79s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 79s] [ 79s] lamb58 failed "build osmo-hlr_0.0.1.20170319.dsc" at Sun Mar 19 19:58:00 UTC 2017. [ 79s] [ 79s] ### VM INTERACTION START ### [ 83s] [ 69.965856] reboot: Power down [ 83s] ### VM INTERACTION END ### [ 83s] [ 83s] lamb58 failed "build osmo-hlr_0.0.1.20170319.dsc" at Sun Mar 19 19:58:04 UTC 2017. [ 83s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 19 19:59:48 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 19:59:48 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in Debian_8.0/i586 In-Reply-To: References: Message-ID: <58cee34cb98a9_6d45ddc0c4378f4@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/Debian_8.0/i586 Package network:osmocom:nightly/osmo-hlr failed to build in Debian_8.0/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 96s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 96s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 96s] ^ [ 96s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 96s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 96s] ^ [ 96s] Makefile:504: recipe for target 'auc.o' failed [ 96s] make[3]: *** [auc.o] Error 1 [ 96s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 96s] Makefile:393: recipe for target 'all-recursive' failed [ 96s] make[2]: *** [all-recursive] Error 1 [ 96s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 96s] Makefile:339: recipe for target 'all' failed [ 96s] make[1]: *** [all] Error 2 [ 96s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 96s] dh_auto_build: make -j1 returned exit code 2 [ 96s] debian/rules:7: recipe for target 'build' failed [ 96s] make: *** [build] Error 2 [ 96s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 96s] [ 96s] lamb14 failed "build osmo-hlr_0.0.1.20170319.dsc" at Sun Mar 19 19:59:46 UTC 2017. [ 96s] [ 96s] ### VM INTERACTION START ### [ 97s] Powering off. [ 98s] [ 83.574316] reboot: Power down [ 98s] ### VM INTERACTION END ### [ 98s] [ 98s] lamb14 failed "build osmo-hlr_0.0.1.20170319.dsc" at Sun Mar 19 19:59:48 UTC 2017. [ 98s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 19 20:00:40 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 20:00:40 +0000 Subject: Build failure of network:osmocom:nightly/osmo-hlr in xUbuntu_16.04/i586 In-Reply-To: References: Message-ID: <58cee38ca82c6_6ce5ddc0c4562b@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-hlr/xUbuntu_16.04/i586 Package network:osmocom:nightly/osmo-hlr failed to build in xUbuntu_16.04/i586 Check out the package for editing: osc checkout network:osmocom:nightly osmo-hlr Last lines of build log: [ 114s] ^ [ 114s] auc.c:101:21: error: 'struct ' has no member named 'ind' [ 114s] aud3g->u.umts.ind, aud3g->u.umts.sqn); [ 114s] ^ [ 114s] auc.c:100:3: note: in expansion of macro 'DBGP' [ 114s] DBGP("3G: for sqn ind %u, previous sqn was %" PRIu64 "\n", [ 114s] ^ [ 114s] Makefile:516: recipe for target 'auc.o' failed [ 114s] make[3]: *** [auc.o] Error 1 [ 114s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 114s] Makefile:405: recipe for target 'all-recursive' failed [ 114s] make[2]: *** [all-recursive] Error 1 [ 114s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 114s] Makefile:352: recipe for target 'all' failed [ 114s] make[1]: *** [all] Error 2 [ 114s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 114s] dh_auto_build: make -j1 returned exit code 2 [ 114s] debian/rules:7: recipe for target 'build' failed [ 114s] make: *** [build] Error 2 [ 114s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 114s] [ 114s] build31 failed "build osmo-hlr_0.0.1.20170319.dsc" at Sun Mar 19 20:00:26 UTC 2017. [ 114s] [ 114s] ### VM INTERACTION START ### [ 117s] [ 101.631327] reboot: Power down [ 118s] ### VM INTERACTION END ### [ 118s] [ 118s] build31 failed "build osmo-hlr_0.0.1.20170319.dsc" at Sun Mar 19 20:00:30 UTC 2017. [ 118s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From admin at opensuse.org Sun Mar 19 20:02:05 2017 From: admin at opensuse.org (OBS Notification) Date: Sun, 19 Mar 2017 20:02:05 +0000 Subject: Build failure of network:osmocom:nightly/openbsc in xUbuntu_16.10/i586 In-Reply-To: References: Message-ID: <58cee3e46330f_6d45ddc0c437913@build.opensuse.org> Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/openbsc/xUbuntu_16.10/i586 Package network:osmocom:nightly/openbsc failed to build in xUbuntu_16.10/i586 Check out the package for editing: osc checkout network:osmocom:nightly openbsc Last lines of build log: [ 158s] [ 158s] Makefile:719: recipe for target 'check-local' failed [ 158s] make[5]: *** [check-local] Error 1 [ 158s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 158s] Makefile:570: recipe for target 'check-am' failed [ 158s] make[4]: *** [check-am] Error 2 [ 158s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 158s] Makefile:422: recipe for target 'check-recursive' failed [ 158s] make[3]: *** [check-recursive] Error 1 [ 158s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 158s] Makefile:486: recipe for target 'check-recursive' failed [ 158s] make[2]: *** [check-recursive] Error 1 [ 158s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 158s] Makefile:777: recipe for target 'check' failed [ 158s] make[1]: *** [check] Error 2 [ 158s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 158s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 158s] debian/rules:13: recipe for target 'build' failed [ 158s] make: *** [build] Error 2 [ 158s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 158s] [ 158s] lamb58 failed "build openbsc_0.15.1.20170319.dsc" at Sun Mar 19 20:01:47 UTC 2017. [ 158s] [ 158s] ### VM INTERACTION START ### [ 161s] [ 146.839547] reboot: Power down [ 161s] ### VM INTERACTION END ### [ 161s] [ 161s] lamb58 failed "build openbsc_0.15.1.20170319.dsc" at Sun Mar 19 20:01:51 UTC 2017. [ 161s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/) From gerrit-no-reply at lists.osmocom.org Mon Mar 20 00:20:14 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 00:20:14 +0000 Subject: libosmocore[master]: build: fix distcheck: include gen scripts in EXTRA_DIST In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2004 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 01:31:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 01:31:40 +0000 Subject: libosmo-netif[master]: steam client: Ensure client is notified on reconnection In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2132/1//COMMIT_MSG Commit Message: Line 7: steam client: Ensure client is notified on reconnection steam?? :D -- To view, visit https://gerrit.osmocom.org/2132 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 20 01:32:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 01:32:11 +0000 Subject: [PATCH] libosmo-netif[master]: stream client: Ensure client is notified on reconnection In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2132 to look at the new patch set (#2). stream client: Ensure client is notified on reconnection without setting the BSC_FD_* flags prior to reconnection, the re-connect would happen silently and the client program would not be notified via the connect_cb(). Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 --- M src/stream.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/32/2132/2 diff --git a/src/stream.c b/src/stream.c index f5408f8..287e297 100644 --- a/src/stream.c +++ b/src/stream.c @@ -340,6 +340,7 @@ switch(cli->state) { case STREAM_CLI_STATE_CONNECTING: + cli->ofd.when |= BSC_FD_READ | BSC_FD_WRITE; osmo_stream_cli_open2(cli, 1); break; default: -- To view, visit https://gerrit.osmocom.org/2132 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 01:32:23 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 01:32:23 +0000 Subject: libosmo-netif[master]: stream client: Ensure client is notified on reconnection In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2132 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 01:42:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 01:42:40 +0000 Subject: osmo-gsm-manuals[master]: osmo-nitb: Update VTY command reference In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (3 comments) How does this work? Do we need to define non-existing node-ids here with child-of an existing node? Either way something seems to be a bit odd, please confirm that node ids are correct. in general ... can't we fix this with some automatic way to match up instead? this is a reviewer's nightmare. https://gerrit.osmocom.org/#/c/2014/2/OsmoNITB/vty/nitb_vty_additions.xml File OsmoNITB/vty/nitb_vty_additions.xml: Line 2: wait a minute, according to the other diff, 29 became 34, not 32. Line 8: id=35 seems to not exist. https://gerrit.osmocom.org/#/c/2014/2/OsmoNITB/vty/nitb_vty_reference.xml File OsmoNITB/vty/nitb_vty_reference.xml: Line 3965: here. -- To view, visit https://gerrit.osmocom.org/2014 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4c2d71eeca853ef277e802e9e8e200eb3414bca Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 20 05:50:58 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 20 Mar 2017 05:50:58 +0000 Subject: libosmocore[master]: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2089 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 05:51:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 20 Mar 2017 05:51:11 +0000 Subject: [MERGED] libosmocore[master]: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build ...................................................................... osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build osmo-auc-gen on 32bit systems allowed only --sqn up to 32bits width. However, the recently added regression test for osmo-auc-gen includes an ivocation with a 48bit wide --sqn, which now causes the builds to fail on 32bit systems. Fix the --sqn argument parsing for larger integers by using strtoull(). Do away with the intermediate variable 'ul' and place the value directly in the auth data struct. Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77 --- M utils/osmo-auc-gen.c 1 file changed, 1 insertion(+), 3 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index 4e2456a..6b1e623 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -106,7 +106,6 @@ while (1) { int c; - unsigned long ul; static struct option long_options[] = { { "2g", 0, 0, '2' }, { "3g", 0, 0, '3' }, @@ -196,8 +195,7 @@ fprintf(stderr, "Only UMTS has SQN\n"); exit(2); } - ul = strtoul(optarg, 0, 10); - test_aud.u.umts.sqn = ul; + test_aud.u.umts.sqn = strtoull(optarg, 0, 10); /* Before calculating the UMTS auth vector, * osmo_auth_gen_vec() increments the SQN. SQN-1 here * to end up with the SQN the user requested. */ -- To view, visit https://gerrit.osmocom.org/2089 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 20 09:12:55 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 09:12:55 +0000 Subject: osmo-trx[master]: CommonLibs: Remove unused files. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2125 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 11:20:06 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 11:20:06 +0000 Subject: [PATCH] openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1875 to look at the new patch set (#7). Add simple CTRL2SOAP proxy Add python client which converts TRAP messages into SOAP requests and perform corresponding actions. It can be used as follows ./soap.py -d -w http://example.com/soapservice/htdocs/wsdl/test.wsdl See ./soap.py -h for additional options. Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Related: SYS#3028 --- A openbsc/contrib/soap.py 1 file changed, 189 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/75/1875/7 diff --git a/openbsc/contrib/soap.py b/openbsc/contrib/soap.py new file mode 100755 index 0000000..861c134 --- /dev/null +++ b/openbsc/contrib/soap.py @@ -0,0 +1,189 @@ +#!/usr/bin/python3 +# -*- mode: python-mode; py-indent-tabs-mode: nil -*- +""" +/* + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +""" + +__version__ = "v0.6" # bump this on every non-trivial change + +from twisted.internet import defer, reactor +from twisted_ipa import CTRL, IPAFactory +from ipa import Ctrl +from treq import post, collect +from suds.client import Client +from functools import partial +import argparse, datetime, signal, sys, os, logging, logging.handlers + + +# keys from OpenBSC openbsc/src/libbsc/bsc_rf_ctrl.c, values SOAP-specific +oper = { 'inoperational' : 0, 'operational' : 1 } +admin = { 'locked' : 0, 'unlocked' : 1 } +policy = { 'off' : 0, 'on' : 1, 'grace' : 2, 'unknown' : 3 } + +# keys from OpenBSC openbsc/src/libbsc/bsc_vty.c +fix = { 'invalid' : 0, 'fix2d' : 1, 'fix3d' : 1 } # SOAP server treats it as boolean but expects int + + +def handle_reply(p, f, log, r): + """ + Reply handler: takes function p to process raw SOAP server reply r, function f to run for each command and verbosity flag v + """ + repl = p(r) # result is expected to have both commands[] array and error string (could be None) + bsc_id = repl.commands[0].split()[0].split('.')[3] # we expect 1st command to have net.0.bsc.666.bts.2.trx.1 location prefix format + log.info("Received SOAP response for BSC %s with %d commands, error status: %s" % (bsc_id, len(repl.commands), repl.error)) + log.debug("BSC %s commands: %s" % (bsc_id, repl.commands)) + for t in repl.commands: # Process OpenBscCommands format from .wsdl + (_, m) = Ctrl().cmd(*t.split()) + f(m) + + +class Trap(CTRL): + """ + TRAP handler (agnostic to factory's client object) + """ + def ctrl_TRAP(self, data, op_id, v): + """ + Parse CTRL TRAP and dispatch to appropriate handler after normalization + """ + (l, r) = v.split() + loc = l.split('.') + t_type = loc[-1] + p = partial(lambda a, i: a[i] if len(a) > i else None, loc) # parse helper + method = getattr(self, 'handle_' + t_type.replace('-', ''), lambda: "Unhandled %s trap" % t_type) + method(p(1), p(3), p(5), p(7), r) # we expect net.0.bsc.666.bts.2.trx.1 format for trap prefix + + def ctrl_SET_REPLY(self, data, _, v): + """ + Debug log for replies to our commands + """ + self.factory.log.debug('SET REPLY %s' % v) + + def ctrl_ERROR(self, data, op_id, v): + """ + We want to know if smth went wrong + """ + self.factory.log.debug('CTRL ERROR [%s] %s' % (op_id, v)) + + def dbg(*_): + """ + Override debug print from lower layers as it's too verbose + """ + pass + + def connectionMade(self): + """ + Logging wrapper, calling super() is necessary not to break reconnection logic + """ + self.factory.log.info("Connected to CTRL@%s:%d" % (self.factory.host, self.factory.port)) + super(CTRL, self).connectionMade() + + @defer.inlineCallbacks + def handle_locationstate(self, net, bsc, bts, trx, data): + """ + Handle location-state TRAP: parse trap content, build SOAP context and use treq's routines to post it while setting up async handlers + """ + (ts, fx, lat, lon, height, opr, adm, pol, mcc, mnc) = data.split(',') + tstamp = datetime.datetime.fromtimestamp(float(ts)).isoformat() + self.factory.log.debug('location-state@%s.%s.%s.%s (%s) [%s/%s] => %s' % (net, bsc, bts, trx, tstamp, mcc, mnc, data)) + ctx = self.factory.client.registerSiteLocation(bsc, float(lon), float(lat), fix.get(fx, 0), tstamp, oper.get(opr, 2), admin.get(adm, 2), policy.get(pol, 3)) + d = post(self.factory.location, ctx.envelope) + d.addCallback(collect, partial(handle_reply, ctx.process_reply, self.transport.write, self.factory.log)) # treq's collect helper is handy to get all reply content at once using closure on ctx + d.addErrback(lambda e, bsc: self.factory.log.critical("HTTP POST error %s while trying to register BSC %s" % (e, bsc)), bsc) # handle HTTP errors + # Ensure that we run only limited number of requests in parallel: + yield self.factory.semaphore.acquire() + yield d # we end up here only if semaphore is available which means it's ok to fire the request without exceeding the limit + self.factory.semaphore.release() + + def handle_notificationrejectionv1(self, net, bsc, bts, trx, data): + """ + Handle notification-rejection-v1 TRAP: just an example to show how more message types can be handled + """ + self.factory.log.debug('notification-rejection-v1 at bsc-id %s => %s' % (bsc, data)) + + +class TrapFactory(IPAFactory): + """ + Store SOAP client object so TRAP handler can use it for requests + """ + location = None + log = None + semaphore = None + client = None + host = None + port = None + def __init__(self, host, port, proto, semaphore, log, wsdl=None, location=None): + self.host = host # for logging only, + self.port = port # seems to be no way to get it from ReconnectingClientFactory + self.log = log + self.semaphore = semaphore + soap = Client(wsdl, location=location, nosend=True) # make async SOAP client + self.location = location.encode() if location else soap.wsdl.services[0].ports[0].location # necessary for dispatching HTTP POST via treq + self.client = soap.service + self.log.debug("Using IPA %s, SUDS client: %s" % (Ctrl.version, soap)) + #super(TrapFactory, self).__init__(proto, True if log.getEffectiveLevel() == logging.DEBUG else False) # FIXME: will print to stdout if True + super(TrapFactory, self).__init__(proto, False) + + +def reloader(path, script, log, dbg1, dbg2, signum, _): + """ + Signal handler: we have to use execl() because twisted's reactor is not restartable due to some bug in twisted implementation + """ + log.info("Received Signal %s - restarting..." % signal.Signals(signum).name) + if signum == signal.SIGUSR1 and dbg1 not in sys.argv and dbg2 not in sys.argv: + sys.argv.append(dbg1) # enforce debug + if signum == signal.SIGUSR2 and (dbg1 in sys.argv or dbg2 in sys.argv): # disable debug + if dbg1 in sys.argv: + sys.argv.remove(dbg1) + if dbg2 in sys.argv: + sys.argv.remove(dbg2) + os.execl(path, script, *sys.argv[1:]) + + +if __name__ == '__main__': + p = argparse.ArgumentParser(description='Proxy between given SOAP service and Osmocom CTRL protocol.') + p.add_argument('-v', '--version', action='version', version=("%(prog)s " + __version__)) + p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface, defaults to 4250") + p.add_argument('-c', '--ctrl', default='localhost', help="Adress to use for CTRL interface, defaults to localhost") + p.add_argument('-w', '--wsdl', required=True, help="WSDL URL for SOAP") + p.add_argument('-n', '--num', type=int, default=5, help="Max number of concurrent HTTP requests to SOAP server") + p.add_argument('-d', '--debug', action='store_true', help="Enable debug log") + p.add_argument('-o', '--output', action='store_true', help="Log to STDOUT in addition to SYSLOG") + p.add_argument('-l', '--location', help="Override location found in WSDL file (don't use unless you know what you're doing)") + args = p.parse_args() + + log = logging.getLogger('CTRL2SOAP') + if args.debug: + log.setLevel(logging.DEBUG) + else: + log.setLevel(logging.INFO) + log.addHandler(logging.handlers.SysLogHandler('/dev/log')) + if args.output: + log.addHandler(logging.StreamHandler(sys.stdout)) + + reboot = partial(reloader, os.path.abspath(__file__), os.path.basename(__file__), log, '-d', '--debug') # keep in sync with add_argument() call above + signal.signal(signal.SIGHUP, reboot) + signal.signal(signal.SIGQUIT, reboot) + signal.signal(signal.SIGUSR1, reboot) # restart and enabled debug output + signal.signal(signal.SIGUSR2, reboot) # restart and disable debug output + + log.info("SOAP proxy %s starting with PID %d ..." % (__version__, os.getpid())) + reactor.connectTCP(args.ctrl, args.port, TrapFactory(args.ctrl, args.port, Trap, defer.DeferredSemaphore(args.num), log, args.wsdl, args.location)) + reactor.run() -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 7 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 20 11:47:47 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 20 Mar 2017 11:47:47 +0000 Subject: [MERGED] osmo-bts[master]: l1sap: fix PTCCH detection In-Reply-To: References: Message-ID: dexter has submitted this change and it was merged. Change subject: l1sap: fix PTCCH detection ...................................................................... l1sap: fix PTCCH detection The macro L1SAP_IS_PTCCH(fn) only detects a PTCCH channel at fn%52 = 12, the detection logic has been extended in order to detect PTCCH at fn%52 = 38. See also 3GPP TS 05.02, Clause 7, Table 6 of 9 Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 --- M include/osmo-bts/l1sap.h 1 file changed, 4 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index 0e56406..6373ba8 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -32,7 +32,10 @@ /* PTCH layout from frame number */ #define L1SAP_FN2MACBLOCK(fn) ((fn % 52) / 4) #define L1SAP_FN2PTCCHBLOCK(fn) ((fn / 104) & 3) -#define L1SAP_IS_PTCCH(fn) ((fn % 52) == 12) + +/* Calculate PTCCH occurrence, See also 3GPP TS 05.02, Clause 7, Table 6 of 9 */ +#define L1SAP_IS_PTCCH(fn) (((fn % 52) == 12) || ((fn % 52) == 38)) + static const uint8_t fill_frame[GSM_MACBLOCK_LEN] = { 0x03, 0x03, 0x01, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, -- To view, visit https://gerrit.osmocom.org/1978 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia6f3333121e5e920c5e1d562a081d0a1b58a1153 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 20 11:58:15 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 11:58:15 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: make debug logging more robust Message-ID: Review at https://gerrit.osmocom.org/2133 twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. While at it, also move version string to comply with PEP8. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 30 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2133/1 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 8d0ef9f..f688aef 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,11 +22,13 @@ */ """ +__version__ = "v0.4" # bump this on every non-trivial change + from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging, logging.handlers class IPACommon(basic.Int16StringReceiver): """ @@ -37,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -257,7 +258,7 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + self.dbg('IPA server connection made!') super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -273,7 +274,7 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + self.dbg('CTRL server connection made!') super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -285,14 +286,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -302,37 +303,39 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.debug('IPAFactory connection failed:', reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.debug('IPAFactory connection lost:', reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) if __name__ == '__main__': p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version) - p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3') + p.add_argument('-v', '--version', action='version', version="%(prog)s " + __version__) p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface") p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface") cs = p.add_mutually_exclusive_group() @@ -343,29 +346,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:05:44 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 12:05:44 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. While at it, also adjust version string to comply with PEP8 and PEP386. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 30 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2133/2 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 8d0ef9f..870bca9 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,11 +22,13 @@ */ """ +__version__ = "0.4" # bump this on every non-trivial change + from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging, logging.handlers class IPACommon(basic.Int16StringReceiver): """ @@ -37,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -257,7 +258,7 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + self.dbg('IPA server connection made!') super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -273,7 +274,7 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + self.dbg('CTRL server connection made!') super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -285,14 +286,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -302,37 +303,39 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.debug('IPAFactory connection failed:', reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.debug('IPAFactory connection lost:', reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) if __name__ == '__main__': p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version) - p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3') + p.add_argument('-v', '--version', action='version', version="%(prog)s " + __version__) p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface") p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface") cs = p.add_mutually_exclusive_group() @@ -343,29 +346,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:09:11 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 12:09:11 +0000 Subject: osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker In-Reply-To: References: Message-ID: Patch Set 1: Are we missing jenkins for this one? -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:30:19 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:30:19 +0000 Subject: openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 it looks good at first, but what this patch does is it "degrades" all of the output to debug level. Before, some of the output could be switched off while other output remained. Would it make sense to maintain two distinct log levels? How is the __version__ change related? -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:32:16 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:32:16 +0000 Subject: libosmocore[master]: build: coding/gsm0503: fix build in sep. dir: -I builddir In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2003 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0d465bc109765b1315d615243bea6af027afa368 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:32:22 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:32:22 +0000 Subject: libosmocore[master]: build: generate gsm0503.h to builddir, not srcdir In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 Gerrit-PatchSet: 7 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:32:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:32:44 +0000 Subject: [MERGED] libosmocore[master]: build: generate gsm0503.h to builddir, not srcdir In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build: generate gsm0503.h to builddir, not srcdir ...................................................................... build: generate gsm0503.h to builddir, not srcdir To ensure that a separate build dir keeps the source dir clean of state, generate the gsm0503.h to the builddir instead of the srcdir. Adjustments for everyone to access the right paths were added in previous patches. Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 --- M include/Makefile.am 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/Makefile.am b/include/Makefile.am index f8b1f8f..7d0b384 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -151,6 +151,6 @@ osmocom/gsm/gsm0503.h: $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_header gsm \ - --target-path $(top_srcdir)/include/osmocom/gsm/ + --target-path $(builddir)/osmocom/gsm CLEANFILES = osmocom/gsm/gsm0503.h -- To view, visit https://gerrit.osmocom.org/1996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia773ef5893a2018feb416061aefcf51835df18d2 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:32:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:32:44 +0000 Subject: [MERGED] libosmocore[master]: build: coding/gsm0503: fix build in sep. dir: -I builddir In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build: coding/gsm0503: fix build in sep. dir: -I builddir ...................................................................... build: coding/gsm0503: fix build in sep. dir: -I builddir To allow building coding/gsm0503_interleaving.c which includes the generated bit*gen.h (via bits.h), add -I to the builddir include path in order to find the generated bit*gen.h headers there. Change-Id: I0d465bc109765b1315d615243bea6af027afa368 --- M src/coding/Makefile.am 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/coding/Makefile.am b/src/coding/Makefile.am index e19b187..cbdcf47 100644 --- a/src/coding/Makefile.am +++ b/src/coding/Makefile.am @@ -5,6 +5,7 @@ AM_CPPFLAGS = \ -I"$(top_srcdir)/include" \ + -I"$(top_builddir)/include" \ $(TALLOC_CFLAGS) AM_CFLAGS = -Wall -- To view, visit https://gerrit.osmocom.org/2003 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0d465bc109765b1315d615243bea6af027afa368 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:32:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:32:59 +0000 Subject: libosmocore[master]: build: conv_gen.py: ensure parent dirs of written files exist In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2042 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:35:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:35:40 +0000 Subject: openbsc[master]: bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2017 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b2760b006a0707928530b4390c6997b79b02981 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:35:42 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 12:35:42 +0000 Subject: [MERGED] openbsc[master]: bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy... In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy IMSI ...................................................................... bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy IMSI Fixes: coverity scan CID 163918 Change-Id: I4b2760b006a0707928530b4390c6997b79b02981 --- M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/libbsc/bsc_subscriber.c 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 2042ec6..1bb5141 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -157,7 +157,7 @@ gsub = gprs_subscr_alloc(); if (!gsub) return NULL; - strncpy(gsub->imsi, imsi, sizeof(gsub->imsi)); + osmo_strlcpy(gsub->imsi, imsi, sizeof(gsub->imsi)); } if (!gsub->sgsn_data) diff --git a/openbsc/src/libbsc/bsc_subscriber.c b/openbsc/src/libbsc/bsc_subscriber.c index a5e40cd..73e61e8 100644 --- a/openbsc/src/libbsc/bsc_subscriber.c +++ b/openbsc/src/libbsc/bsc_subscriber.c @@ -80,7 +80,7 @@ { if (!bsub) return; - strncpy(bsub->imsi, imsi, sizeof(bsub->imsi)); + osmo_strlcpy(bsub->imsi, imsi, sizeof(bsub->imsi)); } struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, -- To view, visit https://gerrit.osmocom.org/2017 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4b2760b006a0707928530b4390c6997b79b02981 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:45:43 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 12:45:43 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2133 to look at the new patch set (#3). twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. While at it, also adjust version string to comply with PEP8 and PEP386. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 30 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2133/3 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 8d0ef9f..a13fddf 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,11 +22,13 @@ */ """ +__version__ = "0.4" # bump this on every non-trivial change + from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging, logging.handlers class IPACommon(basic.Int16StringReceiver): """ @@ -37,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -257,7 +258,7 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + self.dbg('IPA server connection made!') super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -273,7 +274,7 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + self.dbg('CTRL server connection made!') super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -285,14 +286,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -302,37 +303,39 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection failed: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection lost: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) if __name__ == '__main__': p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version) - p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3') + p.add_argument('-v', '--version', action='version', version="%(prog)s " + __version__) p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface") p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface") cs = p.add_mutually_exclusive_group() @@ -343,29 +346,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 12:52:41 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 20 Mar 2017 12:52:41 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code Message-ID: Review at https://gerrit.osmocom.org/2134 buildenv: Split up SSE3 and SSE4.1 code Currently we find SSE3 and SSE4.1 code mixed togehter along with generic code in one file. This introduces the risk that the compiler exidantly mixes SSE4.1 instructions into an SSE3, or even worse into a generic code path. This commit splits the SSE3 and SSE4.1 code into separate files and compiles them with the matching target options. Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 --- M Transceiver52M/x86/Makefile.am M Transceiver52M/x86/convert.c A Transceiver52M/x86/convert_sse_3.c A Transceiver52M/x86/convert_sse_3.h A Transceiver52M/x86/convert_sse_4_1.c A Transceiver52M/x86/convert_sse_4_1.h M Transceiver52M/x86/convolve.c A Transceiver52M/x86/convolve_sse_3.c A Transceiver52M/x86/convolve_sse_3.h M config/ax_ext.m4 M configure.ac M utils/convolvetest/Makefile 12 files changed, 896 insertions(+), 662 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/34/2134/1 diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index 7a0b75f..dbf8a9e 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -1,7 +1,28 @@ if !ARCH_ARM -AM_CFLAGS = -Wall -std=gnu99 $(SIMD_FLAGS) -I${srcdir}/../common +AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common noinst_LTLIBRARIES = libarch.la +noinst_LTLIBRARIES += libarch_sse_3.la +noinst_LTLIBRARIES += libarch_sse_4_1.la + +libarch_la_LIBADD = + +# SSE 3 specific code +if HAVE_SSE3 +libarch_sse_3_la_SOURCES = \ + convert_sse_3.c \ + convolve_sse_3.c +libarch_sse_3_la_CFLAGS = -msse3 +libarch_la_LIBADD += libarch_sse_3.la +endif + +# SSE 4.1 specific code +if HAVE_SSE4_1 +libarch_sse_4_1_la_SOURCES = \ + convert_sse_4_1.c +libarch_sse_4_1_la_CFLAGS = -msse4.1 +libarch_la_LIBADD += libarch_sse_4_1.la +endif libarch_la_SOURCES = \ ../common/convolve_base.c \ @@ -9,3 +30,4 @@ convert.c \ convolve.c endif + diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index 3f76b65..f3dd125 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -20,6 +20,8 @@ #include #include #include "convert.h" +#include "convert_sse_3.h" +#include "convert_sse_4_1.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -29,146 +31,12 @@ struct convert_cpu_context { void (*convert_si16_ps_16n) (float *, const short *, int); void (*convert_si16_ps) (float *, const short *, int); - void (*convert_scale_ps_si16_16n)(short *, const float *, float, int); - void (*convert_scale_ps_si16_8n)(short *, const float *, float, int); - void (*convert_scale_ps_si16)(short *, const float *, float, int); + void (*convert_scale_ps_si16_16n) (short *, const float *, float, int); + void (*convert_scale_ps_si16_8n) (short *, const float *, float, int); + void (*convert_scale_ps_si16) (short *, const float *, float, int); }; static struct convert_cpu_context c; - -#ifdef HAVE_SSE3 -#include -#include - -#ifdef HAVE_SSE4_1 -#include - -/* 16*N 16-bit signed integer converted to single precision floats */ -static void _sse_convert_si16_ps_16n(float *restrict out, - const short *restrict in, - int len) -{ - __m128i m0, m1, m2, m3, m4, m5; - __m128 m6, m7, m8, m9; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_si128((__m128i *) &in[16 * i + 0]); - m1 = _mm_loadu_si128((__m128i *) &in[16 * i + 8]); - - /* Unpack */ - m2 = _mm_cvtepi16_epi32(m0); - m4 = _mm_cvtepi16_epi32(m1); - m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); - m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); - m3 = _mm_cvtepi16_epi32(m0); - m5 = _mm_cvtepi16_epi32(m1); - - /* Convert */ - m6 = _mm_cvtepi32_ps(m2); - m7 = _mm_cvtepi32_ps(m3); - m8 = _mm_cvtepi32_ps(m4); - m9 = _mm_cvtepi32_ps(m5); - - /* Store */ - _mm_storeu_ps(&out[16 * i + 0], m6); - _mm_storeu_ps(&out[16 * i + 4], m7); - _mm_storeu_ps(&out[16 * i + 8], m8); - _mm_storeu_ps(&out[16 * i + 12], m9); - } -} - -/* 16*N 16-bit signed integer conversion with remainder */ -static void _sse_convert_si16_ps(float *restrict out, - const short *restrict in, - int len) -{ - int start = len / 16 * 16; - - _sse_convert_si16_ps_16n(out, in, len); - - for (int i = 0; i < len % 16; i++) - out[start + i] = in[start + i]; -} -#endif /* HAVE_SSE4_1 */ - -/* 8*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_8n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2; - __m128i m4, m5; - - for (int i = 0; i < len / 8; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[8 * i + 0]); - m1 = _mm_loadu_ps(&in[8 * i + 4]); - m2 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m2); - m1 = _mm_mul_ps(m1, m2); - - /* Convert */ - m4 = _mm_cvtps_epi32(m0); - m5 = _mm_cvtps_epi32(m1); - - /* Pack and store */ - m5 = _mm_packs_epi32(m4, m5); - _mm_storeu_si128((__m128i *) &out[8 * i], m5); - } -} - -/* 8*N single precision floats scaled and converted with remainder */ -static void _sse_convert_scale_ps_si16(short *restrict out, - const float *restrict in, - float scale, int len) -{ - int start = len / 8 * 8; - - _sse_convert_scale_ps_si16_8n(out, in, scale, len); - - for (int i = 0; i < len % 8; i++) - out[start + i] = in[start + i] * scale; -} - -/* 16*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_16n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2, m3, m4; - __m128i m5, m6, m7, m8; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[16 * i + 0]); - m1 = _mm_loadu_ps(&in[16 * i + 4]); - m2 = _mm_loadu_ps(&in[16 * i + 8]); - m3 = _mm_loadu_ps(&in[16 * i + 12]); - m4 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m4); - m1 = _mm_mul_ps(m1, m4); - m2 = _mm_mul_ps(m2, m4); - m3 = _mm_mul_ps(m3, m4); - - /* Convert */ - m5 = _mm_cvtps_epi32(m0); - m6 = _mm_cvtps_epi32(m1); - m7 = _mm_cvtps_epi32(m2); - m8 = _mm_cvtps_epi32(m3); - - /* Pack and store */ - m5 = _mm_packs_epi32(m5, m6); - m7 = _mm_packs_epi32(m7, m8); - _mm_storeu_si128((__m128i *) &out[16 * i + 0], m5); - _mm_storeu_si128((__m128i *) &out[16 * i + 8], m7); - } -} -#endif void convert_init(void) { diff --git a/Transceiver52M/x86/convert_sse_3.c b/Transceiver52M/x86/convert_sse_3.c new file mode 100644 index 0000000..255db67 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.c @@ -0,0 +1,107 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2; + __m128i m4, m5; + + for (int i = 0; i < len / 8; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[8 * i + 0]); + m1 = _mm_loadu_ps(&in[8 * i + 4]); + m2 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m2); + m1 = _mm_mul_ps(m1, m2); + + /* Convert */ + m4 = _mm_cvtps_epi32(m0); + m5 = _mm_cvtps_epi32(m1); + + /* Pack and store */ + m5 = _mm_packs_epi32(m4, m5); + _mm_storeu_si128((__m128i *) & out[8 * i], m5); + } +} + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len) +{ + int start = len / 8 * 8; + + _sse_convert_scale_ps_si16_8n(out, in, scale, len); + + for (int i = 0; i < len % 8; i++) + out[start + i] = in[start + i] * scale; +} + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2, m3, m4; + __m128i m5, m6, m7, m8; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[16 * i + 0]); + m1 = _mm_loadu_ps(&in[16 * i + 4]); + m2 = _mm_loadu_ps(&in[16 * i + 8]); + m3 = _mm_loadu_ps(&in[16 * i + 12]); + m4 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m4); + m1 = _mm_mul_ps(m1, m4); + m2 = _mm_mul_ps(m2, m4); + m3 = _mm_mul_ps(m3, m4); + + /* Convert */ + m5 = _mm_cvtps_epi32(m0); + m6 = _mm_cvtps_epi32(m1); + m7 = _mm_cvtps_epi32(m2); + m8 = _mm_cvtps_epi32(m3); + + /* Pack and store */ + m5 = _mm_packs_epi32(m5, m6); + m7 = _mm_packs_epi32(m7, m8); + _mm_storeu_si128((__m128i *) & out[16 * i + 0], m5); + _mm_storeu_si128((__m128i *) & out[16 * i + 8], m7); + } +} +#endif diff --git a/Transceiver52M/x86/convert_sse_3.h b/Transceiver52M/x86/convert_sse_3.h new file mode 100644 index 0000000..c2f87d7 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.h @@ -0,0 +1,34 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len); + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len); + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len); diff --git a/Transceiver52M/x86/convert_sse_4_1.c b/Transceiver52M/x86/convert_sse_4_1.c new file mode 100644 index 0000000..42a235c --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.c @@ -0,0 +1,77 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_4_1.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE4_1 +#include + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len) +{ + __m128i m0, m1, m2, m3, m4, m5; + __m128 m6, m7, m8, m9; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_si128((__m128i *) & in[16 * i + 0]); + m1 = _mm_loadu_si128((__m128i *) & in[16 * i + 8]); + + /* Unpack */ + m2 = _mm_cvtepi16_epi32(m0); + m4 = _mm_cvtepi16_epi32(m1); + m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); + m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); + m3 = _mm_cvtepi16_epi32(m0); + m5 = _mm_cvtepi16_epi32(m1); + + /* Convert */ + m6 = _mm_cvtepi32_ps(m2); + m7 = _mm_cvtepi32_ps(m3); + m8 = _mm_cvtepi32_ps(m4); + m9 = _mm_cvtepi32_ps(m5); + + /* Store */ + _mm_storeu_ps(&out[16 * i + 0], m6); + _mm_storeu_ps(&out[16 * i + 4], m7); + _mm_storeu_ps(&out[16 * i + 8], m8); + _mm_storeu_ps(&out[16 * i + 12], m9); + } +} + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len) +{ + int start = len / 16 * 16; + + _sse_convert_si16_ps_16n(out, in, len); + + for (int i = 0; i < len % 16; i++) + out[start + i] = in[start + i]; +} + +#endif diff --git a/Transceiver52M/x86/convert_sse_4_1.h b/Transceiver52M/x86/convert_sse_4_1.h new file mode 100644 index 0000000..57a5efb --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.h @@ -0,0 +1,28 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len); + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len); diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c index 2f3b293..35cba29 100644 --- a/Transceiver52M/x86/convolve.c +++ b/Transceiver52M/x86/convolve.c @@ -21,6 +21,7 @@ #include #include #include "convolve.h" +#include "convolve_sse_3.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -66,529 +67,6 @@ int bounds_check(int x_len, int h_len, int y_len, int start, int len, int step); - -#ifdef HAVE_SSE3 -#include -#include - -/* 4-tap SSE complex-real convolution */ -static void sse_conv_real4(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_real() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m4 = _mm_mul_ps(m2, m7); - m5 = _mm_mul_ps(m3, m7); - - /* Sum and store */ - m6 = _mm_hadd_ps(m4, m5); - m0 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8-tap SSE complex-real convolution */ -static void sse_conv_real8(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m6 = _mm_mul_ps(m6, m4); - m7 = _mm_mul_ps(m7, m4); - m8 = _mm_mul_ps(m8, m5); - m9 = _mm_mul_ps(m9, m5); - - /* Sum and store */ - m6 = _mm_add_ps(m6, m8); - m7 = _mm_add_ps(m7, m9); - m6 = _mm_hadd_ps(m6, m7); - m6 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m6); - m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m6); - } -} - -/* 12-tap SSE complex-real convolution */ -static void sse_conv_real12(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m8, m4); - m11 = _mm_add_ps(m9, m5); - - m2 = _mm_hadd_ps(m10, m11); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 16-tap SSE complex-real convolution */ -static void sse_conv_real16(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - m2 = _mm_loadu_ps(&_x[2 * i + 24]); - m3 = _mm_loadu_ps(&_x[2 * i + 28]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - m6 = _mm_mul_ps(m10, m15); - m7 = _mm_mul_ps(m11, m15); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m4, m6); - m11 = _mm_add_ps(m5, m7); - - m0 = _mm_add_ps(m8, m10); - m1 = _mm_add_ps(m9, m11); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 20-tap SSE complex-real convolution */ -static void sse_conv_real20(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - m8 = _mm_load_ps(&h[32]); - m9 = _mm_load_ps(&h[36]); - - m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Multiply-accumulate first 12 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - m4 = _mm_loadu_ps(&_x[2 * i + 16]); - m5 = _mm_loadu_ps(&_x[2 * i + 20]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); - - m2 = _mm_mul_ps(m6, m11); - m3 = _mm_mul_ps(m7, m11); - m4 = _mm_mul_ps(m8, m12); - m5 = _mm_mul_ps(m9, m12); - m6 = _mm_mul_ps(m0, m13); - m7 = _mm_mul_ps(m1, m13); - - m0 = _mm_add_ps(m2, m4); - m1 = _mm_add_ps(m3, m5); - m8 = _mm_add_ps(m0, m6); - m9 = _mm_add_ps(m1, m7); - - /* Multiply-accumulate last 8 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 24]); - m1 = _mm_loadu_ps(&_x[2 * i + 28]); - m2 = _mm_loadu_ps(&_x[2 * i + 32]); - m3 = _mm_loadu_ps(&_x[2 * i + 36]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_mul_ps(m4, m14); - m1 = _mm_mul_ps(m5, m14); - m2 = _mm_mul_ps(m6, m15); - m3 = _mm_mul_ps(m7, m15); - - m4 = _mm_add_ps(m0, m2); - m5 = _mm_add_ps(m1, m3); - - /* Final sum and store */ - m0 = _mm_add_ps(m8, m4); - m1 = _mm_add_ps(m9, m5); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 4*N-tap SSE complex-real convolution */ -static void sse_conv_real4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m2, m5); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m1); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 4*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_complex() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m3, m5); - - m2 = _mm_mul_ps(m2, m5); - m3 = _mm_mul_ps(m3, m4); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_add_ps(m2, m3); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m2); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_8n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_cmplx_4n() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m12 = _mm_setzero_ps(); - m13 = _mm_setzero_ps(); - m14 = _mm_setzero_ps(); - m15 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 8; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[16 * n + 0]); - m1 = _mm_load_ps(&h[16 * n + 4]); - m2 = _mm_load_ps(&h[16 * n + 8]); - m3 = _mm_load_ps(&h[16 * n + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m8); - m1 = _mm_mul_ps(m5, m9); - m2 = _mm_mul_ps(m6, m10); - m3 = _mm_mul_ps(m7, m11); - - m4 = _mm_mul_ps(m4, m9); - m5 = _mm_mul_ps(m5, m8); - m6 = _mm_mul_ps(m6, m11); - m7 = _mm_mul_ps(m7, m10); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_sub_ps(m2, m3); - m4 = _mm_add_ps(m4, m5); - m6 = _mm_add_ps(m6, m7); - - /* Accumulate */ - m12 = _mm_add_ps(m12, m0); - m13 = _mm_add_ps(m13, m2); - m14 = _mm_add_ps(m14, m4); - m15 = _mm_add_ps(m15, m6); - } - - m0 = _mm_add_ps(m12, m13); - m1 = _mm_add_ps(m14, m15); - m2 = _mm_hadd_ps(m0, m1); - m2 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m2); - m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m2); - } -} -#endif /* API: Initalize convolve module */ void convolve_init(void) diff --git a/Transceiver52M/x86/convolve_sse_3.c b/Transceiver52M/x86/convolve_sse_3.c new file mode 100644 index 0000000..dbee3cc --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.c @@ -0,0 +1,542 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "convolve_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_real() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m4 = _mm_mul_ps(m2, m7); + m5 = _mm_mul_ps(m3, m7); + + /* Sum and store */ + m6 = _mm_hadd_ps(m4, m5); + m0 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m6 = _mm_mul_ps(m6, m4); + m7 = _mm_mul_ps(m7, m4); + m8 = _mm_mul_ps(m8, m5); + m9 = _mm_mul_ps(m9, m5); + + /* Sum and store */ + m6 = _mm_add_ps(m6, m8); + m7 = _mm_add_ps(m7, m9); + m6 = _mm_hadd_ps(m6, m7); + m6 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m6); + m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m6); + } +} + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m8, m4); + m11 = _mm_add_ps(m9, m5); + + m2 = _mm_hadd_ps(m10, m11); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + m2 = _mm_loadu_ps(&_x[2 * i + 24]); + m3 = _mm_loadu_ps(&_x[2 * i + 28]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + m6 = _mm_mul_ps(m10, m15); + m7 = _mm_mul_ps(m11, m15); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m4, m6); + m11 = _mm_add_ps(m5, m7); + + m0 = _mm_add_ps(m8, m10); + m1 = _mm_add_ps(m9, m11); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + m8 = _mm_load_ps(&h[32]); + m9 = _mm_load_ps(&h[36]); + + m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Multiply-accumulate first 12 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + m4 = _mm_loadu_ps(&_x[2 * i + 16]); + m5 = _mm_loadu_ps(&_x[2 * i + 20]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); + + m2 = _mm_mul_ps(m6, m11); + m3 = _mm_mul_ps(m7, m11); + m4 = _mm_mul_ps(m8, m12); + m5 = _mm_mul_ps(m9, m12); + m6 = _mm_mul_ps(m0, m13); + m7 = _mm_mul_ps(m1, m13); + + m0 = _mm_add_ps(m2, m4); + m1 = _mm_add_ps(m3, m5); + m8 = _mm_add_ps(m0, m6); + m9 = _mm_add_ps(m1, m7); + + /* Multiply-accumulate last 8 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 24]); + m1 = _mm_loadu_ps(&_x[2 * i + 28]); + m2 = _mm_loadu_ps(&_x[2 * i + 32]); + m3 = _mm_loadu_ps(&_x[2 * i + 36]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_mul_ps(m4, m14); + m1 = _mm_mul_ps(m5, m14); + m2 = _mm_mul_ps(m6, m15); + m3 = _mm_mul_ps(m7, m15); + + m4 = _mm_add_ps(m0, m2); + m5 = _mm_add_ps(m1, m3); + + /* Final sum and store */ + m0 = _mm_add_ps(m8, m4); + m1 = _mm_add_ps(m9, m5); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m2, m5); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m1); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_complex() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m3, m5); + + m2 = _mm_mul_ps(m2, m5); + m3 = _mm_mul_ps(m3, m4); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_add_ps(m2, m3); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m2); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_cmplx_4n() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m12 = _mm_setzero_ps(); + m13 = _mm_setzero_ps(); + m14 = _mm_setzero_ps(); + m15 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 8; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[16 * n + 0]); + m1 = _mm_load_ps(&h[16 * n + 4]); + m2 = _mm_load_ps(&h[16 * n + 8]); + m3 = _mm_load_ps(&h[16 * n + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m8); + m1 = _mm_mul_ps(m5, m9); + m2 = _mm_mul_ps(m6, m10); + m3 = _mm_mul_ps(m7, m11); + + m4 = _mm_mul_ps(m4, m9); + m5 = _mm_mul_ps(m5, m8); + m6 = _mm_mul_ps(m6, m11); + m7 = _mm_mul_ps(m7, m10); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_sub_ps(m2, m3); + m4 = _mm_add_ps(m4, m5); + m6 = _mm_add_ps(m6, m7); + + /* Accumulate */ + m12 = _mm_add_ps(m12, m0); + m13 = _mm_add_ps(m13, m2); + m14 = _mm_add_ps(m14, m4); + m15 = _mm_add_ps(m15, m6); + } + + m0 = _mm_add_ps(m12, m13); + m1 = _mm_add_ps(m14, m15); + m2 = _mm_hadd_ps(m0, m1); + m2 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m2); + m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m2); + } +} +#endif diff --git a/Transceiver52M/x86/convolve_sse_3.h b/Transceiver52M/x86/convolve_sse_3.h new file mode 100644 index 0000000..ac30ca5 --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.h @@ -0,0 +1,68 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); diff --git a/config/ax_ext.m4 b/config/ax_ext.m4 index 4883b89..67b8d47 100644 --- a/config/ax_ext.m4 +++ b/config/ax_ext.m4 @@ -53,16 +53,20 @@ if test x"$ax_cv_support_sse3_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse3" AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) + AM_CONDITIONAL(HAVE_SSE3, true) else AC_MSG_WARN([Your compiler does not support sse3 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE3, false) fi AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) if test x"$ax_cv_support_sse41_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse4.1" AC_DEFINE(HAVE_SSE4_1,,[Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions]) + AM_CONDITIONAL(HAVE_SSE4_1, true) else AC_MSG_WARN([Your compiler does not support sse4.1 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE4_1, false) fi ;; esac diff --git a/configure.ac b/configure.ac index 7d7750e..b042d24 100644 --- a/configure.ac +++ b/configure.ac @@ -115,6 +115,9 @@ # Find and define supported SIMD extensions AS_IF([test "x$with_sse" == "xyes"], [ AX_EXT +], [ + AM_CONDITIONAL(HAVE_SSE3, false) + AM_CONDITIONAL(HAVE_SSE4_1, false) ]) AM_CONDITIONAL(USRP1, [test "x$with_usrp1" = "xyes"]) diff --git a/utils/convolvetest/Makefile b/utils/convolvetest/Makefile index 0ce4cb1..1c8df85 100644 --- a/utils/convolvetest/Makefile +++ b/utils/convolvetest/Makefile @@ -1,4 +1,4 @@ -all: main.o convolve_base.o convolve.o +all: main.o convolve_base.o convolve.o convolve_sse_3.o gcc -g -Wall ./*.o -o convtest -losmocore clean: @@ -14,3 +14,6 @@ convolve.o: ../../Transceiver52M/x86/convolve.c gcc -std=c99 -c ../../Transceiver52M/x86/convolve.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 +convolve_sse_3.o: ../../Transceiver52M/x86/convolve_sse_3.c + gcc -std=c99 -c ../../Transceiver52M/x86/convolve_sse_3.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 + -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:13:55 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 13:13:55 +0000 Subject: osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 AX_EXT is macro from autoconf-archive package - I think it's avery bad idea to supply our own modified copy: this means we'll have to track all upstream fixes manually. I think we should either move this code directly to configure.ac or add our own macro wrapping ax_ext. If neither possible we should at the very least explicitly mention from which version of autoconf-archive this was copy-pasted. -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:26:58 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:26:58 +0000 Subject: [MERGED] libosmocore[master]: build: conv_gen.py: ensure parent dirs of written files exist In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build: conv_gen.py: ensure parent dirs of written files exist ...................................................................... build: conv_gen.py: ensure parent dirs of written files exist Previously, this would fail when generating to $builddir if that subtree did not exist yet in $builddir. Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 --- M utils/conv_gen.py 1 file changed, 9 insertions(+), 3 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/utils/conv_gen.py b/utils/conv_gen.py index 1ffeb3f..0cdba75 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -306,9 +306,15 @@ code = ConvolutionalCode(0, polys, name = name) code.print_state_and_output(fi) +def open_for_writing(parent_dir, base_name): + path = os.path.join(parent_dir, base_name) + if not os.path.isdir(parent_dir): + os.makedirs(parent_dir) + return open(path, 'w') + def generate_codes(codes, path, prefix, name): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) f.write(mod_license + "\n") f.write("#include \n") f.write("#include \n\n") @@ -335,7 +341,7 @@ def generate_vectors(codes, path, prefix, name, inc = None): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) f.write(mod_license + "\n") # Print includes @@ -363,7 +369,7 @@ def generate_header(codes, path, prefix, name, description = None): # Open a new file for writing - f = open(os.path.join(path, name), 'w') + f = open_for_writing(path, name) # Print license and includes f.write(mod_license + "\n") -- To view, visit https://gerrit.osmocom.org/2042 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:33:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:33:11 +0000 Subject: openbsc[master]: python tests: allow running from separate build dir In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1906 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2731f361e3b72d0980968e6cf83594ea450db7c2 Gerrit-PatchSet: 7 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:33:15 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:33:15 +0000 Subject: [MERGED] openbsc[master]: python tests: allow running from separate build dir In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: python tests: allow running from separate build dir ...................................................................... python tests: allow running from separate build dir The VTY tests assume that $top_builddir == $top_srcdir. Use the script's location from sys.path[0] to find the correct locations of example configs even when building in another directory. Change-Id: I2731f361e3b72d0980968e6cf83594ea450db7c2 --- M openbsc/tests/ctrl_test_runner.py M openbsc/tests/smpp_test_runner.py M openbsc/tests/vty_test_runner.py 3 files changed, 9 insertions(+), 4 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py index 5030e8b..02bc28a 100644 --- a/openbsc/tests/ctrl_test_runner.py +++ b/openbsc/tests/ctrl_test_runner.py @@ -30,7 +30,8 @@ import osmopy.obscvty as obscvty import osmopy.osmoutil as osmoutil -confpath = '.' +# to be able to find $top_srcdir/doc/... +confpath = os.path.join(sys.path[0], '..') verbose = False class TestCtrlBase(unittest.TestCase): diff --git a/openbsc/tests/smpp_test_runner.py b/openbsc/tests/smpp_test_runner.py index 06fb766..2fd144b 100644 --- a/openbsc/tests/smpp_test_runner.py +++ b/openbsc/tests/smpp_test_runner.py @@ -18,6 +18,7 @@ # along with this program. If not, see . import os +import sys import time import unittest import socket @@ -25,7 +26,7 @@ import osmopy.obscvty as obscvty import osmopy.osmoutil as osmoutil -confpath = '.' +confpath = os.path.join(sys.path[0], '..') class TestVTYBase(unittest.TestCase): diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 87b9eba..305c956 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -24,10 +24,13 @@ import osmopy.obscvty as obscvty import osmopy.osmoutil as osmoutil -sys.path.append("../contrib") +# add $top_srcdir/contrib to find ipa.py +sys.path.append(os.path.join(sys.path[0], '..', 'contrib')) + from ipa import IPA -confpath = '.' +# to be able to find $top_srcdir/doc/... +confpath = os.path.join(sys.path[0], '..') class TestVTYBase(unittest.TestCase): -- To view, visit https://gerrit.osmocom.org/1906 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2731f361e3b72d0980968e6cf83594ea450db7c2 Gerrit-PatchSet: 8 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:55:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:55:11 +0000 Subject: osmo-hlr[master]: fix db_subscr_ps error handling In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2108 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I27e8b46915efd678c72138e250a9cbb4c9c8ac20 Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:55:12 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:55:12 +0000 Subject: [MERGED] osmo-hlr[master]: fix db_subscr_ps error handling In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix db_subscr_ps error handling ...................................................................... fix db_subscr_ps error handling Reset stmt and return right away on failure to execute. Change-Id: I27e8b46915efd678c72138e250a9cbb4c9c8ac20 Fixes: Coverity Scan CID#164747 --- M src/db_hlr.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/db_hlr.c b/src/db_hlr.c index 340e7ce..f6ae18f 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -92,7 +92,8 @@ rc = sqlite3_step(stmt); /* execute the statement */ if (rc != SQLITE_DONE) { LOGHLR(imsi, LOGL_ERROR, "Error executing SQL: %d\n", rc); - rc = -ENOEXEC; + db_remove_reset(stmt); + return -ENOEXEC; } rc = sqlite3_changes(dbc->db); /* verify execution result */ -- To view, visit https://gerrit.osmocom.org/2108 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I27e8b46915efd678c72138e250a9cbb4c9c8ac20 Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:55:37 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:55:37 +0000 Subject: [MERGED] libosmocore[master]: build: fix distcheck: include gen scripts in EXTRA_DIST In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build: fix distcheck: include gen scripts in EXTRA_DIST ...................................................................... build: fix distcheck: include gen scripts in EXTRA_DIST Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7 --- M utils/Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Max: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/utils/Makefile.am b/utils/Makefile.am index e95f546..51af3d8 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -2,6 +2,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall +EXTRA_DIST = conv_gen.py conv_codes_gsm.py + bin_PROGRAMS = osmo-arfcn osmo-auc-gen osmo_arfcn_SOURCES = osmo-arfcn.c -- To view, visit https://gerrit.osmocom.org/2004 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 20 13:55:41 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 13:55:41 +0000 Subject: [MERGED] libosmocore[master]: build: fix build dependencies for generated sources In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build: fix build dependencies for generated sources ...................................................................... build: fix build dependencies for generated sources Ensure that a changed conv_gen.py and/or conv_codes_gsm.py result in regeneration of the gsm0503* generated sources. Before this patch, manual cleaning of the generated files was necessary to benefit from a code update. Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 --- M include/Makefile.am M src/gsm/Makefile.am 2 files changed, 6 insertions(+), 2 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Max: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/Makefile.am b/include/Makefile.am index 7d0b384..e2a1b12 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,3 +1,5 @@ +BUILT_SOURCES = osmocom/gsm/gsm0503.h + nobase_include_HEADERS = \ osmocom/codec/codec.h \ osmocom/core/application.h \ @@ -149,7 +151,7 @@ $(AM_V_GEN)$(MKDIR_P) $(dir $@) $(AM_V_GEN)sed -e's/XX/$*/g' $< > $@ -osmocom/gsm/gsm0503.h: +osmocom/gsm/gsm0503.h: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_header gsm \ --target-path $(builddir)/osmocom/gsm diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 653bdb9..3a4a0cd 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -14,6 +14,8 @@ noinst_LTLIBRARIES = libgsmint.la lib_LTLIBRARIES = libosmogsm.la +BUILT_SOURCES = gsm0503_conv.c + libgsmint_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \ gprs_cipher_core.c gprs_rlc.c gsm0480.c abis_nm.c gsm0502.c \ @@ -34,7 +36,7 @@ EXTRA_DIST = libosmogsm.map # Convolutional codes generation -gsm0503_conv.c: +gsm0503_conv.c: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm CLEANFILES = gsm0503_conv.c -- To view, visit https://gerrit.osmocom.org/2002 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Mon Mar 20 14:08:25 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 14:08:25 +0000 Subject: osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (3 comments) in OS#1869 there is mention of the 'attribute' based per-function cpu features, but I can't see them in this patch. I must apologize because I assumed you were aware of this way to solve, since Holger had already posted it a long time ago somewhere. I should have brought your attention to it more urgently. With those attributes it may not be necessary to separate the files at all ... could you take a brief look and decide which way to go with the 'attribute' style -- are they no longer needed now, or should we rewrite this patch to use those instead? https://gerrit.osmocom.org/#/c/2134/1/Transceiver52M/x86/Makefile.am File Transceiver52M/x86/Makefile.am: Line 33: whitespace https://gerrit.osmocom.org/#/c/2134/1/Transceiver52M/x86/convert.c File Transceiver52M/x86/convert.c: Line 36: void (*convert_scale_ps_si16) (short *, const float *, float, int); this doesn't change anything, does it?? drop this chunk. https://gerrit.osmocom.org/#/c/2134/1/utils/convolvetest/Makefile File utils/convolvetest/Makefile: Line 19: (we usually avoid empty lines at eof) -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 20 14:13:09 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 14:13:09 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2133 to look at the new patch set (#4). twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. While at it, also adjust version string to comply with PEP8 and PEP386. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 34 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2133/4 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 8d0ef9f..ecac118 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,11 +22,13 @@ */ """ +__version__ = "0.4" # bump this on every non-trivial change + from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging, logging.handlers class IPACommon(basic.Int16StringReceiver): """ @@ -37,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -158,7 +159,8 @@ We have to resetDelay() here to drop internal state to default values to make reconnection logic work Make sure to call this via super() if overriding to keep reconnection logic intact """ - self.dbg('IPA connection made!') + addr = self.transport.getPeer() + self.dbg('IPA connected to %s:%d peer' % (addr.host, addr.port)) self.factory.resetDelay() @@ -257,7 +259,8 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + addr = self.transport.getPeer() + self.factory.log.info(('IPA server: connection from %s:%d client' % (addr.host, addr.port)) super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -273,7 +276,8 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + addr = self.transport.getPeer() + self.factory.log.info('CTRL server: connection from %s:%d client' % (addr.host, addr.port)) super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -285,14 +289,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -302,37 +306,39 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection failed: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection lost: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) if __name__ == '__main__': p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version) - p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3') + p.add_argument('-v', '--version', action='version', version="%(prog)s v" + __version__) p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface") p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface") cs = p.add_mutually_exclusive_group() @@ -343,29 +349,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 14:14:02 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 14:14:02 +0000 Subject: osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker In-Reply-To: References: Message-ID: Patch Set 1: yes. it's a python tool to connect to an actual sim card, so I'm not sure what a jenkins job could test here ... do a pyflakes test? so far I V+1 manually. -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 14:18:39 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 14:18:39 +0000 Subject: osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Meh, pyflakes tends to print crapload of false-positives - manual verification is fine in this case. At least until osmo-gsm-tester got some sim cards on board ;-) -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 14:52:20 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 14:52:20 +0000 Subject: openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+1 (1 comment) except... https://gerrit.osmocom.org/#/c/2133/4/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 25: __version__ = "0.4" # bump this on every non-trivial change separate patch for this? -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 20 15:56:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 20 Mar 2017 15:56:26 +0000 Subject: osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 agreed :) -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 16:17:11 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 20 Mar 2017 16:17:11 +0000 Subject: osmo-trx[master]: CommonLibs: Remove unused files. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2125 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 16:18:13 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 20 Mar 2017 16:18:13 +0000 Subject: osmo-trx[master]: sigProcLib: Fix documentation, sync argument names in .cpp a... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2128 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 16:18:35 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 20 Mar 2017 16:18:35 +0000 Subject: osmo-trx[master]: sigProcLib: Typo sybols -> symbols In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2126 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 16:18:54 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 20 Mar 2017 16:18:54 +0000 Subject: osmo-trx[master]: radioBuffer: Remove extra ; at the end of inline function de... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2127 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8911adf0a0bb1ae828ac9cdf1a76c904639f6c06 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 20 16:31:38 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 16:31:38 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2133 to look at the new patch set (#5). twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 32 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2133/5 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 0a08747..cbf26db 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,13 +22,13 @@ */ """ -__version__ = "0.4" # bump this on every non-trivial change +__version__ = "0.5" # bump this on every non-trivial change from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging, logging.handlers class IPACommon(basic.Int16StringReceiver): """ @@ -39,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -160,7 +159,8 @@ We have to resetDelay() here to drop internal state to default values to make reconnection logic work Make sure to call this via super() if overriding to keep reconnection logic intact """ - self.dbg('IPA connection made!') + addr = self.transport.getPeer() + self.dbg('IPA connected to %s:%d peer' % (addr.host, addr.port)) self.factory.resetDelay() @@ -259,7 +259,8 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + addr = self.transport.getPeer() + self.factory.log.info(('IPA server: connection from %s:%d client' % (addr.host, addr.port)) super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -275,7 +276,8 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + addr = self.transport.getPeer() + self.factory.log.info('CTRL server: connection from %s:%d client' % (addr.host, addr.port)) super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -287,14 +289,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -304,31 +306,33 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection failed: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection lost: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) @@ -345,29 +349,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 20 16:31:39 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 20 Mar 2017 16:31:39 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: bump version properly Message-ID: Review at https://gerrit.osmocom.org/2135 twisted_ipa.py: bump version properly Adjust version string to comply with PEP8 and PEP386. Change-Id: I44c8521f12e6432038998bfb1ac1bb37a1137787 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/35/2135/1 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 8d0ef9f..0a08747 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,6 +22,8 @@ */ """ +__version__ = "0.4" # bump this on every non-trivial change + from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor @@ -332,7 +334,7 @@ if __name__ == '__main__': p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version) - p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3') + p.add_argument('-v', '--version', action='version', version="%(prog)s v" + __version__) p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface") p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface") cs = p.add_mutually_exclusive_group() -- To view, visit https://gerrit.osmocom.org/2135 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I44c8521f12e6432038998bfb1ac1bb37a1137787 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Mar 20 17:32:04 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Mon, 20 Mar 2017 17:32:04 +0000 Subject: [MERGED] osmo-trx[master]: CommonLibs: Remove unused files. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: CommonLibs: Remove unused files. ...................................................................... CommonLibs: Remove unused files. Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 --- M CommonLibs/Configuration.cpp D CommonLibs/F16.h D CommonLibs/F16Test.cpp M CommonLibs/Logger.cpp M CommonLibs/Logger.h M CommonLibs/Makefile.am D CommonLibs/MemoryLeak.h D CommonLibs/Regexp.h D CommonLibs/RegexpTest.cpp D CommonLibs/Reporting.cpp D CommonLibs/Reporting.h D CommonLibs/ScalarTypes.h D CommonLibs/URLEncode.cpp D CommonLibs/URLEncode.h D CommonLibs/URLEncodeTest.cpp D CommonLibs/Utils.cpp D CommonLibs/Utils.h 17 files changed, 49 insertions(+), 1,313 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/CommonLibs/Configuration.cpp b/CommonLibs/Configuration.cpp index 8cbfcb0..bfff893 100644 --- a/CommonLibs/Configuration.cpp +++ b/CommonLibs/Configuration.cpp @@ -53,6 +53,23 @@ ")" }; +static std::string replaceAll(const std::string input, const std::string search, const std::string replace) +{ + std::string output = input; + int index = 0; + + while (true) { + index = output.find(search, index); + if (index == std::string::npos) { + break; + } + + output.replace(index, replace.length(), replace); + index += replace.length(); + } + + return output; +} float ConfigurationRecord::floatNumber() const @@ -259,8 +276,8 @@ ss << "% END AUTO-GENERATED CONTENT" << endl; ss << endl; - string tmp = Utils::replaceAll(ss.str(), "^", "\\^"); - return Utils::replaceAll(tmp, "_", "\\_"); + string tmp = replaceAll(ss.str(), "^", "\\^"); + return replaceAll(tmp, "_", "\\_"); } bool ConfigurationTable::defines(const string& key) diff --git a/CommonLibs/F16.h b/CommonLibs/F16.h deleted file mode 100644 index aa292f0..0000000 --- a/CommonLibs/F16.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -* Copyright 2009 Free Software Foundation, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - -#ifndef F16_H -#define F16_H - -#include -#include - - - -/** Round a float to the appropriate F16 value. */ -inline int32_t _f16_round(float f) -{ - if (f>0.0F) return (int32_t)(f+0.5F); - if (f<0.0F) return (int32_t)(f-0.5F); - return 0; -} - - - -/** A class for F15.16 fixed point arithmetic with saturation. */ -class F16 { - - - private: - - int32_t mV; - - - public: - - F16() {} - - F16(int i) { mV = i<<16; } - F16(float f) { mV = _f16_round(f*65536.0F); } - F16(double f) { mV = _f16_round((float)f*65536.0F); } - - int32_t& raw() { return mV; } - const int32_t& raw() const { return mV; } - - float f() const { return mV/65536.0F; } - - //operator float() const { return mV/65536.0F; } - //operator int() const { return mV>>16; } - - F16 operator=(float f) - { - mV = _f16_round(f*65536.0F); - return *this; - } - - F16 operator=(int i) - { - mV = i<<16; - return *this; - } - - F16 operator=(const F16& other) - { - mV = other.mV; - return mV; - } - - F16 operator+(const F16& other) const - { - F16 retVal; - retVal.mV = mV + other.mV; - return retVal; - } - - F16& operator+=(const F16& other) - { - mV += other.mV; - return *this; - } - - F16 operator-(const F16& other) const - { - F16 retVal; - retVal.mV = mV - other.mV; - return retVal; - } - - F16& operator-=(const F16& other) - { - mV -= other.mV; - return *this; - } - - F16 operator*(const F16& other) const - { - F16 retVal; - int64_t p = (int64_t)mV * (int64_t)other.mV; - retVal.mV = p>>16; - return retVal; - } - - F16& operator*=(const F16& other) - { - int64_t p = (int64_t)mV * (int64_t)other.mV; - mV = p>>16; - return *this; - } - - F16 operator*(float f) const - { - F16 retVal; - retVal.mV = mV * f; - return retVal; - } - - F16& operator*=(float f) - { - mV *= f; - return *this; - } - - F16 operator/(const F16& other) const - { - F16 retVal; - int64_t pV = (int64_t)mV << 16; - retVal.mV = pV / other.mV; - return retVal; - } - - F16& operator/=(const F16& other) - { - int64_t pV = (int64_t)mV << 16; - mV = pV / other.mV; - return *this; - } - - F16 operator/(float f) const - { - F16 retVal; - retVal.mV = mV / f; - return retVal; - } - - F16& operator/=(float f) - { - mV /= f; - return *this; - } - - bool operator>(const F16& other) const - { - return mV>other.mV; - } - - bool operator<(const F16& other) const - { - return mV(float f) const - { - return (mV/65536.0F) > f; - } - - bool operator<(float f) const - { - return (mV/65536.0F) < f; - } - - bool operator==(float f) const - { - return (mV/65536.0F) == f; - } - -}; - - - -inline std::ostream& operator<<(std::ostream& os, const F16& v) -{ - os << v.f(); - return os; -} - -#endif - diff --git a/CommonLibs/F16Test.cpp b/CommonLibs/F16Test.cpp deleted file mode 100644 index 7f3c84d..0000000 --- a/CommonLibs/F16Test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright 2009 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#include "F16.h" - - -#include - -using namespace std; - -int main(int argc, char **argv) -{ - - F16 a = 2.5; - F16 b = 1.5; - F16 c = 2.5 * 1.5; - F16 d = c + a; - F16 e = 10; - cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl; - - a *= 3; - b *= 0.3; - c *= e; - cout << a << ' ' << b << ' ' << c << ' ' << d << endl; - - a /= 3; - b /= 0.3; - c = d * 0.05; - cout << a << ' ' << b << ' ' << c << ' ' << d << endl; - - F16 f = a/d; - cout << f << ' ' << f+0.5 << endl; -} diff --git a/CommonLibs/Logger.cpp b/CommonLibs/Logger.cpp index 82391cc..4e4dbbc 100644 --- a/CommonLibs/Logger.cpp +++ b/CommonLibs/Logger.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // For gettimeofday #include "Configuration.h" #include "Logger.h" @@ -111,6 +112,31 @@ return level; } +static std::string format(const char *fmt, ...) +{ + va_list ap; + char buf[300]; + va_start(ap,fmt); + int n = vsnprintf(buf,300,fmt,ap); + va_end(ap); + if (n >= (300-4)) { strcpy(&buf[(300-4)],"..."); } + return std::string(buf); +} + +const std::string timestr() +{ + struct timeval tv; + struct tm tm; + gettimeofday(&tv,NULL); + localtime_r(&tv.tv_sec,&tm); + unsigned tenths = tv.tv_usec / 100000; // Rounding down is ok. + return format(" %02d:%02d:%02d.%1d",tm.tm_hour,tm.tm_min,tm.tm_sec,tenths); +} + +std::ostream& operator<<(std::ostream& os, std::ostringstream& ss) +{ + return os << ss.str(); +} int getLoggingLevel(const char* filename) { diff --git a/CommonLibs/Logger.h b/CommonLibs/Logger.h index 9667f36..68c5a9b 100644 --- a/CommonLibs/Logger.h +++ b/CommonLibs/Logger.h @@ -83,7 +83,6 @@ #include "Threads.h" // must be after defines above, if these files are to be allowed to use LOG() -#include "Utils.h" /** A C++ stream-based thread-safe logger. @@ -123,6 +122,8 @@ std::list gGetLoggerAlarms(); ///< Get a copy of the recent alarm list. +const std::string timestr(); // A timestamp to print in messages. +std::ostream& operator<<(std::ostream& os, std::ostringstream& ss); /**@ Global control and initialization of the logging system. */ //@{ diff --git a/CommonLibs/Makefile.am b/CommonLibs/Makefile.am index ed9cf29..f0f1061 100644 --- a/CommonLibs/Makefile.am +++ b/CommonLibs/Makefile.am @@ -36,24 +36,18 @@ Sockets.cpp \ Threads.cpp \ Timeval.cpp \ - Reporting.cpp \ Logger.cpp \ Configuration.cpp \ - sqlite3util.cpp \ - URLEncode.cpp \ - Utils.cpp + sqlite3util.cpp noinst_PROGRAMS = \ BitVectorTest \ InterthreadTest \ SocketsTest \ TimevalTest \ - RegexpTest \ VectorTest \ ConfigurationTest \ - LogTest \ - URLEncodeTest \ - F16Test + LogTest # ReportingTest @@ -64,18 +58,10 @@ Sockets.h \ Threads.h \ Timeval.h \ - Regexp.h \ Vector.h \ Configuration.h \ - Reporting.h \ - F16.h \ - URLEncode.h \ - Utils.h \ Logger.h \ sqlite3util.h - -URLEncodeTest_SOURCES = URLEncodeTest.cpp -URLEncodeTest_LDADD = libcommon.la BitVectorTest_SOURCES = BitVectorTest.cpp BitVectorTest_LDADD = libcommon.la $(SQLITE3_LIBS) @@ -94,9 +80,6 @@ VectorTest_SOURCES = VectorTest.cpp VectorTest_LDADD = libcommon.la $(SQLITE3_LIBS) -RegexpTest_SOURCES = RegexpTest.cpp -RegexpTest_LDADD = libcommon.la - ConfigurationTest_SOURCES = ConfigurationTest.cpp ConfigurationTest_LDADD = libcommon.la $(SQLITE3_LIBS) @@ -105,8 +88,6 @@ LogTest_SOURCES = LogTest.cpp LogTest_LDADD = libcommon.la $(SQLITE3_LIBS) - -F16Test_SOURCES = F16Test.cpp MOSTLYCLEANFILES += testSource testDestination diff --git a/CommonLibs/MemoryLeak.h b/CommonLibs/MemoryLeak.h deleted file mode 100644 index 4948534..0000000 --- a/CommonLibs/MemoryLeak.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ -#ifndef _MEMORYLEAK_ -#define _MEMORYLEAK_ 1 -#include -#include "ScalarTypes.h" -#include "Logger.h" - -namespace Utils { - -struct MemStats { - // Enumerates the classes that are checked. - // Redundancies are ok, for example, we check BitVector and also - // several descendants of BitVector. - enum MemoryNames { - mZeroIsUnused, - mVector, - mVectorData, - mBitVector, - mByteVector, - mByteVectorData, - mRLCRawBlock, - mRLCUplinkDataBlock, - mRLCMessage, - mRLCMsgPacketDownlinkDummyControlBlock, // Redundant with RLCMessage - mTBF, - mLlcEngine, - mSgsnDownlinkMsg, - mRachInfo, - mPdpPdu, - mFECDispatchInfo, - mL3Frame, - msignalVector, - mSoftVector, - mScramblingCode, - mURlcDownSdu, - mURlcPdu, - // Must be last: - mMax, - }; - int mMemTotal[mMax]; // In elements, not bytes. - int mMemNow[mMax]; - const char *mMemName[mMax]; - MemStats(); - void memChkNew(MemoryNames memIndex, const char *id); - void memChkDel(MemoryNames memIndex, const char *id); - void text(std::ostream &os); - // We would prefer to use an unordered_map, but that requires special compile switches. - // What a super great language. - typedef std::map MemMapType; - MemMapType mMemMap; -}; -extern struct MemStats gMemStats; -extern int gMemLeakDebug; - -// This is a memory leak detector. -// Use by putting RN_MEMCHKNEW and RN_MEMCHKDEL in class constructors/destructors, -// or use the DEFINE_MEMORY_LEAK_DETECTOR class and add the defined class -// as an ancestor to the class to be memory leak checked. - -struct MemLabel { - std::string mccKey; - virtual ~MemLabel() { - Int_z &tmp = Utils::gMemStats.mMemMap[mccKey]; tmp = tmp - 1; - } -}; - -#if RN_DISABLE_MEMORY_LEAK_TEST -#define RN_MEMCHKNEW(type) -#define RN_MEMCHKDEL(type) -#define RN_MEMLOG(type,ptr) -#define DEFINE_MEMORY_LEAK_DETECTOR_CLASS(subClass,checkerClass) \ - struct checkerClass {}; -#else - -#define RN_MEMCHKNEW(type) { Utils::gMemStats.memChkNew(Utils::MemStats::m##type,#type); } -#define RN_MEMCHKDEL(type) { Utils::gMemStats.memChkDel(Utils::MemStats::m##type,#type); } - -#define RN_MEMLOG(type,ptr) { \ - static std::string key = format("%s_%s:%d",#type,__FILE__,__LINE__); \ - (ptr)->/* MemCheck##type:: */ mccKey = key; \ - Utils::gMemStats.mMemMap[key]++; \ - } - -// TODO: The above assumes that checkclass is MemCheck ## subClass -#define DEFINE_MEMORY_LEAK_DETECTOR_CLASS(subClass,checkerClass) \ - struct checkerClass : public virtual Utils::MemLabel { \ - checkerClass() { RN_MEMCHKNEW(subClass); } \ - virtual ~checkerClass() { \ - RN_MEMCHKDEL(subClass); \ - } \ - }; - -#endif - -} // namespace Utils - -#endif diff --git a/CommonLibs/Regexp.h b/CommonLibs/Regexp.h deleted file mode 100644 index 3ff1e97..0000000 --- a/CommonLibs/Regexp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright 2008 Free Software Foundation, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - -#ifndef REGEXPW_H -#define REGEXPW_H - -#include -#include -#include - - - -class Regexp { - - private: - - regex_t mRegex; - - - public: - - Regexp(const char* regexp, int flags=REG_EXTENDED) - { - int result = regcomp(&mRegex, regexp, flags); - if (result) { - char msg[256]; - regerror(result,&mRegex,msg,255); - std::cerr << "Regexp compilation of " << regexp << " failed: " << msg << std::endl; - abort(); - } - } - - ~Regexp() - { regfree(&mRegex); } - - bool match(const char *text, int flags=0) const - { return regexec(&mRegex, text, 0, NULL, flags)==0; } - -}; - - -#endif diff --git a/CommonLibs/RegexpTest.cpp b/CommonLibs/RegexpTest.cpp deleted file mode 100644 index 748be49..0000000 --- a/CommonLibs/RegexpTest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright 2008 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - - -#include "Regexp.h" -#include - -using namespace std; - - -int main(int argc, char *argv[]) -{ - - Regexp email("^[[:graph:]]+@[[:graph:]]+ "); - Regexp simple("^dburgess@"); - - const char text1[] = "dburgess at jcis.net test message"; - const char text2[] = "no address text message"; - - cout << email.match(text1) << " " << text1 << endl; - cout << email.match(text2) << " " << text2 << endl; - - cout << simple.match(text1) << " " << text1 << endl; - cout << simple.match(text2) << " " << text2 << endl; -} diff --git a/CommonLibs/Reporting.cpp b/CommonLibs/Reporting.cpp deleted file mode 100644 index 3ea7eed..0000000 --- a/CommonLibs/Reporting.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**@file Module for performance-reporting mechanisms. */ -/* -* Copyright 2012 Range Networks, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#include "Reporting.h" -#include "Logger.h" -#include -#include - -static const char* createReportingTable = { - "CREATE TABLE IF NOT EXISTS REPORTING (" - "NAME TEXT UNIQUE NOT NULL, " - "VALUE INTEGER DEFAULT 0, " - "CLEAREDTIME INTEGER NOT NULL, " - "UPDATETIME INTEGER DEFAULT 0 " - ")" -}; - - -ReportingTable::ReportingTable(const char* filename) -{ - gLogEarly(LOG_INFO | mFacility, "opening reporting table from path %s", filename); - // Connect to the database. - int rc = sqlite3_open(filename,&mDB); - if (rc) { - gLogEarly(LOG_EMERG | mFacility, "cannot open reporting database at %s, error message: %s", filename, sqlite3_errmsg(mDB)); - sqlite3_close(mDB); - mDB = NULL; - return; - } - // Create the table, if needed. - if (!sqlite3_command(mDB,createReportingTable)) { - gLogEarly(LOG_EMERG | mFacility, "cannot create reporting table in database at %s, error message: %s", filename, sqlite3_errmsg(mDB)); - } -} - - -bool ReportingTable::create(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"INSERT OR IGNORE INTO REPORTING (NAME,CLEAREDTIME) VALUES (\"%s\",%ld)", paramName, time(NULL)); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot create reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - - -bool ReportingTable::incr(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=VALUE+1, UPDATETIME=%ld WHERE NAME=\"%s\"", time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot increment reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - - -bool ReportingTable::max(const char* paramName, unsigned newVal) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=MAX(VALUE,%u), UPDATETIME=%ld WHERE NAME=\"%s\"", newVal, time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot maximize reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - -bool ReportingTable::clear(const char* paramName) -{ - char cmd[200]; - sprintf(cmd,"UPDATE REPORTING SET VALUE=0, UPDATETIME=0, CLEAREDTIME=%ld WHERE NAME=\"%s\"", time(NULL), paramName); - if (!sqlite3_command(mDB,cmd)) { - gLogEarly(LOG_CRIT|mFacility, "cannot clear reporting parameter %s, error message: %s", paramName, sqlite3_errmsg(mDB)); - return false; - } - return true; -} - - -bool ReportingTable::create(const char* baseName, unsigned minIndex, unsigned maxIndex) -{ - size_t sz = strlen(baseName); - for (unsigned i = minIndex; i<=maxIndex; i++) { - char name[sz+10]; - sprintf(name,"%s.%u",baseName,i); - if (!create(name)) return false; - } - return true; -} - -bool ReportingTable::incr(const char* baseName, unsigned index) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return incr(name); -} - - -bool ReportingTable::max(const char* baseName, unsigned index, unsigned newVal) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return max(name,newVal); -} - - -bool ReportingTable::clear(const char* baseName, unsigned index) -{ - char name[strlen(baseName)+10]; - sprintf(name,"%s.%u",baseName,index); - return clear(name); -} - - - - diff --git a/CommonLibs/Reporting.h b/CommonLibs/Reporting.h deleted file mode 100644 index 1878618..0000000 --- a/CommonLibs/Reporting.h +++ /dev/null @@ -1,86 +0,0 @@ -/**@file Module for performance-reporting mechanisms. */ -/* -* Copyright 2012 Range Networks, Inc. -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - -#ifndef REPORTING_H -#define REPORTING_H - -#include -#include - - -/** - Collect performance statistics into a database. - Parameters are counters or max/min trackers, all integer. -*/ -class ReportingTable { - - private: - - sqlite3* mDB; ///< database connection - int mFacility; ///< rsyslogd facility - - - - public: - - /** - Open the database connection; - create the table if it does not exist yet. - */ - ReportingTable(const char* filename); - - /** Create a new parameter. */ - bool create(const char* paramName); - - /** Create an indexed parameter set. */ - bool create(const char* baseBame, unsigned minIndex, unsigned maxIndex); - - /** Increment a counter. */ - bool incr(const char* paramName); - - /** Increment an indexed counter. */ - bool incr(const char* baseName, unsigned index); - - /** Take a max of a parameter. */ - bool max(const char* paramName, unsigned newVal); - - /** Take a max of an indexed parameter. */ - bool max(const char* paramName, unsigned index, unsigned newVal); - - /** Clear a value. */ - bool clear(const char* paramName); - - /** Clear an indexed value. */ - bool clear(const char* paramName, unsigned index); - - /** Dump the database to a stream. */ - void dump(std::ostream&) const; - -}; - -#endif - - -// vim: ts=4 sw=4 diff --git a/CommonLibs/ScalarTypes.h b/CommonLibs/ScalarTypes.h deleted file mode 100644 index 077d889..0000000 --- a/CommonLibs/ScalarTypes.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#ifndef SCALARTYPES_H -#define SCALARTYPES_H -#include // For size_t -#include -//#include "GSMCommon.h" // Was included for Z100Timer - -// We dont bother to define *= /= etc.; you'll have to convert: a*=b; to: a=a*b; -#define _INITIALIZED_SCALAR_BASE_FUNCS(Classname,Basetype,Init) \ - Classname() : value(Init) {} \ - Classname(Basetype wvalue) { value = wvalue; } /* Can set from basetype. */ \ - operator Basetype(void) const { return value; } /* Converts from basetype. */ \ - Basetype operator=(Basetype wvalue) { return value = wvalue; } \ - Basetype* operator&() { return &value; } - -#define _INITIALIZED_SCALAR_ARITH_FUNCS(Basetype) \ - Basetype operator++() { return ++value; } \ - Basetype operator++(int) { return value++; } \ - Basetype operator--() { return --value; } \ - Basetype operator--(int) { return value--; } \ - Basetype operator+=(Basetype wvalue) { return value = value + wvalue; } \ - Basetype operator-=(Basetype wvalue) { return value = value - wvalue; } - -#define _INITIALIZED_SCALAR_FUNCS(Classname,Basetype,Init) \ - _INITIALIZED_SCALAR_BASE_FUNCS(Classname,Basetype,Init) \ - _INITIALIZED_SCALAR_ARITH_FUNCS(Basetype) - - -#define _DECLARE_SCALAR_TYPE(Classname_i,Classname_z,Basetype) \ - template \ - struct Classname_i { \ - Basetype value; \ - _INITIALIZED_SCALAR_FUNCS(Classname_i,Basetype,Init) \ - }; \ - typedef Classname_i<0> Classname_z; - - -// Usage: -// Where 'classname' is one of the types listed below, then: -// classname_z specifies a zero initialized type; -// classname_i initializes the type to the specified value. -// We also define Float_z. -_DECLARE_SCALAR_TYPE(Int_i, Int_z, int) -_DECLARE_SCALAR_TYPE(Char_i, Char_z, signed char) -_DECLARE_SCALAR_TYPE(Int16_i, Int16_z, int16_t) -_DECLARE_SCALAR_TYPE(Int32_i, Int32_z, int32_t) -_DECLARE_SCALAR_TYPE(UInt_i, UInt_z, unsigned) -_DECLARE_SCALAR_TYPE(UChar_i, UChar_z, unsigned char) -_DECLARE_SCALAR_TYPE(UInt16_i, UInt16_z, uint16_t) -_DECLARE_SCALAR_TYPE(UInt32_i, UInt32_z, uint32_t) -_DECLARE_SCALAR_TYPE(Size_t_i, Size_t_z, size_t) - -// Bool is special because it cannot accept some arithmetic funcs -//_DECLARE_SCALAR_TYPE(Bool_i, Bool_z, bool) -template -struct Bool_i { - bool value; - _INITIALIZED_SCALAR_BASE_FUNCS(Bool_i,bool,Init) -}; -typedef Bool_i<0> Bool_z; - -// float is special, because C++ does not permit the template initalization: -struct Float_z { - float value; - _INITIALIZED_SCALAR_FUNCS(Float_z,float,0) -}; -struct Double_z { - double value; - _INITIALIZED_SCALAR_FUNCS(Double_z,double,0) -}; - - -class ItemWithValueAndWidth { - public: - virtual unsigned getValue() const = 0; - virtual unsigned getWidth() const = 0; -}; - -// A Range Networks Field with a specified width. -// See RLCMessages.h for examples. -template -class Field_i : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field_i,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - -// Synonym for Field_i, but no way to do it. -template -class Field_z : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field_z,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - -// This is an uninitialized field. -template -class Field : public ItemWithValueAndWidth -{ - public: - unsigned value; - _INITIALIZED_SCALAR_FUNCS(Field,unsigned,Init) - unsigned getWidth() const { return Width; } - unsigned getValue() const { return value; } -}; - - -// A Z100Timer with an initial value specified. -//template -//class Z100Timer_i : public GSM::Z100Timer { -// public: -// Z100Timer_i() : GSM::Z100Timer(Init) {} -//}; - -#endif diff --git a/CommonLibs/URLEncode.cpp b/CommonLibs/URLEncode.cpp deleted file mode 100644 index cdf38dd..0000000 --- a/CommonLibs/URLEncode.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2011, Range Networks, Inc. */ - -#include -#include -#include -#include - -using namespace std; - -//based on javascript encodeURIComponent() -string URLEncode(const string &c) -{ - static const char *digits = "01234567890ABCDEF"; - string retVal=""; - for (size_t i=0; i>4) & 0x0f]; - retVal += digits[ch & 0x0f]; - } - } - return retVal; -} - diff --git a/CommonLibs/URLEncode.h b/CommonLibs/URLEncode.h deleted file mode 100644 index 558ced9..0000000 --- a/CommonLibs/URLEncode.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Copyright 2011 Free Software Foundation, Inc. -* -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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 . - -*/ - - - -# include - -std::string URLEncode(const std::string&); diff --git a/CommonLibs/URLEncodeTest.cpp b/CommonLibs/URLEncodeTest.cpp deleted file mode 100644 index dbc4630..0000000 --- a/CommonLibs/URLEncodeTest.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -#include "URLEncode.h" -#include -#include - - -using namespace std; - - -int main(int argc, char *argv[]) -{ - - string test = string("Testing: !@#$%^&*() " __DATE__ " " __TIME__); - cout << test << endl; - cout << URLEncode(test) << endl; -} - diff --git a/CommonLibs/Utils.cpp b/CommonLibs/Utils.cpp deleted file mode 100644 index 1da95fa..0000000 --- a/CommonLibs/Utils.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#include // For usleep -#include // For gettimeofday -#include // For vsnprintf -#include // For ostream -#include // For ostringstream -#include // For strcpy -//#include "GSMCommon.h" -#include "Utils.h" -#include "MemoryLeak.h" - -namespace Utils { - -MemStats gMemStats; -int gMemLeakDebug = 0; - -MemStats::MemStats() -{ - memset(mMemNow,0,sizeof(mMemNow)); - memset(mMemTotal,0,sizeof(mMemTotal)); - memset(mMemName,0,sizeof(mMemName)); -} - -void MemStats::text(std::ostream &os) -{ - os << "Structs current total:\n"; - for (int i = 0; i < mMax; i++) { - os << "\t" << (mMemName[i] ? mMemName[i] : "unknown") << " " << mMemNow[i] << " " << mMemTotal[i] << "\n"; - } -} - -void MemStats::memChkNew(MemoryNames memIndex, const char *id) -{ - /*std::cout << "new " #type "\n";*/ - mMemNow[memIndex]++; - mMemTotal[memIndex]++; - mMemName[memIndex] = id; -} - -void MemStats::memChkDel(MemoryNames memIndex, const char *id) -{ - /*std::cout << "del " #type "\n";*/ - mMemNow[memIndex]--; - if (mMemNow[memIndex] < 0) { - LOG(ERR) << "Memory underflow on type "<= (300-4)) { strcpy(&buf[(300-4)],"..."); } - os << buf; - return os; -} - -std::string format(const char *fmt, ...) -{ - va_list ap; - char buf[300]; - va_start(ap,fmt); - int n = vsnprintf(buf,300,fmt,ap); - va_end(ap); - if (n >= (300-4)) { strcpy(&buf[(300-4)],"..."); } - return std::string(buf); -} - -// Return time in seconds with high resolution. -// Note: In the past I found this to be a surprisingly expensive system call in linux. -double timef() -{ - struct timeval tv; - gettimeofday(&tv,NULL); - return tv.tv_usec / 1000000.0 + tv.tv_sec; -} - -const std::string timestr() -{ - struct timeval tv; - struct tm tm; - gettimeofday(&tv,NULL); - localtime_r(&tv.tv_sec,&tm); - unsigned tenths = tv.tv_usec / 100000; // Rounding down is ok. - return format(" %02d:%02d:%02d.%1d",tm.tm_hour,tm.tm_min,tm.tm_sec,tenths); -} - -// High resolution sleep for the specified time. -// Return FALSE if time is already past. -void sleepf(double howlong) -{ - if (howlong <= 0.00001) return; // Less than 10 usecs, forget it. - usleep((useconds_t) (1000000.0 * howlong)); -} - -//bool sleepuntil(double untilwhen) -//{ - //double now = timef(); - //double howlong = untilwhen - now; // Fractional time in seconds. - // We are not worrying about overflow because all times should be in the near future. - //if (howlong <= 0.00001) return false; // Less than 10 usecs, forget it. - //sleepf(sleeptime); -//} - -std::string Text2Str::str() const -{ - std::ostringstream ss; - text(ss); - return ss.str(); -} - -std::ostream& operator<<(std::ostream& os, const Text2Str *val) -{ - std::ostringstream ss; - if (val) { - val->text(ss); - os << ss.str(); - } else { - os << "(null)"; - } - return os; -} - -// Greatest Common Denominator. -// This is by Doug Brown. -int gcd(int x, int y) -{ - if (x > y) { - return x % y == 0 ? y : gcd(y, x % y); - } else { - return y % x == 0 ? x : gcd(x, y % x); - } -} - - -// Split a C string into an argc,argv array in place; the input string is modified. -// Returns argc, and places results in argv, up to maxargc elements. -// The final argv receives the rest of the input string from maxargc on, -// even if it contains additional splitchars. -// The correct idiom for use is to make a copy of your string, like this: -// char *copy = strcpy((char*)alloca(the_string.length()+1),the_string.c_str()); -// char *argv[2]; -// int argc = cstrSplit(copy,argv,2,NULL); -// If you want to detect the error of too many arguments, add 1 to argv, like this: -// char *argv[3]; -// int argc = cstrSplit(copy,argv,3,NULL); -// if (argc == 3) { error("too many arguments"; } -int cstrSplit(char *in, char **pargv,int maxargc, const char *splitchars) -{ - if (splitchars == NULL) { splitchars = " \t\r\n"; } // Default is any space. - int argc = 0; - while (argc < maxargc) { - while (*in && strchr(splitchars,*in)) {in++;} // scan past any splitchars - if (! *in) return argc; // return if finished. - pargv[argc++] = in; // save ptr to start of arg. - in = strpbrk(in,splitchars); // go to end of arg. - if (!in) return argc; // return if finished. - *in++ = 0; // zero terminate this arg. - } - return argc; -} - -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } -std::ostream& operator<<(std::ostream& os, const Statistic &stat) { stat.text(os); return os; } - -std::string replaceAll(const std::string input, const std::string search, const std::string replace) -{ - std::string output = input; - int index = 0; - - while (true) { - index = output.find(search, index); - if (index == std::string::npos) { - break; - } - - output.replace(index, replace.length(), replace); - index += replace.length(); - } - - return output; -} - -}; diff --git a/CommonLibs/Utils.h b/CommonLibs/Utils.h deleted file mode 100644 index 0bc738e..0000000 --- a/CommonLibs/Utils.h +++ /dev/null @@ -1,148 +0,0 @@ -/* -* Copyright 2011 Range Networks, Inc. -* All Rights Reserved. -* -* This software is distributed under multiple licenses; -* see the COPYING file in the main directory for licensing -* information for this specific distribuion. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - - 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. -*/ - -#ifndef GPRSUTILS_H -#define GPRSUTILS_H -#include -#include -#include -#include -#include // for sqrtf -#include "Logger.h" - - -namespace Utils { - -extern double timef(); // high resolution time -extern const std::string timestr(); // A timestamp to print in messages. -extern void sleepf(double howlong); // high resolution sleep -extern int gcd(int x, int y); - -// It is irritating to create a string just to interface to the brain-damaged -// C++ stream class, but this is only used for debug messages. -std::string format(const char *fmt, ...) __attribute__((format (printf,1,2))); - -int cstrSplit(char *in, char **pargv,int maxargc, const char *splitchars=NULL); - -// For classes with a text() function, provide a function to return a String, -// and also a standard << stream function that takes a pointer to the object. -// We dont provide the function that takes a reference to the object -// because it is too highly overloaded and generally doesnt work. -class Text2Str { - public: - virtual void text(std::ostream &os) const = 0; - std::string str() const; -}; -std::ostream& operator<<(std::ostream& os, const Text2Str *val); - -#if 0 -// Generic Activity Timer. Lots of controls to make everybody happy. -class ATimer { - double mStart; - //bool mActive; - double mLimitTime; - public: - ATimer() : mStart(0), mLimitTime(0) { } - ATimer(double wLimitTime) : mStart(0), mLimitTime(wLimitTime) { } - void start() { mStart=timef(); } - void stop() { mStart=0; } - bool active() { return !!mStart; } - double elapsed() { return timef() - mStart; } - bool expired() { return elapsed() > mLimitTime; } -}; -#endif - - -struct BitSet { - unsigned mBits; - void setBit(unsigned whichbit) { mBits |= 1< struct Statistic { - Type mCurrent, mMin, mMax; // min,max optional initialization so you can print before adding any values. - unsigned mCnt; - double mSum; - //double mSum2; // sum of squares. - // (Type) cast needed in case Type is an enum, stupid language. - Statistic() : mCurrent((Type)0), mMin((Type)0), mMax((Type)0), mCnt(0), mSum(0) /*,mSum2(0)*/ {} - // Set the current value and add a statisical point. - void addPoint(Type val) { - mCurrent = val; - if (mCnt == 0 || val < mMin) {mMin = val;} - if (mCnt == 0 || val > mMax) {mMax = val;} - mCnt++; - mSum += val; - //mSum2 += val * val; - } - Type getCurrent() const { // Return current value. - return mCnt ? mCurrent : 0; - } - double getAvg() const { // Return average. - return mCnt==0 ? 0 : mSum/mCnt; - }; - //float getSD() const { // Return standard deviation. Use low precision square root function. - // return mCnt==0 ? 0 : sqrtf(mCnt * mSum2 - mSum*mSum) / mCnt; - //} - - void text(std::ostream &os) const { // Print everything in parens. - os << "("< &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); -std::ostream& operator<<(std::ostream& os, const Statistic &stat); - - -// Yes, they botched and left this out: -std::ostream& operator<<(std::ostream& os, std::ostringstream& ss); - -std::ostream &osprintf(std::ostream &os, const char *fmt, ...) __attribute__((format (printf,2,3))); - -std::string replaceAll(const std::string input, const std::string search, const std::string replace); - -}; // namespace - -using namespace Utils; - -#endif -- To view, visit https://gerrit.osmocom.org/2125 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Mon Mar 20 18:38:08 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Mon, 20 Mar 2017 18:38:08 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Typo sybols -> symbols In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: Typo sybols -> symbols ...................................................................... sigProcLib: Typo sybols -> symbols Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a --- M Transceiver52M/sigProcLib.cpp 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index a361eff..2a22e49 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1124,7 +1124,7 @@ * Modulate 8-PSK burst. When empty pulse shaping (rotation only) * is enabled, the output vector length will be bit sequence length * times the SPS value. When pulse shaping is enabled, the output - * vector length is fixed at 625 samples (156.25 sybols at 4 SPS). + * vector length is fixed at 625 samples (156.25 symbols at 4 SPS). * Pulse shaped bit sequences that go beyond one burst are truncated. * Pulse shaping at anything but 4 SPS is not supported. */ -- To view, visit https://gerrit.osmocom.org/2126 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8cbef852374d0458c4f4ad4be0df0aa998e3796a Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Mon Mar 20 18:42:56 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Mon, 20 Mar 2017 18:42:56 +0000 Subject: [MERGED] osmo-trx[master]: radioBuffer: Remove extra ; at the end of inline function de... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: radioBuffer: Remove extra ; at the end of inline function definitions. ...................................................................... radioBuffer: Remove extra ; at the end of inline function definitions. Change-Id: I8911adf0a0bb1ae828ac9cdf1a76c904639f6c06 --- M Transceiver52M/radioBuffer.h 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/radioBuffer.h b/Transceiver52M/radioBuffer.h index afb6e63..e5aa315 100644 --- a/Transceiver52M/radioBuffer.h +++ b/Transceiver52M/radioBuffer.h @@ -9,10 +9,10 @@ ~RadioBuffer(); - const size_t getSegmentLen() { return segmentLen; }; - const size_t getNumSegments() { return numSegments; }; - const size_t getAvailSamples() { return availSamples; }; - const size_t getAvailSegments() { return availSamples / segmentLen; }; + const size_t getSegmentLen() { return segmentLen; } + const size_t getNumSegments() { return numSegments; } + const size_t getAvailSamples() { return availSamples; } + const size_t getAvailSegments() { return availSamples / segmentLen; } const size_t getFreeSamples() { -- To view, visit https://gerrit.osmocom.org/2127 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8911adf0a0bb1ae828ac9cdf1a76c904639f6c06 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Mon Mar 20 18:43:07 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Mon, 20 Mar 2017 18:43:07 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Fix documentation, sync argument names in .cpp a... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: Fix documentation, sync argument names in .cpp and .h files. ...................................................................... sigProcLib: Fix documentation, sync argument names in .cpp and .h files. Documentation in sigProcLib.h was noticeably out of sync with the actual implementation - e.g. not all arguments were documented and arguments which are already removed are still in the documentation. Also argument names were different between declaration in .h and implementation in .cpp which was confusing. I've fixed this for detect*Burst() functions. Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 49 insertions(+), 47 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 2a22e49..c1cf12e 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1876,22 +1876,22 @@ * head: Search 8 symbols before target * tail: Search 8 symbols + maximum expected delay */ -int detectRACHBurst(signalVector &rxBurst, - float thresh, +int detectRACHBurst(signalVector &burst, + float threshold, int sps, - complex &, + complex &litude, float &toa, - unsigned maxTOA) + unsigned max_toa) { int rc, target, head, tail; CorrelationSequence *sync; target = 8 + 40; head = 8; - tail = 8 + maxTOA; + tail = 8 + max_toa; sync = gRACHSequence; - rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, + rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, target, head, tail, sync); return rc; @@ -1905,8 +1905,8 @@ * head: Search 6 symbols before target * tail: Search 6 symbols + maximum expected delay */ -int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh, - int sps, complex &, float &toa, unsigned max_toa) +int analyzeTrafficBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; CorrelationSequence *sync; @@ -1919,13 +1919,13 @@ tail = 6 + max_toa; sync = gMidambles[tsc]; - rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, + rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, target, head, tail, sync); return rc; } -int detectEdgeBurst(signalVector &rxBurst, unsigned tsc, float thresh, - int sps, complex &, float &toa, unsigned max_toa) +int detectEdgeBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; CorrelationSequence *sync; @@ -1938,7 +1938,7 @@ tail = 6 + max_toa; sync = gEdgeMidambles[tsc]; - rc = detectGeneralBurst(rxBurst, thresh, sps, amp, toa, + rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, target, head, tail, sync); return rc; } diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index b4aee93..1b646cd 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -189,69 +189,71 @@ float *avgPwr = NULL); /** - RACH correlator/detector. - @param rxBurst The received GSM burst of interest. - @param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + RACH aka Access Burst correlator/detector. + @param burst The received GSM burst of interest. + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received RACH burst. - @param TOA The estimate time-of-arrival of received RACH burst. - @param maxTOA The maximum expected time-of-arrival - @return positive if threshold value is reached, negative on error, zero otherwise + @param toa The estimate time-of-arrival of received RACH burst. + @param max_toa The maximum expected time-of-arrival + @return 1 if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected */ -int detectRACHBurst(signalVector &rxBurst, - float detectThreshold, +int detectRACHBurst(signalVector &burst, + float threshold, int sps, complex &litude, - float &TOA, - unsigned maxTOA); + float &toa, + unsigned max_toa); /** - Normal burst correlator, detector, channel estimator. + GMSK Normal Burst correlator/detector. @param rxBurst The received GSM burst of interest. - - @param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received TSC burst. - @param TOA The estimate time-of-arrival of received TSC burst. - @param maxTOA The maximum expected time-of-arrival - @param requestChannel Set to true if channel estimation is desired. - @param channelResponse The estimated channel. - @param channelResponseOffset The time offset b/w the first sample of the channel response and the reported TOA. - @return positive if threshold value is reached, negative on error, zero otherwise + @param toa The estimate time-of-arrival of received TSC burst. + @param max_toa The maximum expected time-of-arrival + @return 1 if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected */ -int analyzeTrafficBurst(signalVector &rxBurst, - unsigned TSC, - float detectThreshold, +int analyzeTrafficBurst(signalVector &burst, + unsigned tsc, + float threshold, int sps, complex &litude, - float &TOA, - unsigned maxTOA); + float &toa, + unsigned max_toa); /** - EDGE burst detector + EDGE/8-PSK Normal Burst correlator/detector @param burst The received GSM burst of interest - - @param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. @param amplitude The estimated amplitude of received TSC burst. - @param TOA The estimate time-of-arrival of received TSC burst. - @param maxTOA The maximum expected time-of-arrival - @return positive if threshold value is reached, negative on error, zero otherwise + @param toa The estimate time-of-arrival of received TSC burst. + @param max_toa The maximum expected time-of-arrival + @return 1 if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected */ int detectEdgeBurst(signalVector &burst, - unsigned TSC, - float detectThreshold, + unsigned tsc, + float threshold, int sps, complex &litude, - float &TOA, - unsigned maxTOA); + float &toa, + unsigned max_toa); /** Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ - signalVector *downsampleBurst(signalVector &burst); /** -- To view, visit https://gerrit.osmocom.org/2128 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4dfd07125d9a1e9a42a78b79faff539f003deb16 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:39 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:39 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... Message-ID: Review at https://gerrit.osmocom.org/2136 sigProcLib: make energyDetect() simpler by returning actual energy. Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 3 files changed, 10 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/36/2136/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index f156ad4..3df482f 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -606,7 +606,7 @@ { int rc; complex amp; - float toa, pow, max = -1.0, avg = 0.0; + float toa, max = -1.0, avg = 0.0; int max_i = -1; signalVector *burst; SoftVector *bits = NULL; @@ -641,7 +641,7 @@ /* Select the diversity channel with highest energy */ for (size_t i = 0; i < radio_burst->chans(); i++) { - energyDetect(*radio_burst->getVector(i), 20 * mSPSRx, 0.0, &pow); + float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx); if (pow > max) { max = pow; max_i = i; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index c1cf12e..f9e21f0 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1721,10 +1721,8 @@ return (amp.abs()) / rms; } -bool energyDetect(signalVector &rxBurst, - unsigned windowLength, - float detectThreshold, - float *avgPwr) +float energyDetect(signalVector &rxBurst, + unsigned windowLength) { signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; @@ -1735,8 +1733,7 @@ energy += windowItr->norm2(); windowItr+=4; } - if (avgPwr) *avgPwr = energy/windowLength; - return (energy/windowLength > detectThreshold*detectThreshold); + return energy/windowLength; } /* diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 1b646cd..87c0229 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -176,17 +176,13 @@ complex scale); /** - Energy detector, checks to see if received burst energy is above a threshold. - @param rxBurst The received GSM burst of interest. + Rough energy estimator. + @param rxBurst A GSM burst. @param windowLength The number of burst samples used to compute burst energy - @param detectThreshold The detection threshold, a linear value. - @param avgPwr The average power of the received burst. - @return True if burst energy is above threshold. + @return The average power of the received burst. */ -bool energyDetect(signalVector &rxBurst, - unsigned windowLength, - float detectThreshold, - float *avgPwr = NULL); +float energyDetect(signalVector &rxBurst, + unsigned windowLength); /** RACH aka Access Burst correlator/detector. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:39 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:39 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Rename demodulateBurst() to demodGmskBurst() for... Message-ID: Review at https://gerrit.osmocom.org/2137 sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity. Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/37/2137/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index f9e21f0..1653ee9 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2051,7 +2051,7 @@ * 4 SPS (if activated) to minimize distortion through the fractional * delay filters. Symbol rotation and after always operates at 1 SPS. */ -SoftVector *demodulateBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, complex channel, float TOA) { SoftVector *bits; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 87c0229..7dca71f 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -261,16 +261,16 @@ signalVector *decimateVector(signalVector &wVector, size_t factor); /** - Demodulates a received burst using a soft-slicer. - @param rxBurst The burst to be demodulated. + Demodulates a GMSK burst using a soft-slicer. + @param rxBurst The burst to be demodulated. @param gsmPulse The GSM pulse. @param sps The number of samples per GSM symbol. @param channel The amplitude estimate of the received burst. @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodulateBurst(signalVector &rxBurst, int sps, - complex channel, float TOA); +SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, + complex channel, float TOA); /** Demodulate 8-PSK EDGE burst with soft symbol ooutput -- To view, visit https://gerrit.osmocom.org/2137 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:39 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:39 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Slice SoftVector instead of signalVector for GMS... Message-ID: Review at https://gerrit.osmocom.org/2138 sigProcLib: Slice SoftVector instead of signalVector for GMSK demod. This makes it similar to 8-PSK demod and also saves a bit of lines ofcode and should give us a tiny improvement in performance. Ideally we need to remove vector slicing at all, because in osmo-bts-trx we convert back to +-1.0 again (actually to +-127, but it doesn't mater). So we should rather transmit +-1.0 values to avoid double conversion. Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 22 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/38/2138/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 1653ee9..d82157e 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -737,20 +737,6 @@ return true; } -bool vectorSlicer(signalVector *x) -{ - - signalVector::iterator xP = x->begin(); - signalVector::iterator xPEnd = x->end(); - while (xP < xPEnd) { - *xP = (complex) (0.5*(xP->real()+1.0F)); - if (xP->real() > 1.0) *xP = 1.0; - if (xP->real() < 0.0) *xP = 0.0; - xP++; - } - return true; -} - static signalVector *rotateBurst(const BitVector &wBurst, int guardPeriodLength, int sps) { @@ -2021,6 +2007,22 @@ } /* + * Convert signalVector to SoftVector by taking real part of the signal. + */ +static SoftVector *signalToSoftVector(signalVector *dec) +{ + SoftVector *bits = new SoftVector(dec->size()); + + SoftVector::iterator bit_itr = bits->begin(); + signalVector::iterator burst_itr = dec->begin(); + + for (; burst_itr < dec->end(); burst_itr++) + *bit_itr++ = burst_itr->real(); + + return bits; +} + +/* * Shared portion of GMSK and EDGE demodulators consisting of timing * recovery and single tap channel correction. For 4 SPS (if activated), * the output is downsampled prior to the 1 SPS modulation specific @@ -2063,18 +2065,12 @@ /* Shift up by a quarter of a frequency */ GMSKReverseRotate(*dec, 1); - vectorSlicer(dec); - - bits = new SoftVector(dec->size()); - - SoftVector::iterator bit_itr = bits->begin(); - signalVector::iterator burst_itr = dec->begin(); - - for (; burst_itr < dec->end(); burst_itr++) - *bit_itr++ = burst_itr->real(); - + /* Take real part of the signal */ + bits = signalToSoftVector(dec); delete dec; + vectorSlicer(bits); + return bits; } diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 7dca71f..ed72430 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -101,8 +101,8 @@ unsigned startIx = 0, unsigned len = 0); -/** Operate soft slicer on real-valued portion of vector */ -bool vectorSlicer(signalVector *x); +/** Operate soft slicer on a soft-bit vector */ +bool vectorSlicer(SoftVector *x); /** GMSK modulate a GSM burst of bits */ signalVector *modulateBurst(const BitVector &wBurst, -- To view, visit https://gerrit.osmocom.org/2138 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:40 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:40 +0000 Subject: [PATCH] osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... Message-ID: Review at https://gerrit.osmocom.org/2139 Call vectorSlicer() right before packing bits for transmission to osmo-bts. Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/39/2139/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 3df482f..f462736 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -962,6 +962,9 @@ if (!rxBurst) return; + // Convert -1..+1 soft bits to 0..1 soft bits + vectorSlicer(rxBurst); + /* * EDGE demodulator returns 444 (148 * 3) bits */ diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index d82157e..9ea81c1 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2069,8 +2069,6 @@ bits = signalToSoftVector(dec); delete dec; - vectorSlicer(bits); - return bits; } @@ -2100,7 +2098,6 @@ /* Soft slice and normalize */ bits = softSliceEdgeBurst(*rot); - vectorSlicer(bits); delete dec; delete eq; -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:40 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:40 +0000 Subject: [PATCH] osmo-trx[master]: CommonLibs: Print soft bits with less confidence to console ... Message-ID: Review at https://gerrit.osmocom.org/2140 CommonLibs: Print soft bits with less confidence to console when printing a soft vector. We use other symbols to show that these bits has less confidence: o and . for 0 with less confidence | and ' for 1 with less confidence Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435 --- M CommonLibs/BitVector.cpp 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/40/2140/1 diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index 7487834..8389237 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -546,7 +546,11 @@ { for (size_t i=0; i0.75) os << "1"; + else if (sv[i]>0.6) os << "|"; + else if (sv[i]>0.5) os << "'"; else os << "-"; } return os; -- To view, visit https://gerrit.osmocom.org/2140 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:40 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:40 +0000 Subject: [PATCH] osmo-trx[master]: BitVector: Remove convolutional codec - we don't use it in o... Message-ID: Review at https://gerrit.osmocom.org/2141 BitVector: Remove convolutional codec - we don't use it in osmo-trx. Now we have more fexibility in how we represent SoftVector, since we no longer depend on the particular convolutional codec implementation. Change-Id: I3006b6a26c5eff59dbe9c034f689961802f1d0d0 --- M CommonLibs/BitVector.cpp M CommonLibs/BitVector.h M CommonLibs/BitVectorTest.cpp 3 files changed, 1 insertion(+), 411 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/41/2141/1 diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index 8389237..b77a4c4 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -217,30 +217,6 @@ } -void BitVector::encode(const ViterbiR2O4& coder, BitVector& target) -{ - size_t sz = size(); - assert(sz*coder.iRate() == target.size()); - - // Build a "history" array where each element contains the full history. - uint32_t history[sz]; - uint32_t accum = 0; - for (size_t i=0; iiState) << 1; // input state for 0 - const uint32_t iState1 = iState0 | 0x01; // input state for 1 - const uint32_t oStateShifted = (sp->oState) << mIRate; // shifted output - const float cost = sp->cost; - sp++; - // 0 input extension - mCandidates[i].cost = cost; - mCandidates[i].oState = oStateShifted | mGeneratorTable[iState0 & mCMask]; - mCandidates[i].iState = iState0; - // 1 input extension - mCandidates[i+1].cost = cost; - mCandidates[i+1].oState = oStateShifted | mGeneratorTable[iState1 & mCMask]; - mCandidates[i+1].iState = iState1; - } -} - - -void ViterbiR2O4::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) -{ - const float *cTab[2] = {matchCost,mismatchCost}; - for (unsigned i=0; i>1)&0x01][0]; - } -} - - -void ViterbiR2O4::pruneCandidates() -{ - const vCand* c1 = mCandidates; // 0-prefix - const vCand* c2 = mCandidates + mIStates; // 1-prefix - for (unsigned i=0; i=minCost) continue; - minCost = thisCost; - minIndex=i; - } - return mSurvivors[minIndex]; -} - - -const ViterbiR2O4::vCand& ViterbiR2O4::step(uint32_t inSample, const float *probs, const float *iprobs) -{ - branchCandidates(); - getSoftCostMetrics(inSample,probs,iprobs); - pruneCandidates(); - return minCost(); -} - - -uint64_t Parity::syndrome(const BitVector& receivedCodeword) -{ - return receivedCodeword.syndrome(*this); -} - - -void Parity::writeParityWord(const BitVector& data, BitVector& parityTarget, bool invert) -{ - uint64_t pWord = data.parity(*this); - if (invert) pWord = ~pWord; - parityTarget.fillField(0,pWord,size()); -} - - - - - - - - - SoftVector::SoftVector(const BitVector& source) { resize(source.size()); @@ -445,87 +285,6 @@ } - -void SoftVector::decode(ViterbiR2O4 &decoder, BitVector& target) const -{ - const size_t sz = size(); - const unsigned deferral = decoder.deferral(); - const size_t ctsz = sz + deferral*decoder.iRate(); - assert(sz <= decoder.iRate()*target.size()); - - // Build a "history" array where each element contains the full history. - uint32_t history[ctsz]; - { - BitVector bits = sliced(); - uint32_t accum = 0; - for (size_t i=0; i0.5F) pVal = 1.0F-pVal; - float ipVal = 1.0F-pVal; - // This is a cheap approximation to an ideal cost function. - if (pVal<0.01F) pVal = 0.01; - if (ipVal<0.01F) ipVal = 0.01; - matchCostTable[i] = 0.25F/ipVal; - mismatchCostTable[i] = 0.25F/pVal; - } - - // pad end of table with unknowns - for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; - oCount++; - } - } -} - - - -// (pat) Added 6-22-2012 float SoftVector::getEnergy(float *plow) const { const SoftVector &vec = *this; diff --git a/CommonLibs/BitVector.h b/CommonLibs/BitVector.h index e244be7..7473c32 100644 --- a/CommonLibs/BitVector.h +++ b/CommonLibs/BitVector.h @@ -89,142 +89,6 @@ - -/** Parity (CRC-type) generator and checker based on a Generator. */ -class Parity : public Generator { - - protected: - - unsigned mCodewordSize; - - public: - - Parity(uint64_t wCoefficients, unsigned wParitySize, unsigned wCodewordSize) - :Generator(wCoefficients, wParitySize), - mCodewordSize(wCodewordSize) - { } - - /** Compute the parity word and write it into the target segment. */ - void writeParityWord(const BitVector& data, BitVector& parityWordTarget, bool invert=true); - - /** Compute the syndrome of a received sequence. */ - uint64_t syndrome(const BitVector& receivedCodeword); -}; - - - - -/** - Class to represent convolutional coders/decoders of rate 1/2, memory length 4. - This is the "workhorse" coder for most GSM channels. -*/ -class ViterbiR2O4 { - - private: - /**name Lots of precomputed elements so the compiler can optimize like hell. */ - //@{ - /**@name Core values. */ - //@{ - static const unsigned mIRate = 2; ///< reciprocal of rate - static const unsigned mOrder = 4; ///< memory length of generators - //@} - /**@name Derived values. */ - //@{ - static const unsigned mIStates = 0x01 << mOrder; ///< number of states, number of survivors - static const uint32_t mSMask = mIStates-1; ///< survivor mask - static const uint32_t mCMask = (mSMask<<1) | 0x01; ///< candidate mask - static const uint32_t mOMask = (0x01< { @@ -288,8 +152,6 @@ uint64_t syndrome(Generator& gen) const; /** Calculate the parity word for the vector with the given Generator. */ uint64_t parity(Generator& gen) const; - /** Encode the signal with the GSM rate 1/2 convolutional encoder. */ - void encode(const ViterbiR2O4& encoder, BitVector& target); //@} @@ -427,10 +289,7 @@ const SoftVector tail(size_t start) const { return segment(start,size()-start); } //@} - /** Decode soft symbols with the GSM rate-1/2 Viterbi decoder. */ - void decode(ViterbiR2O4 &decoder, BitVector& target) const; - - // (pat) How good is the SoftVector in the sense of the bits being solid? + // How good is the SoftVector in the sense of the bits being solid? // Result of 1 is perfect and 0 means all the bits were 0.5 // If plow is non-NULL, also return the lowest energy bit. float getEnergy(float *low=0) const; diff --git a/CommonLibs/BitVectorTest.cpp b/CommonLibs/BitVectorTest.cpp index 5e487ad..063138f 100644 --- a/CommonLibs/BitVectorTest.cpp +++ b/CommonLibs/BitVectorTest.cpp @@ -35,27 +35,6 @@ int main(int argc, char *argv[]) { - BitVector v1("0000111100111100101011110000"); - cout << v1 << endl; - v1.LSB8MSB(); - cout << v1 << endl; - ViterbiR2O4 vCoder; - BitVector v2(v1.size()*2); - v1.encode(vCoder,v2); - cout << v2 << endl; - SoftVector sv2(v2); - cout << sv2 << endl; - for (unsigned i=0; i From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:40 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:40 +0000 Subject: [PATCH] osmo-trx[master]: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. Message-ID: Review at https://gerrit.osmocom.org/2142 BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. This makes code simpler and will allow us send -127..127 soft bits towards osmo-bts instead of 0..255 bits. Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 --- M CommonLibs/BitVector.cpp M CommonLibs/BitVector.h 2 files changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/42/2142/1 diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index b77a4c4..3b556b9 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace std; @@ -268,7 +269,7 @@ resize(source.size()); for (size_t i=0; i0.5F) newSig[i]=1; + if (mStart[i]>0.0F) newSig[i]=1; else newSig[i] = 0; } return newSig; @@ -291,8 +292,7 @@ int len = vec.size(); float avg = 0; float low = 1; for (int i = 0; i < len; i++) { - float bit = vec[i]; - float energy = 2*((bit < 0.5) ? (0.5-bit) : (bit-0.5)); + float energy = fabsf(vec[i]); if (energy < low) low = energy; avg += energy/len; } @@ -304,12 +304,12 @@ ostream& operator<<(ostream& os, const SoftVector& sv) { for (size_t i=0; i0.75) os << "1"; - else if (sv[i]>0.6) os << "|"; - else if (sv[i]>0.5) os << "'"; + if (sv[i]<-0.5) os << "0"; + else if (sv[i]<-0.25) os << "o"; + else if (sv[i]<0.0) os << "."; + else if (sv[i]>0.5) os << "1"; + else if (sv[i]>0.25) os << "|"; + else if (sv[i]>0.0) os << "'"; else os << "-"; } return os; diff --git a/CommonLibs/BitVector.h b/CommonLibs/BitVector.h index 7473c32..d2acb5f 100644 --- a/CommonLibs/BitVector.h +++ b/CommonLibs/BitVector.h @@ -290,19 +290,19 @@ //@} // How good is the SoftVector in the sense of the bits being solid? - // Result of 1 is perfect and 0 means all the bits were 0.5 + // Result of 1 is perfect and 0 means all the bits were 0.0 // If plow is non-NULL, also return the lowest energy bit. float getEnergy(float *low=0) const; /** Fill with "unknown" values. */ - void unknown() { fill(0.5F); } + void unknown() { fill(0.0F); } /** Return a hard bit value from a given index by slicing. */ bool bit(size_t index) const { const float *dp = mStart+index; assert(dp0.5F; + return (*dp)>0.0F; } /** Slice the whole signal into bits. */ -- To view, visit https://gerrit.osmocom.org/2142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:47:41 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:47:41 +0000 Subject: [PATCH] osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. Message-ID: Review at https://gerrit.osmocom.org/2143 osmo-trx: Separate command line switch to enable EDGE filler. Now -r comand line switch always enables GMSK filler even when EDGE mode is enabled with -e switch. If you want to enable EDGE filler, use -E switch. Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab --- M Transceiver52M/osmo-trx.cpp 1 file changed, 11 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/43/2143/1 diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 5e81586..dd80557 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -339,7 +339,8 @@ " -c Number of ARFCN channels (default=1)\n" " -f Enable C0 filler table\n" " -o Set baseband frequency offset (default=auto)\n" - " -r Random Normal Burst test mode with TSC\n" + " -r Random GMSK Normal Burst test mode with given TSC\n" + " -E Random 8-PSK Normal Burst test mode with given TSC\n" " -A Random Access Burst test mode with delay\n" " -R RSSI to dBm offset in dB (default=0)\n" " -S Swap channels (UmTRX only)\n", @@ -366,7 +367,7 @@ config->swap_channels = false; config->edge = false; - while ((option = getopt(argc, argv, "ha:l:i:p:c:dmxgfo:s:b:r:A:R:Se")) != -1) { + while ((option = getopt(argc, argv, "ha:l:i:p:c:dmxgfo:s:b:r:E:A:R:Se")) != -1) { switch (option) { case 'h': print_help(); @@ -414,6 +415,10 @@ case 'r': config->rtsc = atoi(optarg); config->filler = Transceiver::FILLER_NORM_RAND; + break; + case 'E': + config->rtsc = atoi(optarg); + config->filler = Transceiver::FILLER_EDGE_RAND; break; case 'A': config->rach_delay = atoi(optarg); @@ -463,8 +468,10 @@ } } - if (config->edge && (config->filler == Transceiver::FILLER_NORM_RAND)) - config->filler = Transceiver::FILLER_EDGE_RAND; + if (!config->edge && (config->filler == Transceiver::FILLER_EDGE_RAND)) { + printf("Can't enable EDGE filler when EDGE mode is disabled\n\n"); + goto bad_config; + } if ((config->tx_sps != 1) && (config->tx_sps != 4) && (config->rx_sps != 1) && (config->rx_sps != 4)) { -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Tue Mar 21 03:55:50 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 03:55:50 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Rename demodulateBurst() to demodGmskBurst() for... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2137 to look at the new patch set (#2). sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity. Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 3 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/37/2137/2 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 3df482f..3f624d0 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -583,7 +583,7 @@ if (type == EDGE) return demodEdgeBurst(burst, mSPSRx, amp, toa); - return demodulateBurst(burst, mSPSRx, amp, toa); + return demodGmskBurst(burst, mSPSRx, amp, toa); } void writeToFile(radioVector *radio_burst, size_t chan) diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index f9e21f0..1653ee9 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2051,7 +2051,7 @@ * 4 SPS (if activated) to minimize distortion through the fractional * delay filters. Symbol rotation and after always operates at 1 SPS. */ -SoftVector *demodulateBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, complex channel, float TOA) { SoftVector *bits; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 87c0229..7dca71f 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -261,16 +261,16 @@ signalVector *decimateVector(signalVector &wVector, size_t factor); /** - Demodulates a received burst using a soft-slicer. - @param rxBurst The burst to be demodulated. + Demodulates a GMSK burst using a soft-slicer. + @param rxBurst The burst to be demodulated. @param gsmPulse The GSM pulse. @param sps The number of samples per GSM symbol. @param channel The amplitude estimate of the received burst. @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodulateBurst(signalVector &rxBurst, int sps, - complex channel, float TOA); +SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, + complex channel, float TOA); /** Demodulate 8-PSK EDGE burst with soft symbol ooutput -- To view, visit https://gerrit.osmocom.org/2137 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:44:16 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:44:16 +0000 Subject: osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2136/1/Transceiver52M/Transceiver.cpp File Transceiver52M/Transceiver.cpp: Line 609: float toa, max = -1.0, avg = 0.0; There's no need to move variable declaration. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:44:58 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:44:58 +0000 Subject: osmo-trx[master]: sigProcLib: Rename demodulateBurst() to demodGmskBurst() for... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2137 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:46:43 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:46:43 +0000 Subject: osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Patch Set 2: Could you elaborate, why is this better than before? -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:47:40 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:47:40 +0000 Subject: osmo-trx[master]: CommonLibs: Print soft bits with less confidence to console ... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2140 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:48:48 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:48:48 +0000 Subject: osmo-trx[master]: BitVector: Remove convolutional codec - we don't use it in o... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2141 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3006b6a26c5eff59dbe9c034f689961802f1d0d0 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:50:13 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:50:13 +0000 Subject: osmo-trx[master]: sigProcLib: Slice SoftVector instead of signalVector for GMS... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2138 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:52:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:52:45 +0000 Subject: osmo-trx[master]: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2142/2/CommonLibs/BitVector.h File CommonLibs/BitVector.h: Line 305: return (*dp)>0.0F; Can we just compare "> 0" in here? -- To view, visit https://gerrit.osmocom.org/2142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 21 09:58:57 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 09:58:57 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2143/2/Transceiver52M/osmo-trx.cpp File Transceiver52M/osmo-trx.cpp: Line 419: case 'E': So user can still specify ... -E 123 -r 321 ... without enabling EDGE and it'll work (provided options are parsed from left to right) because "-r" will shadow "-E", but ... -r 123 -E 321 ... will fail. I think it's better to make "-E" and "-r" mutually exclusive - unless there's use-case when we actually need both. -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 21 11:50:14 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 21 Mar 2017 11:50:14 +0000 Subject: openbsc[master]: twisted_ipa.py: bump version properly In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2135 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I44c8521f12e6432038998bfb1ac1bb37a1137787 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: neels Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 11:52:40 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 21 Mar 2017 11:52:40 +0000 Subject: openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/2133/5/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 25: __version__ = "0.5" # bump this on every non-trivial change hehe, logging is non-trivial? Line 31: import argparse, logging, logging.handlers it seems logging.handlers is unused? -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 21 12:55:56 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 12:55:56 +0000 Subject: [MERGED] openbsc[master]: twisted_ipa.py: bump version properly In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: twisted_ipa.py: bump version properly ...................................................................... twisted_ipa.py: bump version properly Adjust version string to comply with PEP8 and PEP386. Change-Id: I44c8521f12e6432038998bfb1ac1bb37a1137787 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 8d0ef9f..0a08747 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,6 +22,8 @@ */ """ +__version__ = "0.4" # bump this on every non-trivial change + from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor @@ -332,7 +334,7 @@ if __name__ == '__main__': p = argparse.ArgumentParser("Twisted IPA (module v%s) app" % IPA.version) - p.add_argument('-v', '--version', action='version', version='%(prog)s v0.3') + p.add_argument('-v', '--version', action='version', version="%(prog)s v" + __version__) p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface") p.add_argument('-d', '--host', default='localhost', help="Adress to use for CTRL interface") cs = p.add_mutually_exclusive_group() -- To view, visit https://gerrit.osmocom.org/2135 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I44c8521f12e6432038998bfb1ac1bb37a1137787 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: neels From gerrit-no-reply at lists.osmocom.org Tue Mar 21 12:57:47 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 12:57:47 +0000 Subject: openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Patch Set 5: (1 comment) https://gerrit.osmocom.org/#/c/2133/5/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 25: __version__ = "0.5" # bump this on every non-trivial change > hehe, logging is non-trivial? Yes, because it changes the interface of IPAFactory. -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 21 13:07:05 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 13:07:05 +0000 Subject: [PATCH] openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2133 to look at the new patch set (#6). twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 32 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/2133/6 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 0a08747..c143852 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,13 +22,13 @@ */ """ -__version__ = "0.4" # bump this on every non-trivial change +__version__ = "0.5" # bump this on every non-trivial change from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging class IPACommon(basic.Int16StringReceiver): """ @@ -39,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -160,7 +159,8 @@ We have to resetDelay() here to drop internal state to default values to make reconnection logic work Make sure to call this via super() if overriding to keep reconnection logic intact """ - self.dbg('IPA connection made!') + addr = self.transport.getPeer() + self.dbg('IPA connected to %s:%d peer' % (addr.host, addr.port)) self.factory.resetDelay() @@ -259,7 +259,8 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + addr = self.transport.getPeer() + self.factory.log.info('IPA server: connection from %s:%d client' % (addr.host, addr.port)) super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -275,7 +276,8 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + addr = self.transport.getPeer() + self.factory.log.info('CTRL server: connection from %s:%d client' % (addr.host, addr.port)) super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -287,14 +289,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -304,31 +306,33 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection failed: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection lost: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) @@ -345,29 +349,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 21 15:57:22 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 15:57:22 +0000 Subject: [PATCH] libosmocore[master]: abis: add attribute names Message-ID: Review at https://gerrit.osmocom.org/2144 abis: add attribute names Add human-readable names for Attributes from 3GPP TS 52.021 ?9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map 3 files changed, 66 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/2144/1 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index d6e8c11..40237cb 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -595,6 +595,7 @@ }; extern const struct value_string abis_nm_pcause_type_names[]; +extern const struct value_string abis_nm_att_names[]; /*! \brief NACK causes (Section 9.4.36) */ enum abis_nm_nack_cause { diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 155084a..cbd2f8a 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -261,6 +261,70 @@ [T200_SACCH_TCH_SAPI3] = 10 }; +/*! \brief 3GPP TS 52.021 ?9.4 Attributes and Parameters */ +const struct value_string abis_nm_att_names[] = { + { NM_ATT_ABIS_CHANNEL, "Abis Channel" }, /* ?9.4.1 */ + { NM_ATT_ADD_INFO, "Additional Info" }, /* ?9.4.2 */ + { NM_ATT_ADD_TEXT, "Additional Text" }, /* ?9.4.3 */ + { NM_ATT_ADM_STATE, "Administrative State" }, /* ?9.4.4 */ + { NM_ATT_ARFCN_LIST, "ARFCN List" }, /* ?9.4.5 */ + { NM_ATT_AUTON_REPORT, "Autonomously Report" }, /* ?9.4.6 */ + { NM_ATT_AVAIL_STATUS, "Availability Status" }, /* ?9.4.7 */ + { NM_ATT_BCCH_ARFCN, "BCCH ARFCN" }, /* ?9.4.8 */ + { NM_ATT_BSIC, "BSIC" }, /* ?9.4.9 */ + { NM_ATT_BTS_AIR_TIMER, "BTS Air Timer" }, /* ?9.4.10 */ + { NM_ATT_CCCH_L_I_P, "CCCH Load Indication Period" }, /* ?9.4.11 */ + { NM_ATT_CCCH_L_T, "CCCH Load Threshold" }, /* ?9.4.12 */ + { NM_ATT_CHAN_COMB, "Channel Combination" }, /* ?9.4.13 */ + { NM_ATT_CONN_FAIL_CRIT, "Connection Failure Criterion" }, /* ?9.4.14 */ + { NM_ATT_DEST, "Destination" }, /* ?9.4.15 */ + { NM_ATT_EVENT_TYPE, "Event Type" }, /* ?9.4.16 */ + { NM_ATT_FILE_DATA, "File Data" }, /* ?9.4.17 */ + { NM_ATT_FILE_ID, "File Id" }, /* ?9.4.18 */ + { NM_ATT_FILE_VERSION, "File Version" }, /* ?9.4.19 */ + { NM_ATT_GSM_TIME, "GSM Time" }, /* ?9.4.20 */ + { NM_ATT_HSN, "HSN" }, /* ?9.4.21 */ + { NM_ATT_HW_CONFIG, "HW Configuration" }, /* ?9.4.22 */ + { NM_ATT_HW_DESC, "HW Description" }, /* ?9.4.23 */ + { NM_ATT_INTAVE_PARAM, "Intave Parameter" }, /* ?9.4.24 */ + { NM_ATT_INTERF_BOUND, "Interference level Boundaries" }, /* ?9.4.25 */ + { NM_ATT_LIST_REQ_ATTR, "List of Required Attributes" }, /* ?9.4.26 */ + { NM_ATT_MAIO, "MAIO" }, /* ?9.4.27 */ + { NM_ATT_MANUF_STATE, "Manufacturer Dependent State" }, /* ?9.4.28 */ + { NM_ATT_MANUF_THRESH, "Manufacturer Dependent Thresholds" }, /* ?9.4.29 */ + { NM_ATT_MANUF_ID, "Manufacturer Id" }, /* ?9.4.30 */ + { NM_ATT_MAX_TA, "Max Timing Advance" }, /* ?9.4.31 */ + { NM_ATT_MEAS_RES, "Measurement Result" }, /* ?9.4.32 */ + { NM_ATT_MEAS_TYPE, "Measurement Type" }, /* ?9.4.33 */ + { NM_ATT_MDROP_LINK, "Multi-drop BSC Link" }, /* ?9.4.34 */ + { NM_ATT_MDROP_NEXT, "Multi-drop next BTS Link" }, /* ?9.4.35 */ + { NM_ATT_NACK_CAUSES, "Nack Causes" }, /* ?9.4.36 */ + { NM_ATT_NY1, "Ny1" }, /* ?9.4.37 */ + { NM_ATT_OPER_STATE, "Operational State" }, /* ?9.4.38 */ + { NM_ATT_OVERL_PERIOD, "Overload Period" }, /* ?9.4.39 */ + { NM_ATT_PHYS_CONF, "Physical Config" }, /* ?9.4.40 */ + { NM_ATT_POWER_CLASS, "Power Class" }, /* ?9.4.41 */ + { NM_ATT_POWER_THRESH, "Power Output Thresholds" }, /* ?9.4.42 */ + { NM_ATT_PROB_CAUSE, "Probable Cause" }, /* ?9.4.43 */ + { NM_ATT_RACH_B_THRESH, "RACH Busy Threshold" }, /* ?9.4.44 */ + { NM_ATT_LDAVG_SLOTS, "RACH Load Averaging Slots" }, /* ?9.4.45 */ + { NM_ATT_RAD_SUBC, "Radio Sub Channel" }, /* ?9.4.46 */ + { NM_ATT_RF_MAXPOWR_R, "RF Max Power Reduction" }, /* ?9.4.47 */ + { NM_ATT_SITE_INPUTS, "Site Inputs" }, /* ?9.4.48 */ + { NM_ATT_SITE_OUTPUTS, "Site Outputs" }, /* ?9.4.49 */ + { NM_ATT_SOURCE, "Source" }, /* ?9.4.50 */ + { NM_ATT_SPEC_PROB, "Specific Problems" }, /* ?9.4.51 */ + { NM_ATT_START_TIME, "Starting Time" }, /* ?9.4.52 */ + { NM_ATT_T200, "T200" }, /* ?9.4.53 */ + { NM_ATT_TEI, "TEI" }, /* ?9.4.54 */ + { NM_ATT_TEST_DUR, "Test Duration" }, /* ?9.4.55 */ + { NM_ATT_TEST_NO, "Test No" }, /* ?9.4.56 */ + { NM_ATT_TEST_REPORT, "Test Report Info" }, /* ?9.4.57 */ + { NM_ATT_VSWR_THRESH, "VSWR Thresholds" }, /* ?9.4.58 */ + { NM_ATT_WINDOW_SIZE, "Window Size" }, /* ?9.4.59 */ + { 0, NULL } +}; + /*! \brief Attributes that the BSC can set, not only get, according to Section 9.4 */ const enum abis_nm_attr abis_nm_att_settable[] = { NM_ATT_ADD_INFO, diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 4a33c46..cd4c0ab 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -29,6 +29,7 @@ abis_nm_ipa_magic; abis_mm_event_cause_names; abis_nm_pcause_type_names; +abis_nm_att_names; osmo_sitype_strs; osmo_c4; -- To view, visit https://gerrit.osmocom.org/2144 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Mar 21 16:39:01 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 21 Mar 2017 16:39:01 +0000 Subject: [PATCH] libosmocore[master]: abis: add attribute names In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2144 to look at the new patch set (#2). abis: add attribute names Add human-readable names for Attributes from 3GPP TS 52.021 ?9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map 3 files changed, 73 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/2144/2 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index d6e8c11..40237cb 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -595,6 +595,7 @@ }; extern const struct value_string abis_nm_pcause_type_names[]; +extern const struct value_string abis_nm_att_names[]; /*! \brief NACK causes (Section 9.4.36) */ enum abis_nm_nack_cause { diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 155084a..e98866c 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -261,6 +261,77 @@ [T200_SACCH_TCH_SAPI3] = 10 }; +/*! \brief 3GPP TS 52.021 ?9.4 Attributes and Parameters */ +const struct value_string abis_nm_att_names[] = { + { NM_ATT_ABIS_CHANNEL, "Abis Channel" }, /* ?9.4.1 */ + { NM_ATT_ADD_INFO, "Additional Info" }, /* ?9.4.2 */ + { NM_ATT_ADD_TEXT, "Additional Text" }, /* ?9.4.3 */ + { NM_ATT_ADM_STATE, "Administrative State" }, /* ?9.4.4 */ + { NM_ATT_ARFCN_LIST, "ARFCN List" }, /* ?9.4.5 */ + { NM_ATT_AUTON_REPORT, "Autonomously Report" }, /* ?9.4.6 */ + { NM_ATT_AVAIL_STATUS, "Availability Status" }, /* ?9.4.7 */ + { NM_ATT_BCCH_ARFCN, "BCCH ARFCN" }, /* ?9.4.8 */ + { NM_ATT_BSIC, "BSIC" }, /* ?9.4.9 */ + { NM_ATT_BTS_AIR_TIMER, "BTS Air Timer" }, /* ?9.4.10 */ + { NM_ATT_CCCH_L_I_P, "CCCH Load Indication Period" }, /* ?9.4.11 */ + { NM_ATT_CCCH_L_T, "CCCH Load Threshold" }, /* ?9.4.12 */ + { NM_ATT_CHAN_COMB, "Channel Combination" }, /* ?9.4.13 */ + { NM_ATT_CONN_FAIL_CRIT, "Connection Failure Criterion" }, /* ?9.4.14 */ + { NM_ATT_DEST, "Destination" }, /* ?9.4.15 */ + { NM_ATT_EVENT_TYPE, "Event Type" }, /* ?9.4.16 */ + { NM_ATT_FILE_DATA, "File Data" }, /* ?9.4.17 */ + { NM_ATT_FILE_ID, "File Id" }, /* ?9.4.18 */ + { NM_ATT_FILE_VERSION, "File Version" }, /* ?9.4.19 */ + { NM_ATT_GSM_TIME, "GSM Time" }, /* ?9.4.20 */ + { NM_ATT_HSN, "HSN" }, /* ?9.4.21 */ + { NM_ATT_HW_CONFIG, "HW Configuration" }, /* ?9.4.22 */ + { NM_ATT_HW_DESC, "HW Description" }, /* ?9.4.23 */ + { NM_ATT_INTAVE_PARAM, "Intave Parameter" }, /* ?9.4.24 */ + { NM_ATT_INTERF_BOUND, "Interference level Boundaries" }, /* ?9.4.25 */ + { NM_ATT_LIST_REQ_ATTR, "List of Required Attributes" }, /* ?9.4.26 */ + { NM_ATT_MAIO, "MAIO" }, /* ?9.4.27 */ + { NM_ATT_MANUF_STATE, "Manufacturer Dependent State" }, /* ?9.4.28 */ + { NM_ATT_MANUF_THRESH, "Manufacturer Dependent Thresholds" }, /* ?9.4.29 */ + { NM_ATT_MANUF_ID, "Manufacturer Id" }, /* ?9.4.30 */ + { NM_ATT_MAX_TA, "Max Timing Advance" }, /* ?9.4.31 */ + { NM_ATT_MEAS_RES, "Measurement Result" }, /* ?9.4.32 */ + { NM_ATT_MEAS_TYPE, "Measurement Type" }, /* ?9.4.33 */ + { NM_ATT_MDROP_LINK, "Multi-drop BSC Link" }, /* ?9.4.34 */ + { NM_ATT_MDROP_NEXT, "Multi-drop next BTS Link" }, /* ?9.4.35 */ + { NM_ATT_NACK_CAUSES, "Nack Causes" }, /* ?9.4.36 */ + { NM_ATT_NY1, "Ny1" }, /* ?9.4.37 */ + { NM_ATT_OPER_STATE, "Operational State" }, /* ?9.4.38 */ + { NM_ATT_OVERL_PERIOD, "Overload Period" }, /* ?9.4.39 */ + { NM_ATT_PHYS_CONF, "Physical Config" }, /* ?9.4.40 */ + { NM_ATT_POWER_CLASS, "Power Class" }, /* ?9.4.41 */ + { NM_ATT_POWER_THRESH, "Power Output Thresholds" }, /* ?9.4.42 */ + { NM_ATT_PROB_CAUSE, "Probable Cause" }, /* ?9.4.43 */ + { NM_ATT_RACH_B_THRESH, "RACH Busy Threshold" }, /* ?9.4.44 */ + { NM_ATT_LDAVG_SLOTS, "RACH Load Averaging Slots" }, /* ?9.4.45 */ + { NM_ATT_RAD_SUBC, "Radio Sub Channel" }, /* ?9.4.46 */ + { NM_ATT_RF_MAXPOWR_R, "RF Max Power Reduction" }, /* ?9.4.47 */ + { NM_ATT_SITE_INPUTS, "Site Inputs" }, /* ?9.4.48 */ + { NM_ATT_SITE_OUTPUTS, "Site Outputs" }, /* ?9.4.49 */ + { NM_ATT_SOURCE, "Source" }, /* ?9.4.50 */ + { NM_ATT_SPEC_PROB, "Specific Problems" }, /* ?9.4.51 */ + { NM_ATT_START_TIME, "Starting Time" }, /* ?9.4.52 */ + { NM_ATT_T200, "T200" }, /* ?9.4.53 */ + { NM_ATT_TEI, "TEI" }, /* ?9.4.54 */ + { NM_ATT_TEST_DUR, "Test Duration" }, /* ?9.4.55 */ + { NM_ATT_TEST_NO, "Test No" }, /* ?9.4.56 */ + { NM_ATT_TEST_REPORT, "Test Report Info" }, /* ?9.4.57 */ + { NM_ATT_VSWR_THRESH, "VSWR Thresholds" }, /* ?9.4.58 */ + { NM_ATT_WINDOW_SIZE, "Window Size" }, /* ?9.4.59 */ + { NM_ATT_TSC, "TSC" }, /* ?9.4.60 */ + { NM_ATT_SW_CONFIG, "SW Configuration" }, /* ?9.4.61 */ + { NM_ATT_SW_DESCR, "SW Description" }, /* ?9.4.62 */ + { NM_ATT_SEVERITY, "Perceived Severity" }, /* ?9.4.63 */ + { NM_ATT_GET_ARI, "Get Attribute Response Info" }, /* ?9.4.64 */ + { NM_ATT_OUTST_ALARM, "Outstanding Alarm Sequence" }, /* ?9.4.65 */ + { NM_ATT_HW_CONF_CHG, "HW Conf Change Info" }, /* ?9.4.66 */ + { 0, NULL } +}; + /*! \brief Attributes that the BSC can set, not only get, according to Section 9.4 */ const enum abis_nm_attr abis_nm_att_settable[] = { NM_ATT_ADD_INFO, diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 4a33c46..cd4c0ab 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -29,6 +29,7 @@ abis_nm_ipa_magic; abis_mm_event_cause_names; abis_nm_pcause_type_names; +abis_nm_att_names; osmo_sitype_strs; osmo_c4; -- To view, visit https://gerrit.osmocom.org/2144 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Tue Mar 21 18:09:11 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 21 Mar 2017 18:09:11 +0000 Subject: osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Patch Set 2: > Could you elaborate, why is this better than before? vectorSlicer() converts soft-bits from -1..+1 to 0..1 while we want to keep SoftVector in -1..+1 mode until the last minute, because at some point we'll want to transmit -1..+1 to osmo-bts instead of converting it from 0..1 back to -1..+1 on the osmo-bts side. Plus it removes code duplication - we call it once instead of twice. -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 21 19:34:02 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Tue, 21 Mar 2017 19:34:02 +0000 Subject: osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/2136/1/Transceiver52M/Transceiver.cpp File Transceiver52M/Transceiver.cpp: Line 609: float toa, max = -1.0, avg = 0.0; > There's no need to move variable declaration. Is there good reason not to move it? I prefer the moved declaration. Moving the variable limits scope, which is generally good practice. OsmoTRX uses C++ and I see no reason to adhere to C89 standards or convensions. https://gerrit.osmocom.org/#/c/2136/1/Transceiver52M/sigProcLib.cpp File Transceiver52M/sigProcLib.cpp: PS1, Line 1725: Generally avoid per-line argument lists unless there is a good reason for readability. I'm aware that with C++ and the origins of the codebase, strictly having Osmocom/Linux kernel coding style is not practical. But, this is one case where the declaration clearly does not need to take up two lines. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Tue Mar 21 19:41:03 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Tue, 21 Mar 2017 19:41:03 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2143/2/Transceiver52M/osmo-trx.cpp File Transceiver52M/osmo-trx.cpp: Line 419: case 'E': > So user can still specify ... -E 123 -r 321 ... without enabling EDGE and i In general, I would very much like to stop adding more and more command line arguments. There are already other ambiguous cases similar to that mentioned by Max and most users never use them. I'm open to ideas (e.g. config file, string-value arguments?). -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 22 02:49:45 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 02:49:45 +0000 Subject: osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) > (1 comment) https://gerrit.osmocom.org/#/c/2136/1/Transceiver52M/Transceiver.cpp File Transceiver52M/Transceiver.cpp: Line 609: float toa, max = -1.0, avg = 0.0; > Is there good reason not to move it? I prefer the moved declaration. I follow the rule "declare variable in the least possible namespace". Helps a lot with code modularity and clarity. That's different from C where everything must be declared in the beginning of a function. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 22 02:50:30 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 02:50:30 +0000 Subject: osmo-trx[master]: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) > (1 comment) https://gerrit.osmocom.org/#/c/2142/2/CommonLibs/BitVector.h File CommonLibs/BitVector.h: Line 305: return (*dp)>0.0F; > Can we just compare "> 0" in here? Yes, but I want to make it clear it's a floating point value. -- To view, visit https://gerrit.osmocom.org/2142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 22 08:53:48 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 08:53:48 +0000 Subject: osmo-trx[master]: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 08:54:09 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 08:54:09 +0000 Subject: osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 08:54:50 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 08:54:50 +0000 Subject: osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Patch Set 2: Please add this explanation to commit log. -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 10:46:14 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 22 Mar 2017 10:46:14 +0000 Subject: openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 10:46:36 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 22 Mar 2017 10:46:36 +0000 Subject: [MERGED] openbsc[master]: twisted_ipa.py: make debug logging more robust In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: twisted_ipa.py: make debug logging more robust ...................................................................... twisted_ipa.py: make debug logging more robust Do not print anything to stdout directly - use proper logger object instead: either the one supplied by IPAFactory user or default to NO-OP NullHandler logger. Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Related: SYS#3028 --- M openbsc/contrib/twisted_ipa.py 1 file changed, 32 insertions(+), 23 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py index 0a08747..c143852 100755 --- a/openbsc/contrib/twisted_ipa.py +++ b/openbsc/contrib/twisted_ipa.py @@ -22,13 +22,13 @@ */ """ -__version__ = "0.4" # bump this on every non-trivial change +__version__ = "0.5" # bump this on every non-trivial change from ipa import Ctrl, IPA from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet import reactor from twisted.protocols import basic -import argparse +import argparse, logging class IPACommon(basic.Int16StringReceiver): """ @@ -39,8 +39,7 @@ """ Debug print helper """ - if self.factory.debug: - print(line) + self.factory.log.debug(line) def osmo_CTRL(self, data): """ @@ -160,7 +159,8 @@ We have to resetDelay() here to drop internal state to default values to make reconnection logic work Make sure to call this via super() if overriding to keep reconnection logic intact """ - self.dbg('IPA connection made!') + addr = self.transport.getPeer() + self.dbg('IPA connected to %s:%d peer' % (addr.host, addr.port)) self.factory.resetDelay() @@ -259,7 +259,8 @@ Keep reconnection logic working by calling routine from CCM Initiate CCM upon connection """ - print('IPA server connection made!') + addr = self.transport.getPeer() + self.factory.log.info('IPA server: connection from %s:%d client' % (addr.host, addr.port)) super(IPAServer, self).connectionMade() self.transport.write(IPA().id_get()) @@ -275,7 +276,8 @@ Send TRAP upon connection Note: we can't use sendString() because of it's incompatibility with IPA interpretation of length prefix """ - print('CTRL server connection made!') + addr = self.transport.getPeer() + self.factory.log.info('CTRL server: connection from %s:%d client' % (addr.host, addr.port)) super(CtrlServer, self).connectionMade() self.transport.write(Ctrl().trap('LOL', 'what')) self.transport.write(Ctrl().trap('rulez', 'XXX')) @@ -287,14 +289,14 @@ """ CTRL SET command: always succeed """ - print('SET [%s] %s' % (op_id, v)) + self.dbg('SET [%s] %s' % (op_id, v)) self.reply('SET_REPLY %s %s' % (op_id, v)) def ctrl_GET(self, data, op_id, v): """ CTRL GET command: always fail """ - print('GET [%s] %s' % (op_id, v)) + self.dbg('GET [%s] %s' % (op_id, v)) self.reply('ERROR %s No variable found' % op_id) @@ -304,31 +306,33 @@ Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity """ protocol = IPACommon - debug = False + log = None ccm_id = IPA().identity(unit=b'1515/0/1', mac=b'b0:0b:fa:ce:de:ad:be:ef', utype=b'sysmoBTS', name=b'StingRay', location=b'hell', sw=IPA.version.encode('utf-8')) - def __init__(self, proto=None, debug=False, ccm_id=None): + def __init__(self, proto=None, log=None, ccm_id=None): if proto: self.protocol = proto - if debug: - self.debug = debug if ccm_id: self.ccm_id = ccm_id + if log: + self.log = log + else: + self.log = logging.getLogger('IPAFactory') + log.setLevel(logging.CRITICAL) + log.addHandler(logging.NullHandler) def clientConnectionFailed(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection failed:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection failed: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): """ Only necessary for as debugging aid - if we can somehow set parent's class noisy attribute then we can omit this method """ - if self.debug: - print('IPAFactory connection lost:', reason.getErrorMessage()) + self.log.warning('IPAFactory connection lost: %s' % reason.getErrorMessage()) ReconnectingClientFactory.clientConnectionLost(self, connector, reason) @@ -345,29 +349,34 @@ ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") args = p.parse_args() test = False + + log = logging.getLogger('TwistedIPA') + log.setLevel(logging.DEBUG) + log.addHandler(logging.StreamHandler(sys.stdout)) + if args.ctrl: if args.client: # Start osmo-bsc to receive TRAP messages when osmo-bts-* connects to it print('CTRL client, connecting to %s:%d' % (args.host, args.port)) - reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, debug=True)) + reactor.connectTCP(args.host, args.port, IPAFactory(CTRL, log)) test = True if args.server: # Use bsc_control.py to issue set/get commands print('CTRL server, listening on port %d' % args.port) - reactor.listenTCP(args.port, IPAFactory(CtrlServer, debug=True)) + reactor.listenTCP(args.port, IPAFactory(CtrlServer, log)) test = True if args.ipa: if args.client: # Start osmo-nitb which would initiate A-bis/IP session print('IPA client, connecting to %s ports %d and %d' % (args.host, IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, debug=True)) - reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, debug=True)) + reactor.connectTCP(args.host, IPA.TCP_PORT_OML, IPAFactory(CCM, log)) + reactor.connectTCP(args.host, IPA.TCP_PORT_RSL, IPAFactory(CCM, log)) test = True if args.server: # Start osmo-bts-* which would attempt to connect to us print('IPA server, listening on ports %d and %d' % (IPA.TCP_PORT_OML, IPA.TCP_PORT_RSL)) - reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, debug=True)) - reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, debug=True)) + reactor.listenTCP(IPA.TCP_PORT_RSL, IPAFactory(IPAServer, log)) + reactor.listenTCP(IPA.TCP_PORT_OML, IPAFactory(IPAServer, log)) test = True if test: reactor.run() -- To view, visit https://gerrit.osmocom.org/2133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 22 11:07:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 11:07:00 +0000 Subject: [PATCH] openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1875 to look at the new patch set (#9). Add simple CTRL2SOAP proxy Add python client which converts TRAP messages into SOAP requests and perform corresponding actions. It can be used as follows ./soap.py -d -w http://example.com/soapservice/htdocs/wsdl/test.wsdl See ./soap.py -h for additional options. Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Related: SYS#3028 --- A openbsc/contrib/soap.py 1 file changed, 188 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/75/1875/9 diff --git a/openbsc/contrib/soap.py b/openbsc/contrib/soap.py new file mode 100755 index 0000000..4d0a023 --- /dev/null +++ b/openbsc/contrib/soap.py @@ -0,0 +1,188 @@ +#!/usr/bin/python3 +# -*- mode: python-mode; py-indent-tabs-mode: nil -*- +""" +/* + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +""" + +__version__ = "v0.7" # bump this on every non-trivial change + +from twisted.internet import defer, reactor +from twisted_ipa import CTRL, IPAFactory, __version__ as twisted_ipa_version +from ipa import Ctrl +from treq import post, collect +from suds.client import Client +from functools import partial +from distutils.version import StrictVersion as V # FIXME: use NormalizedVersion from PEP-386 when available +import argparse, datetime, signal, sys, os, logging, logging.handlers + +# we don't support older versions of TwistedIPA module +assert V(twisted_ipa_version) > V('0.4') + +# keys from OpenBSC openbsc/src/libbsc/bsc_rf_ctrl.c, values SOAP-specific +oper = { 'inoperational' : 0, 'operational' : 1 } +admin = { 'locked' : 0, 'unlocked' : 1 } +policy = { 'off' : 0, 'on' : 1, 'grace' : 2, 'unknown' : 3 } + +# keys from OpenBSC openbsc/src/libbsc/bsc_vty.c +fix = { 'invalid' : 0, 'fix2d' : 1, 'fix3d' : 1 } # SOAP server treats it as boolean but expects int + + +def handle_reply(p, f, log, r): + """ + Reply handler: takes function p to process raw SOAP server reply r, function f to run for each command and verbosity flag v + """ + repl = p(r) # result is expected to have both commands[] array and error string (could be None) + bsc_id = repl.commands[0].split()[0].split('.')[3] # we expect 1st command to have net.0.bsc.666.bts.2.trx.1 location prefix format + log.info("Received SOAP response for BSC %s with %d commands, error status: %s" % (bsc_id, len(repl.commands), repl.error)) + log.debug("BSC %s commands: %s" % (bsc_id, repl.commands)) + for t in repl.commands: # Process OpenBscCommands format from .wsdl + (_, m) = Ctrl().cmd(*t.split()) + f(m) + + +class Trap(CTRL): + """ + TRAP handler (agnostic to factory's client object) + """ + def ctrl_TRAP(self, data, op_id, v): + """ + Parse CTRL TRAP and dispatch to appropriate handler after normalization + """ + (l, r) = v.split() + loc = l.split('.') + t_type = loc[-1] + p = partial(lambda a, i: a[i] if len(a) > i else None, loc) # parse helper + method = getattr(self, 'handle_' + t_type.replace('-', ''), lambda: "Unhandled %s trap" % t_type) + method(p(1), p(3), p(5), p(7), r) # we expect net.0.bsc.666.bts.2.trx.1 format for trap prefix + + def ctrl_SET_REPLY(self, data, _, v): + """ + Debug log for replies to our commands + """ + self.factory.log.debug('SET REPLY %s' % v) + + def ctrl_ERROR(self, data, op_id, v): + """ + We want to know if smth went wrong + """ + self.factory.log.debug('CTRL ERROR [%s] %s' % (op_id, v)) + + def connectionMade(self): + """ + Logging wrapper, calling super() is necessary not to break reconnection logic + """ + self.factory.log.info("Connected to CTRL@%s:%d" % (self.factory.host, self.factory.port)) + super(CTRL, self).connectionMade() + + @defer.inlineCallbacks + def handle_locationstate(self, net, bsc, bts, trx, data): + """ + Handle location-state TRAP: parse trap content, build SOAP context and use treq's routines to post it while setting up async handlers + """ + (ts, fx, lat, lon, height, opr, adm, pol, mcc, mnc) = data.split(',') + tstamp = datetime.datetime.fromtimestamp(float(ts)).isoformat() + self.factory.log.debug('location-state@%s.%s.%s.%s (%s) [%s/%s] => %s' % (net, bsc, bts, trx, tstamp, mcc, mnc, data)) + ctx = self.factory.client.registerSiteLocation(bsc, float(lon), float(lat), fix.get(fx, 0), tstamp, oper.get(opr, 2), admin.get(adm, 2), policy.get(pol, 3)) + d = post(self.factory.location, ctx.envelope) + d.addCallback(collect, partial(handle_reply, ctx.process_reply, self.transport.write, self.factory.log)) # treq's collect helper is handy to get all reply content at once using closure on ctx + d.addErrback(lambda e, bsc: self.factory.log.critical("HTTP POST error %s while trying to register BSC %s" % (e, bsc)), bsc) # handle HTTP errors + # Ensure that we run only limited number of requests in parallel: + yield self.factory.semaphore.acquire() + yield d # we end up here only if semaphore is available which means it's ok to fire the request without exceeding the limit + self.factory.semaphore.release() + + def handle_notificationrejectionv1(self, net, bsc, bts, trx, data): + """ + Handle notification-rejection-v1 TRAP: just an example to show how more message types can be handled + """ + self.factory.log.debug('notification-rejection-v1 at bsc-id %s => %s' % (bsc, data)) + + +class TrapFactory(IPAFactory): + """ + Store SOAP client object so TRAP handler can use it for requests + """ + location = None + log = None + semaphore = None + client = None + host = None + port = None + def __init__(self, host, port, proto, semaphore, log, wsdl=None, location=None): + self.host = host # for logging only, + self.port = port # seems to be no way to get it from ReconnectingClientFactory + self.log = log + self.semaphore = semaphore + soap = Client(wsdl, location=location, nosend=True) # make async SOAP client + self.location = location.encode() if location else soap.wsdl.services[0].ports[0].location # necessary for dispatching HTTP POST via treq + self.client = soap.service + level = self.log.getEffectiveLevel() + self.log.setLevel(logging.WARNING) # we do not need excessive debug from lower levels + super(TrapFactory, self).__init__(proto, self.log) + self.log.setLevel(level) + self.log.debug("Using IPA %s, SUDS client: %s" % (Ctrl.version, soap)) + + +def reloader(path, script, log, dbg1, dbg2, signum, _): + """ + Signal handler: we have to use execl() because twisted's reactor is not restartable due to some bug in twisted implementation + """ + log.info("Received Signal %d - restarting..." % signum) + if signum == signal.SIGUSR1 and dbg1 not in sys.argv and dbg2 not in sys.argv: + sys.argv.append(dbg1) # enforce debug + if signum == signal.SIGUSR2 and (dbg1 in sys.argv or dbg2 in sys.argv): # disable debug + if dbg1 in sys.argv: + sys.argv.remove(dbg1) + if dbg2 in sys.argv: + sys.argv.remove(dbg2) + os.execl(path, script, *sys.argv[1:]) + + +if __name__ == '__main__': + p = argparse.ArgumentParser(description='Proxy between given SOAP service and Osmocom CTRL protocol.') + p.add_argument('-v', '--version', action='version', version=("%(prog)s " + __version__)) + p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface, defaults to 4250") + p.add_argument('-c', '--ctrl', default='localhost', help="Adress to use for CTRL interface, defaults to localhost") + p.add_argument('-w', '--wsdl', required=True, help="WSDL URL for SOAP") + p.add_argument('-n', '--num', type=int, default=5, help="Max number of concurrent HTTP requests to SOAP server") + p.add_argument('-d', '--debug', action='store_true', help="Enable debug log") + p.add_argument('-o', '--output', action='store_true', help="Log to STDOUT in addition to SYSLOG") + p.add_argument('-l', '--location', help="Override location found in WSDL file (don't use unless you know what you're doing)") + args = p.parse_args() + + log = logging.getLogger('CTRL2SOAP') + if args.debug: + log.setLevel(logging.DEBUG) + else: + log.setLevel(logging.INFO) + log.addHandler(logging.handlers.SysLogHandler('/dev/log')) + if args.output: + log.addHandler(logging.StreamHandler(sys.stdout)) + + reboot = partial(reloader, os.path.abspath(__file__), os.path.basename(__file__), log, '-d', '--debug') # keep in sync with add_argument() call above + signal.signal(signal.SIGHUP, reboot) + signal.signal(signal.SIGQUIT, reboot) + signal.signal(signal.SIGUSR1, reboot) # restart and enabled debug output + signal.signal(signal.SIGUSR2, reboot) # restart and disable debug output + + log.info("SOAP proxy %s starting with PID %d ..." % (__version__, os.getpid())) + reactor.connectTCP(args.ctrl, args.port, TrapFactory(args.ctrl, args.port, Trap, defer.DeferredSemaphore(args.num), log, args.wsdl, args.location)) + reactor.run() -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 22 11:13:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 22 Mar 2017 11:13:11 +0000 Subject: libosmocore[master]: abis: add attribute names In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/2144/2/src/gsm/abis_nm.c File src/gsm/abis_nm.c: Line 290: { NM_ATT_INTERF_BOUND, "Interference level Boundaries" }, /* ?9.4.25 */ interesting that 'level' is lowercase, but indeed reflects exactly the name in the spec :P -- To view, visit https://gerrit.osmocom.org/2144 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 22 11:14:05 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 11:14:05 +0000 Subject: [MERGED] libosmocore[master]: abis: add attribute names In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: abis: add attribute names ...................................................................... abis: add attribute names Add human-readable names for Attributes from 3GPP TS 52.021 ?9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map 3 files changed, 73 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index d6e8c11..40237cb 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -595,6 +595,7 @@ }; extern const struct value_string abis_nm_pcause_type_names[]; +extern const struct value_string abis_nm_att_names[]; /*! \brief NACK causes (Section 9.4.36) */ enum abis_nm_nack_cause { diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 155084a..e98866c 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -261,6 +261,77 @@ [T200_SACCH_TCH_SAPI3] = 10 }; +/*! \brief 3GPP TS 52.021 ?9.4 Attributes and Parameters */ +const struct value_string abis_nm_att_names[] = { + { NM_ATT_ABIS_CHANNEL, "Abis Channel" }, /* ?9.4.1 */ + { NM_ATT_ADD_INFO, "Additional Info" }, /* ?9.4.2 */ + { NM_ATT_ADD_TEXT, "Additional Text" }, /* ?9.4.3 */ + { NM_ATT_ADM_STATE, "Administrative State" }, /* ?9.4.4 */ + { NM_ATT_ARFCN_LIST, "ARFCN List" }, /* ?9.4.5 */ + { NM_ATT_AUTON_REPORT, "Autonomously Report" }, /* ?9.4.6 */ + { NM_ATT_AVAIL_STATUS, "Availability Status" }, /* ?9.4.7 */ + { NM_ATT_BCCH_ARFCN, "BCCH ARFCN" }, /* ?9.4.8 */ + { NM_ATT_BSIC, "BSIC" }, /* ?9.4.9 */ + { NM_ATT_BTS_AIR_TIMER, "BTS Air Timer" }, /* ?9.4.10 */ + { NM_ATT_CCCH_L_I_P, "CCCH Load Indication Period" }, /* ?9.4.11 */ + { NM_ATT_CCCH_L_T, "CCCH Load Threshold" }, /* ?9.4.12 */ + { NM_ATT_CHAN_COMB, "Channel Combination" }, /* ?9.4.13 */ + { NM_ATT_CONN_FAIL_CRIT, "Connection Failure Criterion" }, /* ?9.4.14 */ + { NM_ATT_DEST, "Destination" }, /* ?9.4.15 */ + { NM_ATT_EVENT_TYPE, "Event Type" }, /* ?9.4.16 */ + { NM_ATT_FILE_DATA, "File Data" }, /* ?9.4.17 */ + { NM_ATT_FILE_ID, "File Id" }, /* ?9.4.18 */ + { NM_ATT_FILE_VERSION, "File Version" }, /* ?9.4.19 */ + { NM_ATT_GSM_TIME, "GSM Time" }, /* ?9.4.20 */ + { NM_ATT_HSN, "HSN" }, /* ?9.4.21 */ + { NM_ATT_HW_CONFIG, "HW Configuration" }, /* ?9.4.22 */ + { NM_ATT_HW_DESC, "HW Description" }, /* ?9.4.23 */ + { NM_ATT_INTAVE_PARAM, "Intave Parameter" }, /* ?9.4.24 */ + { NM_ATT_INTERF_BOUND, "Interference level Boundaries" }, /* ?9.4.25 */ + { NM_ATT_LIST_REQ_ATTR, "List of Required Attributes" }, /* ?9.4.26 */ + { NM_ATT_MAIO, "MAIO" }, /* ?9.4.27 */ + { NM_ATT_MANUF_STATE, "Manufacturer Dependent State" }, /* ?9.4.28 */ + { NM_ATT_MANUF_THRESH, "Manufacturer Dependent Thresholds" }, /* ?9.4.29 */ + { NM_ATT_MANUF_ID, "Manufacturer Id" }, /* ?9.4.30 */ + { NM_ATT_MAX_TA, "Max Timing Advance" }, /* ?9.4.31 */ + { NM_ATT_MEAS_RES, "Measurement Result" }, /* ?9.4.32 */ + { NM_ATT_MEAS_TYPE, "Measurement Type" }, /* ?9.4.33 */ + { NM_ATT_MDROP_LINK, "Multi-drop BSC Link" }, /* ?9.4.34 */ + { NM_ATT_MDROP_NEXT, "Multi-drop next BTS Link" }, /* ?9.4.35 */ + { NM_ATT_NACK_CAUSES, "Nack Causes" }, /* ?9.4.36 */ + { NM_ATT_NY1, "Ny1" }, /* ?9.4.37 */ + { NM_ATT_OPER_STATE, "Operational State" }, /* ?9.4.38 */ + { NM_ATT_OVERL_PERIOD, "Overload Period" }, /* ?9.4.39 */ + { NM_ATT_PHYS_CONF, "Physical Config" }, /* ?9.4.40 */ + { NM_ATT_POWER_CLASS, "Power Class" }, /* ?9.4.41 */ + { NM_ATT_POWER_THRESH, "Power Output Thresholds" }, /* ?9.4.42 */ + { NM_ATT_PROB_CAUSE, "Probable Cause" }, /* ?9.4.43 */ + { NM_ATT_RACH_B_THRESH, "RACH Busy Threshold" }, /* ?9.4.44 */ + { NM_ATT_LDAVG_SLOTS, "RACH Load Averaging Slots" }, /* ?9.4.45 */ + { NM_ATT_RAD_SUBC, "Radio Sub Channel" }, /* ?9.4.46 */ + { NM_ATT_RF_MAXPOWR_R, "RF Max Power Reduction" }, /* ?9.4.47 */ + { NM_ATT_SITE_INPUTS, "Site Inputs" }, /* ?9.4.48 */ + { NM_ATT_SITE_OUTPUTS, "Site Outputs" }, /* ?9.4.49 */ + { NM_ATT_SOURCE, "Source" }, /* ?9.4.50 */ + { NM_ATT_SPEC_PROB, "Specific Problems" }, /* ?9.4.51 */ + { NM_ATT_START_TIME, "Starting Time" }, /* ?9.4.52 */ + { NM_ATT_T200, "T200" }, /* ?9.4.53 */ + { NM_ATT_TEI, "TEI" }, /* ?9.4.54 */ + { NM_ATT_TEST_DUR, "Test Duration" }, /* ?9.4.55 */ + { NM_ATT_TEST_NO, "Test No" }, /* ?9.4.56 */ + { NM_ATT_TEST_REPORT, "Test Report Info" }, /* ?9.4.57 */ + { NM_ATT_VSWR_THRESH, "VSWR Thresholds" }, /* ?9.4.58 */ + { NM_ATT_WINDOW_SIZE, "Window Size" }, /* ?9.4.59 */ + { NM_ATT_TSC, "TSC" }, /* ?9.4.60 */ + { NM_ATT_SW_CONFIG, "SW Configuration" }, /* ?9.4.61 */ + { NM_ATT_SW_DESCR, "SW Description" }, /* ?9.4.62 */ + { NM_ATT_SEVERITY, "Perceived Severity" }, /* ?9.4.63 */ + { NM_ATT_GET_ARI, "Get Attribute Response Info" }, /* ?9.4.64 */ + { NM_ATT_OUTST_ALARM, "Outstanding Alarm Sequence" }, /* ?9.4.65 */ + { NM_ATT_HW_CONF_CHG, "HW Conf Change Info" }, /* ?9.4.66 */ + { 0, NULL } +}; + /*! \brief Attributes that the BSC can set, not only get, according to Section 9.4 */ const enum abis_nm_attr abis_nm_att_settable[] = { NM_ATT_ADD_INFO, diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 4a33c46..cd4c0ab 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -29,6 +29,7 @@ abis_nm_ipa_magic; abis_mm_event_cause_names; abis_nm_pcause_type_names; +abis_nm_att_names; osmo_sitype_strs; osmo_c4; -- To view, visit https://gerrit.osmocom.org/2144 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 22 11:18:51 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 11:18:51 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 2: Maybe we can replace both -r and -E with new --filler which will figure out appropriate filler based on other options by checking if edge is enabled or not? In general, there's GNU gengetopt which supports mutually exclusive groups of options but it's only used for OpenGGSN so far. -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 14:21:59 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 14:21:59 +0000 Subject: [PATCH] libosmocore[master]: abis: add message type names Message-ID: Review at https://gerrit.osmocom.org/2145 abis: add message type names Add human-readable names for Message Types from 3GPP TS 52.021 ?9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map 3 files changed, 105 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/2145/1 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index 40237cb..23392d2 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -595,6 +595,7 @@ }; extern const struct value_string abis_nm_pcause_type_names[]; +extern const struct value_string abis_nm_msgtype_names[]; extern const struct value_string abis_nm_att_names[]; /*! \brief NACK causes (Section 9.4.36) */ diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index e98866c..2eb8bd8 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -261,6 +261,109 @@ [T200_SACCH_TCH_SAPI3] = 10 }; +/*! \brief 3GPP TS 52.021 ?9.1 Message Types */ +const struct value_string abis_nm_msgtype_names[] = { + { NM_MT_LOAD_INIT, "Load Data Initiate" }, /* ?8.3.1 */ + { NM_MT_LOAD_INIT_ACK, "Load Data Initiate Ack" }, + { NM_MT_LOAD_INIT_NACK, "Load Data Initiate Nack" }, + { NM_MT_LOAD_SEG, "Load Data Segment" }, /* ?8.3.2 */ + { NM_MT_LOAD_SEG_ACK, "Load Data Segment Ack" }, + { NM_MT_LOAD_ABORT, "Load Data Abort" }, /* ?8.3.3 */ + { NM_MT_LOAD_END, "Load Data End" }, /* ?8.3.4 */ + { NM_MT_LOAD_END_ACK, "Load Data End Ack" }, + { NM_MT_LOAD_END_NACK, "Load Data End Nack" }, + { NM_MT_SW_ACT_REQ, "SW Activate Request" }, /* ?8.3.5 */ + { NM_MT_SW_ACT_REQ_ACK, "SW Activate Request Ack" }, + { NM_MT_SW_ACT_REQ_NACK, "SW Activate Request Nack" }, + { NM_MT_ACTIVATE_SW, "Activate SW" }, /* ?8.3.6 */ + { NM_MT_ACTIVATE_SW_ACK, "Activate SW Ack" }, + { NM_MT_ACTIVATE_SW_NACK, "Activate SW Nack" }, + { NM_MT_SW_ACTIVATED_REP, "SW Activated Report" }, /* ?8.3.7 */ + { NM_MT_ESTABLISH_TEI "Establish TEI" }, /* ?8.4.1 */ + { NM_MT_ESTABLISH_TEI_ACK, "Establish TEI Ack" }, + { NM_MT_ESTABLISH_TEI_NACK, "Establish TEI Nack" }, + { NM_MT_CONN_TERR_SIGN, "Connect Terrestrial Signalling" }, /* ?8.4.2 */ + { NM_MT_CONN_TERR_SIGN_ACK, "Connect Terrestrial Signalling Ack" }, + { NM_MT_CONN_TERR_SIGN_NACK, "Connect Terrestrial Signalling Nack" }, + { NM_MT_DISC_TERR_SIGN, "Disconnect Terrestrial Signalling" }, /* ?8.4.3 */ + { NM_MT_DISC_TERR_SIGN_ACK, "Disconnect Terrestrial Signalling Ack" }, + { NM_MT_DISC_TERR_SIGN_NACK, "Disconnect Terrestrial Signalling Nack" }, + { NM_MT_CONN_TERR_TRAF, "Connect Terrestrial Traffic" }, /* ?8.4.4 */ + { NM_MT_CONN_TERR_TRAF_ACK, "Connect Terrestrial Traffic Ack" }, + { NM_MT_CONN_TERR_TRAF_NACK, "Connect Terrestrial Traffic Nack" }, + { NM_MT_DISC_TERR_TRAF, "Disconnect Terrestrial Traffic" }, /* ?8.4.5 */ + { NM_MT_DISC_TERR_TRAF_ACK, "Disconnect Terrestrial Traffic Ack" }, + { NM_MT_DISC_TERR_TRAF_NACK, "Disconnect Terrestrial Traffic Nack" }, + { NM_MT_CONN_MDROP_LINK "Connect Multi-Drop Link" }, /* ?8.5.1 */ + { NM_MT_CONN_MDROP_LINK_ACK, "Connect Multi-Drop Link Ack" }, + { NM_MT_CONN_MDROP_LINK_NACK, "Connect Multi-Drop Link Nack" }, + { NM_MT_DISC_MDROP_LINK, "Disconnect Multi-Drop Link" }, /* ?8.5.2 */ + { NM_MT_DISC_MDROP_LINK_ACK, "Disconnect Multi-Drop Link Ack" }, + { NM_MT_DISC_MDROP_LINK_NACK, "Disconnect Multi-Drop Link Nack" }, + { NM_MT_SET_BTS_ATTR "Set BTS Attributes" }, /* ?8.6.1 */ + { NM_MT_SET_BTS_ATTR_ACK, "Set BTS Attributes Ack" }, + { NM_MT_SET_BTS_ATTR_NACK, "Set BTS Attributes Nack" }, + { NM_MT_SET_RADIO_ATTR, "Set Radio Carrier Attributes" }, /* ?8.6.2 */ + { NM_MT_SET_RADIO_ATTR_ACK, "Set Radio Carrier Attributes Ack" }, + { NM_MT_SET_RADIO_ATTR_NACK, "Set Radio Carrier Attributes Nack" }, + { NM_MT_SET_CHAN_ATTR, "Set Channel Attributes" }, /* ?8.6.3 */ + { NM_MT_SET_CHAN_ATTR_ACK, "Set Channel Attributes Ack" }, + { NM_MT_SET_CHAN_ATTR_NACK, "Set Channel Attributes Nack" }, + { NM_MT_PERF_TEST "Perform Test" }, /* ?8.7.1 */ + { NM_MT_PERF_TEST_ACK, "Perform Test Ack" }, + { NM_MT_PERF_TEST_NACK, "Perform Test Nack" }, + { NM_MT_TEST_REP, "Test Report" }, /* ?8.7.2 */ + { NM_MT_SEND_TEST_REP, "Send Test Report" }, /* ?8.7.3 */ + { NM_MT_SEND_TEST_REP_ACK, "Send Test Report Ack" }, + { NM_MT_SEND_TEST_REP_NACK, "Send Test Report Nack" }, + { NM_MT_STOP_TEST, "Stop Test" }, /* ?8.7.4 */ + { NM_MT_STOP_TEST_ACK, "Stop Test Ack" }, + { NM_MT_STOP_TEST_NACK, "Stop Test Nack" }, + { NM_MT_STATECHG_EVENT_REP "State Changed Event Report" }, /* ?8.8.1 */ + { NM_MT_FAILURE_EVENT_REP, "Failure Event Report" }, /* ?8.8.2 */ + { NM_MT_STOP_EVENT_REP, "Stop Sending Event Reports" }, /* ?8.8.3 */ + { NM_MT_STOP_EVENT_REP_ACK, "Stop Sending Event Reports Ack" }, + { NM_MT_STOP_EVENT_REP_NACK, "Stop Sending Event Reports Nack" }, + { NM_MT_REST_EVENT_REP, "Restart Sending Event Reports" }, /* ?8.8.4 */ + { NM_MT_REST_EVENT_REP_ACK, "Restart Sending Event Reports Ack" }, + { NM_MT_REST_EVENT_REP_NACK, "Restart Sending Event Reports Nack" }, + { NM_MT_CHG_ADM_STATE, "Change Administrative State" }, /* ?8.8.5 */ + { NM_MT_CHG_ADM_STATE_ACK, "Change Administrative State Ack" }, + { NM_MT_CHG_ADM_STATE_NACK, "Change Administrative State Nack" }, + { NM_MT_CHG_ADM_STATE_REQ, "Change Administrative State Request" }, /* ?8.8.6 */ + { NM_MT_CHG_ADM_STATE_REQ_ACK, "Change Administrative State Request Ack" }, + { NM_MT_CHG_ADM_STATE_REQ_NACK, "Change Administrative State Request Nack" }, + { NM_MT_REP_OUTST_ALARMS "Report Outstanding Alarms" }, /* ?8.8.7 */ + { NM_MT_REP_OUTST_ALARMS_ACK, "Report Outstanding Alarms Ack" }, + { NM_MT_REP_OUTST_ALARMS_NACK, "Report Outstanding Alarms Nack" }, + { NM_MT_CHANGEOVER "Changeover" }, /* ?8.9.1 */ + { NM_MT_CHANGEOVER_ACK, "Changeover Ack" }, + { NM_MT_CHANGEOVER_NACK, "Changeover Nack" }, + { NM_MT_OPSTART, "Opstart" }, /* ?8.9.2 */ + { NM_MT_OPSTART_ACK, "Opstart Ack" }, + { NM_MT_OPSTART_NACK, "Opstart Nack" }, + { NM_MT_REINIT, "Reinitialize" }, /* ?8.9.3 */ + { NM_MT_REINIT_ACK, "Reinitialize Ack" }, + { NM_MT_REINIT_NACK, "Reinitialize Nack" }, + { NM_MT_SET_SITE_OUT, "Set Site Outputs" }, /* ?8.9.4 */ + { NM_MT_SET_SITE_OUT_ACK, "Set Site Outputs Ack" }, + { NM_MT_SET_SITE_OUT_NACK, "Set Site Outputs Nack" }, + { NM_MT_CHG_HW_CONF "Change HW Configuration" }, /* ?8.9.5 */ + { NM_MT_CHG_HW_CONF_ACK, "Change HW Configuration Ack" }, + { NM_MT_CHG_HW_CONF_NACK, "Change HW Configuration Nack" }, + { NM_MT_MEAS_RES_REQ "Measurement Result Request" }, /* ?8.10.1 */ + { NM_MT_MEAS_RES_RESP, "Measurement Result Response" }, /* ?8.10.2 */ + { NM_MT_STOP_MEAS, "Stop Measurement" }, /* ?8.10.4 */ + { NM_MT_START_MEAS, "Start Measurement" }, /* ?8.10.3 */ + { NM_MT_GET_ATTR "Get Attributes" }, /* ?8.11.1 */ + { NM_MT_GET_ATTR_RESP, "Get Attributes Response" }, /* ?8.11.3 */ + { NM_MT_GET_ATTR_NACK, "Get Attributes Nack" }, + { NM_MT_SET_ALARM_THRES, "Set Alarm Threshold" }, /* ?8.11.2 */ + { NM_MT_SET_ALARM_THRES_ACK, "Set Alarm Threshold Ack" }, + { NM_MT_SET_ALARM_THRES_NACK, "Set Alarm Threshold Nack" }, + { 0, NULL } +}; + /*! \brief 3GPP TS 52.021 ?9.4 Attributes and Parameters */ const struct value_string abis_nm_att_names[] = { { NM_ATT_ABIS_CHANNEL, "Abis Channel" }, /* ?9.4.1 */ diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index cd4c0ab..5649e71 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -29,6 +29,7 @@ abis_nm_ipa_magic; abis_mm_event_cause_names; abis_nm_pcause_type_names; +abis_nm_msgtype_names; abis_nm_att_names; osmo_sitype_strs; -- To view, visit https://gerrit.osmocom.org/2145 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 22 14:26:44 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 22 Mar 2017 14:26:44 +0000 Subject: [PATCH] libosmocore[master]: abis: add message type names In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2145 to look at the new patch set (#2). abis: add message type names Add human-readable names for Message Types from 3GPP TS 52.021 ?9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map 3 files changed, 105 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/2145/2 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index 40237cb..23392d2 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -595,6 +595,7 @@ }; extern const struct value_string abis_nm_pcause_type_names[]; +extern const struct value_string abis_nm_msgtype_names[]; extern const struct value_string abis_nm_att_names[]; /*! \brief NACK causes (Section 9.4.36) */ diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index e98866c..e1b248f 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -261,6 +261,109 @@ [T200_SACCH_TCH_SAPI3] = 10 }; +/*! \brief 3GPP TS 52.021 ?9.1 Message Types */ +const struct value_string abis_nm_msgtype_names[] = { + { NM_MT_LOAD_INIT, "Load Data Initiate" }, /* ?8.3.1 */ + { NM_MT_LOAD_INIT_ACK, "Load Data Initiate Ack" }, + { NM_MT_LOAD_INIT_NACK, "Load Data Initiate Nack" }, + { NM_MT_LOAD_SEG, "Load Data Segment" }, /* ?8.3.2 */ + { NM_MT_LOAD_SEG_ACK, "Load Data Segment Ack" }, + { NM_MT_LOAD_ABORT, "Load Data Abort" }, /* ?8.3.3 */ + { NM_MT_LOAD_END, "Load Data End" }, /* ?8.3.4 */ + { NM_MT_LOAD_END_ACK, "Load Data End Ack" }, + { NM_MT_LOAD_END_NACK, "Load Data End Nack" }, + { NM_MT_SW_ACT_REQ, "SW Activate Request" }, /* ?8.3.5 */ + { NM_MT_SW_ACT_REQ_ACK, "SW Activate Request Ack" }, + { NM_MT_SW_ACT_REQ_NACK, "SW Activate Request Nack" }, + { NM_MT_ACTIVATE_SW, "Activate SW" }, /* ?8.3.6 */ + { NM_MT_ACTIVATE_SW_ACK, "Activate SW Ack" }, + { NM_MT_ACTIVATE_SW_NACK, "Activate SW Nack" }, + { NM_MT_SW_ACTIVATED_REP, "SW Activated Report" }, /* ?8.3.7 */ + { NM_MT_ESTABLISH_TEI, "Establish TEI" }, /* ?8.4.1 */ + { NM_MT_ESTABLISH_TEI_ACK, "Establish TEI Ack" }, + { NM_MT_ESTABLISH_TEI_NACK, "Establish TEI Nack" }, + { NM_MT_CONN_TERR_SIGN, "Connect Terrestrial Signalling" }, /* ?8.4.2 */ + { NM_MT_CONN_TERR_SIGN_ACK, "Connect Terrestrial Signalling Ack" }, + { NM_MT_CONN_TERR_SIGN_NACK, "Connect Terrestrial Signalling Nack" }, + { NM_MT_DISC_TERR_SIGN, "Disconnect Terrestrial Signalling" }, /* ?8.4.3 */ + { NM_MT_DISC_TERR_SIGN_ACK, "Disconnect Terrestrial Signalling Ack" }, + { NM_MT_DISC_TERR_SIGN_NACK, "Disconnect Terrestrial Signalling Nack" }, + { NM_MT_CONN_TERR_TRAF, "Connect Terrestrial Traffic" }, /* ?8.4.4 */ + { NM_MT_CONN_TERR_TRAF_ACK, "Connect Terrestrial Traffic Ack" }, + { NM_MT_CONN_TERR_TRAF_NACK, "Connect Terrestrial Traffic Nack" }, + { NM_MT_DISC_TERR_TRAF, "Disconnect Terrestrial Traffic" }, /* ?8.4.5 */ + { NM_MT_DISC_TERR_TRAF_ACK, "Disconnect Terrestrial Traffic Ack" }, + { NM_MT_DISC_TERR_TRAF_NACK, "Disconnect Terrestrial Traffic Nack" }, + { NM_MT_CONN_MDROP_LINK, "Connect Multi-Drop Link" }, /* ?8.5.1 */ + { NM_MT_CONN_MDROP_LINK_ACK, "Connect Multi-Drop Link Ack" }, + { NM_MT_CONN_MDROP_LINK_NACK, "Connect Multi-Drop Link Nack" }, + { NM_MT_DISC_MDROP_LINK, "Disconnect Multi-Drop Link" }, /* ?8.5.2 */ + { NM_MT_DISC_MDROP_LINK_ACK, "Disconnect Multi-Drop Link Ack" }, + { NM_MT_DISC_MDROP_LINK_NACK, "Disconnect Multi-Drop Link Nack" }, + { NM_MT_SET_BTS_ATTR, "Set BTS Attributes" }, /* ?8.6.1 */ + { NM_MT_SET_BTS_ATTR_ACK, "Set BTS Attributes Ack" }, + { NM_MT_SET_BTS_ATTR_NACK, "Set BTS Attributes Nack" }, + { NM_MT_SET_RADIO_ATTR, "Set Radio Carrier Attributes" }, /* ?8.6.2 */ + { NM_MT_SET_RADIO_ATTR_ACK, "Set Radio Carrier Attributes Ack" }, + { NM_MT_SET_RADIO_ATTR_NACK, "Set Radio Carrier Attributes Nack" }, + { NM_MT_SET_CHAN_ATTR, "Set Channel Attributes" }, /* ?8.6.3 */ + { NM_MT_SET_CHAN_ATTR_ACK, "Set Channel Attributes Ack" }, + { NM_MT_SET_CHAN_ATTR_NACK, "Set Channel Attributes Nack" }, + { NM_MT_PERF_TEST, "Perform Test" }, /* ?8.7.1 */ + { NM_MT_PERF_TEST_ACK, "Perform Test Ack" }, + { NM_MT_PERF_TEST_NACK, "Perform Test Nack" }, + { NM_MT_TEST_REP, "Test Report" }, /* ?8.7.2 */ + { NM_MT_SEND_TEST_REP, "Send Test Report" }, /* ?8.7.3 */ + { NM_MT_SEND_TEST_REP_ACK, "Send Test Report Ack" }, + { NM_MT_SEND_TEST_REP_NACK, "Send Test Report Nack" }, + { NM_MT_STOP_TEST, "Stop Test" }, /* ?8.7.4 */ + { NM_MT_STOP_TEST_ACK, "Stop Test Ack" }, + { NM_MT_STOP_TEST_NACK, "Stop Test Nack" }, + { NM_MT_STATECHG_EVENT_REP, "State Changed Event Report" }, /* ?8.8.1 */ + { NM_MT_FAILURE_EVENT_REP, "Failure Event Report" }, /* ?8.8.2 */ + { NM_MT_STOP_EVENT_REP, "Stop Sending Event Reports" }, /* ?8.8.3 */ + { NM_MT_STOP_EVENT_REP_ACK, "Stop Sending Event Reports Ack" }, + { NM_MT_STOP_EVENT_REP_NACK, "Stop Sending Event Reports Nack" }, + { NM_MT_REST_EVENT_REP, "Restart Sending Event Reports" }, /* ?8.8.4 */ + { NM_MT_REST_EVENT_REP_ACK, "Restart Sending Event Reports Ack" }, + { NM_MT_REST_EVENT_REP_NACK, "Restart Sending Event Reports Nack" }, + { NM_MT_CHG_ADM_STATE, "Change Administrative State" }, /* ?8.8.5 */ + { NM_MT_CHG_ADM_STATE_ACK, "Change Administrative State Ack" }, + { NM_MT_CHG_ADM_STATE_NACK, "Change Administrative State Nack" }, + { NM_MT_CHG_ADM_STATE_REQ, "Change Administrative State Request" }, /* ?8.8.6 */ + { NM_MT_CHG_ADM_STATE_REQ_ACK, "Change Administrative State Request Ack" }, + { NM_MT_CHG_ADM_STATE_REQ_NACK, "Change Administrative State Request Nack" }, + { NM_MT_REP_OUTST_ALARMS, "Report Outstanding Alarms" }, /* ?8.8.7 */ + { NM_MT_REP_OUTST_ALARMS_ACK, "Report Outstanding Alarms Ack" }, + { NM_MT_REP_OUTST_ALARMS_NACK, "Report Outstanding Alarms Nack" }, + { NM_MT_CHANGEOVER, "Changeover" }, /* ?8.9.1 */ + { NM_MT_CHANGEOVER_ACK, "Changeover Ack" }, + { NM_MT_CHANGEOVER_NACK, "Changeover Nack" }, + { NM_MT_OPSTART, "Opstart" }, /* ?8.9.2 */ + { NM_MT_OPSTART_ACK, "Opstart Ack" }, + { NM_MT_OPSTART_NACK, "Opstart Nack" }, + { NM_MT_REINIT, "Reinitialize" }, /* ?8.9.3 */ + { NM_MT_REINIT_ACK, "Reinitialize Ack" }, + { NM_MT_REINIT_NACK, "Reinitialize Nack" }, + { NM_MT_SET_SITE_OUT, "Set Site Outputs" }, /* ?8.9.4 */ + { NM_MT_SET_SITE_OUT_ACK, "Set Site Outputs Ack" }, + { NM_MT_SET_SITE_OUT_NACK, "Set Site Outputs Nack" }, + { NM_MT_CHG_HW_CONF, "Change HW Configuration" }, /* ?8.9.5 */ + { NM_MT_CHG_HW_CONF_ACK, "Change HW Configuration Ack" }, + { NM_MT_CHG_HW_CONF_NACK, "Change HW Configuration Nack" }, + { NM_MT_MEAS_RES_REQ, "Measurement Result Request" }, /* ?8.10.1 */ + { NM_MT_MEAS_RES_RESP, "Measurement Result Response" }, /* ?8.10.2 */ + { NM_MT_STOP_MEAS, "Stop Measurement" }, /* ?8.10.4 */ + { NM_MT_START_MEAS, "Start Measurement" }, /* ?8.10.3 */ + { NM_MT_GET_ATTR, "Get Attributes" }, /* ?8.11.1 */ + { NM_MT_GET_ATTR_RESP, "Get Attributes Response" }, /* ?8.11.3 */ + { NM_MT_GET_ATTR_NACK, "Get Attributes Nack" }, + { NM_MT_SET_ALARM_THRES, "Set Alarm Threshold" }, /* ?8.11.2 */ + { NM_MT_SET_ALARM_THRES_ACK, "Set Alarm Threshold Ack" }, + { NM_MT_SET_ALARM_THRES_NACK, "Set Alarm Threshold Nack" }, + { 0, NULL } +}; + /*! \brief 3GPP TS 52.021 ?9.4 Attributes and Parameters */ const struct value_string abis_nm_att_names[] = { { NM_ATT_ABIS_CHANNEL, "Abis Channel" }, /* ?9.4.1 */ diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index cd4c0ab..5649e71 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -29,6 +29,7 @@ abis_nm_ipa_magic; abis_mm_event_cause_names; abis_nm_pcause_type_names; +abis_nm_msgtype_names; abis_nm_att_names; osmo_sitype_strs; -- To view, visit https://gerrit.osmocom.org/2145 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 22 17:45:04 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 17:45:04 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 2: > Maybe we can replace both -r and -E with new --filler which will > figure out appropriate filler based on other options by checking if > edge is enabled or not? That's exactly what this patch is moving away from. Right now -r option has different behavior based on whether -e is specified or not, which means that I can't generate random GMSK burst if I run in EDGE mode, which is very inconvenient. What we can do is to make this a control interface command rather than a command line parameter. It'll make it harder to use, but more clean from the code perspective. -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:10:52 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:10:52 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2136 to look at the new patch set (#2). sigProcLib: make energyDetect() simpler by returning actual energy. Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 3 files changed, 9 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/36/2136/2 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index f156ad4..3df482f 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -606,7 +606,7 @@ { int rc; complex amp; - float toa, pow, max = -1.0, avg = 0.0; + float toa, max = -1.0, avg = 0.0; int max_i = -1; signalVector *burst; SoftVector *bits = NULL; @@ -641,7 +641,7 @@ /* Select the diversity channel with highest energy */ for (size_t i = 0; i < radio_burst->chans(); i++) { - energyDetect(*radio_burst->getVector(i), 20 * mSPSRx, 0.0, &pow); + float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx); if (pow > max) { max = pow; max_i = i; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index c1cf12e..41b18cf 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1721,10 +1721,7 @@ return (amp.abs()) / rms; } -bool energyDetect(signalVector &rxBurst, - unsigned windowLength, - float detectThreshold, - float *avgPwr) +float energyDetect(signalVector &rxBurst, unsigned windowLength) { signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; @@ -1735,8 +1732,7 @@ energy += windowItr->norm2(); windowItr+=4; } - if (avgPwr) *avgPwr = energy/windowLength; - return (energy/windowLength > detectThreshold*detectThreshold); + return energy/windowLength; } /* diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 1b646cd..87c0229 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -176,17 +176,13 @@ complex scale); /** - Energy detector, checks to see if received burst energy is above a threshold. - @param rxBurst The received GSM burst of interest. + Rough energy estimator. + @param rxBurst A GSM burst. @param windowLength The number of burst samples used to compute burst energy - @param detectThreshold The detection threshold, a linear value. - @param avgPwr The average power of the received burst. - @return True if burst energy is above threshold. + @return The average power of the received burst. */ -bool energyDetect(signalVector &rxBurst, - unsigned windowLength, - float detectThreshold, - float *avgPwr = NULL); +float energyDetect(signalVector &rxBurst, + unsigned windowLength); /** RACH aka Access Burst correlator/detector. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:12:48 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:12:48 +0000 Subject: osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2136/1/Transceiver52M/sigProcLib.cpp File Transceiver52M/sigProcLib.cpp: PS1, Line 1725: { > Generally avoid per-line argument lists unless there is a good reason for r Ok, fixed. This is just an inheritance from the old code where the argument list was split into lines. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:14:20 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:14:20 +0000 Subject: [PATCH] osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2139 to look at the new patch set (#3). Call vectorSlicer() right before packing bits for transmission to osmo-bts. vectorSlicer() converts soft-bits from -1..+1 to 0..1 while we want to keep SoftVector in -1..+1 mode until the last minute, because at some point we'll want to transmit -1..+1 to osmo-bts instead of converting it from 0..1 back to -1..+1 on the osmo-bts side. Plus it removes code duplication - we call it once instead of twice. Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/39/2139/3 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 3f624d0..85dd629 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -962,6 +962,9 @@ if (!rxBurst) return; + // Convert -1..+1 soft bits to 0..1 soft bits + vectorSlicer(rxBurst); + /* * EDGE demodulator returns 444 (148 * 3) bits */ diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index d82157e..9ea81c1 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2069,8 +2069,6 @@ bits = signalToSoftVector(dec); delete dec; - vectorSlicer(bits); - return bits; } @@ -2100,7 +2098,6 @@ /* Soft slice and normalize */ bits = softSliceEdgeBurst(*rot); - vectorSlicer(bits); delete dec; delete eq; -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:14:44 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:14:44 +0000 Subject: osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Patch Set 3: > Please add this explanation to commit log. Good idea. Added -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:15:40 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:15:40 +0000 Subject: osmo-trx[master]: sigProcLib: Rename demodulateBurst() to demodGmskBurst() for... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2137 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:16:09 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:16:09 +0000 Subject: osmo-trx[master]: BitVector: Remove convolutional codec - we don't use it in o... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2141 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3006b6a26c5eff59dbe9c034f689961802f1d0d0 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:16:42 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:16:42 +0000 Subject: osmo-trx[master]: CommonLibs: Print soft bits with less confidence to console ... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2140 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:20:42 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:20:42 +0000 Subject: osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 (2 comments) https://gerrit.osmocom.org/#/c/2136/1/Transceiver52M/Transceiver.cpp File Transceiver52M/Transceiver.cpp: Line 609: float toa, max = -1.0, avg = 0.0; > Is there good reason not to move it? I prefer the moved declaration. Done Line 609: float toa, max = -1.0, avg = 0.0; > I follow the rule "declare variable in the least possible namespace". Helps Done -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:21:48 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:21:48 +0000 Subject: osmo-trx[master]: sigProcLib: Slice SoftVector instead of signalVector for GMS... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2138 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:23:24 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:23:24 +0000 Subject: osmo-trx[master]: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:23:52 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 18:23:52 +0000 Subject: osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:11 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:11 +0000 Subject: [MERGED] osmo-trx[master]: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. ...................................................................... BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits. This makes code simpler and will allow us send -127..127 soft bits towards osmo-bts instead of 0..255 bits. Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 --- M CommonLibs/BitVector.cpp M CommonLibs/BitVector.h 2 files changed, 13 insertions(+), 13 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index b77a4c4..3b556b9 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace std; @@ -268,7 +269,7 @@ resize(source.size()); for (size_t i=0; i0.5F) newSig[i]=1; + if (mStart[i]>0.0F) newSig[i]=1; else newSig[i] = 0; } return newSig; @@ -291,8 +292,7 @@ int len = vec.size(); float avg = 0; float low = 1; for (int i = 0; i < len; i++) { - float bit = vec[i]; - float energy = 2*((bit < 0.5) ? (0.5-bit) : (bit-0.5)); + float energy = fabsf(vec[i]); if (energy < low) low = energy; avg += energy/len; } @@ -304,12 +304,12 @@ ostream& operator<<(ostream& os, const SoftVector& sv) { for (size_t i=0; i0.75) os << "1"; - else if (sv[i]>0.6) os << "|"; - else if (sv[i]>0.5) os << "'"; + if (sv[i]<-0.5) os << "0"; + else if (sv[i]<-0.25) os << "o"; + else if (sv[i]<0.0) os << "."; + else if (sv[i]>0.5) os << "1"; + else if (sv[i]>0.25) os << "|"; + else if (sv[i]>0.0) os << "'"; else os << "-"; } return os; diff --git a/CommonLibs/BitVector.h b/CommonLibs/BitVector.h index 7473c32..d2acb5f 100644 --- a/CommonLibs/BitVector.h +++ b/CommonLibs/BitVector.h @@ -290,19 +290,19 @@ //@} // How good is the SoftVector in the sense of the bits being solid? - // Result of 1 is perfect and 0 means all the bits were 0.5 + // Result of 1 is perfect and 0 means all the bits were 0.0 // If plow is non-NULL, also return the lowest energy bit. float getEnergy(float *low=0) const; /** Fill with "unknown" values. */ - void unknown() { fill(0.5F); } + void unknown() { fill(0.0F); } /** Return a hard bit value from a given index by slicing. */ bool bit(size_t index) const { const float *dp = mStart+index; assert(dp0.5F; + return (*dp)>0.0F; } /** Slice the whole signal into bits. */ -- To view, visit https://gerrit.osmocom.org/2142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:12 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:12 +0000 Subject: [MERGED] osmo-trx[master]: BitVector: Remove convolutional codec - we don't use it in o... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: BitVector: Remove convolutional codec - we don't use it in osmo-trx. ...................................................................... BitVector: Remove convolutional codec - we don't use it in osmo-trx. Now we have more fexibility in how we represent SoftVector, since we no longer depend on the particular convolutional codec implementation. Change-Id: I3006b6a26c5eff59dbe9c034f689961802f1d0d0 --- M CommonLibs/BitVector.cpp M CommonLibs/BitVector.h M CommonLibs/BitVectorTest.cpp 3 files changed, 1 insertion(+), 411 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index 8389237..b77a4c4 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -217,30 +217,6 @@ } -void BitVector::encode(const ViterbiR2O4& coder, BitVector& target) -{ - size_t sz = size(); - assert(sz*coder.iRate() == target.size()); - - // Build a "history" array where each element contains the full history. - uint32_t history[sz]; - uint32_t accum = 0; - for (size_t i=0; iiState) << 1; // input state for 0 - const uint32_t iState1 = iState0 | 0x01; // input state for 1 - const uint32_t oStateShifted = (sp->oState) << mIRate; // shifted output - const float cost = sp->cost; - sp++; - // 0 input extension - mCandidates[i].cost = cost; - mCandidates[i].oState = oStateShifted | mGeneratorTable[iState0 & mCMask]; - mCandidates[i].iState = iState0; - // 1 input extension - mCandidates[i+1].cost = cost; - mCandidates[i+1].oState = oStateShifted | mGeneratorTable[iState1 & mCMask]; - mCandidates[i+1].iState = iState1; - } -} - - -void ViterbiR2O4::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) -{ - const float *cTab[2] = {matchCost,mismatchCost}; - for (unsigned i=0; i>1)&0x01][0]; - } -} - - -void ViterbiR2O4::pruneCandidates() -{ - const vCand* c1 = mCandidates; // 0-prefix - const vCand* c2 = mCandidates + mIStates; // 1-prefix - for (unsigned i=0; i=minCost) continue; - minCost = thisCost; - minIndex=i; - } - return mSurvivors[minIndex]; -} - - -const ViterbiR2O4::vCand& ViterbiR2O4::step(uint32_t inSample, const float *probs, const float *iprobs) -{ - branchCandidates(); - getSoftCostMetrics(inSample,probs,iprobs); - pruneCandidates(); - return minCost(); -} - - -uint64_t Parity::syndrome(const BitVector& receivedCodeword) -{ - return receivedCodeword.syndrome(*this); -} - - -void Parity::writeParityWord(const BitVector& data, BitVector& parityTarget, bool invert) -{ - uint64_t pWord = data.parity(*this); - if (invert) pWord = ~pWord; - parityTarget.fillField(0,pWord,size()); -} - - - - - - - - - SoftVector::SoftVector(const BitVector& source) { resize(source.size()); @@ -445,87 +285,6 @@ } - -void SoftVector::decode(ViterbiR2O4 &decoder, BitVector& target) const -{ - const size_t sz = size(); - const unsigned deferral = decoder.deferral(); - const size_t ctsz = sz + deferral*decoder.iRate(); - assert(sz <= decoder.iRate()*target.size()); - - // Build a "history" array where each element contains the full history. - uint32_t history[ctsz]; - { - BitVector bits = sliced(); - uint32_t accum = 0; - for (size_t i=0; i0.5F) pVal = 1.0F-pVal; - float ipVal = 1.0F-pVal; - // This is a cheap approximation to an ideal cost function. - if (pVal<0.01F) pVal = 0.01; - if (ipVal<0.01F) ipVal = 0.01; - matchCostTable[i] = 0.25F/ipVal; - mismatchCostTable[i] = 0.25F/pVal; - } - - // pad end of table with unknowns - for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; - oCount++; - } - } -} - - - -// (pat) Added 6-22-2012 float SoftVector::getEnergy(float *plow) const { const SoftVector &vec = *this; diff --git a/CommonLibs/BitVector.h b/CommonLibs/BitVector.h index e244be7..7473c32 100644 --- a/CommonLibs/BitVector.h +++ b/CommonLibs/BitVector.h @@ -89,142 +89,6 @@ - -/** Parity (CRC-type) generator and checker based on a Generator. */ -class Parity : public Generator { - - protected: - - unsigned mCodewordSize; - - public: - - Parity(uint64_t wCoefficients, unsigned wParitySize, unsigned wCodewordSize) - :Generator(wCoefficients, wParitySize), - mCodewordSize(wCodewordSize) - { } - - /** Compute the parity word and write it into the target segment. */ - void writeParityWord(const BitVector& data, BitVector& parityWordTarget, bool invert=true); - - /** Compute the syndrome of a received sequence. */ - uint64_t syndrome(const BitVector& receivedCodeword); -}; - - - - -/** - Class to represent convolutional coders/decoders of rate 1/2, memory length 4. - This is the "workhorse" coder for most GSM channels. -*/ -class ViterbiR2O4 { - - private: - /**name Lots of precomputed elements so the compiler can optimize like hell. */ - //@{ - /**@name Core values. */ - //@{ - static const unsigned mIRate = 2; ///< reciprocal of rate - static const unsigned mOrder = 4; ///< memory length of generators - //@} - /**@name Derived values. */ - //@{ - static const unsigned mIStates = 0x01 << mOrder; ///< number of states, number of survivors - static const uint32_t mSMask = mIStates-1; ///< survivor mask - static const uint32_t mCMask = (mSMask<<1) | 0x01; ///< candidate mask - static const uint32_t mOMask = (0x01< { @@ -288,8 +152,6 @@ uint64_t syndrome(Generator& gen) const; /** Calculate the parity word for the vector with the given Generator. */ uint64_t parity(Generator& gen) const; - /** Encode the signal with the GSM rate 1/2 convolutional encoder. */ - void encode(const ViterbiR2O4& encoder, BitVector& target); //@} @@ -427,10 +289,7 @@ const SoftVector tail(size_t start) const { return segment(start,size()-start); } //@} - /** Decode soft symbols with the GSM rate-1/2 Viterbi decoder. */ - void decode(ViterbiR2O4 &decoder, BitVector& target) const; - - // (pat) How good is the SoftVector in the sense of the bits being solid? + // How good is the SoftVector in the sense of the bits being solid? // Result of 1 is perfect and 0 means all the bits were 0.5 // If plow is non-NULL, also return the lowest energy bit. float getEnergy(float *low=0) const; diff --git a/CommonLibs/BitVectorTest.cpp b/CommonLibs/BitVectorTest.cpp index 5e487ad..063138f 100644 --- a/CommonLibs/BitVectorTest.cpp +++ b/CommonLibs/BitVectorTest.cpp @@ -35,27 +35,6 @@ int main(int argc, char *argv[]) { - BitVector v1("0000111100111100101011110000"); - cout << v1 << endl; - v1.LSB8MSB(); - cout << v1 << endl; - ViterbiR2O4 vCoder; - BitVector v2(v1.size()*2); - v1.encode(vCoder,v2); - cout << v2 << endl; - SoftVector sv2(v2); - cout << sv2 << endl; - for (unsigned i=0; i Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:12 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:12 +0000 Subject: [MERGED] osmo-trx[master]: CommonLibs: Print soft bits with less confidence to console ... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: CommonLibs: Print soft bits with less confidence to console when printing a soft vector. ...................................................................... CommonLibs: Print soft bits with less confidence to console when printing a soft vector. We use other symbols to show that these bits has less confidence: o and . for 0 with less confidence | and ' for 1 with less confidence Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435 --- M CommonLibs/BitVector.cpp 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index 7487834..8389237 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -546,7 +546,11 @@ { for (size_t i=0; i0.75) os << "1"; + else if (sv[i]>0.6) os << "|"; + else if (sv[i]>0.5) os << "'"; else os << "-"; } return os; -- To view, visit https://gerrit.osmocom.org/2140 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:12 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:12 +0000 Subject: [MERGED] osmo-trx[master]: Call vectorSlicer() right before packing bits for transmissi... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: Call vectorSlicer() right before packing bits for transmission to osmo-bts. ...................................................................... Call vectorSlicer() right before packing bits for transmission to osmo-bts. vectorSlicer() converts soft-bits from -1..+1 to 0..1 while we want to keep SoftVector in -1..+1 mode until the last minute, because at some point we'll want to transmit -1..+1 to osmo-bts instead of converting it from 0..1 back to -1..+1 on the osmo-bts side. Plus it removes code duplication - we call it once instead of twice. Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp 2 files changed, 3 insertions(+), 3 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 3f624d0..85dd629 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -962,6 +962,9 @@ if (!rxBurst) return; + // Convert -1..+1 soft bits to 0..1 soft bits + vectorSlicer(rxBurst); + /* * EDGE demodulator returns 444 (148 * 3) bits */ diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 56a1a58..6f50f04 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2068,8 +2068,6 @@ bits = signalToSoftVector(dec); delete dec; - vectorSlicer(bits); - return bits; } @@ -2099,7 +2097,6 @@ /* Soft slice and normalize */ bits = softSliceEdgeBurst(*rot); - vectorSlicer(bits); delete dec; delete eq; -- To view, visit https://gerrit.osmocom.org/2139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764 Gerrit-PatchSet: 4 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:13 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:13 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Slice SoftVector instead of signalVector for GMS... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: Slice SoftVector instead of signalVector for GMSK demod. ...................................................................... sigProcLib: Slice SoftVector instead of signalVector for GMSK demod. This makes it similar to 8-PSK demod and also saves a bit of lines ofcode and should give us a tiny improvement in performance. Ideally we need to remove vector slicing at all, because in osmo-bts-trx we convert back to +-1.0 again (actually to +-127, but it doesn't mater). So we should rather transmit +-1.0 values to avoid double conversion. Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 22 insertions(+), 26 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 0a1fd44..56a1a58 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -737,20 +737,6 @@ return true; } -bool vectorSlicer(signalVector *x) -{ - - signalVector::iterator xP = x->begin(); - signalVector::iterator xPEnd = x->end(); - while (xP < xPEnd) { - *xP = (complex) (0.5*(xP->real()+1.0F)); - if (xP->real() > 1.0) *xP = 1.0; - if (xP->real() < 0.0) *xP = 0.0; - xP++; - } - return true; -} - static signalVector *rotateBurst(const BitVector &wBurst, int guardPeriodLength, int sps) { @@ -2020,6 +2006,22 @@ } /* + * Convert signalVector to SoftVector by taking real part of the signal. + */ +static SoftVector *signalToSoftVector(signalVector *dec) +{ + SoftVector *bits = new SoftVector(dec->size()); + + SoftVector::iterator bit_itr = bits->begin(); + signalVector::iterator burst_itr = dec->begin(); + + for (; burst_itr < dec->end(); burst_itr++) + *bit_itr++ = burst_itr->real(); + + return bits; +} + +/* * Shared portion of GMSK and EDGE demodulators consisting of timing * recovery and single tap channel correction. For 4 SPS (if activated), * the output is downsampled prior to the 1 SPS modulation specific @@ -2062,18 +2064,12 @@ /* Shift up by a quarter of a frequency */ GMSKReverseRotate(*dec, 1); - vectorSlicer(dec); - - bits = new SoftVector(dec->size()); - - SoftVector::iterator bit_itr = bits->begin(); - signalVector::iterator burst_itr = dec->begin(); - - for (; burst_itr < dec->end(); burst_itr++) - *bit_itr++ = burst_itr->real(); - + /* Take real part of the signal */ + bits = signalToSoftVector(dec); delete dec; + vectorSlicer(bits); + return bits; } diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 7dca71f..ed72430 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -101,8 +101,8 @@ unsigned startIx = 0, unsigned len = 0); -/** Operate soft slicer on real-valued portion of vector */ -bool vectorSlicer(signalVector *x); +/** Operate soft slicer on a soft-bit vector */ +bool vectorSlicer(SoftVector *x); /** GMSK modulate a GSM burst of bits */ signalVector *modulateBurst(const BitVector &wBurst, -- To view, visit https://gerrit.osmocom.org/2138 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If9ed6f0f80fbe88c994b2f9c3cae91d0d57f4442 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:13 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:13 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Rename demodulateBurst() to demodGmskBurst() for... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity. ...................................................................... sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity. Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 3 files changed, 6 insertions(+), 6 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 3df482f..3f624d0 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -583,7 +583,7 @@ if (type == EDGE) return demodEdgeBurst(burst, mSPSRx, amp, toa); - return demodulateBurst(burst, mSPSRx, amp, toa); + return demodGmskBurst(burst, mSPSRx, amp, toa); } void writeToFile(radioVector *radio_burst, size_t chan) diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 41b18cf..0a1fd44 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2050,7 +2050,7 @@ * 4 SPS (if activated) to minimize distortion through the fractional * delay filters. Symbol rotation and after always operates at 1 SPS. */ -SoftVector *demodulateBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, complex channel, float TOA) { SoftVector *bits; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 87c0229..7dca71f 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -261,16 +261,16 @@ signalVector *decimateVector(signalVector &wVector, size_t factor); /** - Demodulates a received burst using a soft-slicer. - @param rxBurst The burst to be demodulated. + Demodulates a GMSK burst using a soft-slicer. + @param rxBurst The burst to be demodulated. @param gsmPulse The GSM pulse. @param sps The number of samples per GSM symbol. @param channel The amplitude estimate of the received burst. @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodulateBurst(signalVector &rxBurst, int sps, - complex channel, float TOA); +SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, + complex channel, float TOA); /** Demodulate 8-PSK EDGE burst with soft symbol ooutput -- To view, visit https://gerrit.osmocom.org/2137 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:33:13 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:33:13 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: make energyDetect() simpler by returning actual ... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: make energyDetect() simpler by returning actual energy. ...................................................................... sigProcLib: make energyDetect() simpler by returning actual energy. Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 3 files changed, 9 insertions(+), 17 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index f156ad4..3df482f 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -606,7 +606,7 @@ { int rc; complex amp; - float toa, pow, max = -1.0, avg = 0.0; + float toa, max = -1.0, avg = 0.0; int max_i = -1; signalVector *burst; SoftVector *bits = NULL; @@ -641,7 +641,7 @@ /* Select the diversity channel with highest energy */ for (size_t i = 0; i < radio_burst->chans(); i++) { - energyDetect(*radio_burst->getVector(i), 20 * mSPSRx, 0.0, &pow); + float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx); if (pow > max) { max = pow; max_i = i; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index c1cf12e..41b18cf 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1721,10 +1721,7 @@ return (amp.abs()) / rms; } -bool energyDetect(signalVector &rxBurst, - unsigned windowLength, - float detectThreshold, - float *avgPwr) +float energyDetect(signalVector &rxBurst, unsigned windowLength) { signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; @@ -1735,8 +1732,7 @@ energy += windowItr->norm2(); windowItr+=4; } - if (avgPwr) *avgPwr = energy/windowLength; - return (energy/windowLength > detectThreshold*detectThreshold); + return energy/windowLength; } /* diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 1b646cd..87c0229 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -176,17 +176,13 @@ complex scale); /** - Energy detector, checks to see if received burst energy is above a threshold. - @param rxBurst The received GSM burst of interest. + Rough energy estimator. + @param rxBurst A GSM burst. @param windowLength The number of burst samples used to compute burst energy - @param detectThreshold The detection threshold, a linear value. - @param avgPwr The average power of the received burst. - @return True if burst energy is above threshold. + @return The average power of the received burst. */ -bool energyDetect(signalVector &rxBurst, - unsigned windowLength, - float detectThreshold, - float *avgPwr = NULL); +float energyDetect(signalVector &rxBurst, + unsigned windowLength); /** RACH aka Access Burst correlator/detector. -- To view, visit https://gerrit.osmocom.org/2136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:18 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:18 +0000 Subject: [PATCH] osmo-trx[master]: Move CorrType type from Transceiver to sigProcLib. Message-ID: Review at https://gerrit.osmocom.org/2146 Move CorrType type from Transceiver to sigProcLib. Required to move Transceiver::detectBurst to sigProcLib. Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.h 3 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/46/2146/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 85dd629..c1a63fd 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -113,7 +113,7 @@ if ((filler == Transceiver::FILLER_NORM_RAND) || (filler == Transceiver::FILLER_EDGE_RAND)) { - chanType[n] = Transceiver::TSC; + chanType[n] = TSC; } } @@ -452,8 +452,8 @@ } -Transceiver::CorrType Transceiver::expectedCorrType(GSM::Time currTime, - size_t chan) +CorrType Transceiver::expectedCorrType(GSM::Time currTime, + size_t chan) { static int tchh_subslot[26] = { 0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,1 }; static int sdcch4_subslot[102] = { 3,3,3,3,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2, diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index d9a9708..425b004 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -142,15 +142,6 @@ LOOPBACK ///< similar go VII, used in loopback testing } ChannelCombination; - /** Codes for burst types of received bursts*/ - typedef enum { - OFF, ///< timeslot is off - TSC, ///< timeslot should contain a normal burst - RACH, ///< timeslot should contain an access burst - EDGE, ///< timeslot should contain an EDGE burst - IDLE ///< timeslot is an idle (or dummy) burst - } CorrType; - enum FillerType { FILLER_DUMMY, FILLER_ZERO, diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index ed72430..211e1a9 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -33,6 +33,15 @@ UNDEFINED, }; +/** Codes for burst types of received bursts*/ +enum CorrType{ + OFF, ///< timeslot is off + TSC, ///< timeslot should contain a normal burst + RACH, ///< timeslot should contain an access burst + EDGE, ///< timeslot should contain an EDGE burst + IDLE ///< timeslot is an idle (or dummy) burst +}; + enum signalError { SIGERR_NONE, SIGERR_BOUNDS, -- To view, visit https://gerrit.osmocom.org/2146 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:18 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:18 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: rename signalError type to SignalError. Message-ID: Review at https://gerrit.osmocom.org/2147 sigProcLib: rename signalError type to SignalError. Change-Id: I1a5ae6e87d4c69945053fdefec185d0fb1a26399 --- M Transceiver52M/sigProcLib.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/47/2147/1 diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 211e1a9..7bdbde8 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -42,7 +42,7 @@ IDLE ///< timeslot is an idle (or dummy) burst }; -enum signalError { +enum SignalError { SIGERR_NONE, SIGERR_BOUNDS, SIGERR_CLIP, -- To view, visit https://gerrit.osmocom.org/2147 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a5ae6e87d4c69945053fdefec185d0fb1a26399 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:18 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:18 +0000 Subject: [PATCH] osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... Message-ID: Review at https://gerrit.osmocom.org/2148 Move Transceiver::detectBurst() to sigProcLib to make it reusable. Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 4 files changed, 58 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/48/2148/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index c1a63fd..6b50981 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -542,38 +542,6 @@ } } -int Transceiver::detectBurst(signalVector &burst, - complex &, float &toa, CorrType type) -{ - int rc = 0; - - switch (type) { - case EDGE: - rc = detectEdgeBurst(burst, mTSC, BURST_THRESH, mSPSRx, - amp, toa, mMaxExpectedDelayNB); - if (rc > 0) - break; - else - type = TSC; - case TSC: - rc = analyzeTrafficBurst(burst, mTSC, BURST_THRESH, mSPSRx, - amp, toa, mMaxExpectedDelayNB); - break; - case RACH: - rc = detectRACHBurst(burst, BURST_THRESH, mSPSRx, amp, toa, - mMaxExpectedDelayAB); - break; - default: - LOG(ERR) << "Invalid correlation type"; - } - - if (rc > 0) - return type; - - return rc; -} - - /* * Demodulate GMSK by direct rotation and soft slicing. */ @@ -679,7 +647,8 @@ } /* Detect normal or RACH bursts */ - rc = detectBurst(*burst, amp, toa, type); + rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, amp, toa, + mMaxExpectedDelayNB, mMaxExpectedDelayAB); if (rc > 0) { type = (CorrType) rc; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 425b004..3c70e5c 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -202,10 +202,6 @@ /** send messages over the clock socket */ void writeClockInterface(void); - /** Detectbursts */ - int detectBurst(signalVector &burst, - complex &, float &toa, CorrType type); - /** Demodulate burst and output soft bits */ SoftVector *demodulate(signalVector &burst, complex amp, float toa, CorrType type); diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 6f50f04..b531fea 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1925,6 +1925,38 @@ return rc; } +int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, CorrType type, complex &, float &toa, + unsigned max_toa_nb, unsigned max_toa_ab) +{ + int rc = 0; + + switch (type) { + case EDGE: + rc = detectEdgeBurst(burst, tsc, threshold, sps, + amp, toa, max_toa_nb); + if (rc > 0) + break; + else + type = TSC; + case TSC: + rc = analyzeTrafficBurst(burst, tsc, threshold, sps, + amp, toa, max_toa_nb); + break; + case RACH: + rc = detectRACHBurst(burst, threshold, sps, amp, toa, + max_toa_ab); + break; + default: + LOG(ERR) << "Invalid correlation type"; + } + + if (rc > 0) + return type; + + return rc; +} + signalVector *downsampleBurst(signalVector &burst) { signalVector *in, *out; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 7bdbde8..8b7f4af 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -255,6 +255,30 @@ unsigned max_toa); /** + 8-PSK/GMSK/RACH burst detector + @param burst The received GSM burst of interest + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param sps The number of samples per GSM symbol. + @param amplitude The estimated amplitude of received TSC burst. + @param toa The estimate time-of-arrival of received TSC burst. + @param max_toa_nb The maximum expected time-of-arrival for Normal Bursts + @param max_toa_ab The maximum expected time-of-arrival for Access Bursts + @return positive value (CorrType) if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected +*/ +int detectAnyBurst(signalVector &burst, + unsigned tsc, + float threshold, + int sps, + CorrType type, + complex &, + float &toa, + unsigned max_toa_nb, + unsigned max_toa_ab); + +/** Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:18 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:18 +0000 Subject: [PATCH] osmo-trx[master]: Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to ma... Message-ID: Review at https://gerrit.osmocom.org/2149 Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to make it reusable. Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.h 2 files changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/49/2149/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 6b50981..1ae9f93 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -44,15 +44,6 @@ /* Number of running values use in noise average */ #define NOISE_CNT 20 -/* - * Burst detection threshold - * - * Decision threshold value for burst gating on peak-to-average value of - * correlated synchronization sequences. Lower values pass more bursts up - * to upper layers but will increase the false detection rate. - */ -#define BURST_THRESH 4.0 - TransceiverState::TransceiverState() : mRetrans(false), mNoiseLev(0.0), mNoises(NOISE_CNT), mPower(0.0) { diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 8b7f4af..bea9c4a 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -50,6 +50,15 @@ SIGERR_INTERNAL, }; +/* + * Burst detection threshold + * + * Decision threshold value for burst gating on peak-to-average value of + * correlated synchronization sequences. Lower values pass more bursts up + * to upper layers but will increase the false detection rate. + */ +#define BURST_THRESH 4.0 + /** Convert a linear number to a dB value */ float dB(float x); -- To view, visit https://gerrit.osmocom.org/2149 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:19 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:19 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Add operator<< to print CorrType to a string. Message-ID: Review at https://gerrit.osmocom.org/2150 sigProcLib: Add operator<< to print CorrType to a string. Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/50/2150/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index b531fea..5995845 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2166,3 +2166,26 @@ sigProcLibDestroy(); return false; } + +std::string corrTypeToString(CorrType corr) { + switch (corr) { + case OFF: + return "OFF"; + case TSC: + return "TSC"; + case RACH: + return "RACH"; + case EDGE: + return "EDGE"; + case IDLE: + return "IDLE"; + default: + return "unknown"; + } +} + +std::ostream& operator<<(std::ostream& os, CorrType corr) +{ + os << corrTypeToString(corr); + return os; +} diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index bea9c4a..0f40c1e 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -41,6 +41,8 @@ EDGE, ///< timeslot should contain an EDGE burst IDLE ///< timeslot is an idle (or dummy) burst }; +std::string corrTypeToString(CorrType corr); +std::ostream& operator<<(std::ostream& os, CorrType corr); enum SignalError { SIGERR_NONE, -- To view, visit https://gerrit.osmocom.org/2150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:19 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:19 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib.h: Fix whitespaces. No non-whitespace changes. Message-ID: Review at https://gerrit.osmocom.org/2151 sigProcLib.h: Fix whitespaces. No non-whitespace changes. The file seem to be using "2 spaces" indent, bt some lines are using tabs which breaks formatting. Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 --- M Transceiver52M/sigProcLib.h 1 file changed, 42 insertions(+), 42 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/51/2151/1 diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 0f40c1e..285b977 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -21,9 +21,9 @@ #include "signalVector.h" /* Burst lengths */ -#define NORMAL_BURST_NBITS 148 -#define EDGE_BURST_NBITS 444 -#define EDGE_BURST_NSYMS (EDGE_BURST_NBITS / 3) +#define NORMAL_BURST_NBITS 148 +#define EDGE_BURST_NBITS 444 +#define EDGE_BURST_NSYMS (EDGE_BURST_NBITS / 3) /** Convolution type indicator */ enum ConvType { @@ -80,11 +80,11 @@ void sigProcLibDestroy(void); /** - Convolve two vectors. - @param a,b The vectors to be convolved. - @param c, A preallocated vector to hold the convolution result. - @param spanType The type/span of the convolution. - @return The convolution result or NULL on error. + Convolve two vectors. + @param a,b The vectors to be convolved. + @param c, A preallocated vector to hold the convolution result. + @param spanType The type/span of the convolution. + @return The convolution result or NULL on error. */ signalVector *convolve(const signalVector *a, const signalVector *b, signalVector *c, ConvType spanType, @@ -93,18 +93,18 @@ /** Frequency shift a vector. - @param y The frequency shifted vector. - @param x The vector to-be-shifted. - @param freq The digital frequency shift - @param startPhase The starting phase of the oscillator - @param finalPhase The final phase of the oscillator - @return The frequency shifted vector. + @param y The frequency shifted vector. + @param x The vector to-be-shifted. + @param freq The digital frequency shift + @param startPhase The starting phase of the oscillator + @param finalPhase The final phase of the oscillator + @return The frequency shifted vector. */ signalVector* frequencyShift(signalVector *y, - signalVector *x, - float freq = 0.0, - float startPhase = 0.0, - float *finalPhase=NULL); + signalVector *x, + float freq = 0.0, + float startPhase = 0.0, + float *finalPhase=NULL); /** Correlate two vectors. @@ -114,20 +114,20 @@ @return The correlation result. */ signalVector* correlate(signalVector *a, - signalVector *b, - signalVector *c, - ConvType spanType, + signalVector *b, + signalVector *c, + ConvType spanType, bool bReversedConjugated = false, - unsigned startIx = 0, - unsigned len = 0); + unsigned startIx = 0, + unsigned len = 0); /** Operate soft slicer on a soft-bit vector */ bool vectorSlicer(SoftVector *x); /** GMSK modulate a GSM burst of bits */ signalVector *modulateBurst(const BitVector &wBurst, - int guardPeriodLength, - int sps, bool emptyPulse = false); + int guardPeriodLength, + int sps, bool emptyPulse = false); /** 8-PSK modulate a burst of bits */ signalVector *modulateEdgeBurst(const BitVector &bits, @@ -156,7 +156,7 @@ /** Add two vectors in-place */ bool addVector(signalVector &x, - signalVector &y); + signalVector &y); /** Multiply two vectors in-place*/ bool multVector(signalVector &x, @@ -168,24 +168,24 @@ complex mean = complex(0.0)); /** - Given a non-integer index, interpolate a sample. - @param inSig The signal from which to interpolate. - @param ix The index. - @return The interpolated signal value. + Given a non-integer index, interpolate a sample. + @param inSig The signal from which to interpolate. + @param ix The index. + @return The interpolated signal value. */ complex interpolatePoint(const signalVector &inSig, - float ix); + float ix); /** - Given a correlator output, locate the correlation peak. - @param rxBurst The correlator result. - @param peakIndex Pointer to value to receive interpolated peak index. - @param avgPower Power to value to receive mean power. - @return Peak value. + Given a correlator output, locate the correlation peak. + @param rxBurst The correlator result. + @param peakIndex Pointer to value to receive interpolated peak index. + @param avgPower Power to value to receive mean power. + @return Peak value. */ complex peakDetect(const signalVector &rxBurst, - float *peakIndex, - float *avgPwr); + float *peakIndex, + float *avgPwr); /** Apply a scalar to a vector. @@ -193,7 +193,7 @@ @param scale The scalar. */ void scaleVector(signalVector &x, - complex scale); + complex scale); /** Rough energy estimator. @@ -290,14 +290,14 @@ unsigned max_toa_ab); /** - Downsample 4 SPS to 1 SPS using a polyphase filterbank + Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ signalVector *downsampleBurst(signalVector &burst); /** - Decimate a vector. + Decimate a vector. @param wVector The vector of interest. @param factor Decimation factor. @return The decimated signal vector. @@ -318,7 +318,7 @@ /** Demodulate 8-PSK EDGE burst with soft symbol ooutput - @param rxBurst The burst to be demodulated. + @param rxBurst The burst to be demodulated. @param sps The number of samples per GSM symbol. @param channel The amplitude estimate of the received burst. @param TOA The time-of-arrival of the received burst. -- To view, visit https://gerrit.osmocom.org/2151 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:19 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:19 +0000 Subject: [PATCH] osmo-trx[master]: Move Transceiver::demodulate() to sigProcLib to make it reus... Message-ID: Review at https://gerrit.osmocom.org/2152 Move Transceiver::demodulate() to sigProcLib to make it reusable. Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 4 files changed, 14 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/52/2152/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 1ae9f93..65e1c61 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -533,18 +533,6 @@ } } -/* - * Demodulate GMSK by direct rotation and soft slicing. - */ -SoftVector *Transceiver::demodulate(signalVector &burst, complex amp, - float toa, CorrType type) -{ - if (type == EDGE) - return demodEdgeBurst(burst, mSPSRx, amp, toa); - - return demodGmskBurst(burst, mSPSRx, amp, toa); -} - void writeToFile(radioVector *radio_burst, size_t chan) { GSM::Time time = radio_burst->getTime(); @@ -656,7 +644,7 @@ timingOffset = toa; - bits = demodulate(*burst, amp, toa, type); + bits = demodAnyBurst(*burst, mSPSRx, amp, toa, type); delete radio_burst; return bits; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 3c70e5c..6f9cb92 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -202,10 +202,6 @@ /** send messages over the clock socket */ void writeClockInterface(void); - /** Demodulate burst and output soft bits */ - SoftVector *demodulate(signalVector &burst, - complex amp, float toa, CorrType type); - int mSPSTx; ///< number of samples per Tx symbol int mSPSRx; ///< number of samples per Rx symbol size_t mChans; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 5995845..ece6fa0 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2137,6 +2137,15 @@ return bits; } +SoftVector *demodAnyBurst(signalVector &burst, int sps, complex amp, + float toa, CorrType type) +{ + if (type == EDGE) + return demodEdgeBurst(burst, sps, amp, toa); + else + return demodGmskBurst(burst, sps, amp, toa); +} + bool sigProcLibSetup() { initTrigTables(); diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 285b977..fe50508 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -327,4 +327,8 @@ SoftVector *demodEdgeBurst(signalVector &rxBurst, int sps, complex channel, float TOA); +/** Demodulate burst basde on type and output soft bits */ +SoftVector *demodAnyBurst(signalVector &burst, int sps, + complex amp, float toa, CorrType type); + #endif /* SIGPROCLIB_H */ -- To view, visit https://gerrit.osmocom.org/2152 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:19 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:19 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: constify signalVector arguments for detectBurst(... Message-ID: Review at https://gerrit.osmocom.org/2153 sigProcLib: constify signalVector arguments for detectBurst() functions. Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 24 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/53/2153/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index ece6fa0..0ff257c 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1707,7 +1707,7 @@ return (amp.abs()) / rms; } -float energyDetect(signalVector &rxBurst, unsigned windowLength) +float energyDetect(const signalVector &rxBurst, unsigned windowLength) { signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; @@ -1729,12 +1729,13 @@ * For higher oversampling values, we assume the energy detector is in place * and we run full interpolating peak detection. */ -static int detectBurst(signalVector &burst, +static int detectBurst(const signalVector &burst, signalVector &corr, CorrelationSequence *sync, float thresh, int sps, complex *amp, float *toa, int start, int len) { - signalVector *corr_in, *dec = NULL; + const signalVector *corr_in; + signalVector *dec = NULL; if (sps == 4) { dec = downsampleBurst(burst); @@ -1782,7 +1783,7 @@ return 1; } -static float maxAmplitude(signalVector &burst) +static float maxAmplitude(const signalVector &burst) { float max = 0.0; for (size_t i = 0; i < burst.size(); i++) { @@ -1803,13 +1804,13 @@ * head: Search symbols before target * tail: Search symbols after target */ -int detectGeneralBurst(signalVector &rxBurst, - float thresh, - int sps, - complex &, - float &toa, - int target, int head, int tail, - CorrelationSequence *sync) +static int detectGeneralBurst(const signalVector &rxBurst, + float thresh, + int sps, + complex &, + float &toa, + int target, int head, int tail, + CorrelationSequence *sync) { int rc, start, len; bool clipping = false; @@ -1858,7 +1859,7 @@ * head: Search 8 symbols before target * tail: Search 8 symbols + maximum expected delay */ -int detectRACHBurst(signalVector &burst, +int detectRACHBurst(const signalVector &burst, float threshold, int sps, complex &litude, @@ -1887,7 +1888,7 @@ * head: Search 6 symbols before target * tail: Search 6 symbols + maximum expected delay */ -int analyzeTrafficBurst(signalVector &burst, unsigned tsc, float threshold, +int analyzeTrafficBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; @@ -1906,7 +1907,7 @@ return rc; } -int detectEdgeBurst(signalVector &burst, unsigned tsc, float threshold, +int detectEdgeBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; @@ -1925,7 +1926,7 @@ return rc; } -int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold, +int detectAnyBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, CorrType type, complex &, float &toa, unsigned max_toa_nb, unsigned max_toa_ab) { @@ -1957,7 +1958,7 @@ return rc; } -signalVector *downsampleBurst(signalVector &burst) +signalVector *downsampleBurst(const signalVector &burst) { signalVector *in, *out; @@ -2085,7 +2086,7 @@ * delay filters. Symbol rotation and after always operates at 1 SPS. */ SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, - complex channel, float TOA) + complex channel, float TOA) { SoftVector *bits; signalVector *dec; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index fe50508..94b346d 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -201,7 +201,7 @@ @param windowLength The number of burst samples used to compute burst energy @return The average power of the received burst. */ -float energyDetect(signalVector &rxBurst, +float energyDetect(const signalVector &rxBurst, unsigned windowLength); /** @@ -216,7 +216,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int detectRACHBurst(signalVector &burst, +int detectRACHBurst(const signalVector &burst, float threshold, int sps, complex &litude, @@ -236,7 +236,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int analyzeTrafficBurst(signalVector &burst, +int analyzeTrafficBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, @@ -257,7 +257,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int detectEdgeBurst(signalVector &burst, +int detectEdgeBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, @@ -279,7 +279,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int detectAnyBurst(signalVector &burst, +int detectAnyBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, @@ -294,7 +294,7 @@ @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ -signalVector *downsampleBurst(signalVector &burst); +signalVector *downsampleBurst(const signalVector &burst); /** Decimate a vector. -- To view, visit https://gerrit.osmocom.org/2153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:19 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:19 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Constify demodulation functions burst argument. Message-ID: Review at https://gerrit.osmocom.org/2154 sigProcLib: Constify demodulation functions burst argument. demodCommon() used to scale input vector in place which changed original data. That's a bad practice and is not really necessary, so I've changed the code to scale burst after it's copied to a new vector during a delay operation. Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 10 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/54/2154/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 0ff257c..d6905c7 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1253,7 +1253,7 @@ } } -signalVector *delayVector(signalVector *in, signalVector *out, float delay) +signalVector *delayVector(const signalVector *in, signalVector *out, float delay) { int whole, index; float frac; @@ -2060,7 +2060,7 @@ * the output is downsampled prior to the 1 SPS modulation specific * stages. */ -static signalVector *demodCommon(signalVector &burst, int sps, +static signalVector *demodCommon(const signalVector &burst, int sps, complex chan, float toa) { signalVector *delay, *dec; @@ -2068,8 +2068,8 @@ if ((sps != 1) && (sps != 4)) return NULL; - scaleVector(burst, (complex) 1.0 / chan); delay = delayVector(&burst, NULL, -toa * (float) sps); + scaleVector(*delay, (complex) 1.0 / chan); if (sps == 1) return delay; @@ -2085,7 +2085,7 @@ * 4 SPS (if activated) to minimize distortion through the fractional * delay filters. Symbol rotation and after always operates at 1 SPS. */ -SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(const signalVector &rxBurst, int sps, complex channel, float TOA) { SoftVector *bits; @@ -2114,7 +2114,7 @@ * through the fractional delay filters at 1 SPS renders signal * nearly unrecoverable. */ -SoftVector *demodEdgeBurst(signalVector &burst, int sps, +SoftVector *demodEdgeBurst(const signalVector &burst, int sps, complex chan, float toa) { SoftVector *bits; @@ -2138,7 +2138,7 @@ return bits; } -SoftVector *demodAnyBurst(signalVector &burst, int sps, complex amp, +SoftVector *demodAnyBurst(const signalVector &burst, int sps, complex amp, float toa, CorrType type) { if (type == EDGE) diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 94b346d..23f8054 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -152,7 +152,7 @@ float sinc(float x); /** Delay a vector */ -signalVector *delayVector(signalVector *in, signalVector *out, float delay); +signalVector *delayVector(const signalVector *in, signalVector *out, float delay); /** Add two vectors in-place */ bool addVector(signalVector &x, @@ -313,7 +313,7 @@ @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(const signalVector &rxBurst, int sps, complex channel, float TOA); /** @@ -324,11 +324,11 @@ @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodEdgeBurst(signalVector &rxBurst, int sps, +SoftVector *demodEdgeBurst(const signalVector &rxBurst, int sps, complex channel, float TOA); /** Demodulate burst basde on type and output soft bits */ -SoftVector *demodAnyBurst(signalVector &burst, int sps, +SoftVector *demodAnyBurst(const signalVector &burst, int sps, complex amp, float toa, CorrType type); #endif /* SIGPROCLIB_H */ -- To view, visit https://gerrit.osmocom.org/2154 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:20 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:20 +0000 Subject: [PATCH] osmo-trx[master]: signalVector: Implement segment(). Message-ID: Review at https://gerrit.osmocom.org/2155 signalVector: Implement segment(). Change-Id: I6fe3aae53fb2fa5bb7637e976de6059eabe08202 --- M Transceiver52M/signalVector.cpp M Transceiver52M/signalVector.h 2 files changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/55/2155/1 diff --git a/Transceiver52M/signalVector.cpp b/Transceiver52M/signalVector.cpp index 798a3c7..55dad92 100644 --- a/Transceiver52M/signalVector.cpp +++ b/Transceiver52M/signalVector.cpp @@ -45,6 +45,11 @@ mStart = mData + vector.getStart(); } +signalVector signalVector::segment(size_t start, size_t span) +{ + return signalVector(mData, start, span); +} + size_t signalVector::getStart() const { return mStart - mData; diff --git a/Transceiver52M/signalVector.h b/Transceiver52M/signalVector.h index 38541fe..83f141e 100644 --- a/Transceiver52M/signalVector.h +++ b/Transceiver52M/signalVector.h @@ -30,6 +30,9 @@ /** Override base assignment operator to include start offsets */ void operator=(const signalVector& vector); + /** Return an alias to a segment of this signalVector. */ + signalVector segment(size_t start, size_t span); + /** Return head room */ size_t getStart() const; size_t updateHistory(); -- To view, visit https://gerrit.osmocom.org/2155 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6fe3aae53fb2fa5bb7637e976de6059eabe08202 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:20 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:20 +0000 Subject: [PATCH] osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... Message-ID: Review at https://gerrit.osmocom.org/2156 vector: Introduce segmentMove() method to move data inside of a vector. Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 --- M CommonLibs/Vector.h 1 file changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/56/2156/1 diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h index 38dc8d5..bb4d352 100644 --- a/CommonLibs/Vector.h +++ b/CommonLibs/Vector.h @@ -222,6 +222,21 @@ memcpy(other.mStart,base,span*sizeof(T)); } + /** + Move (copy) a segment of this vector into a different position in the vector + @param from Start point from which to copy. + @param to Start point to which to copy. + @param span The number of elements to copy. + */ + void segmentMove(size_t from, size_t to, size_t span) const + { + const T* baseFrom = mStart + from; + T* baseTo = mStart + to; + assert(baseFrom+span<=mEnd); + assert(baseTo+span<=mEnd); + memmove(baseTo,baseFrom,span*sizeof(T)); + } + void fill(const T& val) { T* dp=mStart; -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:44:20 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Wed, 22 Mar 2017 18:44:20 +0000 Subject: [PATCH] osmo-trx[master]: vector: Introduce shrink() function to shrink vector size wi... Message-ID: Review at https://gerrit.osmocom.org/2157 vector: Introduce shrink() function to shrink vector size without loosing data. Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099 --- M CommonLibs/Vector.h 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/57/2157/1 diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h index bb4d352..c66522b 100644 --- a/CommonLibs/Vector.h +++ b/CommonLibs/Vector.h @@ -92,6 +92,13 @@ mEnd = mStart + newSize; } + /** Reduce addressable size of the Vector, keeping content. */ + void shrink(size_t newSize) + { + assert(newSize <= mEnd - mStart); + mEnd = mStart + newSize; + } + /** Release memory and clear pointers. */ void clear() { resize(0); } -- To view, visit https://gerrit.osmocom.org/2157 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris From gerrit-no-reply at lists.osmocom.org Wed Mar 22 18:46:47 2017 From: gerrit-no-reply at lists.osmocom.org (Thorsten Alteholz) Date: Wed, 22 Mar 2017 18:46:47 +0000 Subject: [PATCH] libosmocore[master]: change version of used python interpreter to generic one Message-ID: Review at https://gerrit.osmocom.org/2158 change version of used python interpreter to generic one As python2 is more or less deprecated[1], better use the generic version of the system. [1] https://pythonclock.org/ Change-Id: I1944e6fa32f47e9794ba5bb4795e763cf2ff3e72 --- M src/gsm/Makefile.am M utils/conv_gen.py 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/2158/1 diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3a4a0cd..3902f43 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -37,6 +37,6 @@ # Convolutional codes generation gsm0503_conv.c: $(top_srcdir)/utils/conv_gen.py $(top_srcdir)/utils/conv_codes_gsm.py - $(AM_V_GEN)python2 $(top_srcdir)/utils/conv_gen.py gen_codes gsm + $(AM_V_GEN)python $(top_srcdir)/utils/conv_gen.py gen_codes gsm CLEANFILES = gsm0503_conv.c diff --git a/utils/conv_gen.py b/utils/conv_gen.py index 0cdba75..2ea0bc3 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python mod_license = """ /* -- To view, visit https://gerrit.osmocom.org/2158 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1944e6fa32f47e9794ba5bb4795e763cf2ff3e72 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz From gerrit-no-reply at lists.osmocom.org Wed Mar 22 20:54:12 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 22 Mar 2017 20:54:12 +0000 Subject: [PATCH] osmo-trx[master]: Resampler: Fix initialization return checking Message-ID: Review at https://gerrit.osmocom.org/2159 Resampler: Fix initialization return checking Greater-than comparison was used on boolean type. Change-Id: Ia3b71b3a06b34a6fd781bf197ecf9d5cc1711d13 --- M Transceiver52M/Resampler.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/59/2159/1 diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp index 8a73b79..72b11a9 100644 --- a/Transceiver52M/Resampler.cpp +++ b/Transceiver52M/Resampler.cpp @@ -191,7 +191,7 @@ bool Resampler::init(float bw) { /* Filterbank filter internals */ - if (initFilters(bw) < 0) + if (!initFilters(bw)) return false; /* Precompute filterbank paths */ -- To view, visit https://gerrit.osmocom.org/2159 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia3b71b3a06b34a6fd781bf197ecf9d5cc1711d13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Thu Mar 23 01:15:45 2017 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Thu, 23 Mar 2017 01:15:45 +0000 Subject: [PATCH] openbsc[master]: libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a... In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2040 to look at the new patch set (#2). libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a confirmation message ericsson can handle a reference at the end of a imm assign command which is used in the confirm response. The confirm response is only sent if the trailer is present. Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f --- M openbsc/include/openbsc/abis_rsl.h M openbsc/src/libbsc/abis_rsl.c 2 files changed, 27 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/40/2040/2 diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 692b464..e61d4ea 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -57,6 +57,9 @@ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id); int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); +/* Ericcson vendor specific RSL extensions */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val); + /* Siemens vendor-specific RSL extensions */ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 91cbd46..5ae707c 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1048,7 +1048,7 @@ } /* Chapter 8.5.6 */ -int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val) +struct msgb *rsl_imm_assign_cmd_common(struct gsm_bts *bts, uint8_t len, uint8_t *val) { struct msgb *msg = rsl_msgb_alloc(); struct abis_rsl_dchan_hdr *dh; @@ -1071,6 +1071,29 @@ } msg->dst = bts->c0->rsl_link; + return msg; +} + +/* Chapter 8.5.6 */ +int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + if (!msg) + return 1; + return abis_rsl_sendmsg(msg); +} + +/* Chapter 8.5.6 */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + if (!msg) + return 1; + + /* ericsson can handle a reference at the end of the message which is used in + * the confirm message. The confirm message is only sent if the trailer is present */ + msgb_put_u8(msg, RSL_IE_ERIC_MOBILE_ID); + msgb_put_u32(msg, tlli); return abis_rsl_sendmsg(msg); } -- To view, visit https://gerrit.osmocom.org/2040 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 05:54:27 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Thu, 23 Mar 2017 05:54:27 +0000 Subject: [PATCH] osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H Message-ID: Review at https://gerrit.osmocom.org/2160 osmo-bts-trx/l1_if.c: use channel combination III for TCH/H Currently the channel combination II is used for TCH/H, which allows only one lchan to be allocated. The reason is that it saves a bit of CPU by disabling UL burst detection on lchan 1. There is also the channel combination III, which allows to increase channel capacity, providing two lchans on a single TCH/H timeslot. Ideally we should implement some dynamic II <-> III switching depending on the network load level. But for now this change replaces the channel combination of TCH/H by III, until dynamic switching is implemented. Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 --- M src/osmo-bts-trx/l1_if.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/60/2160/1 diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index abb16eb..d0c8afd 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -49,7 +49,7 @@ [GSM_PCHAN_CCCH] = 4, [GSM_PCHAN_CCCH_SDCCH4] = 5, [GSM_PCHAN_TCH_F] = 1, - [GSM_PCHAN_TCH_H] = 2, + [GSM_PCHAN_TCH_H] = 3, [GSM_PCHAN_SDCCH8_SACCH8C] = 7, [GSM_PCHAN_PDCH] = 13, /* [GSM_PCHAN_TCH_F_PDCH] not needed here, see trx_set_ts_as_pchan() */ -- To view, visit https://gerrit.osmocom.org/2160 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Thu Mar 23 05:57:57 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Thu, 23 Mar 2017 05:57:57 +0000 Subject: [PATCH] osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2160 to look at the new patch set (#2). osmo-bts-trx/l1_if.c: use channel combination III for TCH/H Currently the channel combination II is used for TCH/H, which allows only one lchan to be allocated. The reason is that it saves a bit of CPU by disabling UL burst detection on lchan 1. There is also the channel combination III, which allows to increase channel capacity, providing two lchans on a single TCH/H timeslot. Ideally we should implement some dynamic II <-> III switching depending on the network load level. But for now this change replaces the channel combination of TCH/H by III, until dynamic switching is implemented. Fixes issue: https://osmocom.org/issues/1795 Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 --- M src/osmo-bts-trx/l1_if.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/60/2160/2 diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index abb16eb..d0c8afd 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -49,7 +49,7 @@ [GSM_PCHAN_CCCH] = 4, [GSM_PCHAN_CCCH_SDCCH4] = 5, [GSM_PCHAN_TCH_F] = 1, - [GSM_PCHAN_TCH_H] = 2, + [GSM_PCHAN_TCH_H] = 3, [GSM_PCHAN_SDCCH8_SACCH8C] = 7, [GSM_PCHAN_PDCH] = 13, /* [GSM_PCHAN_TCH_F_PDCH] not needed here, see trx_set_ts_as_pchan() */ -- To view, visit https://gerrit.osmocom.org/2160 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:29:56 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:29:56 +0000 Subject: osmo-pcap[master]: debian: Make a new release with the new feature In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1999 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibe86b761b494e0fb78bbbc78e3c1982e44185750 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:29:58 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:29:58 +0000 Subject: [MERGED] osmo-pcap[master]: debian: Make a new release with the new feature In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: debian: Make a new release with the new feature ...................................................................... debian: Make a new release with the new feature Change-Id: Ibe86b761b494e0fb78bbbc78e3c1982e44185750 --- M debian/changelog 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/debian/changelog b/debian/changelog index fd4259c..6e4df55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +osmo-pcap (0.0.11) UNRELEASED; urgency=medium + + * Add "source ip A.B.C.D" option to use specific address. + + -- Holger Hans Peter Freyther Tue, 17 Jan 2017 09:12:52 +0100 + osmo-pcap (0.0.10) unstable; urgency=medium * New release with new features -- To view, visit https://gerrit.osmocom.org/1999 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibe86b761b494e0fb78bbbc78e3c1982e44185750 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:30:03 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:30:03 +0000 Subject: osmo-pcap[master]: debian: Add -dbg packages for the osmo-pcap-client and osmo-... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2000 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7d6c8e491be459151c1531b86f28bb1dc2ee8bb4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:30:05 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:30:05 +0000 Subject: [MERGED] osmo-pcap[master]: debian: Add -dbg packages for the osmo-pcap-client and osmo-... In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: debian: Add -dbg packages for the osmo-pcap-client and osmo-pcap-server ...................................................................... debian: Add -dbg packages for the osmo-pcap-client and osmo-pcap-server Currently looking at a weird issue. Make it possible to install the -dbg packages. Change-Id: I7d6c8e491be459151c1531b86f28bb1dc2ee8bb4 --- M debian/changelog M debian/control M debian/rules 3 files changed, 15 insertions(+), 0 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/debian/changelog b/debian/changelog index 6e4df55..13bce30 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ osmo-pcap (0.0.11) UNRELEASED; urgency=medium * Add "source ip A.B.C.D" option to use specific address. + * Add osmo-pcap-client-dbg/osmo-pcap-server-dbg package -- Holger Hans Peter Freyther Tue, 17 Jan 2017 09:12:52 +0100 diff --git a/debian/control b/debian/control index 3364e34..2677bc0 100644 --- a/debian/control +++ b/debian/control @@ -17,3 +17,13 @@ Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Collect traces from other systems. + +Package: osmo-pcap-client-dbg +Architecture: any +Depends: osmo-pcap-client (= ${binary:Version}) +Description: Debug symbols of osmo-pcap-client-dbg + +Package: osmo-pcap-server-dbg +Architecture: any +Depends: osmo-pcap-server (= ${binary:Version}) +Description: Debug symbols of osmo-pcap-server-dbg diff --git a/debian/rules b/debian/rules index 78ddc43..872097c 100755 --- a/debian/rules +++ b/debian/rules @@ -39,3 +39,7 @@ install -d -m 0755 $(CURDIR)/debian/osmo-pcap-server/etc/cron.daily/ install -m 0755 $(CURDIR)/contrib/osmo_pcap_clean_old $(CURDIR)/debian/osmo-pcap-server/etc/cron.daily/ + +override_dh_strip: + dh_strip -posmo-pcap-client --dbg-package=osmo-pcap-client-dbg + dh_strip -posmo-pcap-server --dbg-package=osmo-pcap-server-dbg -- To view, visit https://gerrit.osmocom.org/2000 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7d6c8e491be459151c1531b86f28bb1dc2ee8bb4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:30:17 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:30:17 +0000 Subject: [MERGED] osmo-sip-connector[master]: dtmf: Start handling the DTMF MNCC messages and respond In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: dtmf: Start handling the DTMF MNCC messages and respond ...................................................................... dtmf: Start handling the DTMF MNCC messages and respond Simply respond to the dtmf start/stop with a response and move on. Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5 --- M src/mncc.c 1 file changed, 59 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/mncc.c b/src/mncc.c index 7926f5e..e96eed8 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -102,23 +102,33 @@ return NULL; } -static void mncc_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref) +static void mncc_fill_header(struct gsm_mncc *mncc, uint32_t msg_type, uint32_t callref) +{ + mncc->msg_type = msg_type; + mncc->callref = callref; +} + +static void mncc_write(struct mncc_connection *conn, struct gsm_mncc *mncc, uint32_t callref) { int rc; - struct gsm_mncc mncc = { 0, }; - - mncc.msg_type = msg_type; - mncc.callref = callref; /* * TODO: we need to put cause in here for release or such? shall we return a * static struct? */ - rc = write(conn->fd.fd, &mncc, sizeof(mncc)); - if (rc != sizeof(mncc)) { + rc = write(conn->fd.fd, mncc, sizeof(*mncc)); + if (rc != sizeof(*mncc)) { LOGP(DMNCC, LOGL_ERROR, "Failed to send message call(%u)\n", callref); close_connection(conn); } +} + +static void mncc_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref) +{ + struct gsm_mncc mncc = { 0, }; + + mncc_fill_header(&mncc, msg_type, callref); + mncc_write(conn, &mncc, callref); } static void mncc_rtp_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref) @@ -617,6 +627,42 @@ other_leg->connect_call(other_leg); } +static void check_dtmf_start(struct mncc_connection *conn, char *buf, int rc) +{ + struct gsm_mncc out_mncc = { 0, }; + struct gsm_mncc *data; + struct mncc_call_leg *leg; + + leg = find_leg(conn, buf, rc, &data); + if (!leg) + return; + + LOGP(DMNCC, LOGL_DEBUG, "leg(%u) DTMF key=%c\n", leg->callref, data->keypad); + + mncc_fill_header(&out_mncc, MNCC_START_DTMF_RSP, leg->callref); + out_mncc.fields |= MNCC_F_KEYPAD; + out_mncc.keypad = data->keypad; + mncc_write(conn, &out_mncc, leg->callref); +} + +static void check_dtmf_stop(struct mncc_connection *conn, char *buf, int rc) +{ + struct gsm_mncc out_mncc = { 0, }; + struct gsm_mncc *data; + struct mncc_call_leg *leg; + + leg = find_leg(conn, buf, rc, &data); + if (!leg) + return; + + LOGP(DMNCC, LOGL_DEBUG, "leg(%u) DTMF key=%c\n", leg->callref, data->keypad); + + mncc_fill_header(&out_mncc, MNCC_STOP_DTMF_RSP, leg->callref); + out_mncc.fields |= MNCC_F_KEYPAD; + out_mncc.keypad = data->keypad; + mncc_write(conn, &out_mncc, leg->callref); +} + static void check_hello(struct mncc_connection *conn, char *buf, int rc) { struct gsm_mncc_hello *hello; @@ -778,6 +824,12 @@ case MNCC_HOLD_IND: check_hold_ind(conn, buf, rc); break; + case MNCC_START_DTMF_IND: + check_dtmf_start(conn, buf, rc); + break; + case MNCC_STOP_DTMF_IND: + check_dtmf_stop(conn, buf, rc); + break; default: LOGP(DMNCC, LOGL_ERROR, "Unhandled message type %d/0x%x\n", msg_type, msg_type); -- To view, visit https://gerrit.osmocom.org/1873 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5 Gerrit-PatchSet: 5 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:30:50 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:30:50 +0000 Subject: osmo-sip-connector[master]: dtmf: Forward DTMF from MNCC to SIP In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1874 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icf770fae89f7aedf6eba9a119db9b8acc7f938df Gerrit-PatchSet: 4 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:31:13 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:31:13 +0000 Subject: osmo-sip-connector[master]: testpbx: Add another number that will just play a ringback In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2028 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4c778b1f0e7484a755716133f91767af8b1102c0 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:31:23 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:31:23 +0000 Subject: osmo-sip-connector[master]: testpbx: Enable GSM and AMR as codecs to actually be relevant In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1992 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8719c392f57e0dbed0c0c792d1381592dcd662c1 Gerrit-PatchSet: 2 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 07:31:25 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 07:31:25 +0000 Subject: [MERGED] osmo-sip-connector[master]: testpbx: Enable GSM and AMR as codecs to actually be relevant In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: testpbx: Enable GSM and AMR as codecs to actually be relevant ...................................................................... testpbx: Enable GSM and AMR as codecs to actually be relevant Without these codecs we will not have much joy when working with a default GSM BTS/BSC. Change-Id: I8719c392f57e0dbed0c0c792d1381592dcd662c1 --- M contrib/testpbx/configs/vars.xml 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/contrib/testpbx/configs/vars.xml b/contrib/testpbx/configs/vars.xml index 1cb826d..5ef16c9 100644 --- a/contrib/testpbx/configs/vars.xml +++ b/contrib/testpbx/configs/vars.xml @@ -255,8 +255,8 @@ 127 - BV32 --> - - + + + + + + + + + + + + -- To view, visit https://gerrit.osmocom.org/2028 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4c778b1f0e7484a755716133f91767af8b1102c0 Gerrit-PatchSet: 2 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:00:24 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 09:00:24 +0000 Subject: [MERGED] osmo-sip-connector[master]: dtmf: Forward DTMF from MNCC to SIP In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: dtmf: Forward DTMF from MNCC to SIP ...................................................................... dtmf: Forward DTMF from MNCC to SIP We are not using the RTP telephony-event here but the older dtmf relay. We also only have a fixed DTMF duration for now. Change-Id: Icf770fae89f7aedf6eba9a119db9b8acc7f938df --- M src/call.h M src/mncc.c M src/sip.c 3 files changed, 29 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/src/call.h b/src/call.h index 7cb4932..5a11f6c 100644 --- a/src/call.h +++ b/src/call.h @@ -67,6 +67,11 @@ * by the application to release the call. */ void (*release_call)(struct call_leg *); + + /** + * A DTMF key was entered. Forward it. + */ + void (*dtmf)(struct call_leg *, int keypad); }; enum sip_cc_state { diff --git a/src/mncc.c b/src/mncc.c index e96eed8..843c7e7 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -632,6 +632,7 @@ struct gsm_mncc out_mncc = { 0, }; struct gsm_mncc *data; struct mncc_call_leg *leg; + struct call_leg *other_leg; leg = find_leg(conn, buf, rc, &data); if (!leg) @@ -639,6 +640,10 @@ LOGP(DMNCC, LOGL_DEBUG, "leg(%u) DTMF key=%c\n", leg->callref, data->keypad); + other_leg = call_leg_other(&leg->base); + if (other_leg && other_leg->dtmf) + other_leg->dtmf(other_leg, data->keypad); + mncc_fill_header(&out_mncc, MNCC_START_DTMF_RSP, leg->callref); out_mncc.fields |= MNCC_F_KEYPAD; out_mncc.keypad = data->keypad; diff --git a/src/sip.c b/src/sip.c index 348f478..0a642b7 100644 --- a/src/sip.c +++ b/src/sip.c @@ -37,6 +37,7 @@ static void sip_release_call(struct call_leg *_leg); static void sip_ring_call(struct call_leg *_leg); static void sip_connect_call(struct call_leg *_leg); +static void sip_dtmf_call(struct call_leg *_leg, int keypad); static void call_progress(struct sip_call_leg *leg, const sip_t *sip) { @@ -131,6 +132,7 @@ leg->base.release_call = sip_release_call; leg->base.ring_call = sip_ring_call; leg->base.connect_call = sip_connect_call; + leg->base.dtmf = sip_dtmf_call; leg->agent = agent; leg->nua_handle = nh; nua_handle_bind(nh, leg); @@ -288,6 +290,22 @@ talloc_free(sdp); } +static void sip_dtmf_call(struct call_leg *_leg, int keypad) +{ + struct sip_call_leg *leg; + char *buf; + + OSMO_ASSERT(_leg->type == CALL_TYPE_SIP); + leg = (struct sip_call_leg *) _leg; + + buf = talloc_asprintf(leg, "Signal=%c\nDuration=160\n", keypad); + nua_info(leg->nua_handle, + NUTAG_MEDIA_ENABLE(0), + SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), + SIPTAG_PAYLOAD_STR(buf), TAG_END()); + talloc_free(buf); +} + static int send_invite(struct sip_agent *agent, struct sip_call_leg *leg, const char *calling_num, const char *called_num) { @@ -334,6 +352,7 @@ leg->base.type = CALL_TYPE_SIP; leg->base.call = call; leg->base.release_call = sip_release_call; + leg->base.dtmf = sip_dtmf_call; leg->agent = agent; leg->nua_handle = nua_handle(agent->nua, leg, TAG_END()); -- To view, visit https://gerrit.osmocom.org/1874 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icf770fae89f7aedf6eba9a119db9b8acc7f938df Gerrit-PatchSet: 6 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:01:11 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 09:01:11 +0000 Subject: osmo-sip-connector[master]: mncc: Enable in-band signalling for early media In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2029 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I80b1e1f4ca045bd63536476702a5812f27d9b36d Gerrit-PatchSet: 2 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:01:14 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 09:01:14 +0000 Subject: [MERGED] osmo-sip-connector[master]: mncc: Enable in-band signalling for early media In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: mncc: Enable in-band signalling for early media ...................................................................... mncc: Enable in-band signalling for early media Besides sending the alerting request we should inform the MS that there is in-band information now. We do not seem to export these flags in protocol/gsm_04_08.h so hardcode them for now (until I come up with good names for them). Related: OS#1784 Change-Id: I80b1e1f4ca045bd63536476702a5812f27d9b36d --- M src/mncc.c 1 file changed, 9 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/src/mncc.c b/src/mncc.c index 843c7e7..5e2a3a1 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -194,12 +194,20 @@ static void mncc_call_leg_ring(struct call_leg *_leg) { + struct gsm_mncc out_mncc = { 0, }; struct mncc_call_leg *leg; OSMO_ASSERT(_leg->type == CALL_TYPE_MNCC); leg = (struct mncc_call_leg *) _leg; - mncc_send(leg->conn, MNCC_ALERT_REQ, leg->callref); + mncc_fill_header(&out_mncc, MNCC_ALERT_REQ, leg->callref); + /* GSM 04.08 10.5.4.21 */ + out_mncc.fields |= MNCC_F_PROGRESS; + out_mncc.progress.coding = 3; /* Standard defined for the GSM?PLMNS */ + out_mncc.progress.location = 1; /* Private network serving the local user */ + out_mncc.progress.descr = 8; /* In-band information or appropriate pattern now available */ + + mncc_write(leg->conn, &out_mncc, leg->callref); } static void mncc_call_leg_release(struct call_leg *_leg) -- To view, visit https://gerrit.osmocom.org/2029 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I80b1e1f4ca045bd63536476702a5812f27d9b36d Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:05:06 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 09:05:06 +0000 Subject: osmo-sip-connector[master]: mncc/sip: Attempt to parse the media from session in progress In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2030 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I98d173abc46c67b87666ed2f193a581d6e72344b Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:05:16 2017 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 23 Mar 2017 09:05:16 +0000 Subject: [MERGED] osmo-sip-connector[master]: mncc/sip: Attempt to parse the media from session in progress In-Reply-To: References: Message-ID: Holger Freyther has submitted this change and it was merged. Change subject: mncc/sip: Attempt to parse the media from session in progress ...................................................................... mncc/sip: Attempt to parse the media from session in progress Parse the media from session in progress and if present in alerting connect the call early. Sadly this sets RTP to the sendrecv mode even if we would like to keep it as recvonly. Change-Id: I98d173abc46c67b87666ed2f193a581d6e72344b Related: OS#1784 --- M src/mncc.c M src/sip.c 2 files changed, 17 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/src/mncc.c b/src/mncc.c index 5e2a3a1..669a80c 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -1,5 +1,5 @@ /* - * (C) 2016 by Holger Hans Peter Freyther + * (C) 2016-2017 by Holger Hans Peter Freyther * * All Rights Reserved * @@ -196,6 +196,7 @@ { struct gsm_mncc out_mncc = { 0, }; struct mncc_call_leg *leg; + struct call_leg *other_leg; OSMO_ASSERT(_leg->type == CALL_TYPE_MNCC); leg = (struct mncc_call_leg *) _leg; @@ -208,6 +209,14 @@ out_mncc.progress.descr = 8; /* In-band information or appropriate pattern now available */ mncc_write(leg->conn, &out_mncc, leg->callref); + + /* + * If we have remote IP/port let's connect it already. + * FIXME: We would like to keep this as recvonly... + */ + other_leg = call_leg_other(&leg->base); + if (other_leg && other_leg->port != 0 && other_leg->ip != 0) + send_rtp_connect(leg, other_leg); } static void mncc_call_leg_release(struct call_leg *_leg) diff --git a/src/sip.c b/src/sip.c index 0a642b7..4f3d034 100644 --- a/src/sip.c +++ b/src/sip.c @@ -1,5 +1,5 @@ /* - * (C) 2016 by Holger Hans Peter Freyther + * (C) 2016-2017 by Holger Hans Peter Freyther * * All Rights Reserved * @@ -39,12 +39,16 @@ static void sip_connect_call(struct call_leg *_leg); static void sip_dtmf_call(struct call_leg *_leg, int keypad); -static void call_progress(struct sip_call_leg *leg, const sip_t *sip) +static void call_progress(struct sip_call_leg *leg, const sip_t *sip, int status) { struct call_leg *other = call_leg_other(&leg->base); if (!other) return; + + /* Extract SDP for session in progress with matching codec */ + if (status == 183) + sdp_extract_sdp(leg, sip, false); LOGP(DSIP, LOGL_NOTICE, "leg(%p) is now rining.\n", leg); other->ring_call(other); @@ -159,7 +163,7 @@ leg->state = SIP_CC_DLG_CNFD; if (status == 180 || status == 183) - call_progress(leg, sip); + call_progress(leg, sip, status); else if (status == 200) call_connect(leg, sip); else if (status >= 300) { -- To view, visit https://gerrit.osmocom.org/2030 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I98d173abc46c67b87666ed2f193a581d6e72344b Gerrit-PatchSet: 3 Gerrit-Project: osmo-sip-connector Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:17:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:17:45 +0000 Subject: libosmocore[master]: select: Find the highest fd when filling the fd_sets In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1986 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:19:40 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:19:40 +0000 Subject: osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2160 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: neels Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:23:26 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:23:26 +0000 Subject: osmo-trx[master]: Resampler: Fix initialization return checking In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2159 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia3b71b3a06b34a6fd781bf197ecf9d5cc1711d13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:26:36 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:26:36 +0000 Subject: libosmocore[master]: change version of used python interpreter to generic one In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 I think we should not leave this to chance - we should explicitly move to python3 instead. Also, when doing so dependencies in debian/ should be adjusted accordingly. We also have to make sure that both .ipk and .deb packages are still generated properly. -- To view, visit https://gerrit.osmocom.org/2158 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1944e6fa32f47e9794ba5bb4795e763cf2ff3e72 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Thorsten Alteholz Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:30:49 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:30:49 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 4: > Right now -r option has different behavior based on whether -e is specified or not. Ok, so should -r and -e be mutually exclusive? Is so, than we should explicitly check for this in a way that -r .. -E always fails, regardless of other options or command-line switches order. -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 4 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:32:22 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:32:22 +0000 Subject: osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Patch Set 1: FYI: the latest version of autoconf-archive is 2017.03.21 -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:33:39 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:33:39 +0000 Subject: osmo-trx[master]: ssedetect: Add runtime CPU detection In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2100 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iba74f8a6e4e921ff31e4bd9f0c7c881fe547423a Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:34:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:34:00 +0000 Subject: osmo-trx[master]: buildenv: Make build CPU invariant In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2102 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic913aa13c23c348ae62e78c9dfd6ed8b0a62798c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:36:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:36:34 +0000 Subject: osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 > could you > take a brief look and decide which way to go with the 'attribute' > style -- are they no longer needed now, or should we rewrite this > patch to use those instead? this is exactly what has happened. The implementation first used those attributes and now switched to separate files. Guess you have missed the history here. Both dexter and I agree that the separate files makes us more comfortable in being certain any version of the compiler will never use the wrong optimziation in the wrong function. -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:37:32 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:37:32 +0000 Subject: osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Patch Set 1: > AX_EXT is macro from autoconf-archive package - I think it's avery > bad idea to supply our own modified copy: this means we'll have to > track all upstream fixes manually. I think we should either move > this code directly to configure.ac or add our own macro wrapping > ax_ext. If neither possible we should at the very least explicitly > mention from which version of autoconf-archive this was > copy-pasted. I guess simply rename it or merge into configure.ac is fine. I don't thin we need or want to track any upstream changes, as what we are doing now is quite different from upstream. -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:37:58 2017 From: gerrit-no-reply at lists.osmocom.org (Ivan Kluchnikov) Date: Thu, 23 Mar 2017 09:37:58 +0000 Subject: osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2160 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: neels Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:38:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:38:14 +0000 Subject: openbsc[master]: libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2040 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:38:49 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:38:49 +0000 Subject: [MERGED] openbsc[master]: RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS ...................................................................... RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS Change-Id: I66541f9b20e7fd67fbec329283fc3c821c970a56 --- M openbsc/include/openbsc/abis_rsl.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libbsc/bsc_api.c 3 files changed, 9 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 758c555..692b464 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -22,6 +22,7 @@ #ifndef _RSL_H #define _RSL_H +#include #include #include @@ -49,7 +50,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *ts); int rsl_encryption_cmd(struct msgb *msg); int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len, - uint8_t *ms_ident, uint8_t chan_needed); + uint8_t *ms_ident, uint8_t chan_needed, bool is_gprs); int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val); int rsl_data_request(struct msgb *msg, uint8_t link_id); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 26cafc2..91cbd46 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1007,7 +1007,7 @@ } int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len, - uint8_t *ms_ident, uint8_t chan_needed) + uint8_t *ms_ident, uint8_t chan_needed, bool is_gprs) { struct abis_rsl_dchan_hdr *dh; struct msgb *msg = rsl_msgb_alloc(); @@ -1020,6 +1020,11 @@ msgb_tlv_put(msg, RSL_IE_MS_IDENTITY, len-2, ms_ident+2); msgb_tv_put(msg, RSL_IE_CHAN_NEEDED, chan_needed); + /* Ericsson wants to have this IE in case a paging message + * relates to packet paging */ + if (bts->type == GSM_BTS_TYPE_RBS2000 && is_gprs) + msgb_tv_put(msg, RSL_IE_ERIC_PACKET_PAG_IND, 0); + msg->dst = bts->c0->rsl_link; return abis_rsl_sendmsg(msg); diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 54978e5..253326f 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -419,7 +419,7 @@ 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); + return rsl_paging_cmd(bts, page_group, mi_len, mi, chan_type, false); } static void handle_ass_compl(struct gsm_subscriber_connection *conn, -- To view, visit https://gerrit.osmocom.org/2039 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I66541f9b20e7fd67fbec329283fc3c821c970a56 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:38:49 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:38:49 +0000 Subject: [MERGED] openbsc[master]: RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH ...................................................................... RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH This seems to be mandatory when an Ericsson RBS2000 uses a SuperChannel as back-haul. Change-Id: I793e7d62df1ca9f9c38d39e22d3868064d446c8d --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 7 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 5939e75..26cafc2 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -507,6 +507,13 @@ msgb_tv_put(msg, RSL_IE_ACT_TYPE, RSL_ACT_OSMO_PDCH); + if (lchan->ts->trx->bts->type == GSM_BTS_TYPE_RBS2000 && + lchan->ts->trx->bts->rbs2000.use_superchannel) { + const uint8_t eric_pgsl_tmr[] = { 30, 1 }; + msgb_tv_fixed_put(msg, RSL_IE_ERIC_PGSL_TIMERS, + sizeof(eric_pgsl_tmr), eric_pgsl_tmr); + } + msg->dst = lchan->ts->trx->rsl_link; return abis_rsl_sendmsg(msg); -- To view, visit https://gerrit.osmocom.org/2038 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I793e7d62df1ca9f9c38d39e22d3868064d446c8d Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:38:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:38:50 +0000 Subject: [MERGED] openbsc[master]: abis_om2k: protect MO FSMs by NULL check In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: abis_om2k: protect MO FSMs by NULL check ...................................................................... abis_om2k: protect MO FSMs by NULL check Also set MO FSMs to NULL after freeing them. Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200 --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 17 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 9bf0fe2..82a14b2 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1697,7 +1697,17 @@ static void om2k_mo_s_done_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { + struct om2k_mo_fsm_priv *omfp = fi->priv; + omfp->mo->fsm = NULL; osmo_fsm_inst_term(fi, OSMO_FSM_TERM_REGULAR, NULL); +} + +static void om2k_mo_s_error_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct om2k_mo_fsm_priv *omfp = fi->priv; + + omfp->mo->fsm = NULL; + osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL); } static const struct osmo_fsm_state om2k_is_states[] = { @@ -1794,7 +1804,7 @@ .name = "ERROR", .in_event_mask = 0, .out_state_mask = 0, - .onenter = om2k_mo_s_done_onenter, + .onenter = om2k_mo_s_error_onenter, }, }; @@ -2697,6 +2707,12 @@ msgb_hexdump(msg)); return 0; } + if (!mo->fsm) { + LOGP(DNM, LOGL_ERROR, "MO object should not generate any message. fsm == NULL " + "%s: %s\n", get_value_string(om2k_msgcode_vals, msg_type), + msgb_hexdump(msg)); + return 0; + } /* Dispatch message to that MO */ om2k_mo_fsm_recvmsg(bts, mo, &odm); -- To view, visit https://gerrit.osmocom.org/2037 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:38:51 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:38:51 +0000 Subject: [MERGED] openbsc[master]: OM2000: Send ALTCRQ for SuperChannel after receiving IS Enab... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: OM2000: Send ALTCRQ for SuperChannel after receiving IS Enable Req Ack ...................................................................... OM2000: Send ALTCRQ for SuperChannel after receiving IS Enable Req Ack When the BTS is configured to use a SuperChannel and it is using a unix domain socket based transport towards the L2TP daemon, then we must instruct the L2TP daemon to instruct the SIU to change the Abis Lower Transport Mode using the ALTCRQ / ALTCRP L2TP signalling. Change-Id: I672bfaa09c42fbeb0c8459f24b2222b952de954b --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/abis_om2000.c M openbsc/src/libbsc/abis_om2000_vty.c 3 files changed, 32 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index e697cb8..06fa8dd 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -729,6 +729,7 @@ struct om2k_mo om2k_mo; struct gsm_abis_mo mo; } tf; + uint32_t use_superchannel:1; } rbs2000; struct { uint8_t bts_type; diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 1fb7689..9bf0fe2 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1654,6 +1654,7 @@ static void om2k_mo_st_wait_enable_accept(struct osmo_fsm_inst *fi, uint32_t event, void *data) { + struct om2k_mo_fsm_priv *omfp = fi->priv; struct om2k_decoded_msg *omd = data; switch (omd->msg_type) { @@ -1661,6 +1662,9 @@ osmo_fsm_inst_state_chg(fi, OM2K_ST_ERROR, 0, 0); break; case OM2K_MSGT_ENABLE_REQ_ACK: + if (omfp->mo->addr.class == OM2K_MO_CLS_IS && + omfp->trx->bts->rbs2000.use_superchannel) + e1inp_ericsson_set_altc(omfp->trx->bts->oml_link->ts->line, 1); osmo_fsm_inst_state_chg(fi, OM2K_ST_WAIT_ENABLE_RES, OM2K_TIMEOUT, 0); } diff --git a/openbsc/src/libbsc/abis_om2000_vty.c b/openbsc/src/libbsc/abis_om2000_vty.c index 060fb8b..a6bc4c7 100644 --- a/openbsc/src/libbsc/abis_om2000_vty.c +++ b/openbsc/src/libbsc/abis_om2000_vty.c @@ -417,6 +417,29 @@ return CMD_SUCCESS; } +DEFUN(cfg_bts_alt_mode, cfg_bts_alt_mode_cmd, + "abis-lower-transport (single-timeslot|super-channel)", + "Configure thee Abis Lower Transport\n" + "Single Timeslot (classic Abis)\n" + "SuperChannel (Packet Abis)\n") +{ + struct gsm_bts *bts = vty->index; + struct con_group *cg; + + if (bts->type != GSM_BTS_TYPE_RBS2000) { + vty_out(vty, "%% Command only works for RBS2000%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + if (!strcmp(argv[0], "super-channel")) + bts->rbs2000.use_superchannel = 1; + else + bts->rbs2000.use_superchannel = 0; + + return CMD_SUCCESS; +} + DEFUN(cfg_bts_is_conn_list, cfg_bts_is_conn_list_cmd, "is-connection-list (add|del) <0-2047> <0-2047> <0-255>", "Interface Switch Connection List\n" @@ -548,6 +571,9 @@ VTY_NEWLINE); dump_con_group(vty, cgrp); } + if (bts->rbs2000.use_superchannel) + vty_out(vty, " abis-lower-transport super-channel%s", + VTY_NEWLINE); } int abis_om2k_vty_init(void) @@ -575,6 +601,7 @@ install_element(OM2K_CON_GROUP_NODE, &cfg_om2k_con_path_conc_cmd); install_element(BTS_NODE, &cfg_bts_is_conn_list_cmd); + install_element(BTS_NODE, &cfg_bts_alt_mode_cmd); install_element(BTS_NODE, &cfg_om2k_con_group_cmd); install_element(BTS_NODE, &del_om2k_con_group_cmd); -- To view, visit https://gerrit.osmocom.org/2036 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I672bfaa09c42fbeb0c8459f24b2222b952de954b Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:39:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:39:00 +0000 Subject: [MERGED] openbsc[master]: libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a confirmation message ...................................................................... libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a confirmation message ericsson can handle a reference at the end of a imm assign command which is used in the confirm response. The confirm response is only sent if the trailer is present. Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f --- M openbsc/include/openbsc/abis_rsl.h M openbsc/src/libbsc/abis_rsl.c 2 files changed, 27 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 692b464..e61d4ea 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -57,6 +57,9 @@ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id); int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); +/* Ericcson vendor specific RSL extensions */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val); + /* Siemens vendor-specific RSL extensions */ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 91cbd46..5ae707c 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1048,7 +1048,7 @@ } /* Chapter 8.5.6 */ -int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val) +struct msgb *rsl_imm_assign_cmd_common(struct gsm_bts *bts, uint8_t len, uint8_t *val) { struct msgb *msg = rsl_msgb_alloc(); struct abis_rsl_dchan_hdr *dh; @@ -1071,6 +1071,29 @@ } msg->dst = bts->c0->rsl_link; + return msg; +} + +/* Chapter 8.5.6 */ +int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + if (!msg) + return 1; + return abis_rsl_sendmsg(msg); +} + +/* Chapter 8.5.6 */ +int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len, uint8_t *val) +{ + struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val); + if (!msg) + return 1; + + /* ericsson can handle a reference at the end of the message which is used in + * the confirm message. The confirm message is only sent if the trailer is present */ + msgb_put_u8(msg, RSL_IE_ERIC_MOBILE_ID); + msgb_put_u32(msg, tlli); return abis_rsl_sendmsg(msg); } -- To view, visit https://gerrit.osmocom.org/2040 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:39:21 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:39:21 +0000 Subject: openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:40:06 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:40:06 +0000 Subject: osmo-bts[master]: octphy: remove old event control code In-Reply-To: References: Message-ID: Patch Set 3: from which DSP/PHY version on is this not required anymore? -- To view, visit https://gerrit.osmocom.org/1980 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0652627495f6a9bcb0da2431b8beb839bc22062b Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:41:00 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:41:00 +0000 Subject: [MERGED] openbsc[master]: Add simple CTRL2SOAP proxy In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add simple CTRL2SOAP proxy ...................................................................... Add simple CTRL2SOAP proxy Add python client which converts TRAP messages into SOAP requests and perform corresponding actions. It can be used as follows ./soap.py -d -w http://example.com/soapservice/htdocs/wsdl/test.wsdl See ./soap.py -h for additional options. Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Related: SYS#3028 --- A openbsc/contrib/soap.py 1 file changed, 188 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/soap.py b/openbsc/contrib/soap.py new file mode 100755 index 0000000..4d0a023 --- /dev/null +++ b/openbsc/contrib/soap.py @@ -0,0 +1,188 @@ +#!/usr/bin/python3 +# -*- mode: python-mode; py-indent-tabs-mode: nil -*- +""" +/* + * Copyright (C) 2016 sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +""" + +__version__ = "v0.7" # bump this on every non-trivial change + +from twisted.internet import defer, reactor +from twisted_ipa import CTRL, IPAFactory, __version__ as twisted_ipa_version +from ipa import Ctrl +from treq import post, collect +from suds.client import Client +from functools import partial +from distutils.version import StrictVersion as V # FIXME: use NormalizedVersion from PEP-386 when available +import argparse, datetime, signal, sys, os, logging, logging.handlers + +# we don't support older versions of TwistedIPA module +assert V(twisted_ipa_version) > V('0.4') + +# keys from OpenBSC openbsc/src/libbsc/bsc_rf_ctrl.c, values SOAP-specific +oper = { 'inoperational' : 0, 'operational' : 1 } +admin = { 'locked' : 0, 'unlocked' : 1 } +policy = { 'off' : 0, 'on' : 1, 'grace' : 2, 'unknown' : 3 } + +# keys from OpenBSC openbsc/src/libbsc/bsc_vty.c +fix = { 'invalid' : 0, 'fix2d' : 1, 'fix3d' : 1 } # SOAP server treats it as boolean but expects int + + +def handle_reply(p, f, log, r): + """ + Reply handler: takes function p to process raw SOAP server reply r, function f to run for each command and verbosity flag v + """ + repl = p(r) # result is expected to have both commands[] array and error string (could be None) + bsc_id = repl.commands[0].split()[0].split('.')[3] # we expect 1st command to have net.0.bsc.666.bts.2.trx.1 location prefix format + log.info("Received SOAP response for BSC %s with %d commands, error status: %s" % (bsc_id, len(repl.commands), repl.error)) + log.debug("BSC %s commands: %s" % (bsc_id, repl.commands)) + for t in repl.commands: # Process OpenBscCommands format from .wsdl + (_, m) = Ctrl().cmd(*t.split()) + f(m) + + +class Trap(CTRL): + """ + TRAP handler (agnostic to factory's client object) + """ + def ctrl_TRAP(self, data, op_id, v): + """ + Parse CTRL TRAP and dispatch to appropriate handler after normalization + """ + (l, r) = v.split() + loc = l.split('.') + t_type = loc[-1] + p = partial(lambda a, i: a[i] if len(a) > i else None, loc) # parse helper + method = getattr(self, 'handle_' + t_type.replace('-', ''), lambda: "Unhandled %s trap" % t_type) + method(p(1), p(3), p(5), p(7), r) # we expect net.0.bsc.666.bts.2.trx.1 format for trap prefix + + def ctrl_SET_REPLY(self, data, _, v): + """ + Debug log for replies to our commands + """ + self.factory.log.debug('SET REPLY %s' % v) + + def ctrl_ERROR(self, data, op_id, v): + """ + We want to know if smth went wrong + """ + self.factory.log.debug('CTRL ERROR [%s] %s' % (op_id, v)) + + def connectionMade(self): + """ + Logging wrapper, calling super() is necessary not to break reconnection logic + """ + self.factory.log.info("Connected to CTRL@%s:%d" % (self.factory.host, self.factory.port)) + super(CTRL, self).connectionMade() + + @defer.inlineCallbacks + def handle_locationstate(self, net, bsc, bts, trx, data): + """ + Handle location-state TRAP: parse trap content, build SOAP context and use treq's routines to post it while setting up async handlers + """ + (ts, fx, lat, lon, height, opr, adm, pol, mcc, mnc) = data.split(',') + tstamp = datetime.datetime.fromtimestamp(float(ts)).isoformat() + self.factory.log.debug('location-state@%s.%s.%s.%s (%s) [%s/%s] => %s' % (net, bsc, bts, trx, tstamp, mcc, mnc, data)) + ctx = self.factory.client.registerSiteLocation(bsc, float(lon), float(lat), fix.get(fx, 0), tstamp, oper.get(opr, 2), admin.get(adm, 2), policy.get(pol, 3)) + d = post(self.factory.location, ctx.envelope) + d.addCallback(collect, partial(handle_reply, ctx.process_reply, self.transport.write, self.factory.log)) # treq's collect helper is handy to get all reply content at once using closure on ctx + d.addErrback(lambda e, bsc: self.factory.log.critical("HTTP POST error %s while trying to register BSC %s" % (e, bsc)), bsc) # handle HTTP errors + # Ensure that we run only limited number of requests in parallel: + yield self.factory.semaphore.acquire() + yield d # we end up here only if semaphore is available which means it's ok to fire the request without exceeding the limit + self.factory.semaphore.release() + + def handle_notificationrejectionv1(self, net, bsc, bts, trx, data): + """ + Handle notification-rejection-v1 TRAP: just an example to show how more message types can be handled + """ + self.factory.log.debug('notification-rejection-v1 at bsc-id %s => %s' % (bsc, data)) + + +class TrapFactory(IPAFactory): + """ + Store SOAP client object so TRAP handler can use it for requests + """ + location = None + log = None + semaphore = None + client = None + host = None + port = None + def __init__(self, host, port, proto, semaphore, log, wsdl=None, location=None): + self.host = host # for logging only, + self.port = port # seems to be no way to get it from ReconnectingClientFactory + self.log = log + self.semaphore = semaphore + soap = Client(wsdl, location=location, nosend=True) # make async SOAP client + self.location = location.encode() if location else soap.wsdl.services[0].ports[0].location # necessary for dispatching HTTP POST via treq + self.client = soap.service + level = self.log.getEffectiveLevel() + self.log.setLevel(logging.WARNING) # we do not need excessive debug from lower levels + super(TrapFactory, self).__init__(proto, self.log) + self.log.setLevel(level) + self.log.debug("Using IPA %s, SUDS client: %s" % (Ctrl.version, soap)) + + +def reloader(path, script, log, dbg1, dbg2, signum, _): + """ + Signal handler: we have to use execl() because twisted's reactor is not restartable due to some bug in twisted implementation + """ + log.info("Received Signal %d - restarting..." % signum) + if signum == signal.SIGUSR1 and dbg1 not in sys.argv and dbg2 not in sys.argv: + sys.argv.append(dbg1) # enforce debug + if signum == signal.SIGUSR2 and (dbg1 in sys.argv or dbg2 in sys.argv): # disable debug + if dbg1 in sys.argv: + sys.argv.remove(dbg1) + if dbg2 in sys.argv: + sys.argv.remove(dbg2) + os.execl(path, script, *sys.argv[1:]) + + +if __name__ == '__main__': + p = argparse.ArgumentParser(description='Proxy between given SOAP service and Osmocom CTRL protocol.') + p.add_argument('-v', '--version', action='version', version=("%(prog)s " + __version__)) + p.add_argument('-p', '--port', type=int, default=4250, help="Port to use for CTRL interface, defaults to 4250") + p.add_argument('-c', '--ctrl', default='localhost', help="Adress to use for CTRL interface, defaults to localhost") + p.add_argument('-w', '--wsdl', required=True, help="WSDL URL for SOAP") + p.add_argument('-n', '--num', type=int, default=5, help="Max number of concurrent HTTP requests to SOAP server") + p.add_argument('-d', '--debug', action='store_true', help="Enable debug log") + p.add_argument('-o', '--output', action='store_true', help="Log to STDOUT in addition to SYSLOG") + p.add_argument('-l', '--location', help="Override location found in WSDL file (don't use unless you know what you're doing)") + args = p.parse_args() + + log = logging.getLogger('CTRL2SOAP') + if args.debug: + log.setLevel(logging.DEBUG) + else: + log.setLevel(logging.INFO) + log.addHandler(logging.handlers.SysLogHandler('/dev/log')) + if args.output: + log.addHandler(logging.StreamHandler(sys.stdout)) + + reboot = partial(reloader, os.path.abspath(__file__), os.path.basename(__file__), log, '-d', '--debug') # keep in sync with add_argument() call above + signal.signal(signal.SIGHUP, reboot) + signal.signal(signal.SIGQUIT, reboot) + signal.signal(signal.SIGUSR1, reboot) # restart and enabled debug output + signal.signal(signal.SIGUSR2, reboot) # restart and disable debug output + + log.info("SOAP proxy %s starting with PID %d ..." % (__version__, os.getpid())) + reactor.connectTCP(args.ctrl, args.port, TrapFactory(args.ctrl, args.port, Trap, defer.DeferredSemaphore(args.num), log, args.wsdl, args.location)) + reactor.run() -- To view, visit https://gerrit.osmocom.org/1875 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46 Gerrit-PatchSet: 10 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:41:08 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:41:08 +0000 Subject: osmo-bts[master]: bts: revert trx shutdown order In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1977 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I18485de586b402610f9e98053d69e92bc9b18dc2 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:42:25 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:42:25 +0000 Subject: osmo-bts[master]: octphy: set tx/rx antenne IDs via VTY In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 please don't upload a new patch if the comment has not been adressed. It just means that I'll re-view the patch, checking if the code has been changed and then discover it hasn't changed after all. -- To view, visit https://gerrit.osmocom.org/1976 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I872fe3c4d7b593358a4ce2f02cf0726611b9f3aa Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:44:42 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:44:42 +0000 Subject: libosmocore[master]: tests/conv: move conv.h to the global include dir In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 actualyl, no. Files in "include/osmocom/" should only be files that are installed into the system. "tests.h" sounds like something only needed during unit tests, and it does not belong into a directory containing system-wide installed header files? Am I missing something? -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:47:06 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:47:06 +0000 Subject: osmo-bts[master]: Handle TXT indication from OsmoPCU In-Reply-To: References: Message-ID: Patch Set 1: I think rather than the printing of the version via the log, it should also be stored soemwhere in the 'gsm_bts_trx' associated with the PCU for this TRX, so the user can show it in 'show trx'. The same should be done with OsmoBTS version. At any time, the sysadmin should be able to see the versions and capabilities of the BTS+PCU attached to the BSC. -- To view, visit https://gerrit.osmocom.org/2087 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16e73198501487a5b1076bf83390b85538d5af73 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:48:37 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:48:37 +0000 Subject: osmo-trx[master]: vector: Introduce shrink() function to shrink vector size wi... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2157 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:48:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:48:47 +0000 Subject: osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:49:00 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:49:00 +0000 Subject: osmo-trx[master]: signalVector: Implement segment(). In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2155 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6fe3aae53fb2fa5bb7637e976de6059eabe08202 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:49:24 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:49:24 +0000 Subject: osmo-trx[master]: sigProcLib: Constify demodulation functions burst argument. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2154 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:49:36 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:49:36 +0000 Subject: osmo-trx[master]: sigProcLib: constify signalVector arguments for detectBurst(... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:49:55 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:49:55 +0000 Subject: osmo-trx[master]: Move Transceiver::demodulate() to sigProcLib to make it reus... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2152 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:50:43 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:50:43 +0000 Subject: osmo-trx[master]: sigProcLib: Add operator<< to print CorrType to a string. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:50:56 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:50:56 +0000 Subject: osmo-trx[master]: Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to ma... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2149 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:51:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:51:34 +0000 Subject: osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:51:44 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:51:44 +0000 Subject: osmo-trx[master]: sigProcLib: rename signalError type to SignalError. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2147 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1a5ae6e87d4c69945053fdefec185d0fb1a26399 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:52:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:52:02 +0000 Subject: osmo-trx[master]: Move CorrType type from Transceiver to sigProcLib. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2146 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:52:52 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:52:52 +0000 Subject: libosmocore[master]: abis: add message type names In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2145 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:52:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:52:54 +0000 Subject: [MERGED] libosmocore[master]: abis: add message type names In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: abis: add message type names ...................................................................... abis: add message type names Add human-readable names for Message Types from 3GPP TS 52.021 ?9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map 3 files changed, 105 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index 40237cb..23392d2 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -595,6 +595,7 @@ }; extern const struct value_string abis_nm_pcause_type_names[]; +extern const struct value_string abis_nm_msgtype_names[]; extern const struct value_string abis_nm_att_names[]; /*! \brief NACK causes (Section 9.4.36) */ diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index e98866c..e1b248f 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -261,6 +261,109 @@ [T200_SACCH_TCH_SAPI3] = 10 }; +/*! \brief 3GPP TS 52.021 ?9.1 Message Types */ +const struct value_string abis_nm_msgtype_names[] = { + { NM_MT_LOAD_INIT, "Load Data Initiate" }, /* ?8.3.1 */ + { NM_MT_LOAD_INIT_ACK, "Load Data Initiate Ack" }, + { NM_MT_LOAD_INIT_NACK, "Load Data Initiate Nack" }, + { NM_MT_LOAD_SEG, "Load Data Segment" }, /* ?8.3.2 */ + { NM_MT_LOAD_SEG_ACK, "Load Data Segment Ack" }, + { NM_MT_LOAD_ABORT, "Load Data Abort" }, /* ?8.3.3 */ + { NM_MT_LOAD_END, "Load Data End" }, /* ?8.3.4 */ + { NM_MT_LOAD_END_ACK, "Load Data End Ack" }, + { NM_MT_LOAD_END_NACK, "Load Data End Nack" }, + { NM_MT_SW_ACT_REQ, "SW Activate Request" }, /* ?8.3.5 */ + { NM_MT_SW_ACT_REQ_ACK, "SW Activate Request Ack" }, + { NM_MT_SW_ACT_REQ_NACK, "SW Activate Request Nack" }, + { NM_MT_ACTIVATE_SW, "Activate SW" }, /* ?8.3.6 */ + { NM_MT_ACTIVATE_SW_ACK, "Activate SW Ack" }, + { NM_MT_ACTIVATE_SW_NACK, "Activate SW Nack" }, + { NM_MT_SW_ACTIVATED_REP, "SW Activated Report" }, /* ?8.3.7 */ + { NM_MT_ESTABLISH_TEI, "Establish TEI" }, /* ?8.4.1 */ + { NM_MT_ESTABLISH_TEI_ACK, "Establish TEI Ack" }, + { NM_MT_ESTABLISH_TEI_NACK, "Establish TEI Nack" }, + { NM_MT_CONN_TERR_SIGN, "Connect Terrestrial Signalling" }, /* ?8.4.2 */ + { NM_MT_CONN_TERR_SIGN_ACK, "Connect Terrestrial Signalling Ack" }, + { NM_MT_CONN_TERR_SIGN_NACK, "Connect Terrestrial Signalling Nack" }, + { NM_MT_DISC_TERR_SIGN, "Disconnect Terrestrial Signalling" }, /* ?8.4.3 */ + { NM_MT_DISC_TERR_SIGN_ACK, "Disconnect Terrestrial Signalling Ack" }, + { NM_MT_DISC_TERR_SIGN_NACK, "Disconnect Terrestrial Signalling Nack" }, + { NM_MT_CONN_TERR_TRAF, "Connect Terrestrial Traffic" }, /* ?8.4.4 */ + { NM_MT_CONN_TERR_TRAF_ACK, "Connect Terrestrial Traffic Ack" }, + { NM_MT_CONN_TERR_TRAF_NACK, "Connect Terrestrial Traffic Nack" }, + { NM_MT_DISC_TERR_TRAF, "Disconnect Terrestrial Traffic" }, /* ?8.4.5 */ + { NM_MT_DISC_TERR_TRAF_ACK, "Disconnect Terrestrial Traffic Ack" }, + { NM_MT_DISC_TERR_TRAF_NACK, "Disconnect Terrestrial Traffic Nack" }, + { NM_MT_CONN_MDROP_LINK, "Connect Multi-Drop Link" }, /* ?8.5.1 */ + { NM_MT_CONN_MDROP_LINK_ACK, "Connect Multi-Drop Link Ack" }, + { NM_MT_CONN_MDROP_LINK_NACK, "Connect Multi-Drop Link Nack" }, + { NM_MT_DISC_MDROP_LINK, "Disconnect Multi-Drop Link" }, /* ?8.5.2 */ + { NM_MT_DISC_MDROP_LINK_ACK, "Disconnect Multi-Drop Link Ack" }, + { NM_MT_DISC_MDROP_LINK_NACK, "Disconnect Multi-Drop Link Nack" }, + { NM_MT_SET_BTS_ATTR, "Set BTS Attributes" }, /* ?8.6.1 */ + { NM_MT_SET_BTS_ATTR_ACK, "Set BTS Attributes Ack" }, + { NM_MT_SET_BTS_ATTR_NACK, "Set BTS Attributes Nack" }, + { NM_MT_SET_RADIO_ATTR, "Set Radio Carrier Attributes" }, /* ?8.6.2 */ + { NM_MT_SET_RADIO_ATTR_ACK, "Set Radio Carrier Attributes Ack" }, + { NM_MT_SET_RADIO_ATTR_NACK, "Set Radio Carrier Attributes Nack" }, + { NM_MT_SET_CHAN_ATTR, "Set Channel Attributes" }, /* ?8.6.3 */ + { NM_MT_SET_CHAN_ATTR_ACK, "Set Channel Attributes Ack" }, + { NM_MT_SET_CHAN_ATTR_NACK, "Set Channel Attributes Nack" }, + { NM_MT_PERF_TEST, "Perform Test" }, /* ?8.7.1 */ + { NM_MT_PERF_TEST_ACK, "Perform Test Ack" }, + { NM_MT_PERF_TEST_NACK, "Perform Test Nack" }, + { NM_MT_TEST_REP, "Test Report" }, /* ?8.7.2 */ + { NM_MT_SEND_TEST_REP, "Send Test Report" }, /* ?8.7.3 */ + { NM_MT_SEND_TEST_REP_ACK, "Send Test Report Ack" }, + { NM_MT_SEND_TEST_REP_NACK, "Send Test Report Nack" }, + { NM_MT_STOP_TEST, "Stop Test" }, /* ?8.7.4 */ + { NM_MT_STOP_TEST_ACK, "Stop Test Ack" }, + { NM_MT_STOP_TEST_NACK, "Stop Test Nack" }, + { NM_MT_STATECHG_EVENT_REP, "State Changed Event Report" }, /* ?8.8.1 */ + { NM_MT_FAILURE_EVENT_REP, "Failure Event Report" }, /* ?8.8.2 */ + { NM_MT_STOP_EVENT_REP, "Stop Sending Event Reports" }, /* ?8.8.3 */ + { NM_MT_STOP_EVENT_REP_ACK, "Stop Sending Event Reports Ack" }, + { NM_MT_STOP_EVENT_REP_NACK, "Stop Sending Event Reports Nack" }, + { NM_MT_REST_EVENT_REP, "Restart Sending Event Reports" }, /* ?8.8.4 */ + { NM_MT_REST_EVENT_REP_ACK, "Restart Sending Event Reports Ack" }, + { NM_MT_REST_EVENT_REP_NACK, "Restart Sending Event Reports Nack" }, + { NM_MT_CHG_ADM_STATE, "Change Administrative State" }, /* ?8.8.5 */ + { NM_MT_CHG_ADM_STATE_ACK, "Change Administrative State Ack" }, + { NM_MT_CHG_ADM_STATE_NACK, "Change Administrative State Nack" }, + { NM_MT_CHG_ADM_STATE_REQ, "Change Administrative State Request" }, /* ?8.8.6 */ + { NM_MT_CHG_ADM_STATE_REQ_ACK, "Change Administrative State Request Ack" }, + { NM_MT_CHG_ADM_STATE_REQ_NACK, "Change Administrative State Request Nack" }, + { NM_MT_REP_OUTST_ALARMS, "Report Outstanding Alarms" }, /* ?8.8.7 */ + { NM_MT_REP_OUTST_ALARMS_ACK, "Report Outstanding Alarms Ack" }, + { NM_MT_REP_OUTST_ALARMS_NACK, "Report Outstanding Alarms Nack" }, + { NM_MT_CHANGEOVER, "Changeover" }, /* ?8.9.1 */ + { NM_MT_CHANGEOVER_ACK, "Changeover Ack" }, + { NM_MT_CHANGEOVER_NACK, "Changeover Nack" }, + { NM_MT_OPSTART, "Opstart" }, /* ?8.9.2 */ + { NM_MT_OPSTART_ACK, "Opstart Ack" }, + { NM_MT_OPSTART_NACK, "Opstart Nack" }, + { NM_MT_REINIT, "Reinitialize" }, /* ?8.9.3 */ + { NM_MT_REINIT_ACK, "Reinitialize Ack" }, + { NM_MT_REINIT_NACK, "Reinitialize Nack" }, + { NM_MT_SET_SITE_OUT, "Set Site Outputs" }, /* ?8.9.4 */ + { NM_MT_SET_SITE_OUT_ACK, "Set Site Outputs Ack" }, + { NM_MT_SET_SITE_OUT_NACK, "Set Site Outputs Nack" }, + { NM_MT_CHG_HW_CONF, "Change HW Configuration" }, /* ?8.9.5 */ + { NM_MT_CHG_HW_CONF_ACK, "Change HW Configuration Ack" }, + { NM_MT_CHG_HW_CONF_NACK, "Change HW Configuration Nack" }, + { NM_MT_MEAS_RES_REQ, "Measurement Result Request" }, /* ?8.10.1 */ + { NM_MT_MEAS_RES_RESP, "Measurement Result Response" }, /* ?8.10.2 */ + { NM_MT_STOP_MEAS, "Stop Measurement" }, /* ?8.10.4 */ + { NM_MT_START_MEAS, "Start Measurement" }, /* ?8.10.3 */ + { NM_MT_GET_ATTR, "Get Attributes" }, /* ?8.11.1 */ + { NM_MT_GET_ATTR_RESP, "Get Attributes Response" }, /* ?8.11.3 */ + { NM_MT_GET_ATTR_NACK, "Get Attributes Nack" }, + { NM_MT_SET_ALARM_THRES, "Set Alarm Threshold" }, /* ?8.11.2 */ + { NM_MT_SET_ALARM_THRES_ACK, "Set Alarm Threshold Ack" }, + { NM_MT_SET_ALARM_THRES_NACK, "Set Alarm Threshold Nack" }, + { 0, NULL } +}; + /*! \brief 3GPP TS 52.021 ?9.4 Attributes and Parameters */ const struct value_string abis_nm_att_names[] = { { NM_ATT_ABIS_CHANNEL, "Abis Channel" }, /* ?9.4.1 */ diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index cd4c0ab..5649e71 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -29,6 +29,7 @@ abis_nm_ipa_magic; abis_mm_event_cause_names; abis_nm_pcause_type_names; +abis_nm_msgtype_names; abis_nm_att_names; osmo_sitype_strs; -- To view, visit https://gerrit.osmocom.org/2145 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:53:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:53:50 +0000 Subject: osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 1 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:54:02 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:54:02 +0000 Subject: osmo-bts[master]: octphy: fix usage of wrong define constant In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1966 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie4de23daf79bb07ca0c0b818eefe350d18d27e4d Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:54:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:54:34 +0000 Subject: openbsc[master]: LU counters: count completion and failure, not messages sent In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2097 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:56:19 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:56:19 +0000 Subject: libosmocore[master]: Add support for PCU version report In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2083 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:56:45 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 09:56:45 +0000 Subject: openbsc[master]: Handle PCU version received via OML alert In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2085 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:56:57 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 09:56:57 +0000 Subject: [MERGED] libosmocore[master]: Add support for PCU version report In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add support for PCU version report ...................................................................... Add support for PCU version report Expand 3GPP TS 52.021 ?9.4.43 Probable Cause with Osmocom-specific value for PCU version reporting to enable sending it via OML alarms. Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c 2 files changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index 23392d2..c88f0b1 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -277,6 +277,7 @@ OSMO_EVT_WARN_SW_WARN = 0x0001, /* External causes */ OSMO_EVT_EXT_ALARM = 0xfeed, + OSMO_EVT_PCU_VERS = 0xface, }; extern const struct value_string abis_mm_event_cause_names[]; diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index e1b248f..934d7ce 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -162,6 +162,7 @@ { OSMO_EVT_MIN_PAG_TAB_FULL, "Paging table full" }, { OSMO_EVT_WARN_SW_WARN, "Software warning" }, { OSMO_EVT_EXT_ALARM, "External alarm" }, + { OSMO_EVT_PCU_VERS, "PCU version report" }, { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/2083 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 09:58:15 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Thu, 23 Mar 2017 09:58:15 +0000 Subject: libosmocore[master]: tests/conv: move conv.h to the global include dir In-Reply-To: References: Message-ID: Patch Set 2: > actualyl, no. Files in "include/osmocom/" should only be files that > are installed into the system. "tests.h" sounds like something > only needed during unit tests, and it does not belong into a > directory containing system-wide installed header files? Am I > missing something? Ok, you are right. Let me some time to find another way. -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:01:40 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 10:01:40 +0000 Subject: libosmocore[master]: Fix LAPD UA message buffer memory leak. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1984 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:02:30 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 10:02:30 +0000 Subject: libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:03:25 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 10:03:25 +0000 Subject: osmo-bts[master]: osmo-bts-trx: fix scheduling of broken frames In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1776 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:03:28 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 10:03:28 +0000 Subject: [MERGED] osmo-bts[master]: osmo-bts-trx: fix scheduling of broken frames In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-bts-trx: fix scheduling of broken frames ...................................................................... osmo-bts-trx: fix scheduling of broken frames * DTXu: don't set marker for broken frames * do not attempt to send 0-length bursts to avoid flood of errors after bts startup Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3 --- M src/osmo-bts-trx/scheduler_trx.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 9c676d7..aca073a 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -1236,7 +1236,8 @@ rc = tch_hr_decode(tch_data, *bursts_p, (((fn + 26 - 10) % 26) >> 2) & 1, &n_errors, &n_bits_total); - lchan_set_marker(osmo_hr_check_sid(tch_data, rc), lchan); /* DTXu */ + if (rc) /* DTXu */ + lchan_set_marker(osmo_hr_check_sid(tch_data, rc), lchan); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ /* the first FN 0,8,17 or 1,9,18 defines that CMI is included @@ -1375,7 +1376,8 @@ continue; } else gain = 0; - trx_if_data(l1h, tn, fn, gain, bits, nbits); + if (nbits) + trx_if_data(l1h, tn, fn, gain, bits, nbits); } } -- To view, visit https://gerrit.osmocom.org/1776 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3 Gerrit-PatchSet: 5 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:04:17 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 23 Mar 2017 10:04:17 +0000 Subject: osmo-bts[master]: Sync protocol with OsmoPCU In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2086 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:04:39 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 10:04:39 +0000 Subject: [MERGED] osmo-bts[master]: Sync protocol with OsmoPCU In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Sync protocol with OsmoPCU ...................................................................... Sync protocol with OsmoPCU Copy-paste changes from OsmoPCU commit 0a8fae8d141c2cfa4387ffe9b35402d5b8cc85cd. Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 --- M include/osmo-bts/pcuif_proto.h 1 file changed, 19 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index 5527238..88dc09e 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -1,7 +1,10 @@ #ifndef _PCUIF_PROTO_H #define _PCUIF_PROTO_H +#include + #define PCU_IF_VERSION 0x07 +#define TXT_MAX_LEN 128 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ @@ -13,6 +16,7 @@ #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ +#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ /* sapi */ #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ @@ -40,6 +44,16 @@ #define PCU_IF_FLAG_MCS8 (1 << 27) #define PCU_IF_FLAG_MCS9 (1 << 28) +enum gsm_pcu_if_text_type { + PCU_VERSION, + PCU_OML_ALERT, +}; + +struct gsm_pcu_if_txt_ind { + uint8_t type; /* gsm_pcu_if_text_type */ + char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ +} __attribute__ ((packed)); + struct gsm_pcu_if_data { uint8_t sapi; uint8_t len; @@ -50,9 +64,9 @@ uint8_t ts_nr; uint8_t block_nr; int8_t rssi; - uint16_t ber10k; /*!< \brief BER in units of 0.01% */ - int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ - int16_t lqual_cb; /* !< \brief Link quality in centiBel */ + uint16_t ber10k; /*!< \brief BER in units of 0.01% */ + int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ + int16_t lqual_cb; /* !< \brief Link quality in centiBel */ } __attribute__ ((packed)); struct gsm_pcu_if_rts_req { @@ -72,7 +86,7 @@ uint32_t fn; uint16_t arfcn; uint8_t is_11bit; - uint8_t burst_type; + uint8_t burst_type; } __attribute__ ((packed)); struct gsm_pcu_if_info_trx { @@ -148,6 +162,7 @@ struct gsm_pcu_if_data data_ind; struct gsm_pcu_if_rts_req rts_req; struct gsm_pcu_if_rach_ind rach_ind; + struct gsm_pcu_if_txt_ind txt_ind; struct gsm_pcu_if_info_ind info_ind; struct gsm_pcu_if_act_req act_req; struct gsm_pcu_if_time_ind time_ind; -- To view, visit https://gerrit.osmocom.org/2086 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I15e6cc86604947a173e8675ba4b41a3bda2d3296 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:29:28 2017 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Thu, 23 Mar 2017 10:29:28 +0000 Subject: libosmocore[master]: tests/conv: move conv.h to the global include dir In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 wtf ? that's obviously wrong. -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 10:51:24 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Thu, 23 Mar 2017 10:51:24 +0000 Subject: libosmocore[master]: tests/conv: move conv.h to the global include dir In-Reply-To: References: Message-ID: Patch Set 2: > wtf ? that's obviously wrong. Well, what about to create a new 'tests/include' dir, and add one to the include path for tests? -- To view, visit https://gerrit.osmocom.org/2075 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I414223f3d9382642fc4f7efb3b35dc950eaaad86 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 11:05:21 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 11:05:21 +0000 Subject: [PATCH] openbsc[master]: gsm_bts: add version details Message-ID: Review at https://gerrit.osmocom.org/2161 gsm_bts: add version details * add version string to gsm_bts * add PCU version string to gsm_bts_trx * add variant enum to gsm_bts_model using eunm with variants for each hw vendor of OsmoBTS Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/61/2161/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 06fa8dd..c62e66d 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -64,6 +64,8 @@ #define HARDCODED_BTS1_TS 6 #define HARDCODED_BTS2_TS 11 +#define MAX_VERSION_LENGTH 64 + enum gsm_hooks { GSM_HOOK_NM_SWLOAD, GSM_HOOK_RR_PAGING, @@ -433,6 +435,9 @@ /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ struct e1inp_sign_link *oml_link; + /* Connected PCU version (if any) */ + char pcu_version[MAX_VERSION_LENGTH]; + struct gsm_abis_mo mo; struct tlv_parsed nm_attr; struct { @@ -493,12 +498,22 @@ _NUM_GSM_BTS_TYPE }; +enum gsm_bts_model_variant { + BTS_UNKNOWN, + OSMO_BTS_LITECELL15, + OSMO_BTS_OCTPHY, + OSMO_BTS_SYSMO, + OSMO_BTS_TRX, + _NUM_BTS_VARIANT +}; + struct vty; struct gsm_bts_model { struct llist_head list; enum gsm_bts_type type; + enum gsm_bts_model_variant variant; const char *name; bool started; @@ -653,6 +668,8 @@ enum gsm_bts_type type; struct gsm_bts_model *model; enum gsm_band band; + char version[MAX_VERSION_LENGTH]; + /* maximum Tx power that the MS is permitted to use in this cell */ int ms_max_power; -- To view, visit https://gerrit.osmocom.org/2161 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 11:35:02 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 23 Mar 2017 11:35:02 +0000 Subject: osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2160 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: neels Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 11:35:06 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 23 Mar 2017 11:35:06 +0000 Subject: [MERGED] osmo-bts[master]: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: osmo-bts-trx/l1_if.c: use channel combination III for TCH/H ...................................................................... osmo-bts-trx/l1_if.c: use channel combination III for TCH/H Currently the channel combination II is used for TCH/H, which allows only one lchan to be allocated. The reason is that it saves a bit of CPU by disabling UL burst detection on lchan 1. There is also the channel combination III, which allows to increase channel capacity, providing two lchans on a single TCH/H timeslot. Ideally we should implement some dynamic II <-> III switching depending on the network load level. But for now this change replaces the channel combination of TCH/H by III, until dynamic switching is implemented. Fixes issue: https://osmocom.org/issues/1795 Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 --- M src/osmo-bts-trx/l1_if.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Max: Looks good to me, but someone else must approve Ivan Kluchnikov: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index abb16eb..d0c8afd 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -49,7 +49,7 @@ [GSM_PCHAN_CCCH] = 4, [GSM_PCHAN_CCCH_SDCCH4] = 5, [GSM_PCHAN_TCH_F] = 1, - [GSM_PCHAN_TCH_H] = 2, + [GSM_PCHAN_TCH_H] = 3, [GSM_PCHAN_SDCCH8_SACCH8C] = 7, [GSM_PCHAN_PDCH] = 13, /* [GSM_PCHAN_TCH_F_PDCH] not needed here, see trx_set_ts_as_pchan() */ -- To view, visit https://gerrit.osmocom.org/2160 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8fd4abb42c153fcd26bcfe22a2554b5c2d02d810 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: neels From gerrit-no-reply at lists.osmocom.org Thu Mar 23 11:40:58 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 23 Mar 2017 11:40:58 +0000 Subject: openbsc[master]: gsm_bts: add version details In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (3 comments) https://gerrit.osmocom.org/#/c/2161/1//COMMIT_MSG Commit Message: Line 7: gsm_bts: add version details 'and variant' Line 12: hw vendor of OsmoBTS could you explain to the uninformed reader why this is useful and who will use it? thx! https://gerrit.osmocom.org/#/c/2161/1/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 502: BTS_UNKNOWN, It looks to me like this is semantically the same as enum gsm_bts_type just above? Rather not have a mix of BTS_ / OSMO_BTS_ prefixes. The OSMO_ prefix is reserved basically for libosmocore (we agreed on it a few months back). -- To view, visit https://gerrit.osmocom.org/2161 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 23 11:47:45 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 11:47:45 +0000 Subject: [MERGED] openbsc[master]: Handle PCU version received via OML alert In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Handle PCU version received via OML alert ...................................................................... Handle PCU version received via OML alert Explicitly check for and log PCU version received from BTS via OML alert message. Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Related: OS#1614 --- M openbsc/src/libbsc/abis_nm.c 1 file changed, 93 insertions(+), 33 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index 8b0eec2..33a23a2 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -273,51 +273,111 @@ return 0; } -static int rx_fail_evt_rep(struct msgb *mb) +static inline void log_oml_fail_rep(const struct gsm_bts *bts, const char *type, + const char *severity, const uint8_t *p_val, + const char *text) +{ + enum abis_nm_pcause_type pcause = p_val[0]; + enum abis_mm_event_causes cause = osmo_load16be(p_val + 1); + + LOGPC(DNM, LOGL_ERROR, "BTS %u: Failure Event Report: ", bts->nr); + if (type) + LOGPC(DNM, LOGL_ERROR, "Type=%s, ", type); + if (severity) + LOGPC(DNM, LOGL_ERROR, "Severity=%s, ", severity); + + LOGPC(DNM, LOGL_ERROR, "Probable cause=%s: ", + get_value_string(abis_nm_pcause_type_names, pcause)); + + if (pcause == NM_PCAUSE_T_MANUF) + LOGPC(DNM, LOGL_ERROR, "%s, ", + get_value_string(abis_mm_event_cause_names, cause)); + else + LOGPC(DNM, LOGL_ERROR, "%02X %02X ", p_val[1], p_val[2]); + + if (text) { + LOGPC(DNM, LOGL_ERROR, "Additional Text=%s. ", text); + } + + LOGPC(DNM, LOGL_ERROR, "\n"); +} + +static inline void handle_manufact_report(const struct gsm_bts *bts, + const uint8_t *p_val, const char *type, + const char *severity, const char *text) +{ + enum abis_mm_event_causes cause = osmo_load16be(p_val + 1); + + switch (cause) { + case OSMO_EVT_PCU_VERS: + if (text) + LOGPC(DNM, LOGL_NOTICE, + "BTS %u reported connected PCU version %s\n", + bts->nr, text); + else + LOGPC(DNM, LOGL_ERROR, + "BTS %u sent %s without actual version string.\n", + bts->nr, + get_value_string(abis_mm_event_cause_names, + cause)); + break; + default: + log_oml_fail_rep(bts, type, severity, p_val, text); + }; +} + +static int rx_fail_evt_rep(struct msgb *mb, const struct gsm_bts *bts) { struct abis_om_hdr *oh = msgb_l2(mb); struct abis_om_fom_hdr *foh = msgb_l3(mb); struct e1inp_sign_link *sign_link = mb->dst; struct tlv_parsed tp; - const uint8_t *p_val; - char *p_text; + int rc = 0; + const uint8_t *p_val = NULL; + char *p_text = NULL; + const char *e_type = NULL, *severity = NULL; - LOGPC(DNM, LOGL_ERROR, "Failure Event Report: "); + abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, + oh->length-sizeof(*foh)); - abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh)); - - if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE)) - LOGPC(DNM, LOGL_ERROR, "Type=%s, ", - abis_nm_event_type_name(*TLVP_VAL(&tp, NM_ATT_EVENT_TYPE))); - if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY)) - LOGPC(DNM, LOGL_ERROR, "Severity=%s, ", - abis_nm_severity_name(*TLVP_VAL(&tp, NM_ATT_SEVERITY))); - if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { - p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); - LOGPC(DNM, LOGL_ERROR, "Probable cause=%s: ", - get_value_string(abis_nm_pcause_type_names, p_val[0])); - if (p_val[0] == NM_PCAUSE_T_MANUF) - LOGPC(DNM, LOGL_ERROR, "%s, ", - get_value_string(abis_mm_event_cause_names, - osmo_load16be(p_val + 1))); - else - LOGPC(DNM, LOGL_ERROR, "%02X %02X ", p_val[1], p_val[2]); - } if (TLVP_PRESENT(&tp, NM_ATT_ADD_TEXT)) { p_val = TLVP_VAL(&tp, NM_ATT_ADD_TEXT); - p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); - if (p_text) { - LOGPC(DNM, LOGL_ERROR, "Additional Text=%s. ", p_text); - talloc_free(p_text); - } + p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, + TLVP_LEN(&tp, NM_ATT_ADD_TEXT)); } - LOGPC(DNM, LOGL_ERROR, "\n"); + if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE)) + e_type = abis_nm_event_type_name(*TLVP_VAL(&tp, + NM_ATT_EVENT_TYPE)); - return 0; + if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY)) + severity = abis_nm_severity_name(*TLVP_VAL(&tp, + NM_ATT_SEVERITY)); + + if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) { + p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE); + + switch (p_val[0]) { + case NM_PCAUSE_T_MANUF: + handle_manufact_report(bts, p_val, e_type, severity, + p_text); + break; + default: + log_oml_fail_rep(bts, e_type, severity, p_val, p_text); + }; + } else { + LOGPC(DNM, LOGL_ERROR, "BTS%u: Failure Event Report without " + "Probable Cause?!\n", bts->nr); + rc = -EINVAL; + } + + if (p_text) + talloc_free(p_text); + + return rc; } -static int abis_nm_rcvmsg_report(struct msgb *mb) +static int abis_nm_rcvmsg_report(struct msgb *mb, struct gsm_bts *bts) { struct abis_om_fom_hdr *foh = msgb_l3(mb); uint8_t mt = foh->msg_type; @@ -335,7 +395,7 @@ osmo_signal_dispatch(SS_NM, S_NM_SW_ACTIV_REP, mb); break; case NM_MT_FAILURE_EVENT_REP: - rx_fail_evt_rep(mb); + rx_fail_evt_rep(mb, bts); osmo_signal_dispatch(SS_NM, S_NM_FAIL_REP, mb); break; case NM_MT_TEST_REP: @@ -580,7 +640,7 @@ /* check for unsolicited message */ if (is_report(mt)) - return abis_nm_rcvmsg_report(mb); + return abis_nm_rcvmsg_report(mb, bts); if (is_in_arr(mt, abis_nm_sw_load_msgs, ARRAY_SIZE(abis_nm_sw_load_msgs))) return abis_nm_rcvmsg_sw(mb); -- To view, visit https://gerrit.osmocom.org/2085 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 11:51:56 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 11:51:56 +0000 Subject: [PATCH] openbsc[master]: gsm_bts: add version and variant details In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2161 to look at the new patch set (#2). gsm_bts: add version and variant details * add version string to gsm_bts * add PCU version string to gsm_bts_trx * add variant enum to gsm_bts_model using eunm with variants for each hw vendor of OsmoBTS This will come in handy when logging details regarding particular BTS reported via OML, see: Related: OS#1614 Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 --- M openbsc/include/openbsc/gsm_data_shared.h 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/61/2161/2 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 06fa8dd..d712253 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -64,6 +64,8 @@ #define HARDCODED_BTS1_TS 6 #define HARDCODED_BTS2_TS 11 +#define MAX_VERSION_LENGTH 64 + enum gsm_hooks { GSM_HOOK_NM_SWLOAD, GSM_HOOK_RR_PAGING, @@ -433,6 +435,9 @@ /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ struct e1inp_sign_link *oml_link; + /* Connected PCU version (if any) */ + char pcu_version[MAX_VERSION_LENGTH]; + struct gsm_abis_mo mo; struct tlv_parsed nm_attr; struct { @@ -493,12 +498,22 @@ _NUM_GSM_BTS_TYPE }; +enum gsm_bts_model_variant { + BTS_UNKNOWN, + BTS_LITECELL15, + BTS_OCTPHY, + BTS_SYSMO, + BTS_TRX, + _NUM_BTS_VARIANT +}; + struct vty; struct gsm_bts_model { struct llist_head list; enum gsm_bts_type type; + enum gsm_bts_model_variant variant; const char *name; bool started; @@ -653,6 +668,8 @@ enum gsm_bts_type type; struct gsm_bts_model *model; enum gsm_band band; + char version[MAX_VERSION_LENGTH]; + /* maximum Tx power that the MS is permitted to use in this cell */ int ms_max_power; -- To view, visit https://gerrit.osmocom.org/2161 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 23 12:07:25 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 12:07:25 +0000 Subject: osmo-bts[master]: Handle TXT indication from OsmoPCU In-Reply-To: References: Message-ID: Patch Set 1: Could you elaborate, why PCU version should be in gsm_bts_trx and not gsm_bts? For example PCU socket path is stored in gsm_bts_role_bts. Also, there's no "show trx" in BTS vty, you probably meant "show transceiver"? Or this comment is intended for BSC side? -- To view, visit https://gerrit.osmocom.org/2087 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16e73198501487a5b1076bf83390b85538d5af73 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 12:08:55 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 23 Mar 2017 12:08:55 +0000 Subject: [PATCH] osmo-bts[master]: vty: reduce code duplication Message-ID: Review at https://gerrit.osmocom.org/2162 vty: reduce code duplication Use libosmocore's osmo_str2lower() instead of local equivalent. Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e --- M src/common/vty.c 1 file changed, 6 insertions(+), 32 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/62/2162/1 diff --git a/src/common/vty.c b/src/common/vty.c index 646ac87..3f736c9 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -35,7 +35,7 @@ #include #include #include - +#include #include @@ -234,37 +234,11 @@ return CMD_SUCCESS; } -/* FIXME: move to libosmocore ? */ -static char buf_casecnvt[256]; -char *osmo_str_tolower(const char *in) -{ - int len, i; - - if (!in) - return NULL; - - len = strlen(in); - if (len > sizeof(buf_casecnvt)) - len = sizeof(buf_casecnvt); - - for (i = 0; i < len; i++) { - buf_casecnvt[i] = tolower(in[i]); - if (in[i] == '\0') - break; - } - if (i < sizeof(buf_casecnvt)) - buf_casecnvt[i] = '\0'; - - /* just to make sure we're always zero-terminated */ - buf_casecnvt[sizeof(buf_casecnvt)-1] = '\0'; - - return buf_casecnvt; -} - static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) { struct gsm_bts_role_bts *btsb = bts_role_bts(bts); struct gsm_bts_trx *trx; + char buf_casecnvt[256]; int i; vty_out(vty, "bts %u%s", bts->nr, VTY_NEWLINE); @@ -294,13 +268,13 @@ for (i = 0; i < 32; i++) { if (gsmtap_sapi_mask & (1 << i)) { - const char *name = get_value_string(gsmtap_sapi_names, i); - vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); + osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, i)); + vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE); } } if (gsmtap_sapi_acch) { - const char *name = get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH); - vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); + osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH)); + vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE); } vty_out(vty, " min-qual-rach %.0f%s", btsb->min_qual_rach * 10.0f, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/2162 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Mar 23 13:22:07 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 23 Mar 2017 13:22:07 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Hello Max, Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2134 to look at the new patch set (#2). buildenv: Split up SSE3 and SSE4.1 code Currently we find SSE3 and SSE4.1 code mixed togehter along with generic code in one file. This introduces the risk that the compiler exidantly mixes SSE4.1 instructions into an SSE3, or even worse into a generic code path. This commit splits the SSE3 and SSE4.1 code into separate files and compiles them with the matching target options. Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 --- M Transceiver52M/x86/Makefile.am M Transceiver52M/x86/convert.c A Transceiver52M/x86/convert_sse_3.c A Transceiver52M/x86/convert_sse_3.h A Transceiver52M/x86/convert_sse_4_1.c A Transceiver52M/x86/convert_sse_4_1.h M Transceiver52M/x86/convolve.c A Transceiver52M/x86/convolve_sse_3.c A Transceiver52M/x86/convolve_sse_3.h R config/ax_sse.m4 M configure.ac M utils/convolvetest/Makefile 12 files changed, 893 insertions(+), 661 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/34/2134/2 diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index 7a0b75f..70b7064 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -1,7 +1,28 @@ if !ARCH_ARM -AM_CFLAGS = -Wall -std=gnu99 $(SIMD_FLAGS) -I${srcdir}/../common +AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common noinst_LTLIBRARIES = libarch.la +noinst_LTLIBRARIES += libarch_sse_3.la +noinst_LTLIBRARIES += libarch_sse_4_1.la + +libarch_la_LIBADD = + +# SSE 3 specific code +if HAVE_SSE3 +libarch_sse_3_la_SOURCES = \ + convert_sse_3.c \ + convolve_sse_3.c +libarch_sse_3_la_CFLAGS = -msse3 +libarch_la_LIBADD += libarch_sse_3.la +endif + +# SSE 4.1 specific code +if HAVE_SSE4_1 +libarch_sse_4_1_la_SOURCES = \ + convert_sse_4_1.c +libarch_sse_4_1_la_CFLAGS = -msse4.1 +libarch_la_LIBADD += libarch_sse_4_1.la +endif libarch_la_SOURCES = \ ../common/convolve_base.c \ diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index 3f76b65..db98050 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -20,6 +20,8 @@ #include #include #include "convert.h" +#include "convert_sse_3.h" +#include "convert_sse_4_1.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,140 +37,6 @@ }; static struct convert_cpu_context c; - -#ifdef HAVE_SSE3 -#include -#include - -#ifdef HAVE_SSE4_1 -#include - -/* 16*N 16-bit signed integer converted to single precision floats */ -static void _sse_convert_si16_ps_16n(float *restrict out, - const short *restrict in, - int len) -{ - __m128i m0, m1, m2, m3, m4, m5; - __m128 m6, m7, m8, m9; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_si128((__m128i *) &in[16 * i + 0]); - m1 = _mm_loadu_si128((__m128i *) &in[16 * i + 8]); - - /* Unpack */ - m2 = _mm_cvtepi16_epi32(m0); - m4 = _mm_cvtepi16_epi32(m1); - m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); - m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); - m3 = _mm_cvtepi16_epi32(m0); - m5 = _mm_cvtepi16_epi32(m1); - - /* Convert */ - m6 = _mm_cvtepi32_ps(m2); - m7 = _mm_cvtepi32_ps(m3); - m8 = _mm_cvtepi32_ps(m4); - m9 = _mm_cvtepi32_ps(m5); - - /* Store */ - _mm_storeu_ps(&out[16 * i + 0], m6); - _mm_storeu_ps(&out[16 * i + 4], m7); - _mm_storeu_ps(&out[16 * i + 8], m8); - _mm_storeu_ps(&out[16 * i + 12], m9); - } -} - -/* 16*N 16-bit signed integer conversion with remainder */ -static void _sse_convert_si16_ps(float *restrict out, - const short *restrict in, - int len) -{ - int start = len / 16 * 16; - - _sse_convert_si16_ps_16n(out, in, len); - - for (int i = 0; i < len % 16; i++) - out[start + i] = in[start + i]; -} -#endif /* HAVE_SSE4_1 */ - -/* 8*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_8n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2; - __m128i m4, m5; - - for (int i = 0; i < len / 8; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[8 * i + 0]); - m1 = _mm_loadu_ps(&in[8 * i + 4]); - m2 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m2); - m1 = _mm_mul_ps(m1, m2); - - /* Convert */ - m4 = _mm_cvtps_epi32(m0); - m5 = _mm_cvtps_epi32(m1); - - /* Pack and store */ - m5 = _mm_packs_epi32(m4, m5); - _mm_storeu_si128((__m128i *) &out[8 * i], m5); - } -} - -/* 8*N single precision floats scaled and converted with remainder */ -static void _sse_convert_scale_ps_si16(short *restrict out, - const float *restrict in, - float scale, int len) -{ - int start = len / 8 * 8; - - _sse_convert_scale_ps_si16_8n(out, in, scale, len); - - for (int i = 0; i < len % 8; i++) - out[start + i] = in[start + i] * scale; -} - -/* 16*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_16n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2, m3, m4; - __m128i m5, m6, m7, m8; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[16 * i + 0]); - m1 = _mm_loadu_ps(&in[16 * i + 4]); - m2 = _mm_loadu_ps(&in[16 * i + 8]); - m3 = _mm_loadu_ps(&in[16 * i + 12]); - m4 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m4); - m1 = _mm_mul_ps(m1, m4); - m2 = _mm_mul_ps(m2, m4); - m3 = _mm_mul_ps(m3, m4); - - /* Convert */ - m5 = _mm_cvtps_epi32(m0); - m6 = _mm_cvtps_epi32(m1); - m7 = _mm_cvtps_epi32(m2); - m8 = _mm_cvtps_epi32(m3); - - /* Pack and store */ - m5 = _mm_packs_epi32(m5, m6); - m7 = _mm_packs_epi32(m7, m8); - _mm_storeu_si128((__m128i *) &out[16 * i + 0], m5); - _mm_storeu_si128((__m128i *) &out[16 * i + 8], m7); - } -} -#endif void convert_init(void) { diff --git a/Transceiver52M/x86/convert_sse_3.c b/Transceiver52M/x86/convert_sse_3.c new file mode 100644 index 0000000..255db67 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.c @@ -0,0 +1,107 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2; + __m128i m4, m5; + + for (int i = 0; i < len / 8; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[8 * i + 0]); + m1 = _mm_loadu_ps(&in[8 * i + 4]); + m2 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m2); + m1 = _mm_mul_ps(m1, m2); + + /* Convert */ + m4 = _mm_cvtps_epi32(m0); + m5 = _mm_cvtps_epi32(m1); + + /* Pack and store */ + m5 = _mm_packs_epi32(m4, m5); + _mm_storeu_si128((__m128i *) & out[8 * i], m5); + } +} + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len) +{ + int start = len / 8 * 8; + + _sse_convert_scale_ps_si16_8n(out, in, scale, len); + + for (int i = 0; i < len % 8; i++) + out[start + i] = in[start + i] * scale; +} + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2, m3, m4; + __m128i m5, m6, m7, m8; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[16 * i + 0]); + m1 = _mm_loadu_ps(&in[16 * i + 4]); + m2 = _mm_loadu_ps(&in[16 * i + 8]); + m3 = _mm_loadu_ps(&in[16 * i + 12]); + m4 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m4); + m1 = _mm_mul_ps(m1, m4); + m2 = _mm_mul_ps(m2, m4); + m3 = _mm_mul_ps(m3, m4); + + /* Convert */ + m5 = _mm_cvtps_epi32(m0); + m6 = _mm_cvtps_epi32(m1); + m7 = _mm_cvtps_epi32(m2); + m8 = _mm_cvtps_epi32(m3); + + /* Pack and store */ + m5 = _mm_packs_epi32(m5, m6); + m7 = _mm_packs_epi32(m7, m8); + _mm_storeu_si128((__m128i *) & out[16 * i + 0], m5); + _mm_storeu_si128((__m128i *) & out[16 * i + 8], m7); + } +} +#endif diff --git a/Transceiver52M/x86/convert_sse_3.h b/Transceiver52M/x86/convert_sse_3.h new file mode 100644 index 0000000..c2f87d7 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.h @@ -0,0 +1,34 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len); + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len); + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len); diff --git a/Transceiver52M/x86/convert_sse_4_1.c b/Transceiver52M/x86/convert_sse_4_1.c new file mode 100644 index 0000000..42a235c --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.c @@ -0,0 +1,77 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_4_1.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE4_1 +#include + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len) +{ + __m128i m0, m1, m2, m3, m4, m5; + __m128 m6, m7, m8, m9; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_si128((__m128i *) & in[16 * i + 0]); + m1 = _mm_loadu_si128((__m128i *) & in[16 * i + 8]); + + /* Unpack */ + m2 = _mm_cvtepi16_epi32(m0); + m4 = _mm_cvtepi16_epi32(m1); + m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); + m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); + m3 = _mm_cvtepi16_epi32(m0); + m5 = _mm_cvtepi16_epi32(m1); + + /* Convert */ + m6 = _mm_cvtepi32_ps(m2); + m7 = _mm_cvtepi32_ps(m3); + m8 = _mm_cvtepi32_ps(m4); + m9 = _mm_cvtepi32_ps(m5); + + /* Store */ + _mm_storeu_ps(&out[16 * i + 0], m6); + _mm_storeu_ps(&out[16 * i + 4], m7); + _mm_storeu_ps(&out[16 * i + 8], m8); + _mm_storeu_ps(&out[16 * i + 12], m9); + } +} + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len) +{ + int start = len / 16 * 16; + + _sse_convert_si16_ps_16n(out, in, len); + + for (int i = 0; i < len % 16; i++) + out[start + i] = in[start + i]; +} + +#endif diff --git a/Transceiver52M/x86/convert_sse_4_1.h b/Transceiver52M/x86/convert_sse_4_1.h new file mode 100644 index 0000000..57a5efb --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.h @@ -0,0 +1,28 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len); + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len); diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c index 2f3b293..35cba29 100644 --- a/Transceiver52M/x86/convolve.c +++ b/Transceiver52M/x86/convolve.c @@ -21,6 +21,7 @@ #include #include #include "convolve.h" +#include "convolve_sse_3.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -66,529 +67,6 @@ int bounds_check(int x_len, int h_len, int y_len, int start, int len, int step); - -#ifdef HAVE_SSE3 -#include -#include - -/* 4-tap SSE complex-real convolution */ -static void sse_conv_real4(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_real() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m4 = _mm_mul_ps(m2, m7); - m5 = _mm_mul_ps(m3, m7); - - /* Sum and store */ - m6 = _mm_hadd_ps(m4, m5); - m0 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8-tap SSE complex-real convolution */ -static void sse_conv_real8(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m6 = _mm_mul_ps(m6, m4); - m7 = _mm_mul_ps(m7, m4); - m8 = _mm_mul_ps(m8, m5); - m9 = _mm_mul_ps(m9, m5); - - /* Sum and store */ - m6 = _mm_add_ps(m6, m8); - m7 = _mm_add_ps(m7, m9); - m6 = _mm_hadd_ps(m6, m7); - m6 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m6); - m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m6); - } -} - -/* 12-tap SSE complex-real convolution */ -static void sse_conv_real12(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m8, m4); - m11 = _mm_add_ps(m9, m5); - - m2 = _mm_hadd_ps(m10, m11); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 16-tap SSE complex-real convolution */ -static void sse_conv_real16(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - m2 = _mm_loadu_ps(&_x[2 * i + 24]); - m3 = _mm_loadu_ps(&_x[2 * i + 28]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - m6 = _mm_mul_ps(m10, m15); - m7 = _mm_mul_ps(m11, m15); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m4, m6); - m11 = _mm_add_ps(m5, m7); - - m0 = _mm_add_ps(m8, m10); - m1 = _mm_add_ps(m9, m11); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 20-tap SSE complex-real convolution */ -static void sse_conv_real20(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - m8 = _mm_load_ps(&h[32]); - m9 = _mm_load_ps(&h[36]); - - m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Multiply-accumulate first 12 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - m4 = _mm_loadu_ps(&_x[2 * i + 16]); - m5 = _mm_loadu_ps(&_x[2 * i + 20]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); - - m2 = _mm_mul_ps(m6, m11); - m3 = _mm_mul_ps(m7, m11); - m4 = _mm_mul_ps(m8, m12); - m5 = _mm_mul_ps(m9, m12); - m6 = _mm_mul_ps(m0, m13); - m7 = _mm_mul_ps(m1, m13); - - m0 = _mm_add_ps(m2, m4); - m1 = _mm_add_ps(m3, m5); - m8 = _mm_add_ps(m0, m6); - m9 = _mm_add_ps(m1, m7); - - /* Multiply-accumulate last 8 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 24]); - m1 = _mm_loadu_ps(&_x[2 * i + 28]); - m2 = _mm_loadu_ps(&_x[2 * i + 32]); - m3 = _mm_loadu_ps(&_x[2 * i + 36]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_mul_ps(m4, m14); - m1 = _mm_mul_ps(m5, m14); - m2 = _mm_mul_ps(m6, m15); - m3 = _mm_mul_ps(m7, m15); - - m4 = _mm_add_ps(m0, m2); - m5 = _mm_add_ps(m1, m3); - - /* Final sum and store */ - m0 = _mm_add_ps(m8, m4); - m1 = _mm_add_ps(m9, m5); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 4*N-tap SSE complex-real convolution */ -static void sse_conv_real4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m2, m5); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m1); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 4*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_complex() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m3, m5); - - m2 = _mm_mul_ps(m2, m5); - m3 = _mm_mul_ps(m3, m4); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_add_ps(m2, m3); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m2); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_8n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_cmplx_4n() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m12 = _mm_setzero_ps(); - m13 = _mm_setzero_ps(); - m14 = _mm_setzero_ps(); - m15 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 8; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[16 * n + 0]); - m1 = _mm_load_ps(&h[16 * n + 4]); - m2 = _mm_load_ps(&h[16 * n + 8]); - m3 = _mm_load_ps(&h[16 * n + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m8); - m1 = _mm_mul_ps(m5, m9); - m2 = _mm_mul_ps(m6, m10); - m3 = _mm_mul_ps(m7, m11); - - m4 = _mm_mul_ps(m4, m9); - m5 = _mm_mul_ps(m5, m8); - m6 = _mm_mul_ps(m6, m11); - m7 = _mm_mul_ps(m7, m10); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_sub_ps(m2, m3); - m4 = _mm_add_ps(m4, m5); - m6 = _mm_add_ps(m6, m7); - - /* Accumulate */ - m12 = _mm_add_ps(m12, m0); - m13 = _mm_add_ps(m13, m2); - m14 = _mm_add_ps(m14, m4); - m15 = _mm_add_ps(m15, m6); - } - - m0 = _mm_add_ps(m12, m13); - m1 = _mm_add_ps(m14, m15); - m2 = _mm_hadd_ps(m0, m1); - m2 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m2); - m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m2); - } -} -#endif /* API: Initalize convolve module */ void convolve_init(void) diff --git a/Transceiver52M/x86/convolve_sse_3.c b/Transceiver52M/x86/convolve_sse_3.c new file mode 100644 index 0000000..dbee3cc --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.c @@ -0,0 +1,542 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "convolve_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_real() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m4 = _mm_mul_ps(m2, m7); + m5 = _mm_mul_ps(m3, m7); + + /* Sum and store */ + m6 = _mm_hadd_ps(m4, m5); + m0 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m6 = _mm_mul_ps(m6, m4); + m7 = _mm_mul_ps(m7, m4); + m8 = _mm_mul_ps(m8, m5); + m9 = _mm_mul_ps(m9, m5); + + /* Sum and store */ + m6 = _mm_add_ps(m6, m8); + m7 = _mm_add_ps(m7, m9); + m6 = _mm_hadd_ps(m6, m7); + m6 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m6); + m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m6); + } +} + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m8, m4); + m11 = _mm_add_ps(m9, m5); + + m2 = _mm_hadd_ps(m10, m11); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + m2 = _mm_loadu_ps(&_x[2 * i + 24]); + m3 = _mm_loadu_ps(&_x[2 * i + 28]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + m6 = _mm_mul_ps(m10, m15); + m7 = _mm_mul_ps(m11, m15); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m4, m6); + m11 = _mm_add_ps(m5, m7); + + m0 = _mm_add_ps(m8, m10); + m1 = _mm_add_ps(m9, m11); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + m8 = _mm_load_ps(&h[32]); + m9 = _mm_load_ps(&h[36]); + + m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Multiply-accumulate first 12 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + m4 = _mm_loadu_ps(&_x[2 * i + 16]); + m5 = _mm_loadu_ps(&_x[2 * i + 20]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); + + m2 = _mm_mul_ps(m6, m11); + m3 = _mm_mul_ps(m7, m11); + m4 = _mm_mul_ps(m8, m12); + m5 = _mm_mul_ps(m9, m12); + m6 = _mm_mul_ps(m0, m13); + m7 = _mm_mul_ps(m1, m13); + + m0 = _mm_add_ps(m2, m4); + m1 = _mm_add_ps(m3, m5); + m8 = _mm_add_ps(m0, m6); + m9 = _mm_add_ps(m1, m7); + + /* Multiply-accumulate last 8 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 24]); + m1 = _mm_loadu_ps(&_x[2 * i + 28]); + m2 = _mm_loadu_ps(&_x[2 * i + 32]); + m3 = _mm_loadu_ps(&_x[2 * i + 36]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_mul_ps(m4, m14); + m1 = _mm_mul_ps(m5, m14); + m2 = _mm_mul_ps(m6, m15); + m3 = _mm_mul_ps(m7, m15); + + m4 = _mm_add_ps(m0, m2); + m5 = _mm_add_ps(m1, m3); + + /* Final sum and store */ + m0 = _mm_add_ps(m8, m4); + m1 = _mm_add_ps(m9, m5); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m2, m5); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m1); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_complex() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m3, m5); + + m2 = _mm_mul_ps(m2, m5); + m3 = _mm_mul_ps(m3, m4); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_add_ps(m2, m3); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m2); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_cmplx_4n() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m12 = _mm_setzero_ps(); + m13 = _mm_setzero_ps(); + m14 = _mm_setzero_ps(); + m15 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 8; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[16 * n + 0]); + m1 = _mm_load_ps(&h[16 * n + 4]); + m2 = _mm_load_ps(&h[16 * n + 8]); + m3 = _mm_load_ps(&h[16 * n + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m8); + m1 = _mm_mul_ps(m5, m9); + m2 = _mm_mul_ps(m6, m10); + m3 = _mm_mul_ps(m7, m11); + + m4 = _mm_mul_ps(m4, m9); + m5 = _mm_mul_ps(m5, m8); + m6 = _mm_mul_ps(m6, m11); + m7 = _mm_mul_ps(m7, m10); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_sub_ps(m2, m3); + m4 = _mm_add_ps(m4, m5); + m6 = _mm_add_ps(m6, m7); + + /* Accumulate */ + m12 = _mm_add_ps(m12, m0); + m13 = _mm_add_ps(m13, m2); + m14 = _mm_add_ps(m14, m4); + m15 = _mm_add_ps(m15, m6); + } + + m0 = _mm_add_ps(m12, m13); + m1 = _mm_add_ps(m14, m15); + m2 = _mm_hadd_ps(m0, m1); + m2 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m2); + m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m2); + } +} +#endif diff --git a/Transceiver52M/x86/convolve_sse_3.h b/Transceiver52M/x86/convolve_sse_3.h new file mode 100644 index 0000000..ac30ca5 --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.h @@ -0,0 +1,68 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); diff --git a/config/ax_ext.m4 b/config/ax_sse.m4 similarity index 93% rename from config/ax_ext.m4 rename to config/ax_sse.m4 index 4883b89..ed4d223 100644 --- a/config/ax_ext.m4 +++ b/config/ax_sse.m4 @@ -37,7 +37,7 @@ #serial 12 -AC_DEFUN([AX_EXT], +AC_DEFUN([AX_SSE], [ AC_REQUIRE([AC_CANONICAL_HOST]) @@ -53,16 +53,20 @@ if test x"$ax_cv_support_sse3_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse3" AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) + AM_CONDITIONAL(HAVE_SSE3, true) else AC_MSG_WARN([Your compiler does not support sse3 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE3, false) fi AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) if test x"$ax_cv_support_sse41_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse4.1" AC_DEFINE(HAVE_SSE4_1,,[Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions]) + AM_CONDITIONAL(HAVE_SSE4_1, true) else AC_MSG_WARN([Your compiler does not support sse4.1 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE4_1, false) fi ;; esac diff --git a/configure.ac b/configure.ac index 7d7750e..44f2800 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,10 @@ # Find and define supported SIMD extensions AS_IF([test "x$with_sse" == "xyes"], [ - AX_EXT + AX_SSE +], [ + AM_CONDITIONAL(HAVE_SSE3, false) + AM_CONDITIONAL(HAVE_SSE4_1, false) ]) AM_CONDITIONAL(USRP1, [test "x$with_usrp1" = "xyes"]) diff --git a/utils/convolvetest/Makefile b/utils/convolvetest/Makefile index 0ce4cb1..d09a4cd 100644 --- a/utils/convolvetest/Makefile +++ b/utils/convolvetest/Makefile @@ -1,4 +1,4 @@ -all: main.o convolve_base.o convolve.o +all: main.o convolve_base.o convolve.o convolve_sse_3.o gcc -g -Wall ./*.o -o convtest -losmocore clean: @@ -14,3 +14,5 @@ convolve.o: ../../Transceiver52M/x86/convolve.c gcc -std=c99 -c ../../Transceiver52M/x86/convolve.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 +convolve_sse_3.o: ../../Transceiver52M/x86/convolve_sse_3.c + gcc -std=c99 -c ../../Transceiver52M/x86/convolve_sse_3.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 23 13:56:47 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 23 Mar 2017 13:56:47 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Turn off native architecture builds In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2098 to look at the new patch set (#3). buildenv: Turn off native architecture builds The compiler option -march=native instructs the compiler to auto-optimize the code for the current build architecture. This is fine for building and using locally, but contraproductive when generating binary packages. This commit replaces -march=native with $(SIMD_FLAGS), which contains a collection of supported SIMD options, so we won't loose the SSE support. Change-Id: I3df4b8db9692016115edbe2247beeec090715687 --- M Transceiver52M/x86/Makefile.am 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/98/2098/3 diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index eda1a17..699faad 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -1,5 +1,5 @@ if !ARCH_ARM -AM_CFLAGS = -Wall -std=gnu99 -march=native -I${srcdir}/../common +AM_CFLAGS = -Wall -std=gnu99 $(SIMD_FLAGS) -I${srcdir}/../common noinst_LTLIBRARIES = libarch.la -- To view, visit https://gerrit.osmocom.org/2098 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3df4b8db9692016115edbe2247beeec090715687 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 23 13:56:47 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 23 Mar 2017 13:56:47 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Hello Max, Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2134 to look at the new patch set (#3). buildenv: Split up SSE3 and SSE4.1 code Currently we find SSE3 and SSE4.1 code mixed togehter along with generic code in one file. This introduces the risk that the compiler exidantly mixes SSE4.1 instructions into an SSE3, or even worse into a generic code path. This commit splits the SSE3 and SSE4.1 code into separate files and compiles them with the matching target options. Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 --- M Transceiver52M/x86/Makefile.am M Transceiver52M/x86/convert.c A Transceiver52M/x86/convert_sse_3.c A Transceiver52M/x86/convert_sse_3.h A Transceiver52M/x86/convert_sse_4_1.c A Transceiver52M/x86/convert_sse_4_1.h M Transceiver52M/x86/convolve.c A Transceiver52M/x86/convolve_sse_3.c A Transceiver52M/x86/convolve_sse_3.h R config/ax_sse.m4 M configure.ac M utils/convolvetest/Makefile 12 files changed, 893 insertions(+), 661 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/34/2134/3 diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index 7a0b75f..70b7064 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -1,7 +1,28 @@ if !ARCH_ARM -AM_CFLAGS = -Wall -std=gnu99 $(SIMD_FLAGS) -I${srcdir}/../common +AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common noinst_LTLIBRARIES = libarch.la +noinst_LTLIBRARIES += libarch_sse_3.la +noinst_LTLIBRARIES += libarch_sse_4_1.la + +libarch_la_LIBADD = + +# SSE 3 specific code +if HAVE_SSE3 +libarch_sse_3_la_SOURCES = \ + convert_sse_3.c \ + convolve_sse_3.c +libarch_sse_3_la_CFLAGS = -msse3 +libarch_la_LIBADD += libarch_sse_3.la +endif + +# SSE 4.1 specific code +if HAVE_SSE4_1 +libarch_sse_4_1_la_SOURCES = \ + convert_sse_4_1.c +libarch_sse_4_1_la_CFLAGS = -msse4.1 +libarch_la_LIBADD += libarch_sse_4_1.la +endif libarch_la_SOURCES = \ ../common/convolve_base.c \ diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index 3f76b65..db98050 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -20,6 +20,8 @@ #include #include #include "convert.h" +#include "convert_sse_3.h" +#include "convert_sse_4_1.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,140 +37,6 @@ }; static struct convert_cpu_context c; - -#ifdef HAVE_SSE3 -#include -#include - -#ifdef HAVE_SSE4_1 -#include - -/* 16*N 16-bit signed integer converted to single precision floats */ -static void _sse_convert_si16_ps_16n(float *restrict out, - const short *restrict in, - int len) -{ - __m128i m0, m1, m2, m3, m4, m5; - __m128 m6, m7, m8, m9; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_si128((__m128i *) &in[16 * i + 0]); - m1 = _mm_loadu_si128((__m128i *) &in[16 * i + 8]); - - /* Unpack */ - m2 = _mm_cvtepi16_epi32(m0); - m4 = _mm_cvtepi16_epi32(m1); - m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); - m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); - m3 = _mm_cvtepi16_epi32(m0); - m5 = _mm_cvtepi16_epi32(m1); - - /* Convert */ - m6 = _mm_cvtepi32_ps(m2); - m7 = _mm_cvtepi32_ps(m3); - m8 = _mm_cvtepi32_ps(m4); - m9 = _mm_cvtepi32_ps(m5); - - /* Store */ - _mm_storeu_ps(&out[16 * i + 0], m6); - _mm_storeu_ps(&out[16 * i + 4], m7); - _mm_storeu_ps(&out[16 * i + 8], m8); - _mm_storeu_ps(&out[16 * i + 12], m9); - } -} - -/* 16*N 16-bit signed integer conversion with remainder */ -static void _sse_convert_si16_ps(float *restrict out, - const short *restrict in, - int len) -{ - int start = len / 16 * 16; - - _sse_convert_si16_ps_16n(out, in, len); - - for (int i = 0; i < len % 16; i++) - out[start + i] = in[start + i]; -} -#endif /* HAVE_SSE4_1 */ - -/* 8*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_8n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2; - __m128i m4, m5; - - for (int i = 0; i < len / 8; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[8 * i + 0]); - m1 = _mm_loadu_ps(&in[8 * i + 4]); - m2 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m2); - m1 = _mm_mul_ps(m1, m2); - - /* Convert */ - m4 = _mm_cvtps_epi32(m0); - m5 = _mm_cvtps_epi32(m1); - - /* Pack and store */ - m5 = _mm_packs_epi32(m4, m5); - _mm_storeu_si128((__m128i *) &out[8 * i], m5); - } -} - -/* 8*N single precision floats scaled and converted with remainder */ -static void _sse_convert_scale_ps_si16(short *restrict out, - const float *restrict in, - float scale, int len) -{ - int start = len / 8 * 8; - - _sse_convert_scale_ps_si16_8n(out, in, scale, len); - - for (int i = 0; i < len % 8; i++) - out[start + i] = in[start + i] * scale; -} - -/* 16*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_16n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2, m3, m4; - __m128i m5, m6, m7, m8; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[16 * i + 0]); - m1 = _mm_loadu_ps(&in[16 * i + 4]); - m2 = _mm_loadu_ps(&in[16 * i + 8]); - m3 = _mm_loadu_ps(&in[16 * i + 12]); - m4 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m4); - m1 = _mm_mul_ps(m1, m4); - m2 = _mm_mul_ps(m2, m4); - m3 = _mm_mul_ps(m3, m4); - - /* Convert */ - m5 = _mm_cvtps_epi32(m0); - m6 = _mm_cvtps_epi32(m1); - m7 = _mm_cvtps_epi32(m2); - m8 = _mm_cvtps_epi32(m3); - - /* Pack and store */ - m5 = _mm_packs_epi32(m5, m6); - m7 = _mm_packs_epi32(m7, m8); - _mm_storeu_si128((__m128i *) &out[16 * i + 0], m5); - _mm_storeu_si128((__m128i *) &out[16 * i + 8], m7); - } -} -#endif void convert_init(void) { diff --git a/Transceiver52M/x86/convert_sse_3.c b/Transceiver52M/x86/convert_sse_3.c new file mode 100644 index 0000000..255db67 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.c @@ -0,0 +1,107 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2; + __m128i m4, m5; + + for (int i = 0; i < len / 8; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[8 * i + 0]); + m1 = _mm_loadu_ps(&in[8 * i + 4]); + m2 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m2); + m1 = _mm_mul_ps(m1, m2); + + /* Convert */ + m4 = _mm_cvtps_epi32(m0); + m5 = _mm_cvtps_epi32(m1); + + /* Pack and store */ + m5 = _mm_packs_epi32(m4, m5); + _mm_storeu_si128((__m128i *) & out[8 * i], m5); + } +} + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len) +{ + int start = len / 8 * 8; + + _sse_convert_scale_ps_si16_8n(out, in, scale, len); + + for (int i = 0; i < len % 8; i++) + out[start + i] = in[start + i] * scale; +} + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2, m3, m4; + __m128i m5, m6, m7, m8; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[16 * i + 0]); + m1 = _mm_loadu_ps(&in[16 * i + 4]); + m2 = _mm_loadu_ps(&in[16 * i + 8]); + m3 = _mm_loadu_ps(&in[16 * i + 12]); + m4 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m4); + m1 = _mm_mul_ps(m1, m4); + m2 = _mm_mul_ps(m2, m4); + m3 = _mm_mul_ps(m3, m4); + + /* Convert */ + m5 = _mm_cvtps_epi32(m0); + m6 = _mm_cvtps_epi32(m1); + m7 = _mm_cvtps_epi32(m2); + m8 = _mm_cvtps_epi32(m3); + + /* Pack and store */ + m5 = _mm_packs_epi32(m5, m6); + m7 = _mm_packs_epi32(m7, m8); + _mm_storeu_si128((__m128i *) & out[16 * i + 0], m5); + _mm_storeu_si128((__m128i *) & out[16 * i + 8], m7); + } +} +#endif diff --git a/Transceiver52M/x86/convert_sse_3.h b/Transceiver52M/x86/convert_sse_3.h new file mode 100644 index 0000000..c2f87d7 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.h @@ -0,0 +1,34 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len); + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len); + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len); diff --git a/Transceiver52M/x86/convert_sse_4_1.c b/Transceiver52M/x86/convert_sse_4_1.c new file mode 100644 index 0000000..42a235c --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.c @@ -0,0 +1,77 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_4_1.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE4_1 +#include + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len) +{ + __m128i m0, m1, m2, m3, m4, m5; + __m128 m6, m7, m8, m9; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_si128((__m128i *) & in[16 * i + 0]); + m1 = _mm_loadu_si128((__m128i *) & in[16 * i + 8]); + + /* Unpack */ + m2 = _mm_cvtepi16_epi32(m0); + m4 = _mm_cvtepi16_epi32(m1); + m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); + m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); + m3 = _mm_cvtepi16_epi32(m0); + m5 = _mm_cvtepi16_epi32(m1); + + /* Convert */ + m6 = _mm_cvtepi32_ps(m2); + m7 = _mm_cvtepi32_ps(m3); + m8 = _mm_cvtepi32_ps(m4); + m9 = _mm_cvtepi32_ps(m5); + + /* Store */ + _mm_storeu_ps(&out[16 * i + 0], m6); + _mm_storeu_ps(&out[16 * i + 4], m7); + _mm_storeu_ps(&out[16 * i + 8], m8); + _mm_storeu_ps(&out[16 * i + 12], m9); + } +} + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len) +{ + int start = len / 16 * 16; + + _sse_convert_si16_ps_16n(out, in, len); + + for (int i = 0; i < len % 16; i++) + out[start + i] = in[start + i]; +} + +#endif diff --git a/Transceiver52M/x86/convert_sse_4_1.h b/Transceiver52M/x86/convert_sse_4_1.h new file mode 100644 index 0000000..57a5efb --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.h @@ -0,0 +1,28 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len); + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len); diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c index 2f3b293..35cba29 100644 --- a/Transceiver52M/x86/convolve.c +++ b/Transceiver52M/x86/convolve.c @@ -21,6 +21,7 @@ #include #include #include "convolve.h" +#include "convolve_sse_3.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -66,529 +67,6 @@ int bounds_check(int x_len, int h_len, int y_len, int start, int len, int step); - -#ifdef HAVE_SSE3 -#include -#include - -/* 4-tap SSE complex-real convolution */ -static void sse_conv_real4(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_real() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m4 = _mm_mul_ps(m2, m7); - m5 = _mm_mul_ps(m3, m7); - - /* Sum and store */ - m6 = _mm_hadd_ps(m4, m5); - m0 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8-tap SSE complex-real convolution */ -static void sse_conv_real8(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m6 = _mm_mul_ps(m6, m4); - m7 = _mm_mul_ps(m7, m4); - m8 = _mm_mul_ps(m8, m5); - m9 = _mm_mul_ps(m9, m5); - - /* Sum and store */ - m6 = _mm_add_ps(m6, m8); - m7 = _mm_add_ps(m7, m9); - m6 = _mm_hadd_ps(m6, m7); - m6 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m6); - m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m6); - } -} - -/* 12-tap SSE complex-real convolution */ -static void sse_conv_real12(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m8, m4); - m11 = _mm_add_ps(m9, m5); - - m2 = _mm_hadd_ps(m10, m11); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 16-tap SSE complex-real convolution */ -static void sse_conv_real16(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - m2 = _mm_loadu_ps(&_x[2 * i + 24]); - m3 = _mm_loadu_ps(&_x[2 * i + 28]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - m6 = _mm_mul_ps(m10, m15); - m7 = _mm_mul_ps(m11, m15); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m4, m6); - m11 = _mm_add_ps(m5, m7); - - m0 = _mm_add_ps(m8, m10); - m1 = _mm_add_ps(m9, m11); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 20-tap SSE complex-real convolution */ -static void sse_conv_real20(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - m8 = _mm_load_ps(&h[32]); - m9 = _mm_load_ps(&h[36]); - - m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Multiply-accumulate first 12 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - m4 = _mm_loadu_ps(&_x[2 * i + 16]); - m5 = _mm_loadu_ps(&_x[2 * i + 20]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); - - m2 = _mm_mul_ps(m6, m11); - m3 = _mm_mul_ps(m7, m11); - m4 = _mm_mul_ps(m8, m12); - m5 = _mm_mul_ps(m9, m12); - m6 = _mm_mul_ps(m0, m13); - m7 = _mm_mul_ps(m1, m13); - - m0 = _mm_add_ps(m2, m4); - m1 = _mm_add_ps(m3, m5); - m8 = _mm_add_ps(m0, m6); - m9 = _mm_add_ps(m1, m7); - - /* Multiply-accumulate last 8 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 24]); - m1 = _mm_loadu_ps(&_x[2 * i + 28]); - m2 = _mm_loadu_ps(&_x[2 * i + 32]); - m3 = _mm_loadu_ps(&_x[2 * i + 36]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_mul_ps(m4, m14); - m1 = _mm_mul_ps(m5, m14); - m2 = _mm_mul_ps(m6, m15); - m3 = _mm_mul_ps(m7, m15); - - m4 = _mm_add_ps(m0, m2); - m5 = _mm_add_ps(m1, m3); - - /* Final sum and store */ - m0 = _mm_add_ps(m8, m4); - m1 = _mm_add_ps(m9, m5); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 4*N-tap SSE complex-real convolution */ -static void sse_conv_real4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m2, m5); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m1); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 4*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_complex() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m3, m5); - - m2 = _mm_mul_ps(m2, m5); - m3 = _mm_mul_ps(m3, m4); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_add_ps(m2, m3); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m2); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_8n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_cmplx_4n() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m12 = _mm_setzero_ps(); - m13 = _mm_setzero_ps(); - m14 = _mm_setzero_ps(); - m15 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 8; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[16 * n + 0]); - m1 = _mm_load_ps(&h[16 * n + 4]); - m2 = _mm_load_ps(&h[16 * n + 8]); - m3 = _mm_load_ps(&h[16 * n + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m8); - m1 = _mm_mul_ps(m5, m9); - m2 = _mm_mul_ps(m6, m10); - m3 = _mm_mul_ps(m7, m11); - - m4 = _mm_mul_ps(m4, m9); - m5 = _mm_mul_ps(m5, m8); - m6 = _mm_mul_ps(m6, m11); - m7 = _mm_mul_ps(m7, m10); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_sub_ps(m2, m3); - m4 = _mm_add_ps(m4, m5); - m6 = _mm_add_ps(m6, m7); - - /* Accumulate */ - m12 = _mm_add_ps(m12, m0); - m13 = _mm_add_ps(m13, m2); - m14 = _mm_add_ps(m14, m4); - m15 = _mm_add_ps(m15, m6); - } - - m0 = _mm_add_ps(m12, m13); - m1 = _mm_add_ps(m14, m15); - m2 = _mm_hadd_ps(m0, m1); - m2 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m2); - m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m2); - } -} -#endif /* API: Initalize convolve module */ void convolve_init(void) diff --git a/Transceiver52M/x86/convolve_sse_3.c b/Transceiver52M/x86/convolve_sse_3.c new file mode 100644 index 0000000..dbee3cc --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.c @@ -0,0 +1,542 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "convolve_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_real() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m4 = _mm_mul_ps(m2, m7); + m5 = _mm_mul_ps(m3, m7); + + /* Sum and store */ + m6 = _mm_hadd_ps(m4, m5); + m0 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m6 = _mm_mul_ps(m6, m4); + m7 = _mm_mul_ps(m7, m4); + m8 = _mm_mul_ps(m8, m5); + m9 = _mm_mul_ps(m9, m5); + + /* Sum and store */ + m6 = _mm_add_ps(m6, m8); + m7 = _mm_add_ps(m7, m9); + m6 = _mm_hadd_ps(m6, m7); + m6 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m6); + m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m6); + } +} + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m8, m4); + m11 = _mm_add_ps(m9, m5); + + m2 = _mm_hadd_ps(m10, m11); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + m2 = _mm_loadu_ps(&_x[2 * i + 24]); + m3 = _mm_loadu_ps(&_x[2 * i + 28]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + m6 = _mm_mul_ps(m10, m15); + m7 = _mm_mul_ps(m11, m15); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m4, m6); + m11 = _mm_add_ps(m5, m7); + + m0 = _mm_add_ps(m8, m10); + m1 = _mm_add_ps(m9, m11); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + m8 = _mm_load_ps(&h[32]); + m9 = _mm_load_ps(&h[36]); + + m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Multiply-accumulate first 12 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + m4 = _mm_loadu_ps(&_x[2 * i + 16]); + m5 = _mm_loadu_ps(&_x[2 * i + 20]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); + + m2 = _mm_mul_ps(m6, m11); + m3 = _mm_mul_ps(m7, m11); + m4 = _mm_mul_ps(m8, m12); + m5 = _mm_mul_ps(m9, m12); + m6 = _mm_mul_ps(m0, m13); + m7 = _mm_mul_ps(m1, m13); + + m0 = _mm_add_ps(m2, m4); + m1 = _mm_add_ps(m3, m5); + m8 = _mm_add_ps(m0, m6); + m9 = _mm_add_ps(m1, m7); + + /* Multiply-accumulate last 8 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 24]); + m1 = _mm_loadu_ps(&_x[2 * i + 28]); + m2 = _mm_loadu_ps(&_x[2 * i + 32]); + m3 = _mm_loadu_ps(&_x[2 * i + 36]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_mul_ps(m4, m14); + m1 = _mm_mul_ps(m5, m14); + m2 = _mm_mul_ps(m6, m15); + m3 = _mm_mul_ps(m7, m15); + + m4 = _mm_add_ps(m0, m2); + m5 = _mm_add_ps(m1, m3); + + /* Final sum and store */ + m0 = _mm_add_ps(m8, m4); + m1 = _mm_add_ps(m9, m5); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m2, m5); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m1); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_complex() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m3, m5); + + m2 = _mm_mul_ps(m2, m5); + m3 = _mm_mul_ps(m3, m4); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_add_ps(m2, m3); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m2); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_cmplx_4n() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m12 = _mm_setzero_ps(); + m13 = _mm_setzero_ps(); + m14 = _mm_setzero_ps(); + m15 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 8; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[16 * n + 0]); + m1 = _mm_load_ps(&h[16 * n + 4]); + m2 = _mm_load_ps(&h[16 * n + 8]); + m3 = _mm_load_ps(&h[16 * n + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m8); + m1 = _mm_mul_ps(m5, m9); + m2 = _mm_mul_ps(m6, m10); + m3 = _mm_mul_ps(m7, m11); + + m4 = _mm_mul_ps(m4, m9); + m5 = _mm_mul_ps(m5, m8); + m6 = _mm_mul_ps(m6, m11); + m7 = _mm_mul_ps(m7, m10); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_sub_ps(m2, m3); + m4 = _mm_add_ps(m4, m5); + m6 = _mm_add_ps(m6, m7); + + /* Accumulate */ + m12 = _mm_add_ps(m12, m0); + m13 = _mm_add_ps(m13, m2); + m14 = _mm_add_ps(m14, m4); + m15 = _mm_add_ps(m15, m6); + } + + m0 = _mm_add_ps(m12, m13); + m1 = _mm_add_ps(m14, m15); + m2 = _mm_hadd_ps(m0, m1); + m2 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m2); + m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m2); + } +} +#endif diff --git a/Transceiver52M/x86/convolve_sse_3.h b/Transceiver52M/x86/convolve_sse_3.h new file mode 100644 index 0000000..ac30ca5 --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.h @@ -0,0 +1,68 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); diff --git a/config/ax_ext.m4 b/config/ax_sse.m4 similarity index 93% rename from config/ax_ext.m4 rename to config/ax_sse.m4 index 4883b89..ed4d223 100644 --- a/config/ax_ext.m4 +++ b/config/ax_sse.m4 @@ -37,7 +37,7 @@ #serial 12 -AC_DEFUN([AX_EXT], +AC_DEFUN([AX_SSE], [ AC_REQUIRE([AC_CANONICAL_HOST]) @@ -53,16 +53,20 @@ if test x"$ax_cv_support_sse3_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse3" AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) + AM_CONDITIONAL(HAVE_SSE3, true) else AC_MSG_WARN([Your compiler does not support sse3 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE3, false) fi AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) if test x"$ax_cv_support_sse41_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse4.1" AC_DEFINE(HAVE_SSE4_1,,[Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions]) + AM_CONDITIONAL(HAVE_SSE4_1, true) else AC_MSG_WARN([Your compiler does not support sse4.1 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE4_1, false) fi ;; esac diff --git a/configure.ac b/configure.ac index f1159c6..7c3c76f 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,10 @@ # Find and define supported SIMD extensions AS_IF([test "x$with_sse" != "xno"], [ - AX_EXT + AX_SSE +], [ + AM_CONDITIONAL(HAVE_SSE3, false) + AM_CONDITIONAL(HAVE_SSE4_1, false) ]) AM_CONDITIONAL(USRP1, [test "x$with_usrp1" = "xyes"]) diff --git a/utils/convolvetest/Makefile b/utils/convolvetest/Makefile index 0ce4cb1..d09a4cd 100644 --- a/utils/convolvetest/Makefile +++ b/utils/convolvetest/Makefile @@ -1,4 +1,4 @@ -all: main.o convolve_base.o convolve.o +all: main.o convolve_base.o convolve.o convolve_sse_3.o gcc -g -Wall ./*.o -o convtest -losmocore clean: @@ -14,3 +14,5 @@ convolve.o: ../../Transceiver52M/x86/convolve.c gcc -std=c99 -c ../../Transceiver52M/x86/convolve.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 +convolve_sse_3.o: ../../Transceiver52M/x86/convolve_sse_3.c + gcc -std=c99 -c ../../Transceiver52M/x86/convolve_sse_3.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 23 15:28:17 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 23 Mar 2017 15:28:17 +0000 Subject: [PATCH] osmo-trx[master]: buildenv: Split up SSE3 and SSE4.1 code In-Reply-To: References: Message-ID: Hello Max, Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2134 to look at the new patch set (#4). buildenv: Split up SSE3 and SSE4.1 code Currently we find SSE3 and SSE4.1 code mixed togehter along with generic code in one file. This introduces the risk that the compiler exidantly mixes SSE4.1 instructions into an SSE3, or even worse into a generic code path. This commit splits the SSE3 and SSE4.1 code into separate files and compiles them with the matching target options. Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 --- M Transceiver52M/x86/Makefile.am M Transceiver52M/x86/convert.c A Transceiver52M/x86/convert_sse_3.c A Transceiver52M/x86/convert_sse_3.h A Transceiver52M/x86/convert_sse_4_1.c A Transceiver52M/x86/convert_sse_4_1.h M Transceiver52M/x86/convolve.c A Transceiver52M/x86/convolve_sse_3.c A Transceiver52M/x86/convolve_sse_3.h R config/ax_sse.m4 M configure.ac M utils/convolvetest/Makefile 12 files changed, 893 insertions(+), 661 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/34/2134/4 diff --git a/Transceiver52M/x86/Makefile.am b/Transceiver52M/x86/Makefile.am index 7a0b75f..45aa629 100644 --- a/Transceiver52M/x86/Makefile.am +++ b/Transceiver52M/x86/Makefile.am @@ -1,7 +1,28 @@ if !ARCH_ARM -AM_CFLAGS = -Wall -std=gnu99 $(SIMD_FLAGS) -I${srcdir}/../common +AM_CFLAGS = -Wall -std=gnu99 -I${srcdir}/../common noinst_LTLIBRARIES = libarch.la +noinst_LTLIBRARIES += libarch_sse_3.la +noinst_LTLIBRARIES += libarch_sse_4_1.la + +libarch_la_LIBADD = + +# SSE 3 specific code +if HAVE_SSE3 +libarch_sse_3_la_SOURCES = \ + convert_sse_3.c \ + convolve_sse_3.c +libarch_sse_3_la_CFLAGS = $(AM_CFLAGS) -msse3 +libarch_la_LIBADD += libarch_sse_3.la +endif + +# SSE 4.1 specific code +if HAVE_SSE4_1 +libarch_sse_4_1_la_SOURCES = \ + convert_sse_4_1.c +libarch_sse_4_1_la_CFLAGS = $(AM_CFLAGS) -msse4.1 +libarch_la_LIBADD += libarch_sse_4_1.la +endif libarch_la_SOURCES = \ ../common/convolve_base.c \ diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c index 3f76b65..db98050 100644 --- a/Transceiver52M/x86/convert.c +++ b/Transceiver52M/x86/convert.c @@ -20,6 +20,8 @@ #include #include #include "convert.h" +#include "convert_sse_3.h" +#include "convert_sse_4_1.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,140 +37,6 @@ }; static struct convert_cpu_context c; - -#ifdef HAVE_SSE3 -#include -#include - -#ifdef HAVE_SSE4_1 -#include - -/* 16*N 16-bit signed integer converted to single precision floats */ -static void _sse_convert_si16_ps_16n(float *restrict out, - const short *restrict in, - int len) -{ - __m128i m0, m1, m2, m3, m4, m5; - __m128 m6, m7, m8, m9; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_si128((__m128i *) &in[16 * i + 0]); - m1 = _mm_loadu_si128((__m128i *) &in[16 * i + 8]); - - /* Unpack */ - m2 = _mm_cvtepi16_epi32(m0); - m4 = _mm_cvtepi16_epi32(m1); - m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); - m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); - m3 = _mm_cvtepi16_epi32(m0); - m5 = _mm_cvtepi16_epi32(m1); - - /* Convert */ - m6 = _mm_cvtepi32_ps(m2); - m7 = _mm_cvtepi32_ps(m3); - m8 = _mm_cvtepi32_ps(m4); - m9 = _mm_cvtepi32_ps(m5); - - /* Store */ - _mm_storeu_ps(&out[16 * i + 0], m6); - _mm_storeu_ps(&out[16 * i + 4], m7); - _mm_storeu_ps(&out[16 * i + 8], m8); - _mm_storeu_ps(&out[16 * i + 12], m9); - } -} - -/* 16*N 16-bit signed integer conversion with remainder */ -static void _sse_convert_si16_ps(float *restrict out, - const short *restrict in, - int len) -{ - int start = len / 16 * 16; - - _sse_convert_si16_ps_16n(out, in, len); - - for (int i = 0; i < len % 16; i++) - out[start + i] = in[start + i]; -} -#endif /* HAVE_SSE4_1 */ - -/* 8*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_8n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2; - __m128i m4, m5; - - for (int i = 0; i < len / 8; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[8 * i + 0]); - m1 = _mm_loadu_ps(&in[8 * i + 4]); - m2 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m2); - m1 = _mm_mul_ps(m1, m2); - - /* Convert */ - m4 = _mm_cvtps_epi32(m0); - m5 = _mm_cvtps_epi32(m1); - - /* Pack and store */ - m5 = _mm_packs_epi32(m4, m5); - _mm_storeu_si128((__m128i *) &out[8 * i], m5); - } -} - -/* 8*N single precision floats scaled and converted with remainder */ -static void _sse_convert_scale_ps_si16(short *restrict out, - const float *restrict in, - float scale, int len) -{ - int start = len / 8 * 8; - - _sse_convert_scale_ps_si16_8n(out, in, scale, len); - - for (int i = 0; i < len % 8; i++) - out[start + i] = in[start + i] * scale; -} - -/* 16*N single precision floats scaled and converted to 16-bit signed integer */ -static void _sse_convert_scale_ps_si16_16n(short *restrict out, - const float *restrict in, - float scale, int len) -{ - __m128 m0, m1, m2, m3, m4; - __m128i m5, m6, m7, m8; - - for (int i = 0; i < len / 16; i++) { - /* Load (unaligned) packed floats */ - m0 = _mm_loadu_ps(&in[16 * i + 0]); - m1 = _mm_loadu_ps(&in[16 * i + 4]); - m2 = _mm_loadu_ps(&in[16 * i + 8]); - m3 = _mm_loadu_ps(&in[16 * i + 12]); - m4 = _mm_load1_ps(&scale); - - /* Scale */ - m0 = _mm_mul_ps(m0, m4); - m1 = _mm_mul_ps(m1, m4); - m2 = _mm_mul_ps(m2, m4); - m3 = _mm_mul_ps(m3, m4); - - /* Convert */ - m5 = _mm_cvtps_epi32(m0); - m6 = _mm_cvtps_epi32(m1); - m7 = _mm_cvtps_epi32(m2); - m8 = _mm_cvtps_epi32(m3); - - /* Pack and store */ - m5 = _mm_packs_epi32(m5, m6); - m7 = _mm_packs_epi32(m7, m8); - _mm_storeu_si128((__m128i *) &out[16 * i + 0], m5); - _mm_storeu_si128((__m128i *) &out[16 * i + 8], m7); - } -} -#endif void convert_init(void) { diff --git a/Transceiver52M/x86/convert_sse_3.c b/Transceiver52M/x86/convert_sse_3.c new file mode 100644 index 0000000..255db67 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.c @@ -0,0 +1,107 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2; + __m128i m4, m5; + + for (int i = 0; i < len / 8; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[8 * i + 0]); + m1 = _mm_loadu_ps(&in[8 * i + 4]); + m2 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m2); + m1 = _mm_mul_ps(m1, m2); + + /* Convert */ + m4 = _mm_cvtps_epi32(m0); + m5 = _mm_cvtps_epi32(m1); + + /* Pack and store */ + m5 = _mm_packs_epi32(m4, m5); + _mm_storeu_si128((__m128i *) & out[8 * i], m5); + } +} + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len) +{ + int start = len / 8 * 8; + + _sse_convert_scale_ps_si16_8n(out, in, scale, len); + + for (int i = 0; i < len % 8; i++) + out[start + i] = in[start + i] * scale; +} + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len) +{ + __m128 m0, m1, m2, m3, m4; + __m128i m5, m6, m7, m8; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_ps(&in[16 * i + 0]); + m1 = _mm_loadu_ps(&in[16 * i + 4]); + m2 = _mm_loadu_ps(&in[16 * i + 8]); + m3 = _mm_loadu_ps(&in[16 * i + 12]); + m4 = _mm_load1_ps(&scale); + + /* Scale */ + m0 = _mm_mul_ps(m0, m4); + m1 = _mm_mul_ps(m1, m4); + m2 = _mm_mul_ps(m2, m4); + m3 = _mm_mul_ps(m3, m4); + + /* Convert */ + m5 = _mm_cvtps_epi32(m0); + m6 = _mm_cvtps_epi32(m1); + m7 = _mm_cvtps_epi32(m2); + m8 = _mm_cvtps_epi32(m3); + + /* Pack and store */ + m5 = _mm_packs_epi32(m5, m6); + m7 = _mm_packs_epi32(m7, m8); + _mm_storeu_si128((__m128i *) & out[16 * i + 0], m5); + _mm_storeu_si128((__m128i *) & out[16 * i + 8], m7); + } +} +#endif diff --git a/Transceiver52M/x86/convert_sse_3.h b/Transceiver52M/x86/convert_sse_3.h new file mode 100644 index 0000000..c2f87d7 --- /dev/null +++ b/Transceiver52M/x86/convert_sse_3.h @@ -0,0 +1,34 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 8*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_8n(short *restrict out, + const float *restrict in, + float scale, int len); + +/* 8*N single precision floats scaled and converted with remainder */ +void _sse_convert_scale_ps_si16(short *restrict out, + const float *restrict in, float scale, int len); + +/* 16*N single precision floats scaled and converted to 16-bit signed integer */ +void _sse_convert_scale_ps_si16_16n(short *restrict out, + const float *restrict in, + float scale, int len); diff --git a/Transceiver52M/x86/convert_sse_4_1.c b/Transceiver52M/x86/convert_sse_4_1.c new file mode 100644 index 0000000..42a235c --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.c @@ -0,0 +1,77 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "convert_sse_4_1.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE4_1 +#include + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len) +{ + __m128i m0, m1, m2, m3, m4, m5; + __m128 m6, m7, m8, m9; + + for (int i = 0; i < len / 16; i++) { + /* Load (unaligned) packed floats */ + m0 = _mm_loadu_si128((__m128i *) & in[16 * i + 0]); + m1 = _mm_loadu_si128((__m128i *) & in[16 * i + 8]); + + /* Unpack */ + m2 = _mm_cvtepi16_epi32(m0); + m4 = _mm_cvtepi16_epi32(m1); + m0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); + m1 = _mm_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); + m3 = _mm_cvtepi16_epi32(m0); + m5 = _mm_cvtepi16_epi32(m1); + + /* Convert */ + m6 = _mm_cvtepi32_ps(m2); + m7 = _mm_cvtepi32_ps(m3); + m8 = _mm_cvtepi32_ps(m4); + m9 = _mm_cvtepi32_ps(m5); + + /* Store */ + _mm_storeu_ps(&out[16 * i + 0], m6); + _mm_storeu_ps(&out[16 * i + 4], m7); + _mm_storeu_ps(&out[16 * i + 8], m8); + _mm_storeu_ps(&out[16 * i + 12], m9); + } +} + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len) +{ + int start = len / 16 * 16; + + _sse_convert_si16_ps_16n(out, in, len); + + for (int i = 0; i < len % 16; i++) + out[start + i] = in[start + i]; +} + +#endif diff --git a/Transceiver52M/x86/convert_sse_4_1.h b/Transceiver52M/x86/convert_sse_4_1.h new file mode 100644 index 0000000..57a5efb --- /dev/null +++ b/Transceiver52M/x86/convert_sse_4_1.h @@ -0,0 +1,28 @@ +/* + * SSE type conversions + * Copyright (C) 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 16*N 16-bit signed integer converted to single precision floats */ +void _sse_convert_si16_ps_16n(float *restrict out, + const short *restrict in, int len); + +/* 16*N 16-bit signed integer conversion with remainder */ +void _sse_convert_si16_ps(float *restrict out, + const short *restrict in, int len); diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c index 2f3b293..35cba29 100644 --- a/Transceiver52M/x86/convolve.c +++ b/Transceiver52M/x86/convolve.c @@ -21,6 +21,7 @@ #include #include #include "convolve.h" +#include "convolve_sse_3.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -66,529 +67,6 @@ int bounds_check(int x_len, int h_len, int y_len, int start, int len, int step); - -#ifdef HAVE_SSE3 -#include -#include - -/* 4-tap SSE complex-real convolution */ -static void sse_conv_real4(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_real() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m4 = _mm_mul_ps(m2, m7); - m5 = _mm_mul_ps(m3, m7); - - /* Sum and store */ - m6 = _mm_hadd_ps(m4, m5); - m0 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8-tap SSE complex-real convolution */ -static void sse_conv_real8(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m6 = _mm_mul_ps(m6, m4); - m7 = _mm_mul_ps(m7, m4); - m8 = _mm_mul_ps(m8, m5); - m9 = _mm_mul_ps(m9, m5); - - /* Sum and store */ - m6 = _mm_add_ps(m6, m8); - m7 = _mm_add_ps(m7, m9); - m6 = _mm_hadd_ps(m6, m7); - m6 = _mm_hadd_ps(m6, m6); - - _mm_store_ss(&y[2 * i + 0], m6); - m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m6); - } -} - -/* 12-tap SSE complex-real convolution */ -static void sse_conv_real12(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m8, m4); - m11 = _mm_add_ps(m9, m5); - - m2 = _mm_hadd_ps(m10, m11); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 16-tap SSE complex-real convolution */ -static void sse_conv_real16(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - - m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_loadu_ps(&_x[2 * i + 16]); - m1 = _mm_loadu_ps(&_x[2 * i + 20]); - m2 = _mm_loadu_ps(&_x[2 * i + 24]); - m3 = _mm_loadu_ps(&_x[2 * i + 28]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m12); - m1 = _mm_mul_ps(m5, m12); - m2 = _mm_mul_ps(m6, m13); - m3 = _mm_mul_ps(m7, m13); - - m4 = _mm_mul_ps(m8, m14); - m5 = _mm_mul_ps(m9, m14); - m6 = _mm_mul_ps(m10, m15); - m7 = _mm_mul_ps(m11, m15); - - /* Sum and store */ - m8 = _mm_add_ps(m0, m2); - m9 = _mm_add_ps(m1, m3); - m10 = _mm_add_ps(m4, m6); - m11 = _mm_add_ps(m5, m7); - - m0 = _mm_add_ps(m8, m10); - m1 = _mm_add_ps(m9, m11); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 20-tap SSE complex-real convolution */ -static void sse_conv_real20(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[0]); - m1 = _mm_load_ps(&h[4]); - m2 = _mm_load_ps(&h[8]); - m3 = _mm_load_ps(&h[12]); - m4 = _mm_load_ps(&h[16]); - m5 = _mm_load_ps(&h[20]); - m6 = _mm_load_ps(&h[24]); - m7 = _mm_load_ps(&h[28]); - m8 = _mm_load_ps(&h[32]); - m9 = _mm_load_ps(&h[36]); - - m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); - m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); - - for (int i = 0; i < len; i++) { - /* Multiply-accumulate first 12 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 12]); - m4 = _mm_loadu_ps(&_x[2 * i + 16]); - m5 = _mm_loadu_ps(&_x[2 * i + 20]); - - m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); - m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); - - m2 = _mm_mul_ps(m6, m11); - m3 = _mm_mul_ps(m7, m11); - m4 = _mm_mul_ps(m8, m12); - m5 = _mm_mul_ps(m9, m12); - m6 = _mm_mul_ps(m0, m13); - m7 = _mm_mul_ps(m1, m13); - - m0 = _mm_add_ps(m2, m4); - m1 = _mm_add_ps(m3, m5); - m8 = _mm_add_ps(m0, m6); - m9 = _mm_add_ps(m1, m7); - - /* Multiply-accumulate last 8 taps */ - m0 = _mm_loadu_ps(&_x[2 * i + 24]); - m1 = _mm_loadu_ps(&_x[2 * i + 28]); - m2 = _mm_loadu_ps(&_x[2 * i + 32]); - m3 = _mm_loadu_ps(&_x[2 * i + 36]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - m0 = _mm_mul_ps(m4, m14); - m1 = _mm_mul_ps(m5, m14); - m2 = _mm_mul_ps(m6, m15); - m3 = _mm_mul_ps(m7, m15); - - m4 = _mm_add_ps(m0, m2); - m5 = _mm_add_ps(m1, m3); - - /* Final sum and store */ - m0 = _mm_add_ps(m8, m4); - m1 = _mm_add_ps(m9, m5); - m2 = _mm_hadd_ps(m0, m1); - m3 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m3); - m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m3); - } -} - -/* 4*N-tap SSE complex-real convolution */ -static void sse_conv_real4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_real4() */ - - __m128 m0, m1, m2, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m2, m5); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m1); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 4*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_4n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* NOTE: The parameter list of this function has to match the parameter - * list of _base_convolve_complex() in convolve_base.c. This specific - * implementation, ignores some of the parameters of - * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m6 = _mm_setzero_ps(); - m7 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 4; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[8 * n + 0]); - m1 = _mm_load_ps(&h[8 * n + 4]); - m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m2, m4); - m1 = _mm_mul_ps(m3, m5); - - m2 = _mm_mul_ps(m2, m5); - m3 = _mm_mul_ps(m3, m4); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_add_ps(m2, m3); - - /* Accumulate */ - m6 = _mm_add_ps(m6, m0); - m7 = _mm_add_ps(m7, m2); - } - - m0 = _mm_hadd_ps(m6, m7); - m0 = _mm_hadd_ps(m0, m0); - - _mm_store_ss(&y[2 * i + 0], m0); - m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m0); - } -} - -/* 8*N-tap SSE complex-complex convolution */ -static void sse_conv_cmplx_8n(const float *x, int x_len, - const float *h, int h_len, - float *y, int y_len, - int start, int len, - int step, int offset) -{ - /* See NOTE in sse_conv_cmplx_4n() */ - - __m128 m0, m1, m2, m3, m4, m5, m6, m7; - __m128 m8, m9, m10, m11, m12, m13, m14, m15; - - const float *_x = &x[2 * (-(h_len - 1) + start)]; - - for (int i = 0; i < len; i++) { - /* Zero */ - m12 = _mm_setzero_ps(); - m13 = _mm_setzero_ps(); - m14 = _mm_setzero_ps(); - m15 = _mm_setzero_ps(); - - for (int n = 0; n < h_len / 8; n++) { - /* Load (aligned) filter taps */ - m0 = _mm_load_ps(&h[16 * n + 0]); - m1 = _mm_load_ps(&h[16 * n + 4]); - m2 = _mm_load_ps(&h[16 * n + 8]); - m3 = _mm_load_ps(&h[16 * n + 12]); - - m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Load (unaligned) input data */ - m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); - m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); - m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); - m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); - - m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); - m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); - m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); - m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); - - /* Quad multiply */ - m0 = _mm_mul_ps(m4, m8); - m1 = _mm_mul_ps(m5, m9); - m2 = _mm_mul_ps(m6, m10); - m3 = _mm_mul_ps(m7, m11); - - m4 = _mm_mul_ps(m4, m9); - m5 = _mm_mul_ps(m5, m8); - m6 = _mm_mul_ps(m6, m11); - m7 = _mm_mul_ps(m7, m10); - - /* Sum */ - m0 = _mm_sub_ps(m0, m1); - m2 = _mm_sub_ps(m2, m3); - m4 = _mm_add_ps(m4, m5); - m6 = _mm_add_ps(m6, m7); - - /* Accumulate */ - m12 = _mm_add_ps(m12, m0); - m13 = _mm_add_ps(m13, m2); - m14 = _mm_add_ps(m14, m4); - m15 = _mm_add_ps(m15, m6); - } - - m0 = _mm_add_ps(m12, m13); - m1 = _mm_add_ps(m14, m15); - m2 = _mm_hadd_ps(m0, m1); - m2 = _mm_hadd_ps(m2, m2); - - _mm_store_ss(&y[2 * i + 0], m2); - m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); - _mm_store_ss(&y[2 * i + 1], m2); - } -} -#endif /* API: Initalize convolve module */ void convolve_init(void) diff --git a/Transceiver52M/x86/convolve_sse_3.c b/Transceiver52M/x86/convolve_sse_3.c new file mode 100644 index 0000000..dbee3cc --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.c @@ -0,0 +1,542 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "convolve_sse_3.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_SSE3 +#include +#include + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_real() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m4 = _mm_mul_ps(m2, m7); + m5 = _mm_mul_ps(m3, m7); + + /* Sum and store */ + m6 = _mm_hadd_ps(m4, m5); + m0 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m6 = _mm_mul_ps(m6, m4); + m7 = _mm_mul_ps(m7, m4); + m8 = _mm_mul_ps(m8, m5); + m9 = _mm_mul_ps(m9, m5); + + /* Sum and store */ + m6 = _mm_add_ps(m6, m8); + m7 = _mm_add_ps(m7, m9); + m6 = _mm_hadd_ps(m6, m7); + m6 = _mm_hadd_ps(m6, m6); + + _mm_store_ss(&y[2 * i + 0], m6); + m6 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m6); + } +} + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m8, m4); + m11 = _mm_add_ps(m9, m5); + + m2 = _mm_hadd_ps(m10, m11); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + + m12 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_loadu_ps(&_x[2 * i + 16]); + m1 = _mm_loadu_ps(&_x[2 * i + 20]); + m2 = _mm_loadu_ps(&_x[2 * i + 24]); + m3 = _mm_loadu_ps(&_x[2 * i + 28]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m12); + m1 = _mm_mul_ps(m5, m12); + m2 = _mm_mul_ps(m6, m13); + m3 = _mm_mul_ps(m7, m13); + + m4 = _mm_mul_ps(m8, m14); + m5 = _mm_mul_ps(m9, m14); + m6 = _mm_mul_ps(m10, m15); + m7 = _mm_mul_ps(m11, m15); + + /* Sum and store */ + m8 = _mm_add_ps(m0, m2); + m9 = _mm_add_ps(m1, m3); + m10 = _mm_add_ps(m4, m6); + m11 = _mm_add_ps(m5, m7); + + m0 = _mm_add_ps(m8, m10); + m1 = _mm_add_ps(m9, m11); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[0]); + m1 = _mm_load_ps(&h[4]); + m2 = _mm_load_ps(&h[8]); + m3 = _mm_load_ps(&h[12]); + m4 = _mm_load_ps(&h[16]); + m5 = _mm_load_ps(&h[20]); + m6 = _mm_load_ps(&h[24]); + m7 = _mm_load_ps(&h[28]); + m8 = _mm_load_ps(&h[32]); + m9 = _mm_load_ps(&h[36]); + + m11 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m12 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m13 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m14 = _mm_shuffle_ps(m6, m7, _MM_SHUFFLE(0, 2, 0, 2)); + m15 = _mm_shuffle_ps(m8, m9, _MM_SHUFFLE(0, 2, 0, 2)); + + for (int i = 0; i < len; i++) { + /* Multiply-accumulate first 12 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 12]); + m4 = _mm_loadu_ps(&_x[2 * i + 16]); + m5 = _mm_loadu_ps(&_x[2 * i + 20]); + + m6 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m8 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + m0 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(0, 2, 0, 2)); + m1 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(1, 3, 1, 3)); + + m2 = _mm_mul_ps(m6, m11); + m3 = _mm_mul_ps(m7, m11); + m4 = _mm_mul_ps(m8, m12); + m5 = _mm_mul_ps(m9, m12); + m6 = _mm_mul_ps(m0, m13); + m7 = _mm_mul_ps(m1, m13); + + m0 = _mm_add_ps(m2, m4); + m1 = _mm_add_ps(m3, m5); + m8 = _mm_add_ps(m0, m6); + m9 = _mm_add_ps(m1, m7); + + /* Multiply-accumulate last 8 taps */ + m0 = _mm_loadu_ps(&_x[2 * i + 24]); + m1 = _mm_loadu_ps(&_x[2 * i + 28]); + m2 = _mm_loadu_ps(&_x[2 * i + 32]); + m3 = _mm_loadu_ps(&_x[2 * i + 36]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + m0 = _mm_mul_ps(m4, m14); + m1 = _mm_mul_ps(m5, m14); + m2 = _mm_mul_ps(m6, m15); + m3 = _mm_mul_ps(m7, m15); + + m4 = _mm_add_ps(m0, m2); + m5 = _mm_add_ps(m1, m3); + + /* Final sum and store */ + m0 = _mm_add_ps(m8, m4); + m1 = _mm_add_ps(m9, m5); + m2 = _mm_hadd_ps(m0, m1); + m3 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m3); + m3 = _mm_shuffle_ps(m3, m3, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m3); + } +} + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_real4() */ + + __m128 m0, m1, m2, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m2, m5); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m1); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* NOTE: The parameter list of this function has to match the parameter + * list of _base_convolve_complex() in convolve_base.c. This specific + * implementation, ignores some of the parameters of + * _base_convolve_complex(), which are: x_len, y_len, offset, step. */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m6 = _mm_setzero_ps(); + m7 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 4; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[8 * n + 0]); + m1 = _mm_load_ps(&h[8 * n + 4]); + m2 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m3 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 8 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 8 * n + 4]); + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m2, m4); + m1 = _mm_mul_ps(m3, m5); + + m2 = _mm_mul_ps(m2, m5); + m3 = _mm_mul_ps(m3, m4); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_add_ps(m2, m3); + + /* Accumulate */ + m6 = _mm_add_ps(m6, m0); + m7 = _mm_add_ps(m7, m2); + } + + m0 = _mm_hadd_ps(m6, m7); + m0 = _mm_hadd_ps(m0, m0); + + _mm_store_ss(&y[2 * i + 0], m0); + m0 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m0); + } +} + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset) +{ + /* See NOTE in sse_conv_cmplx_4n() */ + + __m128 m0, m1, m2, m3, m4, m5, m6, m7; + __m128 m8, m9, m10, m11, m12, m13, m14, m15; + + const float *_x = &x[2 * (-(h_len - 1) + start)]; + + for (int i = 0; i < len; i++) { + /* Zero */ + m12 = _mm_setzero_ps(); + m13 = _mm_setzero_ps(); + m14 = _mm_setzero_ps(); + m15 = _mm_setzero_ps(); + + for (int n = 0; n < h_len / 8; n++) { + /* Load (aligned) filter taps */ + m0 = _mm_load_ps(&h[16 * n + 0]); + m1 = _mm_load_ps(&h[16 * n + 4]); + m2 = _mm_load_ps(&h[16 * n + 8]); + m3 = _mm_load_ps(&h[16 * n + 12]); + + m4 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m5 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m6 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m7 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Load (unaligned) input data */ + m0 = _mm_loadu_ps(&_x[2 * i + 16 * n + 0]); + m1 = _mm_loadu_ps(&_x[2 * i + 16 * n + 4]); + m2 = _mm_loadu_ps(&_x[2 * i + 16 * n + 8]); + m3 = _mm_loadu_ps(&_x[2 * i + 16 * n + 12]); + + m8 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(0, 2, 0, 2)); + m9 = _mm_shuffle_ps(m0, m1, _MM_SHUFFLE(1, 3, 1, 3)); + m10 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(0, 2, 0, 2)); + m11 = _mm_shuffle_ps(m2, m3, _MM_SHUFFLE(1, 3, 1, 3)); + + /* Quad multiply */ + m0 = _mm_mul_ps(m4, m8); + m1 = _mm_mul_ps(m5, m9); + m2 = _mm_mul_ps(m6, m10); + m3 = _mm_mul_ps(m7, m11); + + m4 = _mm_mul_ps(m4, m9); + m5 = _mm_mul_ps(m5, m8); + m6 = _mm_mul_ps(m6, m11); + m7 = _mm_mul_ps(m7, m10); + + /* Sum */ + m0 = _mm_sub_ps(m0, m1); + m2 = _mm_sub_ps(m2, m3); + m4 = _mm_add_ps(m4, m5); + m6 = _mm_add_ps(m6, m7); + + /* Accumulate */ + m12 = _mm_add_ps(m12, m0); + m13 = _mm_add_ps(m13, m2); + m14 = _mm_add_ps(m14, m4); + m15 = _mm_add_ps(m15, m6); + } + + m0 = _mm_add_ps(m12, m13); + m1 = _mm_add_ps(m14, m15); + m2 = _mm_hadd_ps(m0, m1); + m2 = _mm_hadd_ps(m2, m2); + + _mm_store_ss(&y[2 * i + 0], m2); + m2 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 3, 2, 1)); + _mm_store_ss(&y[2 * i + 1], m2); + } +} +#endif diff --git a/Transceiver52M/x86/convolve_sse_3.h b/Transceiver52M/x86/convolve_sse_3.h new file mode 100644 index 0000000..ac30ca5 --- /dev/null +++ b/Transceiver52M/x86/convolve_sse_3.h @@ -0,0 +1,68 @@ +/* + * SSE Convolution + * Copyright (C) 2012, 2013 Thomas Tsou + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +/* 4-tap SSE complex-real convolution */ +void sse_conv_real4(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8-tap SSE complex-real convolution */ +void sse_conv_real8(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 12-tap SSE complex-real convolution */ +void sse_conv_real12(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 16-tap SSE complex-real convolution */ +void sse_conv_real16(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 20-tap SSE complex-real convolution */ +void sse_conv_real20(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-real convolution */ +void sse_conv_real4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 4*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_4n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); + +/* 8*N-tap SSE complex-complex convolution */ +void sse_conv_cmplx_8n(const float *x, int x_len, + const float *h, int h_len, + float *y, int y_len, + int start, int len, int step, int offset); diff --git a/config/ax_ext.m4 b/config/ax_sse.m4 similarity index 93% rename from config/ax_ext.m4 rename to config/ax_sse.m4 index 4883b89..ed4d223 100644 --- a/config/ax_ext.m4 +++ b/config/ax_sse.m4 @@ -37,7 +37,7 @@ #serial 12 -AC_DEFUN([AX_EXT], +AC_DEFUN([AX_SSE], [ AC_REQUIRE([AC_CANONICAL_HOST]) @@ -53,16 +53,20 @@ if test x"$ax_cv_support_sse3_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse3" AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions]) + AM_CONDITIONAL(HAVE_SSE3, true) else AC_MSG_WARN([Your compiler does not support sse3 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE3, false) fi AX_CHECK_COMPILE_FLAG(-msse4.1, ax_cv_support_sse41_ext=yes, []) if test x"$ax_cv_support_sse41_ext" = x"yes"; then SIMD_FLAGS="$SIMD_FLAGS -msse4.1" AC_DEFINE(HAVE_SSE4_1,,[Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions]) + AM_CONDITIONAL(HAVE_SSE4_1, true) else AC_MSG_WARN([Your compiler does not support sse4.1 instructions, can you try another compiler?]) + AM_CONDITIONAL(HAVE_SSE4_1, false) fi ;; esac diff --git a/configure.ac b/configure.ac index f1159c6..7c3c76f 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,10 @@ # Find and define supported SIMD extensions AS_IF([test "x$with_sse" != "xno"], [ - AX_EXT + AX_SSE +], [ + AM_CONDITIONAL(HAVE_SSE3, false) + AM_CONDITIONAL(HAVE_SSE4_1, false) ]) AM_CONDITIONAL(USRP1, [test "x$with_usrp1" = "xyes"]) diff --git a/utils/convolvetest/Makefile b/utils/convolvetest/Makefile index 0ce4cb1..d09a4cd 100644 --- a/utils/convolvetest/Makefile +++ b/utils/convolvetest/Makefile @@ -1,4 +1,4 @@ -all: main.o convolve_base.o convolve.o +all: main.o convolve_base.o convolve.o convolve_sse_3.o gcc -g -Wall ./*.o -o convtest -losmocore clean: @@ -14,3 +14,5 @@ convolve.o: ../../Transceiver52M/x86/convolve.c gcc -std=c99 -c ../../Transceiver52M/x86/convolve.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 +convolve_sse_3.o: ../../Transceiver52M/x86/convolve_sse_3.c + gcc -std=c99 -c ../../Transceiver52M/x86/convolve_sse_3.c -I ../../Transceiver52M/common/ -msse3 -DHAVE_SSE3 -- To view, visit https://gerrit.osmocom.org/2134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I846e190e92f1258cd412d1b2d79b539e204e04b3 Gerrit-PatchSet: 4 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Mar 23 21:58:16 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 21:58:16 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Fix negative value check on unsigned value Message-ID: Review at https://gerrit.osmocom.org/2163 sigProcLib: Fix negative value check on unsigned value Convert negative value check on unsigned value to zero check to avoid potential divide-by-zero error condition. Coverity issue CID 165059: Control flow issues (NO_EFFECT) Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/63/2163/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 6f50f04..6111d5a 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1712,7 +1712,7 @@ signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; float energy = 0.0; - if (windowLength < 0) windowLength = 20; + if (windowLength == 0) return 0.0; if (windowLength > rxBurst.size()) windowLength = rxBurst.size(); for (unsigned i = 0; i < windowLength; i++) { energy += windowItr->norm2(); -- To view, visit https://gerrit.osmocom.org/2163 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Thu Mar 23 22:05:00 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 22:05:00 +0000 Subject: osmo-trx[master]: sigProcLib.h: Fix whitespaces. No non-whitespace changes. In-Reply-To: References: Message-ID: Patch Set 1: (4 comments) We should get the remaining EOL whitespace removals into this patch. https://gerrit.osmocom.org/#/c/2151/1/Transceiver52M/sigProcLib.h File Transceiver52M/sigProcLib.h: PS1, Line 82: Additional whitespace fix PS1, Line 94: Additional whitespace fix PS1, Line 109: Additional whitespace fix PS1, Line 110: Additional whitespace fix -- To view, visit https://gerrit.osmocom.org/2151 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 23 22:05:44 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 22:05:44 +0000 Subject: osmo-trx[master]: Resampler: Fix initialization return checking In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2159 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia3b71b3a06b34a6fd781bf197ecf9d5cc1711d13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 22:36:10 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 22:36:10 +0000 Subject: osmo-trx[master]: vector: Introduce shrink() function to shrink vector size wi... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2157 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 22:47:47 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Thu, 23 Mar 2017 22:47:47 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib.h: Fix whitespaces. No non-whitespace changes. In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2151 to look at the new patch set (#2). sigProcLib.h: Fix whitespaces. No non-whitespace changes. The file seem to be using "2 spaces" indent, bt some lines are using tabs which breaks formatting. Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 --- M Transceiver52M/sigProcLib.h 1 file changed, 46 insertions(+), 46 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/51/2151/2 diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 0f40c1e..094a5b7 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -21,9 +21,9 @@ #include "signalVector.h" /* Burst lengths */ -#define NORMAL_BURST_NBITS 148 -#define EDGE_BURST_NBITS 444 -#define EDGE_BURST_NSYMS (EDGE_BURST_NBITS / 3) +#define NORMAL_BURST_NBITS 148 +#define EDGE_BURST_NBITS 444 +#define EDGE_BURST_NSYMS (EDGE_BURST_NBITS / 3) /** Convolution type indicator */ enum ConvType { @@ -79,55 +79,55 @@ /** Destroy the signal processing library */ void sigProcLibDestroy(void); -/** - Convolve two vectors. - @param a,b The vectors to be convolved. - @param c, A preallocated vector to hold the convolution result. - @param spanType The type/span of the convolution. - @return The convolution result or NULL on error. +/** + Convolve two vectors. + @param a,b The vectors to be convolved. + @param c, A preallocated vector to hold the convolution result. + @param spanType The type/span of the convolution. + @return The convolution result or NULL on error. */ signalVector *convolve(const signalVector *a, const signalVector *b, signalVector *c, ConvType spanType, size_t start = 0, size_t len = 0, size_t step = 1, int offset = 0); -/** +/** Frequency shift a vector. - @param y The frequency shifted vector. - @param x The vector to-be-shifted. - @param freq The digital frequency shift - @param startPhase The starting phase of the oscillator - @param finalPhase The final phase of the oscillator - @return The frequency shifted vector. + @param y The frequency shifted vector. + @param x The vector to-be-shifted. + @param freq The digital frequency shift + @param startPhase The starting phase of the oscillator + @param finalPhase The final phase of the oscillator + @return The frequency shifted vector. */ signalVector* frequencyShift(signalVector *y, - signalVector *x, - float freq = 0.0, - float startPhase = 0.0, - float *finalPhase=NULL); + signalVector *x, + float freq = 0.0, + float startPhase = 0.0, + float *finalPhase=NULL); -/** - Correlate two vectors. +/** + Correlate two vectors. @param a,b The vectors to be correlated. @param c, A preallocated vector to hold the correlation result. @param spanType The type/span of the correlation. @return The correlation result. */ signalVector* correlate(signalVector *a, - signalVector *b, - signalVector *c, - ConvType spanType, + signalVector *b, + signalVector *c, + ConvType spanType, bool bReversedConjugated = false, - unsigned startIx = 0, - unsigned len = 0); + unsigned startIx = 0, + unsigned len = 0); /** Operate soft slicer on a soft-bit vector */ bool vectorSlicer(SoftVector *x); /** GMSK modulate a GSM burst of bits */ signalVector *modulateBurst(const BitVector &wBurst, - int guardPeriodLength, - int sps, bool emptyPulse = false); + int guardPeriodLength, + int sps, bool emptyPulse = false); /** 8-PSK modulate a burst of bits */ signalVector *modulateEdgeBurst(const BitVector &bits, @@ -156,7 +156,7 @@ /** Add two vectors in-place */ bool addVector(signalVector &x, - signalVector &y); + signalVector &y); /** Multiply two vectors in-place*/ bool multVector(signalVector &x, @@ -168,24 +168,24 @@ complex mean = complex(0.0)); /** - Given a non-integer index, interpolate a sample. - @param inSig The signal from which to interpolate. - @param ix The index. - @return The interpolated signal value. + Given a non-integer index, interpolate a sample. + @param inSig The signal from which to interpolate. + @param ix The index. + @return The interpolated signal value. */ complex interpolatePoint(const signalVector &inSig, - float ix); + float ix); /** - Given a correlator output, locate the correlation peak. - @param rxBurst The correlator result. - @param peakIndex Pointer to value to receive interpolated peak index. - @param avgPower Power to value to receive mean power. - @return Peak value. + Given a correlator output, locate the correlation peak. + @param rxBurst The correlator result. + @param peakIndex Pointer to value to receive interpolated peak index. + @param avgPower Power to value to receive mean power. + @return Peak value. */ complex peakDetect(const signalVector &rxBurst, - float *peakIndex, - float *avgPwr); + float *peakIndex, + float *avgPwr); /** Apply a scalar to a vector. @@ -193,7 +193,7 @@ @param scale The scalar. */ void scaleVector(signalVector &x, - complex scale); + complex scale); /** Rough energy estimator. @@ -290,14 +290,14 @@ unsigned max_toa_ab); /** - Downsample 4 SPS to 1 SPS using a polyphase filterbank + Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ signalVector *downsampleBurst(signalVector &burst); /** - Decimate a vector. + Decimate a vector. @param wVector The vector of interest. @param factor Decimation factor. @return The decimated signal vector. @@ -318,7 +318,7 @@ /** Demodulate 8-PSK EDGE burst with soft symbol ooutput - @param rxBurst The burst to be demodulated. + @param rxBurst The burst to be demodulated. @param sps The number of samples per GSM symbol. @param channel The amplitude estimate of the received burst. @param TOA The time-of-arrival of the received burst. -- To view, visit https://gerrit.osmocom.org/2151 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Thu Mar 23 22:55:11 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 22:55:11 +0000 Subject: osmo-trx[master]: sigProcLib.h: Fix whitespaces. No non-whitespace changes. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2151 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:11:50 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 23:11:50 +0000 Subject: osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2156/1/CommonLibs/Vector.h File CommonLibs/Vector.h: PS1, Line 231: const This method modifies protected member data block and I do not believe should declared const. Yes, the class compiles and is strictly valid because the data, start, and end member pointers are not modified. But, it's hard to say that the Vector object is unchanged after segmentMove() is called, which is what const implies. -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:12:36 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 23:12:36 +0000 Subject: osmo-trx[master]: sigProcLib: rename signalError type to SignalError. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2147 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1a5ae6e87d4c69945053fdefec185d0fb1a26399 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:15:17 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 23:15:17 +0000 Subject: osmo-trx[master]: signalVector: Implement segment(). In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2155 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6fe3aae53fb2fa5bb7637e976de6059eabe08202 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:19:13 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Thu, 23 Mar 2017 23:19:13 +0000 Subject: [PATCH] osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2156 to look at the new patch set (#2). vector: Introduce segmentMove() method to move data inside of a vector. Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 --- M CommonLibs/Vector.h 1 file changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/56/2156/2 diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h index 38dc8d5..7062e17 100644 --- a/CommonLibs/Vector.h +++ b/CommonLibs/Vector.h @@ -222,6 +222,21 @@ memcpy(other.mStart,base,span*sizeof(T)); } + /** + Move (copy) a segment of this vector into a different position in the vector + @param from Start point from which to copy. + @param to Start point to which to copy. + @param span The number of elements to copy. + */ + void segmentMove(size_t from, size_t to, size_t span) + { + const T* baseFrom = mStart + from; + T* baseTo = mStart + to; + assert(baseFrom+span<=mEnd); + assert(baseTo+span<=mEnd); + memmove(baseTo,baseFrom,span*sizeof(T)); + } + void fill(const T& val) { T* dp=mStart; -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:19:23 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Thu, 23 Mar 2017 23:19:23 +0000 Subject: osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... In-Reply-To: References: Message-ID: Patch Set 2: > (1 comment) True. That was a copy-paste error. Fixed now. -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:22:08 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 23:22:08 +0000 Subject: osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2148/1/Transceiver52M/sigProcLib.cpp File Transceiver52M/sigProcLib.cpp: PS1, Line 1930: max_toa_nb Because we are already passing in the type, why do we need to pass 2 maximum TOA values? Only NB/EDGE or RA - not both - can be detected through a single call to detectAnyBurst(). -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:23:04 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 23:23:04 +0000 Subject: osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 23 23:25:50 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Thu, 23 Mar 2017 23:25:50 +0000 Subject: osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2148/1/Transceiver52M/sigProcLib.cpp File Transceiver52M/sigProcLib.cpp: PS1, Line 1930: max_toa_nb > Because we are already passing in the type, why do we need to pass 2 maximu If there was an 'ANY' version of the correlation type, then this could make sense. But we don't have that. -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 24 00:02:11 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 00:02:11 +0000 Subject: osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2148/1/Transceiver52M/sigProcLib.cpp File Transceiver52M/sigProcLib.cpp: PS1, Line 1930: max_toa_nb > If there was an 'ANY' version of the correlation type, then this could make Yes, makes sense. It may make higher level code a bit more complex with an extra if(), but that's ok. I'll change this. -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 24 00:17:22 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 00:17:22 +0000 Subject: osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2148/1/Transceiver52M/sigProcLib.cpp File Transceiver52M/sigProcLib.cpp: PS1, Line 1930: max_toa_nb > Yes, makes sense. It may make higher level code a bit more complex with an Perhaps if or when we have non-static SigProc objects, we can remove passing in the same TSC, threshold, and TOA values on every detect() call. In the meantime, we should at least try to minimize long argument lists with redundant values. -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 24 00:19:23 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 00:19:23 +0000 Subject: osmo-trx[master]: sigProcLib: Constify demodulation functions burst argument. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2154 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 00:20:51 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 00:20:51 +0000 Subject: osmo-trx[master]: sigProcLib: constify signalVector arguments for detectBurst(... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 00:21:41 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 00:21:41 +0000 Subject: osmo-trx[master]: sigProcLib: Add operator<< to print CorrType to a string. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 01:23:44 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 01:23:44 +0000 Subject: [MERGED] osmo-trx[master]: signalVector: Implement segment(). In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: signalVector: Implement segment(). ...................................................................... signalVector: Implement segment(). Change-Id: I6fe3aae53fb2fa5bb7637e976de6059eabe08202 --- M Transceiver52M/signalVector.cpp M Transceiver52M/signalVector.h 2 files changed, 8 insertions(+), 0 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/signalVector.cpp b/Transceiver52M/signalVector.cpp index 798a3c7..55dad92 100644 --- a/Transceiver52M/signalVector.cpp +++ b/Transceiver52M/signalVector.cpp @@ -45,6 +45,11 @@ mStart = mData + vector.getStart(); } +signalVector signalVector::segment(size_t start, size_t span) +{ + return signalVector(mData, start, span); +} + size_t signalVector::getStart() const { return mStart - mData; diff --git a/Transceiver52M/signalVector.h b/Transceiver52M/signalVector.h index 38541fe..83f141e 100644 --- a/Transceiver52M/signalVector.h +++ b/Transceiver52M/signalVector.h @@ -30,6 +30,9 @@ /** Override base assignment operator to include start offsets */ void operator=(const signalVector& vector); + /** Return an alias to a segment of this signalVector. */ + signalVector segment(size_t start, size_t span); + /** Return head room */ size_t getStart() const; size_t updateHistory(); -- To view, visit https://gerrit.osmocom.org/2155 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6fe3aae53fb2fa5bb7637e976de6059eabe08202 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 24 01:24:55 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 01:24:55 +0000 Subject: [MERGED] osmo-trx[master]: vector: Introduce segmentMove() method to move data inside o... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: vector: Introduce segmentMove() method to move data inside of a vector. ...................................................................... vector: Introduce segmentMove() method to move data inside of a vector. Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 --- M CommonLibs/Vector.h 1 file changed, 15 insertions(+), 0 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Jenkins Builder: Verified diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h index 38dc8d5..7062e17 100644 --- a/CommonLibs/Vector.h +++ b/CommonLibs/Vector.h @@ -222,6 +222,21 @@ memcpy(other.mStart,base,span*sizeof(T)); } + /** + Move (copy) a segment of this vector into a different position in the vector + @param from Start point from which to copy. + @param to Start point to which to copy. + @param span The number of elements to copy. + */ + void segmentMove(size_t from, size_t to, size_t span) + { + const T* baseFrom = mStart + from; + T* baseTo = mStart + to; + assert(baseFrom+span<=mEnd); + assert(baseTo+span<=mEnd); + memmove(baseTo,baseFrom,span*sizeof(T)); + } + void fill(const T& val) { T* dp=mStart; -- To view, visit https://gerrit.osmocom.org/2156 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 24 01:25:47 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 01:25:47 +0000 Subject: [MERGED] osmo-trx[master]: vector: Introduce shrink() function to shrink vector size wi... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: vector: Introduce shrink() function to shrink vector size without loosing data. ...................................................................... vector: Introduce shrink() function to shrink vector size without loosing data. Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099 --- M CommonLibs/Vector.h 1 file changed, 7 insertions(+), 0 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h index 7062e17..eae674b 100644 --- a/CommonLibs/Vector.h +++ b/CommonLibs/Vector.h @@ -92,6 +92,13 @@ mEnd = mStart + newSize; } + /** Reduce addressable size of the Vector, keeping content. */ + void shrink(size_t newSize) + { + assert(newSize <= mEnd - mStart); + mEnd = mStart + newSize; + } + /** Release memory and clear pointers. */ void clear() { resize(0); } -- To view, visit https://gerrit.osmocom.org/2157 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 24 17:35:37 2017 From: gerrit-no-reply at lists.osmocom.org (Pau Espin Pedrol) Date: Fri, 24 Mar 2017 17:35:37 +0000 Subject: [PATCH] libosmo-abis[master]: configure: Fix compilation with new libortp Message-ID: Review at https://gerrit.osmocom.org/2164 configure: Fix compilation with new libortp Commit 0c8d9ddaea8c1afdc0e9b8c37a31c9d158e57efd in ortp broke old API: function ortp_set_log_level_mask requires one new parameter 'domain'. This commit fixes compilation in my Archlinux box using ortp 1.0.1. Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Signed-off-by: Pau Espin Pedrol --- M configure.ac M src/trau/osmo_ortp.c 2 files changed, 21 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/64/2164/1 diff --git a/configure.ac b/configure.ac index 99d83f6..ad45f3b 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,16 @@ CPPFLAGS+=" -fsanitize=address -fsanitize=undefined" fi +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ortp_set_log_level_mask(NULL, 0xffff);]] + )], + [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1], + [ortp_set_log_level_mask requires domain parameter])], + [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0], + [ortp_set_log_level_mask has no domain parameter])]) + AC_OUTPUT( libosmoabis.pc libosmotrau.pc diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index d4d4ff5..7677fa5 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -94,8 +94,11 @@ return LOGL_ERROR; } -static void my_ortp_logfn(OrtpLogLevel lev, const char *fmt, - va_list args) +static void my_ortp_logfn( +#if HAVE_ORTP_LOG_DOMAIN + const char *domain, +#endif + OrtpLogLevel lev, const char *fmt, va_list args) { osmo_vlogp(DLMIB, ortp_to_osmo_lvl(lev), __FILE__, 0, 0, fmt, args); @@ -273,7 +276,12 @@ tall_rtp_ctx = ctx; ortp_set_memory_functions(&osmo_ortp_memfn); ortp_init(); - ortp_set_log_level_mask(0xffff); + ortp_set_log_level_mask( +#if HAVE_ORTP_LOG_DOMAIN + ORTP_LOG_DOMAIN, +#endif + 0xffff); + ortp_set_log_handler(my_ortp_logfn); create_payload_types(); } -- To view, visit https://gerrit.osmocom.org/2164 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:25:02 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 24 Mar 2017 19:25:02 +0000 Subject: [PATCH] libosmocore[master]: Add SW Description (de)marshalling Message-ID: Review at https://gerrit.osmocom.org/2165 Add SW Description (de)marshalling * data structure represnting 3GPP TS 52.021 ?9.4.62 SW Description * function to serialize it into msgb * function to deserialize it from buffer * test harness There are several similar functions to deal with SW Description in OpenBSC, there's also need to use similar functionality in OsmoBTS. Hence it's better to put the code into common library with proper tests and documentation. Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map M tests/Makefile.am M tests/msgb/msgb_test.c M tests/msgb/msgb_test.ok 6 files changed, 134 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/65/2165/1 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index c88f0b1..6cef278 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -791,6 +791,20 @@ IPAC_BINF_CELL_ALLOC = (1 << 2), }; +/*! \brief 3GPP TS 52.021 ?9.4.62 SW Description */ +struct osmo_sw_descr { + uint8_t file_id[UINT8_MAX]; + uint8_t file_id_len; + + uint8_t file_version[UINT8_MAX]; + uint8_t file_version_len; +}; + +void abis_nm_put_sw_descr(struct msgb *msg, const struct osmo_sw_descr *sw, + bool put_header); +bool abis_nm_get_sw_descr(struct osmo_sw_descr *sw, const uint8_t * buf, + size_t len); + struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t, enum abis_nm_severity s, enum abis_nm_pcause_type ct, diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 934d7ce..899ce96 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -751,6 +751,64 @@ return nmsg; } +/*! \brief Put given 3GPP TS 52.021 ?9.4.62 SW Description into msgb. + * \param[in] msg message buffer + * \param[in] sw SW Description struct + * \param[in] put_header whether to put NM_ATT_SW_DESCR IE or not + */ +void abis_nm_put_sw_descr(struct msgb *msg, const struct osmo_sw_descr *sw, + bool put_header) +{ + if (put_header) + msgb_v_put(msg, NM_ATT_SW_DESCR); + msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw->file_id_len, sw->file_id); + msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw->file_version_len, + sw->file_version); +} + +/*! \brief Parse 3GPP TS 52.021 ?9.4.62 SW Description from buffer. + * \param[out] sw SW Description struct + * \param[in] buf buffer + * \param[in] len buffer length + * \returns true if parsing succeeded, else otherwise + */ +bool abis_nm_get_sw_descr(struct osmo_sw_descr *sw, const uint8_t * buf, + size_t len) +{ + struct tlv_parsed tp; + const struct tlv_definition sw_tlvdef = { + .def = { + [NM_ATT_SW_DESCR] = { TLV_TYPE_TV }, + [NM_ATT_FILE_ID] = { TLV_TYPE_TL16V }, + [NM_ATT_FILE_VERSION] = { TLV_TYPE_TL16V }, + }, + }; + + /* Note: the return value is ignored here because SW Description tag + itself is considered optional. */ + tlv_parse(&tp, &sw_tlvdef, buf, len, 0, 0); + + /* Parsing SW Description is tricky for current implementation of TLV + parser which fails to deal with following structure: + |T| TL16V | TL16V | properly. Hence, the need for 2nd call: */ + if (tlv_parse(&tp, &sw_tlvdef, buf + TLVP_LEN(&tp, NM_ATT_SW_DESCR), + len - TLVP_LEN(&tp, NM_ATT_SW_DESCR), 0, 0) < 0) + return false; + + if (!TLVP_PRESENT(&tp, NM_ATT_FILE_ID) || + !TLVP_PRESENT(&tp, NM_ATT_FILE_VERSION)) + return false; + + sw->file_id_len = TLVP_LEN(&tp, NM_ATT_FILE_ID); + sw->file_version_len = TLVP_LEN(&tp, NM_ATT_FILE_VERSION); + + memcpy(sw->file_id, TLVP_VAL(&tp, NM_ATT_FILE_ID), sw->file_id_len); + memcpy(sw->file_version, TLVP_VAL(&tp, NM_ATT_FILE_VERSION), + sw->file_version_len); + + return true; +} + /*! \brief Obtain OML Channel Combination for phnsical channel config */ int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan) { diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 5649e71..fd327b6 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -31,6 +31,8 @@ abis_nm_pcause_type_names; abis_nm_msgtype_names; abis_nm_att_names; +abis_nm_put_sw_descr; +abis_nm_get_sw_descr; osmo_sitype_strs; osmo_c4; diff --git a/tests/Makefile.am b/tests/Makefile.am index 352b5a7..16b45ea 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -74,7 +74,7 @@ lapd_lapd_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la msgb_msgb_test_SOURCES = msgb/msgb_test.c -msgb_msgb_test_LDADD = $(top_builddir)/src/libosmocore.la +msgb_msgb_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la msgfile_msgfile_test_SOURCES = msgfile/msgfile_test.c msgfile_msgfile_test_LDADD = $(top_builddir)/src/libosmocore.la diff --git a/tests/msgb/msgb_test.c b/tests/msgb/msgb_test.c index ac10382..d1583a0 100644 --- a/tests/msgb/msgb_test.c +++ b/tests/msgb/msgb_test.c @@ -23,10 +23,12 @@ #include #include #include +#include + #include #include - +#include #include #define CHECK_RC(rc) \ @@ -177,6 +179,55 @@ msgb_free(msg2); } +static inline void print_chk(const char *what, uint8_t len1, uint8_t len2, + const uint8_t *x1, const uint8_t *x2) +{ + int cmp = memcmp(x1, x2, len2); + printf("\tFILE %s [%u == %u -> %d, %s] %d - %s\n", what, len1, len2, + len1 == len2, len1 != len2 ? "fail" : "ok", + cmp, cmp != 0 ? "FAIL" : "OK"); +} + +static inline void chk_descr(struct msgb *msg, struct osmo_sw_descr *get, + struct osmo_sw_descr *put, bool h) +{ + bool res; + + abis_nm_put_sw_descr(msg, put, h); + printf("msgb [%u/%u]: SW DESCR (with%s header)\n", msg->len, + msg->data_len, h ? "" : "out"); + + res = abis_nm_get_sw_descr(get, msgb_data(msg), msg->len); + if (res) { + print_chk("ID", get->file_id_len, put->file_id_len, get->file_id, + put->file_id); + print_chk("VERSION", get->file_version_len, + put->file_version_len, get->file_version, + put->file_version); + } else + printf("SW DESCR (with%s header) parsing error!\n", + h ? "" : "out"); + + msgb_reset(msg); +} + +static void test_msg_sw() +{ + const char *f_id = "TEST.L0L", *f_ver = "0.1.666~deadbeeffacefeed-dirty"; + uint8_t lf_id = strlen(f_id), lf_ver = strlen(f_ver); + struct msgb *msg = msgb_alloc_headroom(4096, 128, "sw"); + struct osmo_sw_descr sw_get1 = { 0 }, sw_get2 = { 0 }, sw_put = { + .file_id_len = lf_id, + .file_version_len = lf_ver, + }; + + memcpy(sw_put.file_id, f_id, lf_id); + memcpy(sw_put.file_version, f_ver, lf_ver); + + chk_descr(msg, &sw_get1, &sw_put, true); + chk_descr(msg, &sw_get2, &sw_put, false); +} + static void test_msgb_resize_area() { struct msgb *msg = msgb_alloc_headroom(4096, 128, "data"); @@ -287,6 +338,7 @@ test_msgb_api_errors(); test_msgb_copy(); test_msgb_resize_area(); + test_msg_sw(); printf("Success.\n"); diff --git a/tests/msgb/msgb_test.ok b/tests/msgb/msgb_test.ok index 6603fe7..fcb8101 100644 --- a/tests/msgb/msgb_test.ok +++ b/tests/msgb/msgb_test.ok @@ -32,4 +32,10 @@ Original: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f Extended: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f Shrinked: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f +msgb [45/4096]: SW DESCR (with header) + FILE ID [8 == 8 -> 1, ok] 0 - OK + FILE VERSION [30 == 30 -> 1, ok] 0 - OK +msgb [44/4096]: SW DESCR (without header) + FILE ID [8 == 8 -> 1, ok] 0 - OK + FILE VERSION [30 == 30 -> 1, ok] 0 - OK Success. -- To view, visit https://gerrit.osmocom.org/2165 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:42:09 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 24 Mar 2017 19:42:09 +0000 Subject: [PATCH] libosmocore[master]: Add SW Description (de)marshalling In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2165 to look at the new patch set (#2). Add SW Description (de)marshalling * data structure represnting 3GPP TS 52.021 ?9.4.62 SW Description * function to serialize it into msgb * function to deserialize it from buffer * test harness There are several similar functions to deal with SW Description in OpenBSC, there's also need to use similar functionality in OsmoBTS. Hence it's better to put the code into common library with proper tests and documentation. Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map M tests/Makefile.am M tests/msgb/msgb_test.c M tests/msgb/msgb_test.ok 6 files changed, 135 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/65/2165/2 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index c88f0b1..04f361f 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -29,6 +29,7 @@ /*! \file gsm_12_21.h */ #include +#include #include /*! \brief generic header in front of every OML message according to TS 08.59 */ @@ -791,6 +792,20 @@ IPAC_BINF_CELL_ALLOC = (1 << 2), }; +/*! \brief 3GPP TS 52.021 ?9.4.62 SW Description */ +struct osmo_sw_descr { + uint8_t file_id[UINT8_MAX]; + uint8_t file_id_len; + + uint8_t file_version[UINT8_MAX]; + uint8_t file_version_len; +}; + +void abis_nm_put_sw_descr(struct msgb *msg, const struct osmo_sw_descr *sw, + bool put_header); +bool abis_nm_get_sw_descr(struct osmo_sw_descr *sw, const uint8_t * buf, + size_t len); + struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t, enum abis_nm_severity s, enum abis_nm_pcause_type ct, diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 934d7ce..899ce96 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -751,6 +751,64 @@ return nmsg; } +/*! \brief Put given 3GPP TS 52.021 ?9.4.62 SW Description into msgb. + * \param[in] msg message buffer + * \param[in] sw SW Description struct + * \param[in] put_header whether to put NM_ATT_SW_DESCR IE or not + */ +void abis_nm_put_sw_descr(struct msgb *msg, const struct osmo_sw_descr *sw, + bool put_header) +{ + if (put_header) + msgb_v_put(msg, NM_ATT_SW_DESCR); + msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw->file_id_len, sw->file_id); + msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw->file_version_len, + sw->file_version); +} + +/*! \brief Parse 3GPP TS 52.021 ?9.4.62 SW Description from buffer. + * \param[out] sw SW Description struct + * \param[in] buf buffer + * \param[in] len buffer length + * \returns true if parsing succeeded, else otherwise + */ +bool abis_nm_get_sw_descr(struct osmo_sw_descr *sw, const uint8_t * buf, + size_t len) +{ + struct tlv_parsed tp; + const struct tlv_definition sw_tlvdef = { + .def = { + [NM_ATT_SW_DESCR] = { TLV_TYPE_TV }, + [NM_ATT_FILE_ID] = { TLV_TYPE_TL16V }, + [NM_ATT_FILE_VERSION] = { TLV_TYPE_TL16V }, + }, + }; + + /* Note: the return value is ignored here because SW Description tag + itself is considered optional. */ + tlv_parse(&tp, &sw_tlvdef, buf, len, 0, 0); + + /* Parsing SW Description is tricky for current implementation of TLV + parser which fails to deal with following structure: + |T| TL16V | TL16V | properly. Hence, the need for 2nd call: */ + if (tlv_parse(&tp, &sw_tlvdef, buf + TLVP_LEN(&tp, NM_ATT_SW_DESCR), + len - TLVP_LEN(&tp, NM_ATT_SW_DESCR), 0, 0) < 0) + return false; + + if (!TLVP_PRESENT(&tp, NM_ATT_FILE_ID) || + !TLVP_PRESENT(&tp, NM_ATT_FILE_VERSION)) + return false; + + sw->file_id_len = TLVP_LEN(&tp, NM_ATT_FILE_ID); + sw->file_version_len = TLVP_LEN(&tp, NM_ATT_FILE_VERSION); + + memcpy(sw->file_id, TLVP_VAL(&tp, NM_ATT_FILE_ID), sw->file_id_len); + memcpy(sw->file_version, TLVP_VAL(&tp, NM_ATT_FILE_VERSION), + sw->file_version_len); + + return true; +} + /*! \brief Obtain OML Channel Combination for phnsical channel config */ int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan) { diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 5649e71..fd327b6 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -31,6 +31,8 @@ abis_nm_pcause_type_names; abis_nm_msgtype_names; abis_nm_att_names; +abis_nm_put_sw_descr; +abis_nm_get_sw_descr; osmo_sitype_strs; osmo_c4; diff --git a/tests/Makefile.am b/tests/Makefile.am index 352b5a7..16b45ea 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -74,7 +74,7 @@ lapd_lapd_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la msgb_msgb_test_SOURCES = msgb/msgb_test.c -msgb_msgb_test_LDADD = $(top_builddir)/src/libosmocore.la +msgb_msgb_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la msgfile_msgfile_test_SOURCES = msgfile/msgfile_test.c msgfile_msgfile_test_LDADD = $(top_builddir)/src/libosmocore.la diff --git a/tests/msgb/msgb_test.c b/tests/msgb/msgb_test.c index ac10382..d1583a0 100644 --- a/tests/msgb/msgb_test.c +++ b/tests/msgb/msgb_test.c @@ -23,10 +23,12 @@ #include #include #include +#include + #include #include - +#include #include #define CHECK_RC(rc) \ @@ -177,6 +179,55 @@ msgb_free(msg2); } +static inline void print_chk(const char *what, uint8_t len1, uint8_t len2, + const uint8_t *x1, const uint8_t *x2) +{ + int cmp = memcmp(x1, x2, len2); + printf("\tFILE %s [%u == %u -> %d, %s] %d - %s\n", what, len1, len2, + len1 == len2, len1 != len2 ? "fail" : "ok", + cmp, cmp != 0 ? "FAIL" : "OK"); +} + +static inline void chk_descr(struct msgb *msg, struct osmo_sw_descr *get, + struct osmo_sw_descr *put, bool h) +{ + bool res; + + abis_nm_put_sw_descr(msg, put, h); + printf("msgb [%u/%u]: SW DESCR (with%s header)\n", msg->len, + msg->data_len, h ? "" : "out"); + + res = abis_nm_get_sw_descr(get, msgb_data(msg), msg->len); + if (res) { + print_chk("ID", get->file_id_len, put->file_id_len, get->file_id, + put->file_id); + print_chk("VERSION", get->file_version_len, + put->file_version_len, get->file_version, + put->file_version); + } else + printf("SW DESCR (with%s header) parsing error!\n", + h ? "" : "out"); + + msgb_reset(msg); +} + +static void test_msg_sw() +{ + const char *f_id = "TEST.L0L", *f_ver = "0.1.666~deadbeeffacefeed-dirty"; + uint8_t lf_id = strlen(f_id), lf_ver = strlen(f_ver); + struct msgb *msg = msgb_alloc_headroom(4096, 128, "sw"); + struct osmo_sw_descr sw_get1 = { 0 }, sw_get2 = { 0 }, sw_put = { + .file_id_len = lf_id, + .file_version_len = lf_ver, + }; + + memcpy(sw_put.file_id, f_id, lf_id); + memcpy(sw_put.file_version, f_ver, lf_ver); + + chk_descr(msg, &sw_get1, &sw_put, true); + chk_descr(msg, &sw_get2, &sw_put, false); +} + static void test_msgb_resize_area() { struct msgb *msg = msgb_alloc_headroom(4096, 128, "data"); @@ -287,6 +338,7 @@ test_msgb_api_errors(); test_msgb_copy(); test_msgb_resize_area(); + test_msg_sw(); printf("Success.\n"); diff --git a/tests/msgb/msgb_test.ok b/tests/msgb/msgb_test.ok index 6603fe7..fcb8101 100644 --- a/tests/msgb/msgb_test.ok +++ b/tests/msgb/msgb_test.ok @@ -32,4 +32,10 @@ Original: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f Extended: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f Shrinked: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f +msgb [45/4096]: SW DESCR (with header) + FILE ID [8 == 8 -> 1, ok] 0 - OK + FILE VERSION [30 == 30 -> 1, ok] 0 - OK +msgb [44/4096]: SW DESCR (without header) + FILE ID [8 == 8 -> 1, ok] 0 - OK + FILE VERSION [30 == 30 -> 1, ok] 0 - OK Success. -- To view, visit https://gerrit.osmocom.org/2165 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:53:30 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 19:53:30 +0000 Subject: osmo-trx[master]: Move CorrType type from Transceiver to sigProcLib. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2146 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:54:04 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 19:54:04 +0000 Subject: [MERGED] osmo-trx[master]: Move CorrType type from Transceiver to sigProcLib. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: Move CorrType type from Transceiver to sigProcLib. ...................................................................... Move CorrType type from Transceiver to sigProcLib. Required to move Transceiver::detectBurst to sigProcLib. Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.h 3 files changed, 12 insertions(+), 12 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 85dd629..c1a63fd 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -113,7 +113,7 @@ if ((filler == Transceiver::FILLER_NORM_RAND) || (filler == Transceiver::FILLER_EDGE_RAND)) { - chanType[n] = Transceiver::TSC; + chanType[n] = TSC; } } @@ -452,8 +452,8 @@ } -Transceiver::CorrType Transceiver::expectedCorrType(GSM::Time currTime, - size_t chan) +CorrType Transceiver::expectedCorrType(GSM::Time currTime, + size_t chan) { static int tchh_subslot[26] = { 0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,1 }; static int sdcch4_subslot[102] = { 3,3,3,3,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2, diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index d9a9708..425b004 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -142,15 +142,6 @@ LOOPBACK ///< similar go VII, used in loopback testing } ChannelCombination; - /** Codes for burst types of received bursts*/ - typedef enum { - OFF, ///< timeslot is off - TSC, ///< timeslot should contain a normal burst - RACH, ///< timeslot should contain an access burst - EDGE, ///< timeslot should contain an EDGE burst - IDLE ///< timeslot is an idle (or dummy) burst - } CorrType; - enum FillerType { FILLER_DUMMY, FILLER_ZERO, diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index ed72430..211e1a9 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -33,6 +33,15 @@ UNDEFINED, }; +/** Codes for burst types of received bursts*/ +enum CorrType{ + OFF, ///< timeslot is off + TSC, ///< timeslot should contain a normal burst + RACH, ///< timeslot should contain an access burst + EDGE, ///< timeslot should contain an EDGE burst + IDLE ///< timeslot is an idle (or dummy) burst +}; + enum signalError { SIGERR_NONE, SIGERR_BOUNDS, -- To view, visit https://gerrit.osmocom.org/2146 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:54:04 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 19:54:04 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: rename signalError type to SignalError. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: rename signalError type to SignalError. ...................................................................... sigProcLib: rename signalError type to SignalError. Change-Id: I1a5ae6e87d4c69945053fdefec185d0fb1a26399 --- M Transceiver52M/sigProcLib.h 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 211e1a9..7bdbde8 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -42,7 +42,7 @@ IDLE ///< timeslot is an idle (or dummy) burst }; -enum signalError { +enum SignalError { SIGERR_NONE, SIGERR_BOUNDS, SIGERR_CLIP, -- To view, visit https://gerrit.osmocom.org/2147 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1a5ae6e87d4c69945053fdefec185d0fb1a26399 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:56:03 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 19:56:03 +0000 Subject: osmo-trx[master]: Move Transceiver::demodulate() to sigProcLib to make it reus... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2152 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 19:56:17 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 24 Mar 2017 19:56:17 +0000 Subject: osmo-trx[master]: Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to ma... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2149 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 20:05:59 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 24 Mar 2017 20:05:59 +0000 Subject: [PATCH] openbsc[master]: Use libosmocore for SW Description parsing Message-ID: Review at https://gerrit.osmocom.org/2166 Use libosmocore for SW Description parsing Requires libosmocore with Ib63b6b5e83b8914864fc7edd789f8958cdc993cd. Change-Id: Ib94db414e94a2a1f234ac6f1cb346dca1c7a8be3 --- M openbsc/src/ipaccess/ipaccess-config.c 1 file changed, 10 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/2166/1 diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 0c3f888..f5a09b4 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -52,6 +52,7 @@ #include #include #include +#include struct gsm_network *bsc_gsmnet; @@ -70,17 +71,9 @@ static int found_trx = 0; static int loop_tests = 0; -struct sw_load { - uint8_t file_id[255]; - uint8_t file_id_len; - - uint8_t file_version[255]; - uint8_t file_version_len; -}; - static void *tall_ctx_config = NULL; -static struct sw_load *sw_load1 = NULL; -static struct sw_load *sw_load2 = NULL; +static struct osmo_sw_descr *sw_load1 = NULL; +static struct osmo_sw_descr *sw_load2 = NULL; /* static uint8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00, 0x00 }; @@ -344,19 +337,11 @@ msg->l3h = &msg->l2h[3]; /* activate software */ - if (sw_load1) { - msgb_v_put(msg, NM_ATT_SW_DESCR); - msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load1->file_id_len, sw_load1->file_id); - msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load1->file_version_len, - sw_load1->file_version); - } + if (sw_load1) + abis_nm_put_sw_descr(msg, sw_load1, true); - if (sw_load2) { - msgb_v_put(msg, NM_ATT_SW_DESCR); - msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load2->file_id_len, sw_load2->file_id); - msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load2->file_version_len, - sw_load2->file_version); - } + if (sw_load2) + abis_nm_put_sw_descr(msg, sw_load2, true); /* fill in the data */ msg->l2h[0] = NM_ATT_IPACC_CUR_SW_CFG; @@ -618,11 +603,11 @@ return 0; } -static struct sw_load *create_swload(struct sdp_header *header) +static struct osmo_sw_descr *create_swload(struct sdp_header *header) { - struct sw_load *load; + struct osmo_sw_descr *load; - load = talloc_zero(tall_ctx_config, struct sw_load); + load = talloc_zero(tall_ctx_config, struct osmo_sw_descr); strncpy((char *)load->file_id, header->firmware_info.sw_part, 20); load->file_id_len = strlen(header->firmware_info.sw_part) + 1; -- To view, visit https://gerrit.osmocom.org/2166 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib94db414e94a2a1f234ac6f1cb346dca1c7a8be3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Fri Mar 24 20:44:54 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 24 Mar 2017 20:44:54 +0000 Subject: [PATCH] libosmocore[master]: Add SW Description (de)marshalling In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2165 to look at the new patch set (#3). Add SW Description (de)marshalling * data structure represnting 3GPP TS 52.021 ?9.4.62 SW Description * function to serialize it into msgb * function to deserialize it from buffer * test harness There are several similar functions to deal with SW Description in OpenBSC, there's also need to use similar functionality in OsmoBTS. Hence it's better to put the code into common library with proper tests and documentation. Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Related: OS#1614 --- M include/osmocom/gsm/protocol/gsm_12_21.h M src/gsm/abis_nm.c M src/gsm/libosmogsm.map M tests/Makefile.am M tests/msgb/msgb_test.c M tests/msgb/msgb_test.ok 6 files changed, 147 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/65/2165/3 diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h index c88f0b1..0fed512 100644 --- a/include/osmocom/gsm/protocol/gsm_12_21.h +++ b/include/osmocom/gsm/protocol/gsm_12_21.h @@ -29,6 +29,7 @@ /*! \file gsm_12_21.h */ #include +#include #include /*! \brief generic header in front of every OML message according to TS 08.59 */ @@ -791,6 +792,20 @@ IPAC_BINF_CELL_ALLOC = (1 << 2), }; +/*! \brief 3GPP TS 52.021 ?9.4.62 SW Description */ +struct osmo_sw_descr { + uint8_t file_id[UINT8_MAX]; + uint8_t file_id_len; + + uint8_t file_version[UINT8_MAX]; + uint8_t file_version_len; +}; + +uint16_t abis_nm_put_sw_descr(struct msgb *msg, const struct osmo_sw_descr *sw, + bool put_header, bool simulate); +bool abis_nm_get_sw_descr(struct osmo_sw_descr *sw, const uint8_t * buf, + size_t len); + struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t, enum abis_nm_severity s, enum abis_nm_pcause_type ct, diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c index 934d7ce..a732bd0 100644 --- a/src/gsm/abis_nm.c +++ b/src/gsm/abis_nm.c @@ -751,6 +751,74 @@ return nmsg; } +/*! \brief Put given 3GPP TS 52.021 ?9.4.62 SW Description into msgb. + * \param[in] msg message buffer + * \param[in] sw SW Description struct + * \param[in] put_header boolean, whether to put NM_ATT_SW_DESCR IE or not + * \param[in] simulate boolean, whether to actually modify msg or not + * \returns length of buffer space necessary to store sw + */ +uint16_t abis_nm_put_sw_descr(struct msgb *msg, const struct osmo_sw_descr *sw, + bool put_header, bool simulate) +{ + uint16_t len = (put_header ? 1 : 0) + (sw->file_id_len + 3) + + (sw->file_version_len + 3); + + if (simulate) + return len; + + if (put_header) + msgb_v_put(msg, NM_ATT_SW_DESCR); + msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw->file_id_len, sw->file_id); + msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw->file_version_len, + sw->file_version); + + return len; +} + +/*! \brief Parse 3GPP TS 52.021 ?9.4.62 SW Description from buffer. + * \param[out] sw SW Description struct + * \param[in] buf buffer + * \param[in] len buffer length + * \returns true if parsing succeeded, else otherwise + */ +bool abis_nm_get_sw_descr(struct osmo_sw_descr *sw, const uint8_t * buf, + size_t len) +{ + struct tlv_parsed tp; + const struct tlv_definition sw_tlvdef = { + .def = { + [NM_ATT_SW_DESCR] = { TLV_TYPE_TV }, + [NM_ATT_FILE_ID] = { TLV_TYPE_TL16V }, + [NM_ATT_FILE_VERSION] = { TLV_TYPE_TL16V }, + }, + }; + + /* Note: the return value is ignored here because SW Description tag + itself is considered optional. */ + tlv_parse(&tp, &sw_tlvdef, buf, len, 0, 0); + + /* Parsing SW Description is tricky for current implementation of TLV + parser which fails to deal with following structure: + |T| TL16V | TL16V | properly. Hence, the need for 2nd call: */ + if (tlv_parse(&tp, &sw_tlvdef, buf + TLVP_LEN(&tp, NM_ATT_SW_DESCR), + len - TLVP_LEN(&tp, NM_ATT_SW_DESCR), 0, 0) < 0) + return false; + + if (!TLVP_PRESENT(&tp, NM_ATT_FILE_ID) || + !TLVP_PRESENT(&tp, NM_ATT_FILE_VERSION)) + return false; + + sw->file_id_len = TLVP_LEN(&tp, NM_ATT_FILE_ID); + sw->file_version_len = TLVP_LEN(&tp, NM_ATT_FILE_VERSION); + + memcpy(sw->file_id, TLVP_VAL(&tp, NM_ATT_FILE_ID), sw->file_id_len); + memcpy(sw->file_version, TLVP_VAL(&tp, NM_ATT_FILE_VERSION), + sw->file_version_len); + + return true; +} + /*! \brief Obtain OML Channel Combination for phnsical channel config */ int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan) { diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 5649e71..fd327b6 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -31,6 +31,8 @@ abis_nm_pcause_type_names; abis_nm_msgtype_names; abis_nm_att_names; +abis_nm_put_sw_descr; +abis_nm_get_sw_descr; osmo_sitype_strs; osmo_c4; diff --git a/tests/Makefile.am b/tests/Makefile.am index 352b5a7..16b45ea 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -74,7 +74,7 @@ lapd_lapd_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la msgb_msgb_test_SOURCES = msgb/msgb_test.c -msgb_msgb_test_LDADD = $(top_builddir)/src/libosmocore.la +msgb_msgb_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la msgfile_msgfile_test_SOURCES = msgfile/msgfile_test.c msgfile_msgfile_test_LDADD = $(top_builddir)/src/libosmocore.la diff --git a/tests/msgb/msgb_test.c b/tests/msgb/msgb_test.c index ac10382..c5d1f9e 100644 --- a/tests/msgb/msgb_test.c +++ b/tests/msgb/msgb_test.c @@ -23,10 +23,12 @@ #include #include #include +#include + #include #include - +#include #include #define CHECK_RC(rc) \ @@ -177,6 +179,57 @@ msgb_free(msg2); } +static inline void print_chk(const char *what, uint8_t len1, uint8_t len2, + const uint8_t *x1, const uint8_t *x2) +{ + int cmp = memcmp(x1, x2, len2); + printf("\tFILE %s [%u == %u -> %d, %s] %d => %s\n", what, len1, len2, + len1 == len2, len1 != len2 ? "fail" : "ok", + cmp, cmp != 0 ? "FAIL" : "OK"); +} + +static inline void chk_descr(struct msgb *msg, struct osmo_sw_descr *get, + struct osmo_sw_descr *put, bool h) +{ + bool res; + uint16_t len = abis_nm_put_sw_descr(msg, put, h, false); + + printf("msgb [%u/%u/%u - %s]: SW DESCR (with%s header) %s\n", msg->len, + msg->data_len, len, len != msg->len ? "fail" : "ok", + h ? "" : "out", + len > put->file_version_len + put->file_id_len ? "OK" : "FAIL"); + + res = abis_nm_get_sw_descr(get, msgb_data(msg), msg->len); + if (res) { + print_chk("ID", get->file_id_len, put->file_id_len, get->file_id, + put->file_id); + print_chk("VERSION", get->file_version_len, + put->file_version_len, get->file_version, + put->file_version); + } else + printf("SW DESCR (with%s header) parsing error!\n", + h ? "" : "out"); + + msgb_reset(msg); +} + +static void test_msg_sw() +{ + const char *f_id = "TEST.L0L", *f_ver = "0.1.666~deadbeeffacefeed-dirty"; + uint8_t lf_id = strlen(f_id), lf_ver = strlen(f_ver); + struct msgb *msg = msgb_alloc_headroom(4096, 128, "sw"); + struct osmo_sw_descr sw_get1 = { 0 }, sw_get2 = { 0 }, sw_put = { + .file_id_len = lf_id, + .file_version_len = lf_ver, + }; + + memcpy(sw_put.file_id, f_id, lf_id); + memcpy(sw_put.file_version, f_ver, lf_ver); + + chk_descr(msg, &sw_get1, &sw_put, true); + chk_descr(msg, &sw_get2, &sw_put, false); +} + static void test_msgb_resize_area() { struct msgb *msg = msgb_alloc_headroom(4096, 128, "data"); @@ -287,6 +340,7 @@ test_msgb_api_errors(); test_msgb_copy(); test_msgb_resize_area(); + test_msg_sw(); printf("Success.\n"); diff --git a/tests/msgb/msgb_test.ok b/tests/msgb/msgb_test.ok index 6603fe7..2a35407 100644 --- a/tests/msgb/msgb_test.ok +++ b/tests/msgb/msgb_test.ok @@ -32,4 +32,10 @@ Original: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f Extended: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f Shrinked: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f +msgb [45/4096/45 - ok]: SW DESCR (with header) OK + FILE ID [8 == 8 -> 1, ok] 0 => OK + FILE VERSION [30 == 30 -> 1, ok] 0 => OK +msgb [44/4096/44 - ok]: SW DESCR (without header) OK + FILE ID [8 == 8 -> 1, ok] 0 => OK + FILE VERSION [30 == 30 -> 1, ok] 0 => OK Success. -- To view, visit https://gerrit.osmocom.org/2165 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 24 20:46:05 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 24 Mar 2017 20:46:05 +0000 Subject: libosmocore[master]: Add SW Description (de)marshalling In-Reply-To: References: Message-ID: Patch Set 3: RFC: this requires more testing from my side before it can be merged but I'd like to use opportunity to collect feedback nevertheless. -- To view, visit https://gerrit.osmocom.org/2165 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 24 21:09:55 2017 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 24 Mar 2017 21:09:55 +0000 Subject: [PATCH] openbsc[master]: Use libosmocore for SW Description parsing In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2166 to look at the new patch set (#2). Use libosmocore for SW Description parsing Requires libosmocore with Ib63b6b5e83b8914864fc7edd789f8958cdc993cd. Change-Id: Ib94db414e94a2a1f234ac6f1cb346dca1c7a8be3 --- M openbsc/include/openbsc/abis_nm.h M openbsc/src/ipaccess/ipaccess-config.c M openbsc/src/libbsc/abis_nm.c M openbsc/tests/abis/abis_test.c 4 files changed, 63 insertions(+), 128 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/2166/2 diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h index 2465452..7c56ac2 100644 --- a/openbsc/include/openbsc/abis_nm.h +++ b/openbsc/include/openbsc/abis_nm.h @@ -68,18 +68,6 @@ int (*sw_act_req)(struct msgb *); }; -struct abis_nm_sw_descr { - /* where does it start? how long is it? */ - const uint8_t *start; - size_t len; - - /* the parsed data */ - const uint8_t *file_id; - uint16_t file_id_len; - const uint8_t *file_ver; - uint16_t file_ver_len; -}; - extern int abis_nm_rcvmsg(struct msgb *msg); int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len); @@ -182,8 +170,8 @@ void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */ int abis_nm_parse_sw_config(const uint8_t *data, const size_t len, - struct abis_nm_sw_descr *res, const int res_len); -int abis_nm_select_newest_sw(const struct abis_nm_sw_descr *sw, const size_t len); + struct osmo_sw_descr *res, const int res_len); +int abis_nm_select_newest_sw(const struct osmo_sw_descr *sw, const size_t len); /* Helper functions for updating attributes */ int abis_nm_update_max_power_red(struct gsm_bts_trx *trx); diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 0c3f888..4b01658 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -52,6 +52,7 @@ #include #include #include +#include struct gsm_network *bsc_gsmnet; @@ -70,17 +71,9 @@ static int found_trx = 0; static int loop_tests = 0; -struct sw_load { - uint8_t file_id[255]; - uint8_t file_id_len; - - uint8_t file_version[255]; - uint8_t file_version_len; -}; - static void *tall_ctx_config = NULL; -static struct sw_load *sw_load1 = NULL; -static struct sw_load *sw_load2 = NULL; +static struct osmo_sw_descr *sw_load1 = NULL; +static struct osmo_sw_descr *sw_load2 = NULL; /* static uint8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00, 0x00 }; @@ -344,19 +337,11 @@ msg->l3h = &msg->l2h[3]; /* activate software */ - if (sw_load1) { - msgb_v_put(msg, NM_ATT_SW_DESCR); - msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load1->file_id_len, sw_load1->file_id); - msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load1->file_version_len, - sw_load1->file_version); - } + if (sw_load1) + abis_nm_put_sw_descr(msg, sw_load1, true, false); - if (sw_load2) { - msgb_v_put(msg, NM_ATT_SW_DESCR); - msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load2->file_id_len, sw_load2->file_id); - msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load2->file_version_len, - sw_load2->file_version); - } + if (sw_load2) + abis_nm_put_sw_descr(msg, sw_load2, true, false); /* fill in the data */ msg->l2h[0] = NM_ATT_IPACC_CUR_SW_CFG; @@ -618,11 +603,11 @@ return 0; } -static struct sw_load *create_swload(struct sdp_header *header) +static struct osmo_sw_descr *create_swload(struct sdp_header *header) { - struct sw_load *load; + struct osmo_sw_descr *load; - load = talloc_zero(tall_ctx_config, struct sw_load); + load = talloc_zero(tall_ctx_config, struct osmo_sw_descr); strncpy((char *)load->file_id, header->firmware_info.sw_part, 20); load->file_id_len = strlen(header->firmware_info.sw_part) + 1; diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index 33a23a2..b9dec10 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -413,93 +413,43 @@ /* Activate the specified software into the BTS */ static int ipacc_sw_activate(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, - uint8_t i2, const uint8_t *sw_desc, uint8_t swdesc_len) + uint8_t i2, const struct osmo_sw_descr *sw_desc) { struct abis_om_hdr *oh; struct msgb *msg = nm_msgb_alloc(); - uint8_t len = swdesc_len; - uint8_t *trailer; + uint16_t len = abis_nm_put_sw_descr(msg, sw_desc, true, true); oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); fill_om_fom_hdr(oh, len, NM_MT_ACTIVATE_SW, obj_class, i0, i1, i2); - - trailer = msgb_put(msg, swdesc_len); - memcpy(trailer, sw_desc, swdesc_len); + abis_nm_put_sw_descr(msg, sw_desc, true, false); return abis_nm_sendmsg(bts, msg); } int abis_nm_parse_sw_config(const uint8_t *sw_descr, const size_t sw_descr_len, - struct abis_nm_sw_descr *desc, const int res_len) + struct osmo_sw_descr *desc, const int res_len) { - static const struct tlv_definition sw_descr_def = { - .def = { - [NM_ATT_FILE_ID] = { TLV_TYPE_TL16V, }, - [NM_ATT_FILE_VERSION] = { TLV_TYPE_TL16V, }, - }, - }; - - size_t pos = 0; - int desc_pos = 0; - - for (pos = 0; pos < sw_descr_len && desc_pos < res_len; ++desc_pos) { - uint8_t tag; - uint16_t tag_len; - const uint8_t *val; - int len; - + int desc_pos; + for (desc_pos = 0; desc_pos < res_len; ++desc_pos) { memset(&desc[desc_pos], 0, sizeof(desc[desc_pos])); - desc[desc_pos].start = &sw_descr[pos]; - - /* Classic TLV parsing doesn't work well with SW_DESCR because of it's - * nested nature and the fact you have to assume it contains only two sub - * tags NM_ATT_FILE_VERSION & NM_ATT_FILE_ID to parse it */ - if (sw_descr[pos] != NM_ATT_SW_DESCR) { - LOGP(DNM, LOGL_ERROR, - "SW_DESCR attribute identifier not found!\n"); - return -1; - } - - pos += 1; - len = tlv_parse_one(&tag, &tag_len, &val, - &sw_descr_def, &sw_descr[pos], sw_descr_len - pos); - if (len < 0 || (tag != NM_ATT_FILE_ID)) { - LOGP(DNM, LOGL_ERROR, - "FILE_ID attribute identifier not found!\n"); - return -2; - } - desc[desc_pos].file_id = val; - desc[desc_pos].file_id_len = tag_len; - pos += len; - - - len = tlv_parse_one(&tag, &tag_len, &val, - &sw_descr_def, &sw_descr[pos], sw_descr_len - pos); - if (len < 0 || (tag != NM_ATT_FILE_VERSION)) { - LOGP(DNM, LOGL_ERROR, - "FILE_VERSION attribute identifier not found!\n"); - return -3; - } - desc[desc_pos].file_ver = val; - desc[desc_pos].file_ver_len = tag_len; - pos += len; - - /* final size */ - desc[desc_pos].len = &sw_descr[pos] - desc[desc_pos].start; + if (!abis_nm_get_sw_descr(&desc[desc_pos], sw_descr, + sw_descr_len)) + return -EINVAL; } return desc_pos; } -int abis_nm_select_newest_sw(const struct abis_nm_sw_descr *sw_descr, - const size_t size) +int abis_nm_select_newest_sw(const struct osmo_sw_descr *sw_descr, + const size_t size) { int res = 0; int i; for (i = 1; i < size; ++i) { - if (memcmp(sw_descr[res].file_ver, sw_descr[i].file_ver, - OSMO_MIN(sw_descr[i].file_ver_len, sw_descr[res].file_ver_len)) < 0) { + if (memcmp(sw_descr[res].file_version, sw_descr[i].file_version, + OSMO_MIN(sw_descr[i].file_version_len, + sw_descr[res].file_version_len)) < 0) { res = i; } } @@ -515,7 +465,7 @@ struct tlv_parsed tp; const uint8_t *sw_config; int ret, sw_config_len, len; - struct abis_nm_sw_descr sw_descr[5]; + struct osmo_sw_descr sw_descr[5]; abis_nm_debugp_foh(DNM, foh); @@ -560,7 +510,7 @@ foh->obj_inst.bts_nr, foh->obj_inst.trx_nr, foh->obj_inst.ts_nr, - sw_descr[ret].start, sw_descr[ret].len); + &sw_descr[ret]); } /* Receive a CHANGE_ADM_STATE_ACK, parse the TLV and update local state */ diff --git a/openbsc/tests/abis/abis_test.c b/openbsc/tests/abis/abis_test.c index 496267f..2d50f33 100644 --- a/openbsc/tests/abis/abis_test.c +++ b/openbsc/tests/abis/abis_test.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -50,29 +51,32 @@ static void test_simple_sw_config(void) { - struct abis_nm_sw_descr descr[1]; + struct osmo_sw_descr descr[1]; + uint16_t len; int rc; rc = abis_nm_parse_sw_config(simple_config, ARRAY_SIZE(simple_config), &descr[0], ARRAY_SIZE(descr)); if (rc != 1) { - printf("FAILED to parse the File Id/File version\n"); + printf("%s(): FAILED to parse the File Id/File version: %d\n", + __func__, rc); abort(); } - if (descr[0].len != 13) { - printf("WRONG SIZE: %zu\n", descr[0].len); + len = abis_nm_put_sw_descr(NULL, &descr[0], true, true); + if (len != 13) { + printf("WRONG SIZE: %u\n", len); abort(); } - printf("Start: %td len: %zu\n", descr[0].start - simple_config, descr[0].len); + printf("len: %u\n", len); printf("file_id: %s\n", osmo_hexdump(descr[0].file_id, descr[0].file_id_len)); - printf("file_ver: %s\n", osmo_hexdump(descr[0].file_ver, descr[0].file_ver_len)); + printf("file_ver: %s\n", osmo_hexdump(descr[0].file_version, descr[0].file_version_len)); } static void test_simple_sw_short(void) { - struct abis_nm_sw_descr descr[1]; + struct osmo_sw_descr descr[1]; int i; for (i = 1; i < ARRAY_SIZE(simple_config); ++i) { @@ -88,54 +92,62 @@ static void test_dual_sw_config(void) { - struct abis_nm_sw_descr descr[2]; + struct osmo_sw_descr descr[2]; + uint16_t len0, len1; int rc; rc = abis_nm_parse_sw_config(dual_config, ARRAY_SIZE(dual_config), &descr[0], ARRAY_SIZE(descr)); if (rc != 2) { - printf("FAILED to parse the File Id/File version\n"); + printf("%s(): FAILED to parse the File Id/File version: %d\n", + __func__, rc); abort(); } - if (descr[0].len != 13) { - printf("WRONG SIZE0: %zu\n", descr[0].len); + len0 = abis_nm_put_sw_descr(NULL, &descr[0], true, true); + if (len0 != 13) { + printf("WRONG SIZE0: %u\n", len0); abort(); } - if (descr[1].len != 13) { - printf("WRONG SIZE1: %zu\n", descr[1].len); + len1 = abis_nm_put_sw_descr(NULL, &descr[1], true, true); + if (len1 != 13) { + printf("WRONG SIZE1: %u\n", len1); abort(); } - printf("Start: %td len: %zu\n", descr[0].start - dual_config, descr[0].len); + printf("len: %u\n", len0); printf("file_id: %s\n", osmo_hexdump(descr[0].file_id, descr[0].file_id_len)); - printf("file_ver: %s\n", osmo_hexdump(descr[0].file_ver, descr[0].file_ver_len)); + printf("file_ver: %s\n", osmo_hexdump(descr[0].file_version, descr[0].file_version_len)); - printf("Start: %td len: %zu\n", descr[1].start - dual_config, descr[1].len); + printf("len: %u\n", len1); printf("file_id: %s\n", osmo_hexdump(descr[1].file_id, descr[1].file_id_len)); - printf("file_ver: %s\n", osmo_hexdump(descr[1].file_ver, descr[1].file_ver_len)); + printf("file_ver: %s\n", osmo_hexdump(descr[1].file_version, descr[1].file_version_len)); } static void test_sw_selection(void) { - struct abis_nm_sw_descr descr[8], tmp; + struct osmo_sw_descr descr[8], tmp; + uint16_t len0, len1; int rc, pos; rc = abis_nm_parse_sw_config(load_config, ARRAY_SIZE(load_config), &descr[0], ARRAY_SIZE(descr)); if (rc != 2) { - printf("FAILED to parse the File Id/File version\n"); + printf("%s(): FAILED to parse the File Id/File version: %d\n", + __func__, rc); abort(); } - printf("Start: %td len: %zu\n", descr[0].start - load_config, descr[0].len); + len0 = abis_nm_put_sw_descr(NULL, &descr[0], true, true); + printf("len: %u\n", len0); printf("file_id: %s\n", osmo_hexdump(descr[0].file_id, descr[0].file_id_len)); - printf("file_ver: %s\n", osmo_hexdump(descr[0].file_ver, descr[0].file_ver_len)); + printf("file_ver: %s\n", osmo_hexdump(descr[0].file_version, descr[0].file_version_len)); - printf("Start: %td len: %zu\n", descr[1].start - load_config, descr[1].len); + len1 = abis_nm_put_sw_descr(NULL, &descr[1], true, true); + printf("len: %u\n", len1); printf("file_id: %s\n", osmo_hexdump(descr[1].file_id, descr[1].file_id_len)); - printf("file_ver: %s\n", osmo_hexdump(descr[1].file_ver, descr[1].file_ver_len)); + printf("file_ver: %s\n", osmo_hexdump(descr[1].file_version, descr[1].file_version_len)); /* start */ pos = abis_nm_select_newest_sw(descr, rc); -- To view, visit https://gerrit.osmocom.org/2166 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib94db414e94a2a1f234ac6f1cb346dca1c7a8be3 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 24 21:59:58 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 21:59:58 +0000 Subject: [PATCH] osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2148 to look at the new patch set (#2). Move Transceiver::detectBurst() to sigProcLib to make it reusable. Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 4 files changed, 56 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/48/2148/2 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index c1a63fd..e37c08e 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -542,38 +542,6 @@ } } -int Transceiver::detectBurst(signalVector &burst, - complex &, float &toa, CorrType type) -{ - int rc = 0; - - switch (type) { - case EDGE: - rc = detectEdgeBurst(burst, mTSC, BURST_THRESH, mSPSRx, - amp, toa, mMaxExpectedDelayNB); - if (rc > 0) - break; - else - type = TSC; - case TSC: - rc = analyzeTrafficBurst(burst, mTSC, BURST_THRESH, mSPSRx, - amp, toa, mMaxExpectedDelayNB); - break; - case RACH: - rc = detectRACHBurst(burst, BURST_THRESH, mSPSRx, amp, toa, - mMaxExpectedDelayAB); - break; - default: - LOG(ERR) << "Invalid correlation type"; - } - - if (rc > 0) - return type; - - return rc; -} - - /* * Demodulate GMSK by direct rotation and soft slicing. */ @@ -679,7 +647,8 @@ } /* Detect normal or RACH bursts */ - rc = detectBurst(*burst, amp, toa, type); + rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, amp, toa, + (type==RACH)?mMaxExpectedDelayAB:mMaxExpectedDelayNB); if (rc > 0) { type = (CorrType) rc; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 425b004..3c70e5c 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -202,10 +202,6 @@ /** send messages over the clock socket */ void writeClockInterface(void); - /** Detectbursts */ - int detectBurst(signalVector &burst, - complex &, float &toa, CorrType type); - /** Demodulate burst and output soft bits */ SoftVector *demodulate(signalVector &burst, complex amp, float toa, CorrType type); diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 6f50f04..2de1816 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1925,6 +1925,38 @@ return rc; } +int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, CorrType type, complex &, float &toa, + unsigned max_toa) +{ + int rc = 0; + + switch (type) { + case EDGE: + rc = detectEdgeBurst(burst, tsc, threshold, sps, + amp, toa, max_toa); + if (rc > 0) + break; + else + type = TSC; + case TSC: + rc = analyzeTrafficBurst(burst, tsc, threshold, sps, + amp, toa, max_toa); + break; + case RACH: + rc = detectRACHBurst(burst, threshold, sps, amp, toa, + max_toa); + break; + default: + LOG(ERR) << "Invalid correlation type"; + } + + if (rc > 0) + return type; + + return rc; +} + signalVector *downsampleBurst(signalVector &burst) { signalVector *in, *out; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 7bdbde8..6413b47 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -255,6 +255,28 @@ unsigned max_toa); /** + 8-PSK/GMSK/RACH burst detector + @param burst The received GSM burst of interest + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param sps The number of samples per GSM symbol. + @param amplitude The estimated amplitude of received TSC burst. + @param toa The estimate time-of-arrival of received TSC burst (in symbols). + @param max_toa The maximum expected time-of-arrival (in symbols). + @return positive value (CorrType) if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected +*/ +int detectAnyBurst(signalVector &burst, + unsigned tsc, + float threshold, + int sps, + CorrType type, + complex &, + float &toa, + unsigned max_toa); + +/** Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 24 22:03:19 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Fri, 24 Mar 2017 22:03:19 +0000 Subject: libosmocore[master]: core/conv: implement optimized Viterbi decoder In-Reply-To: References: Message-ID: Patch Set 5: Sylvain, a kind ping about this. No pressure :) -- To view, visit https://gerrit.osmocom.org/1337 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Mar 26 22:25:06 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 26 Mar 2017 22:25:06 +0000 Subject: [PATCH] osmo-pcu[master]: cosmetic: BitcompTest: make readable Message-ID: Review at https://gerrit.osmocom.org/2167 cosmetic: BitcompTest: make readable In order to understand what the bitcomp test is logging, cosmetically rearrange the code: - memset bits_data before assigning to destination bitvec. - use macro CEIL_DIV_8 to clarify what (x+7)/8 does. - rename check_result() to result_matches() and return a bool, also constify result_matches() args and pass a bitvec reference instead of copying the bitvec struct. - rearrange logging lines to make readable what is going on there. - drop unused 'init_flag' There are obviously errors like double hexdumps per log line, multiple newlines in a LOGP statement and so forth: these shall be fixed by subsequent patches. Change-Id: Id0da9d9b67f4713d3a67e3532ed44b8cb1bd1d08 --- M tests/bitcomp/BitcompTest.cpp 1 file changed, 45 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/67/2167/1 diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index 31b6d11..31aebd4 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -17,6 +17,7 @@ #define MASK(n) (0xFF << (8-n)) #define MAX_CRBB_LEN 23 #define MAX_URBB_LEN 40 +#define CEIL_DIV_8(x) (((x) + 7)/8) void *tall_pcu_ctx; @@ -120,23 +121,22 @@ return 1; } -/* To verify the result with expected result */ -int check_result(bitvec bits, uint8_t *exp_data, unsigned int exp_len) +bool result_matches(const bitvec &bits, const uint8_t *exp_data, unsigned int exp_len) { if (bits.cur_bit != exp_len) - return 0; + return false; size_t n = (exp_len / 8); int rem = (exp_len % 8); if (memcmp(exp_data, bits.data, n) == 0) { if (rem == 0) - return 1; + return true; if ((bits.data[n] & MASK(rem)) == ((*(exp_data + n)) & MASK(rem))) - return 1; + return true; else - return 0; + return false; } else - return 0; + return false; } /* To test decoding of compressed bitmap by Tree based method @@ -146,7 +146,6 @@ static void test_EPDAN_decode_tree(void) { bitvec dest; - int init_flag = 1; unsigned int itr; int rc; uint8_t bits_data[RLC_EGPRS_MAX_WS/8]; @@ -154,47 +153,56 @@ printf("=== start %s ===\n", __func__); for (itr = 0 ; itr < (sizeof(test) / sizeof(test_data)) ; itr++) { + memset(bits_data, 0, sizeof(bits_data)); dest.data = bits_data; dest.data_len = sizeof(bits_data); dest.cur_bit = 0; - memset(dest.data, 0, sizeof(bits_data)); - LOGP(DRLCMACDL, LOGL_DEBUG, "\nTest:%d\nTree based decoding:" - "\nuncompressed data = %s\nlen = %d\n", itr + 1, - osmo_hexdump(test[itr].crbb_data, - (test[itr].crbb_len + 7)/8), test[itr].crbb_len - ); + LOGP(DRLCMACDL, LOGL_DEBUG, + "\nTest:%d\n" + "Tree based decoding:\n" + "uncompressed data = %s\n" + "len = %d\n", + itr + 1, + osmo_hexdump(test[itr].crbb_data, + CEIL_DIV_8(test[itr].crbb_len)), + test[itr].crbb_len); rc = egprs_compress::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].crbb_data, &dest); if (rc < 0) { LOGP(DRLCMACUL, LOGL_NOTICE, - "\nFailed to decode CRBB: length %d, data %s", - test[itr].crbb_len, osmo_hexdump( - test[itr].crbb_data, (test[itr].crbb_len + 7)/8)); + "\nFailed to decode CRBB: length %d, data %s", + test[itr].crbb_len, + osmo_hexdump(test[itr].crbb_data, + CEIL_DIV_8(test[itr].crbb_len))); } - if (init_flag) - init_flag = 0; if (test[itr].verify) { - if (check_result(dest, test[itr].ucmp_data, - test[itr].ucmp_len) == 0) { - LOGP(DRLCMACDL, LOGL_DEBUG, "\nTree based decoding" - ":Error\nexpected data = %s\nexpected" - " len = %d\ndecoded data = %s\n" - "decoded len = %d\n", - osmo_hexdump(test[itr].ucmp_data, - (test[itr].ucmp_len + 7)/8), - test[itr].ucmp_len, osmo_hexdump(dest.data, - (dest.cur_bit + 7)/8), dest.cur_bit - ); + if (!result_matches(dest, test[itr].ucmp_data, + test[itr].ucmp_len)) { + LOGP(DRLCMACDL, LOGL_DEBUG, + "\nTree based decoding: Error\n" + "expected data = %s\n" + "expected len = %d\n" + "decoded data = %s\n" + "decoded len = %d\n", + osmo_hexdump(test[itr].ucmp_data, + CEIL_DIV_8(test[itr].ucmp_len)), + test[itr].ucmp_len, + osmo_hexdump(dest.data, + CEIL_DIV_8(dest.cur_bit)), + dest.cur_bit); OSMO_ASSERT(0); } } - LOGP(DRLCMACDL, LOGL_DEBUG, "\nexpected data = %s\nexpected len = %d" - "\ndecoded data = %s\ndecoded len = %d\n", - osmo_hexdump(test[itr].ucmp_data, - (test[itr].ucmp_len + 7)/8), - test[itr].ucmp_len, osmo_hexdump(dest.data, - (dest.cur_bit + 7)/8), dest.cur_bit - ); + LOGP(DRLCMACDL, LOGL_DEBUG, + "\nexpected data = %s\n" + "expected len = %d\n" + "decoded data = %s\n" + "decoded len = %d\n", + osmo_hexdump(test[itr].ucmp_data, + CEIL_DIV_8(test[itr].ucmp_len)), + test[itr].ucmp_len, + osmo_hexdump(dest.data, CEIL_DIV_8(dest.cur_bit)), + dest.cur_bit); } printf("=== end %s ===\n", __func__); -- To view, visit https://gerrit.osmocom.org/2167 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id0da9d9b67f4713d3a67e3532ed44b8cb1bd1d08 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Mar 26 22:25:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 26 Mar 2017 22:25:08 +0000 Subject: [PATCH] osmo-pcu[master]: bitcomp test: fix: only one hexdump per log; use printf Message-ID: Review at https://gerrit.osmocom.org/2168 bitcomp test: fix: only one hexdump per log; use printf The test wants to write multiline results, so it should use printf instead of the logging system. Split logs to only one hexdump per printf(). One cannot use osmo_hexdump twice in one printf(); before this, one of the two hexdumps won, both dumps would show as the same. Very bad for a regression test! This uncovers a discrepancy between expected and produced results, proving that the expected stderr output was not capable of uncovering test failures. The test's check_result() function *has* always verified the decoded data, but only up to the last decoded bit. Our expected data contains seemingly random bits after the end of the decoded bits, but check_result() never compares those, hence we don't catch that error. The extra bits should definitely be zero, because the destination buffer is pre-initialized to zero -- fixed in a subsequent patch. This should cosmetically fix the build failure found in: http://lists.osmocom.org/pipermail/osmocom-net-gprs/2017-March/000876.html [osmo-pcu 0.2.896-0a8f] testsuite: 4 failed from: Arnaud ZANETTI on: Fri Mar 24 09:53:53 UTC 2017 The real fix will follow. Change-Id: I24fc32eb55baaf22f9c6fdda917bfb8395d02b1c --- M tests/bitcomp/BitcompTest.cpp M tests/bitcomp/BitcompTest.err 2 files changed, 17 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/68/2168/1 diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index 31aebd4..f35d6be 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -18,6 +18,8 @@ #define MAX_CRBB_LEN 23 #define MAX_URBB_LEN 40 #define CEIL_DIV_8(x) (((x) + 7)/8) +#define _LOG(fmt, args...) \ + fprintf(stderr, fmt, ## args) void *tall_pcu_ctx; @@ -157,8 +159,7 @@ dest.data = bits_data; dest.data_len = sizeof(bits_data); dest.cur_bit = 0; - LOGP(DRLCMACDL, LOGL_DEBUG, - "\nTest:%d\n" + _LOG("\nTest:%d\n" "Tree based decoding:\n" "uncompressed data = %s\n" "len = %d\n", @@ -169,8 +170,7 @@ rc = egprs_compress::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].crbb_data, &dest); if (rc < 0) { - LOGP(DRLCMACUL, LOGL_NOTICE, - "\nFailed to decode CRBB: length %d, data %s", + _LOG("\nFailed to decode CRBB: length %d, data %s", test[itr].crbb_len, osmo_hexdump(test[itr].crbb_data, CEIL_DIV_8(test[itr].crbb_len))); @@ -178,29 +178,27 @@ if (test[itr].verify) { if (!result_matches(dest, test[itr].ucmp_data, test[itr].ucmp_len)) { - LOGP(DRLCMACDL, LOGL_DEBUG, - "\nTree based decoding: Error\n" + _LOG("\nTree based decoding: Error\n" "expected data = %s\n" - "expected len = %d\n" - "decoded data = %s\n" - "decoded len = %d\n", + "expected len = %d\n", osmo_hexdump(test[itr].ucmp_data, CEIL_DIV_8(test[itr].ucmp_len)), - test[itr].ucmp_len, + test[itr].ucmp_len); + _LOG("decoded data = %s\n" + "decoded len = %d\n", osmo_hexdump(dest.data, CEIL_DIV_8(dest.cur_bit)), dest.cur_bit); OSMO_ASSERT(0); } } - LOGP(DRLCMACDL, LOGL_DEBUG, - "\nexpected data = %s\n" - "expected len = %d\n" - "decoded data = %s\n" - "decoded len = %d\n", + _LOG("\nexpected data = %s\n" + "expected len = %d\n", osmo_hexdump(test[itr].ucmp_data, CEIL_DIV_8(test[itr].ucmp_len)), - test[itr].ucmp_len, + test[itr].ucmp_len); + _LOG("decoded data = %s\n" + "decoded len = %d\n", osmo_hexdump(dest.data, CEIL_DIV_8(dest.cur_bit)), dest.cur_bit); } diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err index 7481d72..f769daa 100644 --- a/tests/bitcomp/BitcompTest.err +++ b/tests/bitcomp/BitcompTest.err @@ -13,7 +13,7 @@ expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db expected len = 194 -decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db +decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 decoded len = 194 Test:2 @@ -27,7 +27,7 @@ expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03 expected len = 182 -decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03 +decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 decoded len = 182 Test:3 @@ -106,7 +106,7 @@ expected data = expected len = 0 -decoded data = +decoded data = b0 00 00 decoded len = 19 Test:8 -- To view, visit https://gerrit.osmocom.org/2168 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I24fc32eb55baaf22f9c6fdda917bfb8395d02b1c Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Mar 26 22:25:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 26 Mar 2017 22:25:08 +0000 Subject: [PATCH] osmo-pcu[master]: bitcomp test: fix: also verify bits after decoded data Message-ID: Review at https://gerrit.osmocom.org/2169 bitcomp test: fix: also verify bits after decoded data Before this, the expected data had seemingly random bits set after the end of the expected decoding result. Make the test expect these extra bits as zero, matching with the buffer initialization to zero. In result_matches(), compare the full length of bytes instead of masking the bits after the end of the decoded data (which caused us to not catch the wrong expectation until now). This fixes the underlying issues found in http://lists.osmocom.org/pipermail/osmocom-net-gprs/2017-March/000876.html [osmo-pcu 0.2.896-0a8f] testsuite: 4 failed from: Arnaud ZANETTI on: Fri Mar 24 09:53:53 UTC 2017 Change-Id: I2501208e2f8b4f709efbcadbd1057c086472c9e6 --- M tests/bitcomp/BitcompTest.cpp M tests/bitcomp/BitcompTest.err 2 files changed, 5 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/69/2169/1 diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index f35d6be..c5fde2e 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -38,7 +38,7 @@ .ucmp_data = { 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, - 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xdb + 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xc0 }, .ucmp_len = 194, .verify = 1 }, @@ -49,7 +49,7 @@ .ucmp_data = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x03 + 0x00, 0x00, 0x00, 0x00, 0x00 }, .ucmp_len = 182, .verify = 1 }, @@ -127,18 +127,7 @@ { if (bits.cur_bit != exp_len) return false; - size_t n = (exp_len / 8); - int rem = (exp_len % 8); - - if (memcmp(exp_data, bits.data, n) == 0) { - if (rem == 0) - return true; - if ((bits.data[n] & MASK(rem)) == ((*(exp_data + n)) & MASK(rem))) - return true; - else - return false; - } else - return false; + return (memcmp(exp_data, bits.data, CEIL_DIV_8(exp_len)) == 0); } /* To test decoding of compressed bitmap by Tree based method diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err index f769daa..1d6fb00 100644 --- a/tests/bitcomp/BitcompTest.err +++ b/tests/bitcomp/BitcompTest.err @@ -11,7 +11,7 @@ Run_length = 19 Run_length = 32 -expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db +expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 expected len = 194 decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 decoded len = 194 @@ -25,7 +25,7 @@ Run_length = 51 Run_length = 41 -expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03 +expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 expected len = 182 decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 decoded len = 182 -- To view, visit https://gerrit.osmocom.org/2169 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2501208e2f8b4f709efbcadbd1057c086472c9e6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Mar 26 22:25:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 26 Mar 2017 22:25:08 +0000 Subject: [PATCH] osmo-pcu[master]: bitcomp test: use expected rc instead of 'verify' flag Message-ID: Review at https://gerrit.osmocom.org/2170 bitcomp test: use expected rc instead of 'verify' flag The 'verify' flag is useless, we always want to verify everything. Replace 'verify' with 'expect_rc', expecting a specific decoding result per test set. When an error code was returned, cut short the loop and skip printing expected vs. decoded bits. This uncovers the fact that the first test marked as "invalid inputs" does not seem to be invalid after all, or at least does not produce an error to be returned. For now, only uncover this fact, the fix shall be submitted later. Change-Id: Icf815a8f1acb0e275463408450171df046879847 --- M tests/bitcomp/BitcompTest.cpp M tests/bitcomp/BitcompTest.err 2 files changed, 51 insertions(+), 41 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/70/2170/1 diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index c5fde2e..4ec6f29 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -29,7 +29,7 @@ uint8_t crbb_data[MAX_CRBB_LEN]; /* compressed data */ uint8_t ucmp_data[MAX_URBB_LEN]; /* uncompressed data */ int ucmp_len; - int verify; + int expect_rc; } test[] = { { .crbb_len = 67, .cc = 1, .crbb_data = { @@ -40,7 +40,8 @@ 0xff, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xc0 }, - .ucmp_len = 194, .verify = 1 + .ucmp_len = 194, + .expect_rc = 0, }, { .crbb_len = 40, .cc = 1, .crbb_data = { @@ -51,12 +52,14 @@ 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 }, - .ucmp_len = 182, .verify = 1 + .ucmp_len = 182, + .expect_rc = 0, }, { .crbb_len = 8, .cc = 1, .crbb_data = {0x02}, .ucmp_data = {0xff, 0xff, 0xff, 0xf8}, - .ucmp_len = 29, .verify = 1 + .ucmp_len = 29, + .expect_rc = 0, }, { .crbb_len = 103, .cc = 1, .crbb_data = { @@ -69,13 +72,15 @@ 0x0f, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff }, - .ucmp_len = 288, .verify = 1 + .ucmp_len = 288, + .expect_rc = 0, }, /* Test vector from libosmocore test */ { .crbb_len = 35, .cc = 0, .crbb_data = {0xde, 0x88, 0x75, 0x65, 0x80}, .ucmp_data = {0x37, 0x47, 0x81, 0xf0}, - .ucmp_len = 28, .verify = 1 + .ucmp_len = 28, + .expect_rc = 0, }, { .crbb_len = 18, .cc = 1, .crbb_data = {0xdd, 0x41, 0x00}, @@ -83,23 +88,28 @@ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }, - .ucmp_len = 90, .verify = 1 + .ucmp_len = 90, + .expect_rc = 0, }, - /*Invalid inputs*/ + /* TODO: previously marked as "Invalid inputs" but succeeds */ { .crbb_len = 18, .cc = 1, .crbb_data = {0x1E, 0x70, 0xc0}, - .ucmp_data = {0x0}, - .ucmp_len = 0, .verify = 0 + .ucmp_data = {0xb0, 0x00, 0x00}, + .ucmp_len = 19, + .expect_rc = 0, }, + /* Invalid inputs */ { .crbb_len = 14, .cc = 1, .crbb_data = {0x00, 0x1E, 0x7c}, .ucmp_data = {0x0}, - .ucmp_len = 0, .verify = 0 + .ucmp_len = 0, + .expect_rc = -1, }, { .crbb_len = 24, .cc = 0, .crbb_data = {0x00, 0x00, 0x00}, .ucmp_data = {0x0}, - .ucmp_len = 0, .verify = 0 + .ucmp_len = 0, + .expect_rc = -1, } }; @@ -158,28 +168,29 @@ test[itr].crbb_len); rc = egprs_compress::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].crbb_data, &dest); + _LOG("rc = %d\n", rc); + OSMO_ASSERT(test[itr].expect_rc == rc); if (rc < 0) { - _LOG("\nFailed to decode CRBB: length %d, data %s", + _LOG("Failed to decode CRBB: length %d, data %s\n", test[itr].crbb_len, osmo_hexdump(test[itr].crbb_data, CEIL_DIV_8(test[itr].crbb_len))); + continue; } - if (test[itr].verify) { - if (!result_matches(dest, test[itr].ucmp_data, - test[itr].ucmp_len)) { - _LOG("\nTree based decoding: Error\n" - "expected data = %s\n" - "expected len = %d\n", - osmo_hexdump(test[itr].ucmp_data, - CEIL_DIV_8(test[itr].ucmp_len)), - test[itr].ucmp_len); - _LOG("decoded data = %s\n" - "decoded len = %d\n", - osmo_hexdump(dest.data, - CEIL_DIV_8(dest.cur_bit)), - dest.cur_bit); - OSMO_ASSERT(0); - } + if (!result_matches(dest, test[itr].ucmp_data, + test[itr].ucmp_len)) { + _LOG("\nTree based decoding: Error\n" + "expected data = %s\n" + "expected len = %d\n", + osmo_hexdump(test[itr].ucmp_data, + CEIL_DIV_8(test[itr].ucmp_len)), + test[itr].ucmp_len); + _LOG("decoded data = %s\n" + "decoded len = %d\n", + osmo_hexdump(dest.data, + CEIL_DIV_8(dest.cur_bit)), + dest.cur_bit); + OSMO_ASSERT(0); } _LOG("\nexpected data = %s\n" "expected len = %d\n", diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err index 1d6fb00..2eabd78 100644 --- a/tests/bitcomp/BitcompTest.err +++ b/tests/bitcomp/BitcompTest.err @@ -10,6 +10,7 @@ Run_length = 31 Run_length = 19 Run_length = 32 +rc = 0 expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 expected len = 194 @@ -24,6 +25,7 @@ Run_length = 40 Run_length = 51 Run_length = 41 +rc = 0 expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 expected len = 182 @@ -35,6 +37,7 @@ uncompressed data = 02 len = 8 Run_length = 29 +rc = 0 expected data = ff ff ff f8 expected len = 29 @@ -56,6 +59,7 @@ Run_length = 32 Run_length = 22 Run_length = 33 +rc = 0 expected data = ff ff ff f8 00 00 ff ff ff f8 00 00 7f ff ff fe 00 00 0f ff ff ff e0 00 00 7f ff ff ff 80 00 01 ff ff ff ff expected len = 288 @@ -76,6 +80,7 @@ Run_length = 4 Run_length = 6 Run_length = 5 +rc = 0 expected data = 37 47 81 f0 expected len = 28 @@ -89,6 +94,7 @@ Run_length = 64 Run_length = 16 Run_length = 10 +rc = 0 expected data = ff ff ff ff ff ff ff ff ff ff 00 00 expected len = 90 @@ -103,9 +109,10 @@ Run_length = 1 Run_length = 2 Run_length = 15 +rc = 0 -expected data = -expected len = 0 +expected data = b0 00 00 +expected len = 19 decoded data = b0 00 00 decoded len = 19 @@ -113,20 +120,12 @@ Tree based decoding: uncompressed data = 00 1e len = 14 - +rc = -1 Failed to decode CRBB: length 14, data 00 1e -expected data = -expected len = 0 -decoded data = -decoded len = 0 Test:9 Tree based decoding: uncompressed data = 00 00 00 len = 24 - +rc = -1 Failed to decode CRBB: length 24, data 00 00 00 -expected data = -expected len = 0 -decoded data = -decoded len = 0 -- To view, visit https://gerrit.osmocom.org/2170 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icf815a8f1acb0e275463408450171df046879847 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 27 12:12:43 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 27 Mar 2017 12:12:43 +0000 Subject: libosmo-abis[master]: configure: Fix compilation with new libortp In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (3 comments) excellent! marked some minor cosmetics... https://gerrit.osmocom.org/#/c/2164/1//COMMIT_MSG Commit Message: Line 15: Signed-off-by: Pau Espin Pedrol we don't use 'Signed-off-by' in Osmocom https://gerrit.osmocom.org/#/c/2164/1/configure.ac File configure.ac: Line 65: [[ortp_set_log_level_mask(NULL, 0xffff);]] two indents instead? https://gerrit.osmocom.org/#/c/2164/1/src/trau/osmo_ortp.c File src/trau/osmo_ortp.c: Line 281: ORTP_LOG_DOMAIN, indents of 'ORTP_LOG_DOMAIN' and '0xffff' differ -- To view, visit https://gerrit.osmocom.org/2164 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 27 12:38:54 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 27 Mar 2017 12:38:54 +0000 Subject: openbsc[master]: gsm_bts: add version and variant details In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (2 comments) plz clarify some details... https://gerrit.osmocom.org/#/c/2161/2/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 501: enum gsm_bts_model_variant { this qestion is still open: It looks to me like this is semantically the same as enum gsm_bts_type just above? If it has to be a separate enum, please clarify with a code comment why that is so. Line 671: char version[MAX_VERSION_LENGTH]; I wonder why the variant is in gsm_bts_model and the version is in gsm_bts. Aren't they the same kind of information and should be kept together? Isn't gsm_bts_model "just" an internal API collection? will we have separate gsm_bts_model APIs based on the variant? So far that's not the case, right? -- To view, visit https://gerrit.osmocom.org/2161 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 27 12:49:08 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 27 Mar 2017 12:49:08 +0000 Subject: osmo-bts[master]: vty: reduce code duplication In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2162/1/src/common/vty.c File src/common/vty.c: Line 271: osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, i)); hmm the osmo_str2lower() API is a bit unfortunate: no size checks. We should check the size separately. The local implementation checked that buf_casecnvt is large enough. Admitted, it's super unlikely that gsmtap_sapi_names entries will be > 256, in fact 6 would suffice. So this is more about coding style than real failure... what do you think? -- To view, visit https://gerrit.osmocom.org/2162 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 27 12:52:26 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 27 Mar 2017 12:52:26 +0000 Subject: osmo-trx[master]: sigProcLib: Fix negative value check on unsigned value In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2163/1//COMMIT_MSG Commit Message: Line 12: Coverity issue CID 165059: Control flow issues (NO_EFFECT) we would normally mark something like: "Fixes: CID#165059" -- To view, visit https://gerrit.osmocom.org/2163 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 27 13:19:41 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 27 Mar 2017 13:19:41 +0000 Subject: libosmocore[master]: Add SW Description (de)marshalling In-Reply-To: References: Message-ID: Patch Set 3: Code-Review-1 (9 comments) https://gerrit.osmocom.org/#/c/2165/3//COMMIT_MSG Commit Message: Line 9: * data structure represnting 3GPP TS 52.021 ?9.4.62 SW Description (typo) https://gerrit.osmocom.org/#/c/2165/3/include/osmocom/gsm/protocol/gsm_12_21.h File include/osmocom/gsm/protocol/gsm_12_21.h: Line 796: struct osmo_sw_descr { struct of the API is prefixed 'osmo_' and functions 'abis_nm_'? would it make sense to use the same prefix instead? https://gerrit.osmocom.org/#/c/2165/3/src/gsm/abis_nm.c File src/gsm/abis_nm.c: Line 755: * \param[in] msg message buffer isn't that technically a \param[out]? Line 757: * \param[in] put_header boolean, whether to put NM_ATT_SW_DESCR IE or not call it 'put_sw_descr' instead? Line 758: * \param[in] simulate boolean, whether to actually modify msg or not I guess it would make more sense to have the len calculation in a separate function -- no production code would ever simulate, right? Line 765: (sw->file_version_len + 3); (indent -= 1 space?) Where do the magic 3s come from? Line 789: const struct tlv_definition sw_tlvdef = { static? Line 798: itself is considered optional. */ Ah, I'm beginning to understand, the SW DESCR is a TV, where the V is another set of TLVs. Maybe this comment could highlight that. In case tlv_parse() returns zero, there is no outer TV and we can exit further parsing right away. Just noticing: tlv_parse()'s API doc is wrong, it returns the number of parsed TLV elements, not the bytes! I think this should be tightened. Maybe the outer SW DESCR TV should be parsed in a separate stage, feeding the V of FILE_ID and FILE_VERSION to this function only when they are actually present? Because, from above tlv_definition, the SW_DESCR TV could come at any position as far as the tlv_parse()r is concerned: maybe first some FILE_ID, then a SW_DESCR... I guess we should prevent that. https://gerrit.osmocom.org/#/c/2165/3/tests/msgb/msgb_test.c File tests/msgb/msgb_test.c: Line 202: res = abis_nm_get_sw_descr(get, msgb_data(msg), msg->len); I'm pretty sure that this test does not belong in msgb_test.c. This file is for generig msgb testing, not for specific payloads. -- To view, visit https://gerrit.osmocom.org/2165 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Mar 27 13:23:51 2017 From: gerrit-no-reply at lists.osmocom.org (Pau Espin Pedrol) Date: Mon, 27 Mar 2017 13:23:51 +0000 Subject: [PATCH] libosmo-abis[master]: configure: Fix compilation with new libortp In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2164 to look at the new patch set (#2). configure: Fix compilation with new libortp Commit 0c8d9ddaea8c1afdc0e9b8c37a31c9d158e57efd in ortp broke old API: function ortp_set_log_level_mask requires one new parameter 'domain'. This commit fixes compilation in my Archlinux box using ortp 1.0.1. Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 --- M configure.ac M src/trau/osmo_ortp.c 2 files changed, 21 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/64/2164/2 diff --git a/configure.ac b/configure.ac index 99d83f6..43266be 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,16 @@ CPPFLAGS+=" -fsanitize=address -fsanitize=undefined" fi +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ortp_set_log_level_mask(NULL, 0xffff);]] + )], + [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1], + [ortp_set_log_level_mask requires domain parameter])], + [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0], + [ortp_set_log_level_mask has no domain parameter])]) + AC_OUTPUT( libosmoabis.pc libosmotrau.pc diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index d4d4ff5..141065e 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -94,8 +94,11 @@ return LOGL_ERROR; } -static void my_ortp_logfn(OrtpLogLevel lev, const char *fmt, - va_list args) +static void my_ortp_logfn( +#if HAVE_ORTP_LOG_DOMAIN + const char *domain, +#endif + OrtpLogLevel lev, const char *fmt, va_list args) { osmo_vlogp(DLMIB, ortp_to_osmo_lvl(lev), __FILE__, 0, 0, fmt, args); @@ -273,7 +276,12 @@ tall_rtp_ctx = ctx; ortp_set_memory_functions(&osmo_ortp_memfn); ortp_init(); - ortp_set_log_level_mask(0xffff); + ortp_set_log_level_mask( +#if HAVE_ORTP_LOG_DOMAIN + ORTP_LOG_DOMAIN, +#endif + 0xffff); + ortp_set_log_handler(my_ortp_logfn); create_payload_types(); } -- To view, visit https://gerrit.osmocom.org/2164 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Mar 27 13:51:35 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 27 Mar 2017 13:51:35 +0000 Subject: libosmo-abis[master]: configure: Fix compilation with new libortp In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 very nice :) -- To view, visit https://gerrit.osmocom.org/2164 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 27 22:12:29 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 27 Mar 2017 22:12:29 +0000 Subject: osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Mar 27 22:15:43 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 27 Mar 2017 22:15:43 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Fix negative value check on unsigned value In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2163 to look at the new patch set (#2). sigProcLib: Fix negative value check on unsigned value Convert negative value check on unsigned value to zero check to avoid potential divide-by-zero error condition. Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Fixes: Coverity CID 165059 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/63/2163/2 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 6f50f04..6111d5a 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1712,7 +1712,7 @@ signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; float energy = 0.0; - if (windowLength < 0) windowLength = 20; + if (windowLength == 0) return 0.0; if (windowLength > rxBurst.size()) windowLength = rxBurst.size(); for (unsigned i = 0; i < windowLength; i++) { energy += windowItr->norm2(); -- To view, visit https://gerrit.osmocom.org/2163 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:20:15 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:20:15 +0000 Subject: [MERGED] osmo-trx[master]: Move Transceiver::detectBurst() to sigProcLib to make it reu... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: Move Transceiver::detectBurst() to sigProcLib to make it reusable. ...................................................................... Move Transceiver::detectBurst() to sigProcLib to make it reusable. Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 4 files changed, 56 insertions(+), 37 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index c1a63fd..e37c08e 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -542,38 +542,6 @@ } } -int Transceiver::detectBurst(signalVector &burst, - complex &, float &toa, CorrType type) -{ - int rc = 0; - - switch (type) { - case EDGE: - rc = detectEdgeBurst(burst, mTSC, BURST_THRESH, mSPSRx, - amp, toa, mMaxExpectedDelayNB); - if (rc > 0) - break; - else - type = TSC; - case TSC: - rc = analyzeTrafficBurst(burst, mTSC, BURST_THRESH, mSPSRx, - amp, toa, mMaxExpectedDelayNB); - break; - case RACH: - rc = detectRACHBurst(burst, BURST_THRESH, mSPSRx, amp, toa, - mMaxExpectedDelayAB); - break; - default: - LOG(ERR) << "Invalid correlation type"; - } - - if (rc > 0) - return type; - - return rc; -} - - /* * Demodulate GMSK by direct rotation and soft slicing. */ @@ -679,7 +647,8 @@ } /* Detect normal or RACH bursts */ - rc = detectBurst(*burst, amp, toa, type); + rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, amp, toa, + (type==RACH)?mMaxExpectedDelayAB:mMaxExpectedDelayNB); if (rc > 0) { type = (CorrType) rc; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 425b004..3c70e5c 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -202,10 +202,6 @@ /** send messages over the clock socket */ void writeClockInterface(void); - /** Detectbursts */ - int detectBurst(signalVector &burst, - complex &, float &toa, CorrType type); - /** Demodulate burst and output soft bits */ SoftVector *demodulate(signalVector &burst, complex amp, float toa, CorrType type); diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 6f50f04..2de1816 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1925,6 +1925,38 @@ return rc; } +int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold, + int sps, CorrType type, complex &, float &toa, + unsigned max_toa) +{ + int rc = 0; + + switch (type) { + case EDGE: + rc = detectEdgeBurst(burst, tsc, threshold, sps, + amp, toa, max_toa); + if (rc > 0) + break; + else + type = TSC; + case TSC: + rc = analyzeTrafficBurst(burst, tsc, threshold, sps, + amp, toa, max_toa); + break; + case RACH: + rc = detectRACHBurst(burst, threshold, sps, amp, toa, + max_toa); + break; + default: + LOG(ERR) << "Invalid correlation type"; + } + + if (rc > 0) + return type; + + return rc; +} + signalVector *downsampleBurst(signalVector &burst) { signalVector *in, *out; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 7bdbde8..6413b47 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -255,6 +255,28 @@ unsigned max_toa); /** + 8-PSK/GMSK/RACH burst detector + @param burst The received GSM burst of interest + @param tsc Midamble type (0..7) also known as TSC + @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. + @param sps The number of samples per GSM symbol. + @param amplitude The estimated amplitude of received TSC burst. + @param toa The estimate time-of-arrival of received TSC burst (in symbols). + @param max_toa The maximum expected time-of-arrival (in symbols). + @return positive value (CorrType) if threshold value is reached, + negative value (-SignalError) on error, + zero (SIGERR_NONE) if no burst is detected +*/ +int detectAnyBurst(signalVector &burst, + unsigned tsc, + float threshold, + int sps, + CorrType type, + complex &, + float &toa, + unsigned max_toa); + +/** Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols -- To view, visit https://gerrit.osmocom.org/2148 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:23:24 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:23:24 +0000 Subject: [MERGED] osmo-trx[master]: Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to ma... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to make it reusable. ...................................................................... Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to make it reusable. Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.h 2 files changed, 9 insertions(+), 9 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index e37c08e..d32967e 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -44,15 +44,6 @@ /* Number of running values use in noise average */ #define NOISE_CNT 20 -/* - * Burst detection threshold - * - * Decision threshold value for burst gating on peak-to-average value of - * correlated synchronization sequences. Lower values pass more bursts up - * to upper layers but will increase the false detection rate. - */ -#define BURST_THRESH 4.0 - TransceiverState::TransceiverState() : mRetrans(false), mNoiseLev(0.0), mNoises(NOISE_CNT), mPower(0.0) { diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 6413b47..04c4757 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -50,6 +50,15 @@ SIGERR_INTERNAL, }; +/* + * Burst detection threshold + * + * Decision threshold value for burst gating on peak-to-average value of + * correlated synchronization sequences. Lower values pass more bursts up + * to upper layers but will increase the false detection rate. + */ +#define BURST_THRESH 4.0 + /** Convert a linear number to a dB value */ float dB(float x); -- To view, visit https://gerrit.osmocom.org/2149 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:29:57 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:29:57 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Constify demodulation functions burst argument. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: Constify demodulation functions burst argument. ...................................................................... sigProcLib: Constify demodulation functions burst argument. demodCommon() used to scale input vector in place which changed original data. That's a bad practice and is not really necessary, so I've changed the code to scale burst after it's copied to a new vector during a delay operation. Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3 --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 10 insertions(+), 10 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index eaaae34..4c2222c 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1253,7 +1253,7 @@ } } -signalVector *delayVector(signalVector *in, signalVector *out, float delay) +signalVector *delayVector(const signalVector *in, signalVector *out, float delay) { int whole, index; float frac; @@ -2060,7 +2060,7 @@ * the output is downsampled prior to the 1 SPS modulation specific * stages. */ -static signalVector *demodCommon(signalVector &burst, int sps, +static signalVector *demodCommon(const signalVector &burst, int sps, complex chan, float toa) { signalVector *delay, *dec; @@ -2068,8 +2068,8 @@ if ((sps != 1) && (sps != 4)) return NULL; - scaleVector(burst, (complex) 1.0 / chan); delay = delayVector(&burst, NULL, -toa * (float) sps); + scaleVector(*delay, (complex) 1.0 / chan); if (sps == 1) return delay; @@ -2085,7 +2085,7 @@ * 4 SPS (if activated) to minimize distortion through the fractional * delay filters. Symbol rotation and after always operates at 1 SPS. */ -SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(const signalVector &rxBurst, int sps, complex channel, float TOA) { SoftVector *bits; @@ -2114,7 +2114,7 @@ * through the fractional delay filters at 1 SPS renders signal * nearly unrecoverable. */ -SoftVector *demodEdgeBurst(signalVector &burst, int sps, +SoftVector *demodEdgeBurst(const signalVector &burst, int sps, complex chan, float toa) { SoftVector *bits; @@ -2138,7 +2138,7 @@ return bits; } -SoftVector *demodAnyBurst(signalVector &burst, int sps, complex amp, +SoftVector *demodAnyBurst(const signalVector &burst, int sps, complex amp, float toa, CorrType type) { if (type == EDGE) diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index a67b0ca..4318fe0 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -152,7 +152,7 @@ float sinc(float x); /** Delay a vector */ -signalVector *delayVector(signalVector *in, signalVector *out, float delay); +signalVector *delayVector(const signalVector *in, signalVector *out, float delay); /** Add two vectors in-place */ bool addVector(signalVector &x, @@ -311,7 +311,7 @@ @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, +SoftVector *demodGmskBurst(const signalVector &rxBurst, int sps, complex channel, float TOA); /** @@ -322,11 +322,11 @@ @param TOA The time-of-arrival of the received burst. @return The demodulated bit sequence. */ -SoftVector *demodEdgeBurst(signalVector &rxBurst, int sps, +SoftVector *demodEdgeBurst(const signalVector &rxBurst, int sps, complex channel, float TOA); /** Demodulate burst basde on type and output soft bits */ -SoftVector *demodAnyBurst(signalVector &burst, int sps, +SoftVector *demodAnyBurst(const signalVector &burst, int sps, complex amp, float toa, CorrType type); #endif /* SIGPROCLIB_H */ -- To view, visit https://gerrit.osmocom.org/2154 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic45f71b634e48808356d68925bb9f5783e0bf0d3 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:29:57 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:29:57 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: constify signalVector arguments for detectBurst(... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: constify signalVector arguments for detectBurst() functions. ...................................................................... sigProcLib: constify signalVector arguments for detectBurst() functions. Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 24 insertions(+), 23 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 467a203..eaaae34 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1707,7 +1707,7 @@ return (amp.abs()) / rms; } -float energyDetect(signalVector &rxBurst, unsigned windowLength) +float energyDetect(const signalVector &rxBurst, unsigned windowLength) { signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; @@ -1729,12 +1729,13 @@ * For higher oversampling values, we assume the energy detector is in place * and we run full interpolating peak detection. */ -static int detectBurst(signalVector &burst, +static int detectBurst(const signalVector &burst, signalVector &corr, CorrelationSequence *sync, float thresh, int sps, complex *amp, float *toa, int start, int len) { - signalVector *corr_in, *dec = NULL; + const signalVector *corr_in; + signalVector *dec = NULL; if (sps == 4) { dec = downsampleBurst(burst); @@ -1782,7 +1783,7 @@ return 1; } -static float maxAmplitude(signalVector &burst) +static float maxAmplitude(const signalVector &burst) { float max = 0.0; for (size_t i = 0; i < burst.size(); i++) { @@ -1803,13 +1804,13 @@ * head: Search symbols before target * tail: Search symbols after target */ -int detectGeneralBurst(signalVector &rxBurst, - float thresh, - int sps, - complex &, - float &toa, - int target, int head, int tail, - CorrelationSequence *sync) +static int detectGeneralBurst(const signalVector &rxBurst, + float thresh, + int sps, + complex &, + float &toa, + int target, int head, int tail, + CorrelationSequence *sync) { int rc, start, len; bool clipping = false; @@ -1858,7 +1859,7 @@ * head: Search 8 symbols before target * tail: Search 8 symbols + maximum expected delay */ -int detectRACHBurst(signalVector &burst, +int detectRACHBurst(const signalVector &burst, float threshold, int sps, complex &litude, @@ -1887,7 +1888,7 @@ * head: Search 6 symbols before target * tail: Search 6 symbols + maximum expected delay */ -int analyzeTrafficBurst(signalVector &burst, unsigned tsc, float threshold, +int analyzeTrafficBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; @@ -1906,7 +1907,7 @@ return rc; } -int detectEdgeBurst(signalVector &burst, unsigned tsc, float threshold, +int detectEdgeBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, complex &litude, float &toa, unsigned max_toa) { int rc, target, head, tail; @@ -1925,7 +1926,7 @@ return rc; } -int detectAnyBurst(signalVector &burst, unsigned tsc, float threshold, +int detectAnyBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, CorrType type, complex &, float &toa, unsigned max_toa) { @@ -1957,7 +1958,7 @@ return rc; } -signalVector *downsampleBurst(signalVector &burst) +signalVector *downsampleBurst(const signalVector &burst) { signalVector *in, *out; @@ -2085,7 +2086,7 @@ * delay filters. Symbol rotation and after always operates at 1 SPS. */ SoftVector *demodGmskBurst(signalVector &rxBurst, int sps, - complex channel, float TOA) + complex channel, float TOA) { SoftVector *bits; signalVector *dec; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index a10d551..a67b0ca 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -201,7 +201,7 @@ @param windowLength The number of burst samples used to compute burst energy @return The average power of the received burst. */ -float energyDetect(signalVector &rxBurst, +float energyDetect(const signalVector &rxBurst, unsigned windowLength); /** @@ -216,7 +216,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int detectRACHBurst(signalVector &burst, +int detectRACHBurst(const signalVector &burst, float threshold, int sps, complex &litude, @@ -236,7 +236,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int analyzeTrafficBurst(signalVector &burst, +int analyzeTrafficBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, @@ -257,7 +257,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int detectEdgeBurst(signalVector &burst, +int detectEdgeBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, @@ -278,7 +278,7 @@ negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected */ -int detectAnyBurst(signalVector &burst, +int detectAnyBurst(const signalVector &burst, unsigned tsc, float threshold, int sps, @@ -292,7 +292,7 @@ @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ -signalVector *downsampleBurst(signalVector &burst); +signalVector *downsampleBurst(const signalVector &burst); /** Decimate a vector. -- To view, visit https://gerrit.osmocom.org/2153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic033371a387353eb12b1827a0eb16c00c07da88a Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:29:58 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:29:58 +0000 Subject: [MERGED] osmo-trx[master]: Move Transceiver::demodulate() to sigProcLib to make it reus... In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: Move Transceiver::demodulate() to sigProcLib to make it reusable. ...................................................................... Move Transceiver::demodulate() to sigProcLib to make it reusable. Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 4 files changed, 14 insertions(+), 17 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index d32967e..4616fea 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -533,18 +533,6 @@ } } -/* - * Demodulate GMSK by direct rotation and soft slicing. - */ -SoftVector *Transceiver::demodulate(signalVector &burst, complex amp, - float toa, CorrType type) -{ - if (type == EDGE) - return demodEdgeBurst(burst, mSPSRx, amp, toa); - - return demodGmskBurst(burst, mSPSRx, amp, toa); -} - void writeToFile(radioVector *radio_burst, size_t chan) { GSM::Time time = radio_burst->getTime(); @@ -656,7 +644,7 @@ timingOffset = toa; - bits = demodulate(*burst, amp, toa, type); + bits = demodAnyBurst(*burst, mSPSRx, amp, toa, type); delete radio_burst; return bits; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 3c70e5c..6f9cb92 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -202,10 +202,6 @@ /** send messages over the clock socket */ void writeClockInterface(void); - /** Demodulate burst and output soft bits */ - SoftVector *demodulate(signalVector &burst, - complex amp, float toa, CorrType type); - int mSPSTx; ///< number of samples per Tx symbol int mSPSRx; ///< number of samples per Rx symbol size_t mChans; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index d57f8b4..467a203 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2137,6 +2137,15 @@ return bits; } +SoftVector *demodAnyBurst(signalVector &burst, int sps, complex amp, + float toa, CorrType type) +{ + if (type == EDGE) + return demodEdgeBurst(burst, sps, amp, toa); + else + return demodGmskBurst(burst, sps, amp, toa); +} + bool sigProcLibSetup() { initTrigTables(); diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index da009a5..a10d551 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -325,4 +325,8 @@ SoftVector *demodEdgeBurst(signalVector &rxBurst, int sps, complex channel, float TOA); +/** Demodulate burst basde on type and output soft bits */ +SoftVector *demodAnyBurst(signalVector &burst, int sps, + complex amp, float toa, CorrType type); + #endif /* SIGPROCLIB_H */ -- To view, visit https://gerrit.osmocom.org/2152 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:29:58 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:29:58 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib.h: Fix whitespaces. No non-whitespace changes. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib.h: Fix whitespaces. No non-whitespace changes. ...................................................................... sigProcLib.h: Fix whitespaces. No non-whitespace changes. The file seem to be using "2 spaces" indent, bt some lines are using tabs which breaks formatting. Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 --- M Transceiver52M/sigProcLib.h 1 file changed, 46 insertions(+), 46 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 4f2c13e..da009a5 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -21,9 +21,9 @@ #include "signalVector.h" /* Burst lengths */ -#define NORMAL_BURST_NBITS 148 -#define EDGE_BURST_NBITS 444 -#define EDGE_BURST_NSYMS (EDGE_BURST_NBITS / 3) +#define NORMAL_BURST_NBITS 148 +#define EDGE_BURST_NBITS 444 +#define EDGE_BURST_NSYMS (EDGE_BURST_NBITS / 3) /** Convolution type indicator */ enum ConvType { @@ -79,55 +79,55 @@ /** Destroy the signal processing library */ void sigProcLibDestroy(void); -/** - Convolve two vectors. - @param a,b The vectors to be convolved. - @param c, A preallocated vector to hold the convolution result. - @param spanType The type/span of the convolution. - @return The convolution result or NULL on error. +/** + Convolve two vectors. + @param a,b The vectors to be convolved. + @param c, A preallocated vector to hold the convolution result. + @param spanType The type/span of the convolution. + @return The convolution result or NULL on error. */ signalVector *convolve(const signalVector *a, const signalVector *b, signalVector *c, ConvType spanType, size_t start = 0, size_t len = 0, size_t step = 1, int offset = 0); -/** +/** Frequency shift a vector. - @param y The frequency shifted vector. - @param x The vector to-be-shifted. - @param freq The digital frequency shift - @param startPhase The starting phase of the oscillator - @param finalPhase The final phase of the oscillator - @return The frequency shifted vector. + @param y The frequency shifted vector. + @param x The vector to-be-shifted. + @param freq The digital frequency shift + @param startPhase The starting phase of the oscillator + @param finalPhase The final phase of the oscillator + @return The frequency shifted vector. */ signalVector* frequencyShift(signalVector *y, - signalVector *x, - float freq = 0.0, - float startPhase = 0.0, - float *finalPhase=NULL); + signalVector *x, + float freq = 0.0, + float startPhase = 0.0, + float *finalPhase=NULL); -/** - Correlate two vectors. +/** + Correlate two vectors. @param a,b The vectors to be correlated. @param c, A preallocated vector to hold the correlation result. @param spanType The type/span of the correlation. @return The correlation result. */ signalVector* correlate(signalVector *a, - signalVector *b, - signalVector *c, - ConvType spanType, + signalVector *b, + signalVector *c, + ConvType spanType, bool bReversedConjugated = false, - unsigned startIx = 0, - unsigned len = 0); + unsigned startIx = 0, + unsigned len = 0); /** Operate soft slicer on a soft-bit vector */ bool vectorSlicer(SoftVector *x); /** GMSK modulate a GSM burst of bits */ signalVector *modulateBurst(const BitVector &wBurst, - int guardPeriodLength, - int sps, bool emptyPulse = false); + int guardPeriodLength, + int sps, bool emptyPulse = false); /** 8-PSK modulate a burst of bits */ signalVector *modulateEdgeBurst(const BitVector &bits, @@ -156,7 +156,7 @@ /** Add two vectors in-place */ bool addVector(signalVector &x, - signalVector &y); + signalVector &y); /** Multiply two vectors in-place*/ bool multVector(signalVector &x, @@ -168,24 +168,24 @@ complex mean = complex(0.0)); /** - Given a non-integer index, interpolate a sample. - @param inSig The signal from which to interpolate. - @param ix The index. - @return The interpolated signal value. + Given a non-integer index, interpolate a sample. + @param inSig The signal from which to interpolate. + @param ix The index. + @return The interpolated signal value. */ complex interpolatePoint(const signalVector &inSig, - float ix); + float ix); /** - Given a correlator output, locate the correlation peak. - @param rxBurst The correlator result. - @param peakIndex Pointer to value to receive interpolated peak index. - @param avgPower Power to value to receive mean power. - @return Peak value. + Given a correlator output, locate the correlation peak. + @param rxBurst The correlator result. + @param peakIndex Pointer to value to receive interpolated peak index. + @param avgPower Power to value to receive mean power. + @return Peak value. */ complex peakDetect(const signalVector &rxBurst, - float *peakIndex, - float *avgPwr); + float *peakIndex, + float *avgPwr); /** Apply a scalar to a vector. @@ -193,7 +193,7 @@ @param scale The scalar. */ void scaleVector(signalVector &x, - complex scale); + complex scale); /** Rough energy estimator. @@ -288,14 +288,14 @@ unsigned max_toa); /** - Downsample 4 SPS to 1 SPS using a polyphase filterbank + Downsample 4 SPS to 1 SPS using a polyphase filterbank @param burst Input burst of at least 624 symbols @return Decimated signal vector of 156 symbols */ signalVector *downsampleBurst(signalVector &burst); /** - Decimate a vector. + Decimate a vector. @param wVector The vector of interest. @param factor Decimation factor. @return The decimated signal vector. @@ -316,7 +316,7 @@ /** Demodulate 8-PSK EDGE burst with soft symbol ooutput - @param rxBurst The burst to be demodulated. + @param rxBurst The burst to be demodulated. @param sps The number of samples per GSM symbol. @param channel The amplitude estimate of the received burst. @param TOA The time-of-arrival of the received burst. -- To view, visit https://gerrit.osmocom.org/2151 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7718cca45c245c9e91250ab2877f5436d4029698 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 14:29:58 2017 From: gerrit-no-reply at lists.osmocom.org (Alexander Chemeris) Date: Tue, 28 Mar 2017 14:29:58 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Add operator<< to print CorrType to a string. In-Reply-To: References: Message-ID: Alexander Chemeris has submitted this change and it was merged. Change subject: sigProcLib: Add operator<< to print CorrType to a string. ...................................................................... sigProcLib: Add operator<< to print CorrType to a string. Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 25 insertions(+), 0 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 2de1816..d57f8b4 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -2166,3 +2166,26 @@ sigProcLibDestroy(); return false; } + +std::string corrTypeToString(CorrType corr) { + switch (corr) { + case OFF: + return "OFF"; + case TSC: + return "TSC"; + case RACH: + return "RACH"; + case EDGE: + return "EDGE"; + case IDLE: + return "IDLE"; + default: + return "unknown"; + } +} + +std::ostream& operator<<(std::ostream& os, CorrType corr) +{ + os << corrTypeToString(corr); + return os; +} diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 04c4757..4f2c13e 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -41,6 +41,8 @@ EDGE, ///< timeslot should contain an EDGE burst IDLE ///< timeslot is an idle (or dummy) burst }; +std::string corrTypeToString(CorrType corr); +std::ostream& operator<<(std::ostream& os, CorrType corr); enum SignalError { SIGERR_NONE, -- To view, visit https://gerrit.osmocom.org/2150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3d68cbdab8fb504d7f155029654a576d318a201e Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 21:31:58 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Tue, 28 Mar 2017 21:31:58 +0000 Subject: osmo-trx[master]: sigProcLib: Fix negative value check on unsigned value In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2163 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Mar 28 21:44:37 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Tue, 28 Mar 2017 21:44:37 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Remove unreachable code and no-effect checks Message-ID: Review at https://gerrit.osmocom.org/2171 sigProcLib: Remove unreachable code and no-effect checks Unreachable path and negative value inspection on unsigned types. Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Fixes: Coverity CID 165239, 165238, 165236 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 2 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/71/2171/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 4c2222c..9673d99 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1773,10 +1773,6 @@ /* Normalize our channel gain */ *amp = *amp / sync->gain; - /* Compenate for residual rotation with dual Laurent pulse */ - if (sps == 4) - *amp = *amp * complex(0.0, 1.0); - /* Compensate for residuate time lag */ *toa = *toa - sync->toa; @@ -1894,7 +1890,7 @@ int rc, target, head, tail; CorrelationSequence *sync; - if ((tsc < 0) || (tsc > 7)) + if (tsc > 7) return -SIGERR_UNSUPPORTED; target = 3 + 58 + 16 + 5; @@ -1913,7 +1909,7 @@ int rc, target, head, tail; CorrelationSequence *sync; - if ((tsc < 0) || (tsc > 7)) + if (tsc > 7) return -SIGERR_UNSUPPORTED; target = 3 + 58 + 16 + 5; -- To view, visit https://gerrit.osmocom.org/2171 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Mar 28 22:24:41 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Tue, 28 Mar 2017 22:24:41 +0000 Subject: [PATCH] osmo-trx[master]: sigProcLib: Check return status on downsampling Message-ID: Review at https://gerrit.osmocom.org/2172 sigProcLib: Check return status on downsampling Improper length values will cause the polyphase resampler rotation to fail. Check return and return NULL on error. Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Fixes: Coverity CID 165235 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/72/2172/1 diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 9673d99..4bb41a9 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1962,8 +1962,12 @@ out = new signalVector(DOWNSAMPLE_OUT_LEN); memcpy(in->begin(), burst.begin(), DOWNSAMPLE_IN_LEN * 2 * sizeof(float)); - dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN, - (float *) out->begin(), DOWNSAMPLE_OUT_LEN); + if (dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN, + (float *) out->begin(), DOWNSAMPLE_OUT_LEN) < 0) { + delete out; + out = NULL; + } + delete in; return out; }; -- To view, visit https://gerrit.osmocom.org/2172 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:20:42 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:20:42 +0000 Subject: [MERGED] libosmo-netif[master]: stream client: Ensure client is notified on reconnection In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream client: Ensure client is notified on reconnection ...................................................................... stream client: Ensure client is notified on reconnection without setting the BSC_FD_* flags prior to reconnection, the re-connect would happen silently and the client program would not be notified via the connect_cb(). Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 --- M src/stream.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/stream.c b/src/stream.c index f5408f8..287e297 100644 --- a/src/stream.c +++ b/src/stream.c @@ -340,6 +340,7 @@ switch(cli->state) { case STREAM_CLI_STATE_CONNECTING: + cli->ofd.when |= BSC_FD_READ | BSC_FD_WRITE; osmo_stream_cli_open2(cli, 1); break; default: -- To view, visit https://gerrit.osmocom.org/2132 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaf8ec8662cf83476eee1b76fa41dc57f063f0ad3 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:23:54 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:23:54 +0000 Subject: [PATCH] libosmo-netif[master]: stream.c: Handle SCTP in osmo_stream_srv_recv() Message-ID: Review at https://gerrit.osmocom.org/2173 stream.c: Handle SCTP in osmo_stream_srv_recv() Change-Id: If0875cfa3eba9ef36acc0c4bfd0d168a45c380b9 --- M src/stream.c 1 file changed, 57 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/73/2173/1 diff --git a/src/stream.c b/src/stream.c index 287e297..6b8bc95 100644 --- a/src/stream.c +++ b/src/stream.c @@ -662,9 +662,65 @@ int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg) { +#ifdef HAVE_LIBSCTP + struct sctp_sndrcvinfo sinfo; + int flags = 0; +#endif int ret; - ret = recv(conn->ofd.fd, msgb_data(msg), msgb_tailroom(msg), 0); + if (!msg) + return -EINVAL; + + switch (conn->srv->proto) { +#ifdef HAVE_LIBSCTP + case IPPROTO_SCTP: + ret = sctp_recvmsg(conn->ofd.fd, msgb_data(msg), msgb_tailroom(msg), + NULL, NULL, &sinfo, &flags); + if (flags & MSG_NOTIFICATION) { + union sctp_notification *notif = (union sctp_notification *) msgb_data(msg); + LOGP(DLINP, LOGL_DEBUG, "NOTIFICATION %u flags=0x%x\n", notif->sn_header.sn_type, notif->sn_header.sn_flags); + switch (notif->sn_header.sn_type) { + case SCTP_ASSOC_CHANGE: + LOGP(DLINP, LOGL_DEBUG, "===> ASSOC CHANGE:"); + switch (notif->sn_assoc_change.sac_state) { + case SCTP_COMM_UP: + LOGPC(DLINP, LOGL_DEBUG, " UP\n"); + break; + case SCTP_COMM_LOST: + LOGPC(DLINP, LOGL_DEBUG, " LOST\n"); + break; + case SCTP_RESTART: + LOGPC(DLINP, LOGL_DEBUG, " RESTART\n"); + break; + case SCTP_SHUTDOWN_COMP: + LOGPC(DLINP, LOGL_DEBUG, " SHUTDOWN COMP\n"); + break; + case SCTP_CANT_STR_ASSOC: + LOGPC(DLINP, LOGL_DEBUG, " CANT STR ASSOC\n"); + break; + } + break; + case SCTP_PEER_ADDR_CHANGE: + LOGP(DLINP, LOGL_DEBUG, "===> PEER ADDR CHANGE\n"); + break; + case SCTP_SHUTDOWN_EVENT: + LOGP(DLINP, LOGL_DEBUG, "===> SHUTDOWN EVT\n"); + /* Handle this like a regular disconnect */ + return 0; + break; + } + return -EAGAIN; + } + msgb_sctp_ppid(msg) = ntohl(sinfo.sinfo_ppid); + msgb_sctp_stream(msg) = ntohl(sinfo.sinfo_stream); + break; +#endif + case IPPROTO_TCP: + default: + ret = recv(conn->ofd.fd, msgb_data(msg), msgb_tailroom(msg), 0); + break; + } + if (ret < 0) { if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, -- To view, visit https://gerrit.osmocom.org/2173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If0875cfa3eba9ef36acc0c4bfd0d168a45c380b9 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: daniel From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:28:33 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:28:33 +0000 Subject: libosmo-netif[master]: stream.c: Handle SCTP in osmo_stream_srv_recv() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If0875cfa3eba9ef36acc0c4bfd0d168a45c380b9 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:29:50 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:29:50 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 5: You could start to use libosmovty and turn the program into a "true" osmocom component, with VTY interface and related config file... -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 5 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:30:29 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:30:29 +0000 Subject: osmo-pcu[master]: cosmetic: BitcompTest: make readable In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2167 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id0da9d9b67f4713d3a67e3532ed44b8cb1bd1d08 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:30:47 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:30:47 +0000 Subject: osmo-pcu[master]: bitcomp test: fix: only one hexdump per log; use printf In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2168 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I24fc32eb55baaf22f9c6fdda917bfb8395d02b1c Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:30:53 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:30:53 +0000 Subject: osmo-pcu[master]: bitcomp test: fix: also verify bits after decoded data In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2169 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2501208e2f8b4f709efbcadbd1057c086472c9e6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:31:04 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:31:04 +0000 Subject: osmo-pcu[master]: bitcomp test: use expected rc instead of 'verify' flag In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2170 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icf815a8f1acb0e275463408450171df046879847 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:31:11 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:31:11 +0000 Subject: [MERGED] osmo-pcu[master]: bitcomp test: use expected rc instead of 'verify' flag In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bitcomp test: use expected rc instead of 'verify' flag ...................................................................... bitcomp test: use expected rc instead of 'verify' flag The 'verify' flag is useless, we always want to verify everything. Replace 'verify' with 'expect_rc', expecting a specific decoding result per test set. When an error code was returned, cut short the loop and skip printing expected vs. decoded bits. This uncovers the fact that the first test marked as "invalid inputs" does not seem to be invalid after all, or at least does not produce an error to be returned. For now, only uncover this fact, the fix shall be submitted later. Change-Id: Icf815a8f1acb0e275463408450171df046879847 --- M tests/bitcomp/BitcompTest.cpp M tests/bitcomp/BitcompTest.err 2 files changed, 51 insertions(+), 41 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index c5fde2e..4ec6f29 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -29,7 +29,7 @@ uint8_t crbb_data[MAX_CRBB_LEN]; /* compressed data */ uint8_t ucmp_data[MAX_URBB_LEN]; /* uncompressed data */ int ucmp_len; - int verify; + int expect_rc; } test[] = { { .crbb_len = 67, .cc = 1, .crbb_data = { @@ -40,7 +40,8 @@ 0xff, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xc0 }, - .ucmp_len = 194, .verify = 1 + .ucmp_len = 194, + .expect_rc = 0, }, { .crbb_len = 40, .cc = 1, .crbb_data = { @@ -51,12 +52,14 @@ 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 }, - .ucmp_len = 182, .verify = 1 + .ucmp_len = 182, + .expect_rc = 0, }, { .crbb_len = 8, .cc = 1, .crbb_data = {0x02}, .ucmp_data = {0xff, 0xff, 0xff, 0xf8}, - .ucmp_len = 29, .verify = 1 + .ucmp_len = 29, + .expect_rc = 0, }, { .crbb_len = 103, .cc = 1, .crbb_data = { @@ -69,13 +72,15 @@ 0x0f, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff }, - .ucmp_len = 288, .verify = 1 + .ucmp_len = 288, + .expect_rc = 0, }, /* Test vector from libosmocore test */ { .crbb_len = 35, .cc = 0, .crbb_data = {0xde, 0x88, 0x75, 0x65, 0x80}, .ucmp_data = {0x37, 0x47, 0x81, 0xf0}, - .ucmp_len = 28, .verify = 1 + .ucmp_len = 28, + .expect_rc = 0, }, { .crbb_len = 18, .cc = 1, .crbb_data = {0xdd, 0x41, 0x00}, @@ -83,23 +88,28 @@ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }, - .ucmp_len = 90, .verify = 1 + .ucmp_len = 90, + .expect_rc = 0, }, - /*Invalid inputs*/ + /* TODO: previously marked as "Invalid inputs" but succeeds */ { .crbb_len = 18, .cc = 1, .crbb_data = {0x1E, 0x70, 0xc0}, - .ucmp_data = {0x0}, - .ucmp_len = 0, .verify = 0 + .ucmp_data = {0xb0, 0x00, 0x00}, + .ucmp_len = 19, + .expect_rc = 0, }, + /* Invalid inputs */ { .crbb_len = 14, .cc = 1, .crbb_data = {0x00, 0x1E, 0x7c}, .ucmp_data = {0x0}, - .ucmp_len = 0, .verify = 0 + .ucmp_len = 0, + .expect_rc = -1, }, { .crbb_len = 24, .cc = 0, .crbb_data = {0x00, 0x00, 0x00}, .ucmp_data = {0x0}, - .ucmp_len = 0, .verify = 0 + .ucmp_len = 0, + .expect_rc = -1, } }; @@ -158,28 +168,29 @@ test[itr].crbb_len); rc = egprs_compress::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].crbb_data, &dest); + _LOG("rc = %d\n", rc); + OSMO_ASSERT(test[itr].expect_rc == rc); if (rc < 0) { - _LOG("\nFailed to decode CRBB: length %d, data %s", + _LOG("Failed to decode CRBB: length %d, data %s\n", test[itr].crbb_len, osmo_hexdump(test[itr].crbb_data, CEIL_DIV_8(test[itr].crbb_len))); + continue; } - if (test[itr].verify) { - if (!result_matches(dest, test[itr].ucmp_data, - test[itr].ucmp_len)) { - _LOG("\nTree based decoding: Error\n" - "expected data = %s\n" - "expected len = %d\n", - osmo_hexdump(test[itr].ucmp_data, - CEIL_DIV_8(test[itr].ucmp_len)), - test[itr].ucmp_len); - _LOG("decoded data = %s\n" - "decoded len = %d\n", - osmo_hexdump(dest.data, - CEIL_DIV_8(dest.cur_bit)), - dest.cur_bit); - OSMO_ASSERT(0); - } + if (!result_matches(dest, test[itr].ucmp_data, + test[itr].ucmp_len)) { + _LOG("\nTree based decoding: Error\n" + "expected data = %s\n" + "expected len = %d\n", + osmo_hexdump(test[itr].ucmp_data, + CEIL_DIV_8(test[itr].ucmp_len)), + test[itr].ucmp_len); + _LOG("decoded data = %s\n" + "decoded len = %d\n", + osmo_hexdump(dest.data, + CEIL_DIV_8(dest.cur_bit)), + dest.cur_bit); + OSMO_ASSERT(0); } _LOG("\nexpected data = %s\n" "expected len = %d\n", diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err index 1d6fb00..2eabd78 100644 --- a/tests/bitcomp/BitcompTest.err +++ b/tests/bitcomp/BitcompTest.err @@ -10,6 +10,7 @@ Run_length = 31 Run_length = 19 Run_length = 32 +rc = 0 expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 expected len = 194 @@ -24,6 +25,7 @@ Run_length = 40 Run_length = 51 Run_length = 41 +rc = 0 expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 expected len = 182 @@ -35,6 +37,7 @@ uncompressed data = 02 len = 8 Run_length = 29 +rc = 0 expected data = ff ff ff f8 expected len = 29 @@ -56,6 +59,7 @@ Run_length = 32 Run_length = 22 Run_length = 33 +rc = 0 expected data = ff ff ff f8 00 00 ff ff ff f8 00 00 7f ff ff fe 00 00 0f ff ff ff e0 00 00 7f ff ff ff 80 00 01 ff ff ff ff expected len = 288 @@ -76,6 +80,7 @@ Run_length = 4 Run_length = 6 Run_length = 5 +rc = 0 expected data = 37 47 81 f0 expected len = 28 @@ -89,6 +94,7 @@ Run_length = 64 Run_length = 16 Run_length = 10 +rc = 0 expected data = ff ff ff ff ff ff ff ff ff ff 00 00 expected len = 90 @@ -103,9 +109,10 @@ Run_length = 1 Run_length = 2 Run_length = 15 +rc = 0 -expected data = -expected len = 0 +expected data = b0 00 00 +expected len = 19 decoded data = b0 00 00 decoded len = 19 @@ -113,20 +120,12 @@ Tree based decoding: uncompressed data = 00 1e len = 14 - +rc = -1 Failed to decode CRBB: length 14, data 00 1e -expected data = -expected len = 0 -decoded data = -decoded len = 0 Test:9 Tree based decoding: uncompressed data = 00 00 00 len = 24 - +rc = -1 Failed to decode CRBB: length 24, data 00 00 00 -expected data = -expected len = 0 -decoded data = -decoded len = 0 -- To view, visit https://gerrit.osmocom.org/2170 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icf815a8f1acb0e275463408450171df046879847 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:31:12 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:31:12 +0000 Subject: [MERGED] osmo-pcu[master]: bitcomp test: fix: also verify bits after decoded data In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bitcomp test: fix: also verify bits after decoded data ...................................................................... bitcomp test: fix: also verify bits after decoded data Before this, the expected data had seemingly random bits set after the end of the expected decoding result. Make the test expect these extra bits as zero, matching with the buffer initialization to zero. In result_matches(), compare the full length of bytes instead of masking the bits after the end of the decoded data (which caused us to not catch the wrong expectation until now). This fixes the underlying issues found in http://lists.osmocom.org/pipermail/osmocom-net-gprs/2017-March/000876.html [osmo-pcu 0.2.896-0a8f] testsuite: 4 failed from: Arnaud ZANETTI on: Fri Mar 24 09:53:53 UTC 2017 Change-Id: I2501208e2f8b4f709efbcadbd1057c086472c9e6 --- M tests/bitcomp/BitcompTest.cpp M tests/bitcomp/BitcompTest.err 2 files changed, 5 insertions(+), 16 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index f35d6be..c5fde2e 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -38,7 +38,7 @@ .ucmp_data = { 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, - 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xdb + 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xc0 }, .ucmp_len = 194, .verify = 1 }, @@ -49,7 +49,7 @@ .ucmp_data = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x03 + 0x00, 0x00, 0x00, 0x00, 0x00 }, .ucmp_len = 182, .verify = 1 }, @@ -127,18 +127,7 @@ { if (bits.cur_bit != exp_len) return false; - size_t n = (exp_len / 8); - int rem = (exp_len % 8); - - if (memcmp(exp_data, bits.data, n) == 0) { - if (rem == 0) - return true; - if ((bits.data[n] & MASK(rem)) == ((*(exp_data + n)) & MASK(rem))) - return true; - else - return false; - } else - return false; + return (memcmp(exp_data, bits.data, CEIL_DIV_8(exp_len)) == 0); } /* To test decoding of compressed bitmap by Tree based method diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err index f769daa..1d6fb00 100644 --- a/tests/bitcomp/BitcompTest.err +++ b/tests/bitcomp/BitcompTest.err @@ -11,7 +11,7 @@ Run_length = 19 Run_length = 32 -expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db +expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 expected len = 194 decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 decoded len = 194 @@ -25,7 +25,7 @@ Run_length = 51 Run_length = 41 -expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03 +expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 expected len = 182 decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 decoded len = 182 -- To view, visit https://gerrit.osmocom.org/2169 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2501208e2f8b4f709efbcadbd1057c086472c9e6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:31:16 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:31:16 +0000 Subject: [MERGED] osmo-pcu[master]: bitcomp test: fix: only one hexdump per log; use printf In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bitcomp test: fix: only one hexdump per log; use printf ...................................................................... bitcomp test: fix: only one hexdump per log; use printf The test wants to write multiline results, so it should use printf instead of the logging system. Split logs to only one hexdump per printf(). One cannot use osmo_hexdump twice in one printf(); before this, one of the two hexdumps won, both dumps would show as the same. Very bad for a regression test! This uncovers a discrepancy between expected and produced results, proving that the expected stderr output was not capable of uncovering test failures. The test's check_result() function *has* always verified the decoded data, but only up to the last decoded bit. Our expected data contains seemingly random bits after the end of the decoded bits, but check_result() never compares those, hence we don't catch that error. The extra bits should definitely be zero, because the destination buffer is pre-initialized to zero -- fixed in a subsequent patch. This should cosmetically fix the build failure found in: http://lists.osmocom.org/pipermail/osmocom-net-gprs/2017-March/000876.html [osmo-pcu 0.2.896-0a8f] testsuite: 4 failed from: Arnaud ZANETTI on: Fri Mar 24 09:53:53 UTC 2017 The real fix will follow. Change-Id: I24fc32eb55baaf22f9c6fdda917bfb8395d02b1c --- M tests/bitcomp/BitcompTest.cpp M tests/bitcomp/BitcompTest.err 2 files changed, 17 insertions(+), 19 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index 31aebd4..f35d6be 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -18,6 +18,8 @@ #define MAX_CRBB_LEN 23 #define MAX_URBB_LEN 40 #define CEIL_DIV_8(x) (((x) + 7)/8) +#define _LOG(fmt, args...) \ + fprintf(stderr, fmt, ## args) void *tall_pcu_ctx; @@ -157,8 +159,7 @@ dest.data = bits_data; dest.data_len = sizeof(bits_data); dest.cur_bit = 0; - LOGP(DRLCMACDL, LOGL_DEBUG, - "\nTest:%d\n" + _LOG("\nTest:%d\n" "Tree based decoding:\n" "uncompressed data = %s\n" "len = %d\n", @@ -169,8 +170,7 @@ rc = egprs_compress::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].crbb_data, &dest); if (rc < 0) { - LOGP(DRLCMACUL, LOGL_NOTICE, - "\nFailed to decode CRBB: length %d, data %s", + _LOG("\nFailed to decode CRBB: length %d, data %s", test[itr].crbb_len, osmo_hexdump(test[itr].crbb_data, CEIL_DIV_8(test[itr].crbb_len))); @@ -178,29 +178,27 @@ if (test[itr].verify) { if (!result_matches(dest, test[itr].ucmp_data, test[itr].ucmp_len)) { - LOGP(DRLCMACDL, LOGL_DEBUG, - "\nTree based decoding: Error\n" + _LOG("\nTree based decoding: Error\n" "expected data = %s\n" - "expected len = %d\n" - "decoded data = %s\n" - "decoded len = %d\n", + "expected len = %d\n", osmo_hexdump(test[itr].ucmp_data, CEIL_DIV_8(test[itr].ucmp_len)), - test[itr].ucmp_len, + test[itr].ucmp_len); + _LOG("decoded data = %s\n" + "decoded len = %d\n", osmo_hexdump(dest.data, CEIL_DIV_8(dest.cur_bit)), dest.cur_bit); OSMO_ASSERT(0); } } - LOGP(DRLCMACDL, LOGL_DEBUG, - "\nexpected data = %s\n" - "expected len = %d\n" - "decoded data = %s\n" - "decoded len = %d\n", + _LOG("\nexpected data = %s\n" + "expected len = %d\n", osmo_hexdump(test[itr].ucmp_data, CEIL_DIV_8(test[itr].ucmp_len)), - test[itr].ucmp_len, + test[itr].ucmp_len); + _LOG("decoded data = %s\n" + "decoded len = %d\n", osmo_hexdump(dest.data, CEIL_DIV_8(dest.cur_bit)), dest.cur_bit); } diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err index 7481d72..f769daa 100644 --- a/tests/bitcomp/BitcompTest.err +++ b/tests/bitcomp/BitcompTest.err @@ -13,7 +13,7 @@ expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db expected len = 194 -decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db +decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0 decoded len = 194 Test:2 @@ -27,7 +27,7 @@ expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03 expected len = 182 -decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03 +decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00 decoded len = 182 Test:3 @@ -106,7 +106,7 @@ expected data = expected len = 0 -decoded data = +decoded data = b0 00 00 decoded len = 19 Test:8 -- To view, visit https://gerrit.osmocom.org/2168 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I24fc32eb55baaf22f9c6fdda917bfb8395d02b1c Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:31:17 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:31:17 +0000 Subject: [MERGED] osmo-pcu[master]: cosmetic: BitcompTest: make readable In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: cosmetic: BitcompTest: make readable ...................................................................... cosmetic: BitcompTest: make readable In order to understand what the bitcomp test is logging, cosmetically rearrange the code: - memset bits_data before assigning to destination bitvec. - use macro CEIL_DIV_8 to clarify what (x+7)/8 does. - rename check_result() to result_matches() and return a bool, also constify result_matches() args and pass a bitvec reference instead of copying the bitvec struct. - rearrange logging lines to make readable what is going on there. - drop unused 'init_flag' There are obviously errors like double hexdumps per log line, multiple newlines in a LOGP statement and so forth: these shall be fixed by subsequent patches. Change-Id: Id0da9d9b67f4713d3a67e3532ed44b8cb1bd1d08 --- M tests/bitcomp/BitcompTest.cpp 1 file changed, 45 insertions(+), 37 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index 31b6d11..31aebd4 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -17,6 +17,7 @@ #define MASK(n) (0xFF << (8-n)) #define MAX_CRBB_LEN 23 #define MAX_URBB_LEN 40 +#define CEIL_DIV_8(x) (((x) + 7)/8) void *tall_pcu_ctx; @@ -120,23 +121,22 @@ return 1; } -/* To verify the result with expected result */ -int check_result(bitvec bits, uint8_t *exp_data, unsigned int exp_len) +bool result_matches(const bitvec &bits, const uint8_t *exp_data, unsigned int exp_len) { if (bits.cur_bit != exp_len) - return 0; + return false; size_t n = (exp_len / 8); int rem = (exp_len % 8); if (memcmp(exp_data, bits.data, n) == 0) { if (rem == 0) - return 1; + return true; if ((bits.data[n] & MASK(rem)) == ((*(exp_data + n)) & MASK(rem))) - return 1; + return true; else - return 0; + return false; } else - return 0; + return false; } /* To test decoding of compressed bitmap by Tree based method @@ -146,7 +146,6 @@ static void test_EPDAN_decode_tree(void) { bitvec dest; - int init_flag = 1; unsigned int itr; int rc; uint8_t bits_data[RLC_EGPRS_MAX_WS/8]; @@ -154,47 +153,56 @@ printf("=== start %s ===\n", __func__); for (itr = 0 ; itr < (sizeof(test) / sizeof(test_data)) ; itr++) { + memset(bits_data, 0, sizeof(bits_data)); dest.data = bits_data; dest.data_len = sizeof(bits_data); dest.cur_bit = 0; - memset(dest.data, 0, sizeof(bits_data)); - LOGP(DRLCMACDL, LOGL_DEBUG, "\nTest:%d\nTree based decoding:" - "\nuncompressed data = %s\nlen = %d\n", itr + 1, - osmo_hexdump(test[itr].crbb_data, - (test[itr].crbb_len + 7)/8), test[itr].crbb_len - ); + LOGP(DRLCMACDL, LOGL_DEBUG, + "\nTest:%d\n" + "Tree based decoding:\n" + "uncompressed data = %s\n" + "len = %d\n", + itr + 1, + osmo_hexdump(test[itr].crbb_data, + CEIL_DIV_8(test[itr].crbb_len)), + test[itr].crbb_len); rc = egprs_compress::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].crbb_data, &dest); if (rc < 0) { LOGP(DRLCMACUL, LOGL_NOTICE, - "\nFailed to decode CRBB: length %d, data %s", - test[itr].crbb_len, osmo_hexdump( - test[itr].crbb_data, (test[itr].crbb_len + 7)/8)); + "\nFailed to decode CRBB: length %d, data %s", + test[itr].crbb_len, + osmo_hexdump(test[itr].crbb_data, + CEIL_DIV_8(test[itr].crbb_len))); } - if (init_flag) - init_flag = 0; if (test[itr].verify) { - if (check_result(dest, test[itr].ucmp_data, - test[itr].ucmp_len) == 0) { - LOGP(DRLCMACDL, LOGL_DEBUG, "\nTree based decoding" - ":Error\nexpected data = %s\nexpected" - " len = %d\ndecoded data = %s\n" - "decoded len = %d\n", - osmo_hexdump(test[itr].ucmp_data, - (test[itr].ucmp_len + 7)/8), - test[itr].ucmp_len, osmo_hexdump(dest.data, - (dest.cur_bit + 7)/8), dest.cur_bit - ); + if (!result_matches(dest, test[itr].ucmp_data, + test[itr].ucmp_len)) { + LOGP(DRLCMACDL, LOGL_DEBUG, + "\nTree based decoding: Error\n" + "expected data = %s\n" + "expected len = %d\n" + "decoded data = %s\n" + "decoded len = %d\n", + osmo_hexdump(test[itr].ucmp_data, + CEIL_DIV_8(test[itr].ucmp_len)), + test[itr].ucmp_len, + osmo_hexdump(dest.data, + CEIL_DIV_8(dest.cur_bit)), + dest.cur_bit); OSMO_ASSERT(0); } } - LOGP(DRLCMACDL, LOGL_DEBUG, "\nexpected data = %s\nexpected len = %d" - "\ndecoded data = %s\ndecoded len = %d\n", - osmo_hexdump(test[itr].ucmp_data, - (test[itr].ucmp_len + 7)/8), - test[itr].ucmp_len, osmo_hexdump(dest.data, - (dest.cur_bit + 7)/8), dest.cur_bit - ); + LOGP(DRLCMACDL, LOGL_DEBUG, + "\nexpected data = %s\n" + "expected len = %d\n" + "decoded data = %s\n" + "decoded len = %d\n", + osmo_hexdump(test[itr].ucmp_data, + CEIL_DIV_8(test[itr].ucmp_len)), + test[itr].ucmp_len, + osmo_hexdump(dest.data, CEIL_DIV_8(dest.cur_bit)), + dest.cur_bit); } printf("=== end %s ===\n", __func__); -- To view, visit https://gerrit.osmocom.org/2167 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id0da9d9b67f4713d3a67e3532ed44b8cb1bd1d08 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:32:55 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:32:55 +0000 Subject: osmo-bts[master]: vty: reduce code duplication In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 even if osmo_str2lower() is unfortunate: I still think it's better to have one shared implementation, rather than local ones. -- To view, visit https://gerrit.osmocom.org/2162 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:33:05 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:33:05 +0000 Subject: [MERGED] osmo-bts[master]: vty: reduce code duplication In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: vty: reduce code duplication ...................................................................... vty: reduce code duplication Use libosmocore's osmo_str2lower() instead of local equivalent. Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e --- M src/common/vty.c 1 file changed, 6 insertions(+), 32 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/vty.c b/src/common/vty.c index 646ac87..3f736c9 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -35,7 +35,7 @@ #include #include #include - +#include #include @@ -234,37 +234,11 @@ return CMD_SUCCESS; } -/* FIXME: move to libosmocore ? */ -static char buf_casecnvt[256]; -char *osmo_str_tolower(const char *in) -{ - int len, i; - - if (!in) - return NULL; - - len = strlen(in); - if (len > sizeof(buf_casecnvt)) - len = sizeof(buf_casecnvt); - - for (i = 0; i < len; i++) { - buf_casecnvt[i] = tolower(in[i]); - if (in[i] == '\0') - break; - } - if (i < sizeof(buf_casecnvt)) - buf_casecnvt[i] = '\0'; - - /* just to make sure we're always zero-terminated */ - buf_casecnvt[sizeof(buf_casecnvt)-1] = '\0'; - - return buf_casecnvt; -} - static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) { struct gsm_bts_role_bts *btsb = bts_role_bts(bts); struct gsm_bts_trx *trx; + char buf_casecnvt[256]; int i; vty_out(vty, "bts %u%s", bts->nr, VTY_NEWLINE); @@ -294,13 +268,13 @@ for (i = 0; i < 32; i++) { if (gsmtap_sapi_mask & (1 << i)) { - const char *name = get_value_string(gsmtap_sapi_names, i); - vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); + osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, i)); + vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE); } } if (gsmtap_sapi_acch) { - const char *name = get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH); - vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); + osmo_str2lower(buf_casecnvt, get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH)); + vty_out(vty, " gsmtap-sapi %s%s", buf_casecnvt, VTY_NEWLINE); } vty_out(vty, " min-qual-rach %.0f%s", btsb->min_qual_rach * 10.0f, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/2162 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7faced2eaf0f6f87f06081235eea9d4c3ba71a7e Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:34:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:34:14 +0000 Subject: libosmo-abis[master]: configure: Fix compilation with new libortp In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2164 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:34:15 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:34:15 +0000 Subject: [MERGED] libosmo-abis[master]: configure: Fix compilation with new libortp In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: configure: Fix compilation with new libortp ...................................................................... configure: Fix compilation with new libortp Commit 0c8d9ddaea8c1afdc0e9b8c37a31c9d158e57efd in ortp broke old API: function ortp_set_log_level_mask requires one new parameter 'domain'. This commit fixes compilation in my Archlinux box using ortp 1.0.1. Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 --- M configure.ac M src/trau/osmo_ortp.c 2 files changed, 21 insertions(+), 3 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/configure.ac b/configure.ac index 99d83f6..43266be 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,16 @@ CPPFLAGS+=" -fsanitize=address -fsanitize=undefined" fi +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ortp_set_log_level_mask(NULL, 0xffff);]] + )], + [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1], + [ortp_set_log_level_mask requires domain parameter])], + [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0], + [ortp_set_log_level_mask has no domain parameter])]) + AC_OUTPUT( libosmoabis.pc libosmotrau.pc diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index d4d4ff5..141065e 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -94,8 +94,11 @@ return LOGL_ERROR; } -static void my_ortp_logfn(OrtpLogLevel lev, const char *fmt, - va_list args) +static void my_ortp_logfn( +#if HAVE_ORTP_LOG_DOMAIN + const char *domain, +#endif + OrtpLogLevel lev, const char *fmt, va_list args) { osmo_vlogp(DLMIB, ortp_to_osmo_lvl(lev), __FILE__, 0, 0, fmt, args); @@ -273,7 +276,12 @@ tall_rtp_ctx = ctx; ortp_set_memory_functions(&osmo_ortp_memfn); ortp_init(); - ortp_set_log_level_mask(0xffff); + ortp_set_log_level_mask( +#if HAVE_ORTP_LOG_DOMAIN + ORTP_LOG_DOMAIN, +#endif + 0xffff); + ortp_set_log_handler(my_ortp_logfn); create_payload_types(); } -- To view, visit https://gerrit.osmocom.org/2164 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I46e565f1873c7baf3c3b0aafe73951d20ce083b4 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:34:59 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:34:59 +0000 Subject: [MERGED] libosmo-netif[master]: stream.c: Handle SCTP in osmo_stream_srv_recv() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream.c: Handle SCTP in osmo_stream_srv_recv() ...................................................................... stream.c: Handle SCTP in osmo_stream_srv_recv() Change-Id: If0875cfa3eba9ef36acc0c4bfd0d168a45c380b9 --- M src/stream.c 1 file changed, 57 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/stream.c b/src/stream.c index 287e297..6b8bc95 100644 --- a/src/stream.c +++ b/src/stream.c @@ -662,9 +662,65 @@ int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg) { +#ifdef HAVE_LIBSCTP + struct sctp_sndrcvinfo sinfo; + int flags = 0; +#endif int ret; - ret = recv(conn->ofd.fd, msgb_data(msg), msgb_tailroom(msg), 0); + if (!msg) + return -EINVAL; + + switch (conn->srv->proto) { +#ifdef HAVE_LIBSCTP + case IPPROTO_SCTP: + ret = sctp_recvmsg(conn->ofd.fd, msgb_data(msg), msgb_tailroom(msg), + NULL, NULL, &sinfo, &flags); + if (flags & MSG_NOTIFICATION) { + union sctp_notification *notif = (union sctp_notification *) msgb_data(msg); + LOGP(DLINP, LOGL_DEBUG, "NOTIFICATION %u flags=0x%x\n", notif->sn_header.sn_type, notif->sn_header.sn_flags); + switch (notif->sn_header.sn_type) { + case SCTP_ASSOC_CHANGE: + LOGP(DLINP, LOGL_DEBUG, "===> ASSOC CHANGE:"); + switch (notif->sn_assoc_change.sac_state) { + case SCTP_COMM_UP: + LOGPC(DLINP, LOGL_DEBUG, " UP\n"); + break; + case SCTP_COMM_LOST: + LOGPC(DLINP, LOGL_DEBUG, " LOST\n"); + break; + case SCTP_RESTART: + LOGPC(DLINP, LOGL_DEBUG, " RESTART\n"); + break; + case SCTP_SHUTDOWN_COMP: + LOGPC(DLINP, LOGL_DEBUG, " SHUTDOWN COMP\n"); + break; + case SCTP_CANT_STR_ASSOC: + LOGPC(DLINP, LOGL_DEBUG, " CANT STR ASSOC\n"); + break; + } + break; + case SCTP_PEER_ADDR_CHANGE: + LOGP(DLINP, LOGL_DEBUG, "===> PEER ADDR CHANGE\n"); + break; + case SCTP_SHUTDOWN_EVENT: + LOGP(DLINP, LOGL_DEBUG, "===> SHUTDOWN EVT\n"); + /* Handle this like a regular disconnect */ + return 0; + break; + } + return -EAGAIN; + } + msgb_sctp_ppid(msg) = ntohl(sinfo.sinfo_ppid); + msgb_sctp_stream(msg) = ntohl(sinfo.sinfo_stream); + break; +#endif + case IPPROTO_TCP: + default: + ret = recv(conn->ofd.fd, msgb_data(msg), msgb_tailroom(msg), 0); + break; + } + if (ret < 0) { if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, -- To view, visit https://gerrit.osmocom.org/2173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If0875cfa3eba9ef36acc0c4bfd0d168a45c380b9 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:35:18 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:35:18 +0000 Subject: osmo-trx[master]: sigProcLib: Check return status on downsampling In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2172 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:35:49 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:35:49 +0000 Subject: osmo-trx[master]: sigProcLib: Remove unreachable code and no-effect checks In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2171 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:38:13 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:38:13 +0000 Subject: openbsc[master]: gsm_bts: add version and variant details In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/2161/1/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 502: BTS_UNKNOWN, > It looks to me like this is semantically the same as enum gsm_bts_type just enum gsm_bts_type should basically differentiate bdtween BS11/nanobts/rbs2000/nokia/osmo (without 'sysmo') and then inside 'osmo' we have the sub-variants that are now introduced in 'gsm_bts_model_variant'. It might be best to renaem GSM_BTS_TYPE_OSMO_SYSMO to GSM_BTS_OSMOBTS and to rename gsm_bts_model_variant into osmobts_variant or something like that. -- To view, visit https://gerrit.osmocom.org/2161 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:39:25 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:39:25 +0000 Subject: osmo-trx[master]: buildenv: Turn off native architecture builds In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2098 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3df4b8db9692016115edbe2247beeec090715687 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:40:21 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:40:21 +0000 Subject: libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:40:22 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:40:22 +0000 Subject: [MERGED] libosmo-abis[master]: Fix RTP jitter buffer that never stop to increase. In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix RTP jitter buffer that never stop to increase. ...................................................................... Fix RTP jitter buffer that never stop to increase. Duration passed to osmo_rtp_send_frame_ext function is based on the last frame and the current one. Duration must then be added to the timestamp before being transmitted. Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d --- M src/trau/osmo_ortp.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 141065e..4e9df56 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -467,9 +467,9 @@ return -ENOMEM; rtp_set_markbit(mblk, marker); + rs->tx_timestamp += duration; rc = rtp_session_sendm_with_ts(rs->sess, mblk, rs->tx_timestamp); - rs->tx_timestamp += duration; if (rc < 0) { /* no need to free() the mblk, as rtp_session_rtp_send() * unconditionally free()s the mblk even in case of -- To view, visit https://gerrit.osmocom.org/1982 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0593d6530c097cca34125a0ae2dd1b019b4dd80d Gerrit-PatchSet: 3 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: jfdionne From gerrit-no-reply at lists.osmocom.org Wed Mar 29 13:40:34 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 29 Mar 2017 13:40:34 +0000 Subject: [MERGED] libosmocore[master]: Fix LAPD UA message buffer memory leak. In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix LAPD UA message buffer memory leak. ...................................................................... Fix LAPD UA message buffer memory leak. The state check in lapd_dl_reset causes some buffers never to be released. Using talloc report LAPD UA message buffers are never released after each call and cause a memory leak. Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e --- M src/gsm/lapd_core.c 1 file changed, 5 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 0cc28a6..a602d78 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -308,11 +308,6 @@ /* reset to IDLE state */ void lapd_dl_reset(struct lapd_datalink *dl) { - if (dl->state == LAPD_STATE_IDLE) - return; - LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl); - /* enter idle state (and remove eventual cont_res) */ - lapd_dl_newstate(dl, LAPD_STATE_IDLE); /* flush buffer */ lapd_dl_flush_tx(dl); lapd_dl_flush_send(dl); @@ -322,6 +317,11 @@ /* stop Timers */ lapd_stop_t200(dl); lapd_stop_t203(dl); + if (dl->state == LAPD_STATE_IDLE) + return; + LOGP(DLLAPD, LOGL_INFO, "Resetting LAPDm instance (dl=%p)\n", dl); + /* enter idle state (and remove eventual cont_res) */ + lapd_dl_newstate(dl, LAPD_STATE_IDLE); } /* reset and de-allocate history buffer */ -- To view, visit https://gerrit.osmocom.org/1984 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: jfdionne Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Wed Mar 29 19:20:47 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 29 Mar 2017 19:20:47 +0000 Subject: osmo-trx[master]: sigProcLib: Check return status on downsampling In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2172 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 19:21:14 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 29 Mar 2017 19:21:14 +0000 Subject: osmo-trx[master]: sigProcLib: Remove unreachable code and no-effect checks In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2171 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Mar 29 19:33:22 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Wed, 29 Mar 2017 19:33:22 +0000 Subject: osmo-trx[master]: osmo-trx: Separate command line switch to enable EDGE filler. In-Reply-To: References: Message-ID: Patch Set 5: I would very much like to replace the command line and control socket interface. There are more than enough configuration options so that a config file makes sense - that is the direction that I prefer over command line arguments. For the control socket interface, we need to consider backwards compatibility with OpenBTS. -- To view, visit https://gerrit.osmocom.org/2143 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic8808bbe3f06740ef3fec1d1865ecb57fbcfabab Gerrit-PatchSet: 5 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:36:47 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:36:47 +0000 Subject: [PATCH] pysim[master]: Fix select control parameter Message-ID: Review at https://gerrit.osmocom.org/2174 Fix select control parameter sysmo-usim-sjs1 requires P2 to be set to 0x0C (request FCI) when using the USIM application commands. The FCI is not used by pysim anyway and might even cause problems with other cards. This commit adds a pair of get/set methods to the SimCardCommands class in order to set a default for the selection control parameters (P1, P2). (Similar to the set/get methods for the class byte) The SysmoUSIMSJS1 class now calls the setter method for the selection control parameters inside of its constructuor and sets the selection control parameter default to "000C". This way we can be sure that we only change the behaviour for sysmo-usim-sjs1 and do not break support for any other cards. Change-Id: I1993a267c952bf37d5de1cb4e1107f445614c17b --- M pySim/cards.py M pySim/commands.py 2 files changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/74/2174/1 diff --git a/pySim/cards.py b/pySim/cards.py index 23352a7..fafc55f 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -425,6 +425,7 @@ def __init__(self, ssc): super(SysmoUSIMSJS1, self).__init__(ssc) self._scc.cla_byte = "00" + self._scc.sel_ctrl = "000C" @classmethod def autodetect(kls, scc): diff --git a/pySim/commands.py b/pySim/commands.py index b7fb77f..d8bd8f2 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -29,6 +29,7 @@ def __init__(self, transport): self._tp = transport; self._cla_byte = "a0" + self._sel_ctrl = "0000" @property def cla_byte(self): @@ -37,11 +38,17 @@ def cla_byte(self, value): self._cla_byte = value + @property + def sel_ctrl(self): + return self._sel_ctrl + @sel_ctrl.setter + def sel_ctrl(self, value): + self._sel_ctrl = value def select_file(self, dir_list): rv = [] for i in dir_list: - data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4000002" + i) + data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4" + self._sel_ctrl + "02" + i) rv.append(data) return rv -- To view, visit https://gerrit.osmocom.org/2174 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1993a267c952bf37d5de1cb4e1107f445614c17b Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:36:50 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:36:50 +0000 Subject: [PATCH] pysim[master]: fix writing of ICCID for sysmo-usim-sjs1 Message-ID: Review at https://gerrit.osmocom.org/2175 fix writing of ICCID for sysmo-usim-sjs1 The programming procedure for sysmo-usim-sjs1 lacks writing the ICCID. This commit adds the missing call to update_binary() Change-Id: Ief85aa07c562d8d7b2a6dec302d2f485d0b1e577 --- M pySim/cards.py 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/75/2175/1 diff --git a/pySim/cards.py b/pySim/cards.py index fafc55f..925c5e6 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -434,19 +434,19 @@ def program(self, p): + # authenticate as ADM using default key (written on the card..) + if not p['pin_adm']: + raise ValueError("Please provide a PIN-ADM as there is no default one") + self._scc.verify_chv(0x0A, h2b(p['pin_adm'])) # select MF r = self._scc.select_file(['3f00']) + # write EF.ICCID + data, sw = self._scc.update_binary('2fe2', enc_iccid(p['iccid'])) + # select DF_GSM r = self._scc.select_file(['7f20']) - - # authenticate as ADM using default key (written on the card..) - if not p['pin_adm']: - raise ValueError("Please provide a PIN-ADM as there is no default one") - - self._scc.verify_chv(0x0A, h2b(p['pin_adm'])) - # set Ki in proprietary file data, sw = self._scc.update_binary('00FF', p['ki']) -- To view, visit https://gerrit.osmocom.org/2175 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ief85aa07c562d8d7b2a6dec302d2f485d0b1e577 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:52 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:52 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add utils for AoIP Transport Layer Address Message-ID: Review at https://gerrit.osmocom.org/2176 gsm0808: Add utils for AoIP Transport Layer Address The planned support for true A over IP requires the encoding and decoding of a so called "AoIP Transport Layer Address" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332 --- A include/osmocom/gsm/gsm0808_utils.h M src/gsm/Makefile.am A src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 5 files changed, 217 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/2176/1 diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h new file mode 100644 index 0000000..d4d8618 --- /dev/null +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -0,0 +1,29 @@ +/* (C) 2016 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * 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 . + * + */ +#pragma once + +#include + +/* Encode AoIP transport address element */ +struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss); + +/* Decode AoIP transport address element */ +struct sockaddr_storage *gsm0808_dec_aoip_trasp_addr(const void *ctx, + struct msgb *msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3a4a0cd..e64c9e7 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -25,7 +25,7 @@ auth_milenage.c milenage/aes-encblock.c gea.c \ milenage/aes-internal.c milenage/aes-internal-enc.c \ milenage/milenage.c gan.c ipa.c gsm0341.c apn.c \ - gsup.c gprs_gea.c gsm0503_conv.c oap.c + gsup.c gprs_gea.c gsm0503_conv.c oap.c gsm0808_utils.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c new file mode 100644 index 0000000..d1897cf4 --- /dev/null +++ b/src/gsm/gsm0808_utils.c @@ -0,0 +1,115 @@ +/* (C) 2016 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * 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 . + * + */ + +#include +#include +#include +#include +#include +#include + +#define ELEMENT_MSGB_MAXLEN 256 + +#define IP_V4_ADDR_LEN 4 +#define IP_V6_ADDR_LEN 16 +#define IP_PORT_LEN 2 + +/* Encode AoIP transport address element */ +struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss) +{ + /* See also 3GPP TS 48.008 3.2.2.102 AoIP Transport Layer Address */ + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + uint16_t port = 0; + + uint8_t *ptr; + struct msgb *msg; + + OSMO_ASSERT(ss); + OSMO_ASSERT(ss->ss_family == AF_INET || ss->ss_family == AF_INET6); + + msg = msgb_alloc(ELEMENT_MSGB_MAXLEN, "AoIP Transport Layer Address"); + if (!msg) + return NULL; + + switch (ss->ss_family) { + case AF_INET: + sin = (struct sockaddr_in *)ss; + port = ntohs(sin->sin_port); + ptr = msgb_put(msg, IP_V4_ADDR_LEN); + memcpy(ptr, &sin->sin_addr.s_addr, IP_V4_ADDR_LEN); + break; + case AF_INET6: + sin6 = (struct sockaddr_in6 *)ss; + port = ntohs(sin6->sin6_port); + ptr = msgb_put(msg, IP_V6_ADDR_LEN); + memcpy(ptr, sin6->sin6_addr.s6_addr, IP_V6_ADDR_LEN); + break; + } + + msgb_put_u16(msg, port); + return msg; +} + +/* Decode AoIP transport address element */ +struct sockaddr_storage *gsm0808_dec_aoip_trasp_addr(const void *ctx, + struct msgb *msg) +{ + /* See also 3GPP TS 48.008 3.2.2.102 AoIP Transport Layer Address */ + struct sockaddr_storage *ss; + struct sockaddr_in sin; + struct sockaddr_in6 sin6; + uint8_t *ptr; + + if (!msg) + return NULL; + + switch (msg->len) { + + case IP_V4_ADDR_LEN + IP_PORT_LEN: + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(msgb_get_u16(msg)); + ptr = msgb_get(msg, IP_V4_ADDR_LEN); + memcpy(&sin.sin_addr.s_addr, ptr, IP_V4_ADDR_LEN); + ss = talloc_zero(ctx, struct sockaddr_storage); + if (!ss) + return NULL; + memcpy(ss, &sin, sizeof(sin)); + break; + case IP_V6_ADDR_LEN + IP_PORT_LEN: + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_port = htons(msgb_get_u16(msg)); + ptr = msgb_get(msg, IP_V6_ADDR_LEN); + memcpy(sin6.sin6_addr.s6_addr, ptr, IP_V6_ADDR_LEN); + ss = talloc_zero(ctx, struct sockaddr_storage); + if (!ss) + return NULL; + memcpy(ss, &sin6, sizeof(sin6)); + break; + default: + /* Malformed element */ + return NULL; + break; + } + + return ss; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 5649e71..3ad847d 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -137,6 +137,8 @@ gsm0808_create_reset; gsm0808_create_sapi_reject; gsm0808_prepend_dtap_header; +gsm0808_enc_aoip_trasp_addr; +gsm0808_dec_aoip_trasp_addr; gsm0858_rsl_ul_meas_enc; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 98502b7..99605d8 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -19,9 +19,14 @@ */ #include +#include +#include #include #include +#include +#include +#include #define VERIFY(msg, data, len) \ if (msgb_l3len(msg) != len) { \ @@ -247,8 +252,67 @@ msgb_free(in_msg); } +static void test_enc_dec_aoip_trasp_addr_v4(const void *ctx) +{ + struct sockaddr_storage enc_addr; + struct sockaddr_storage *dec_addr; + struct sockaddr_in enc_addr_in; + struct msgb *msg; + + memset(&enc_addr_in, 0, sizeof(enc_addr_in)); + enc_addr_in.sin_family = AF_INET; + enc_addr_in.sin_port = htons(1234); + inet_aton("255.0.255.255", &enc_addr_in.sin_addr); + + memset(&enc_addr, 0, sizeof(enc_addr)); + memcpy(&enc_addr, &enc_addr_in, sizeof(enc_addr_in)); + + msg = gsm0808_enc_aoip_trasp_addr(&enc_addr); + OSMO_ASSERT(msg); + dec_addr = gsm0808_dec_aoip_trasp_addr(ctx, msg); + OSMO_ASSERT(dec_addr); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_addr, dec_addr, sizeof(enc_addr)) == 0); + + talloc_free(dec_addr); + msgb_free(msg); +} + +static void test_enc_dec_aoip_trasp_addr_v6(const void *ctx) +{ + struct sockaddr_storage enc_addr; + struct sockaddr_storage *dec_addr; + struct sockaddr_in6 enc_addr_in; + struct msgb *msg; + + memset(&enc_addr_in, 0, sizeof(enc_addr_in)); + enc_addr_in.sin6_family = AF_INET6; + enc_addr_in.sin6_port = htons(4567); + inet_pton(AF_INET6, "2001:0db8:85a3:08d3:1319:8a2e:0370:7344", + &enc_addr_in.sin6_addr); + + memset(&enc_addr, 0, sizeof(enc_addr)); + memcpy(&enc_addr, &enc_addr_in, sizeof(enc_addr_in)); + + msg = gsm0808_enc_aoip_trasp_addr(&enc_addr); + OSMO_ASSERT(msg); + dec_addr = gsm0808_dec_aoip_trasp_addr(ctx, msg); + OSMO_ASSERT(dec_addr); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_addr, dec_addr, sizeof(enc_addr)) == 0); + + talloc_free(dec_addr); + msgb_free(msg); +} + int main(int argc, char **argv) { + void *ctx; + + ctx = talloc_named_const(NULL, 0, "gsm0808_ctx"); + printf("Testing generation of GSM0808 messages\n"); test_create_layer3(); test_create_reset(); @@ -263,7 +327,13 @@ test_create_clear_rqst(); test_create_dtap(); test_prepend_dtap(); + test_enc_dec_aoip_trasp_addr_v4(ctx); + test_enc_dec_aoip_trasp_addr_v6(ctx); printf("Done\n"); + + talloc_report_full(ctx, stderr); + OSMO_ASSERT(talloc_total_blocks(ctx) == 1); + return EXIT_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/2176 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:52 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:52 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add utils for Speech Codec List and Speech Codec Message-ID: Review at https://gerrit.osmocom.org/2177 gsm0808: Add utils for Speech Codec List and Speech Codec The planned support for true A over IP requires the encoding and decoding of a so called "Speech Codec Element" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200 --- M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 5 files changed, 367 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/2177/1 diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index d4d8618..4049a2f 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -21,9 +21,25 @@ #include +#include + /* Encode AoIP transport address element */ struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss); /* Decode AoIP transport address element */ struct sockaddr_storage *gsm0808_dec_aoip_trasp_addr(const void *ctx, struct msgb *msg); + +/* Encode Speech Codec element */ +struct msgb *gsm0808_enc_speech_codec(struct gsm0808_speech_codec *sc); + +/* Decode Speech Codec element */ +struct gsm0808_speech_codec *gsm0808_dec_speech_codec(const void *ctx, + struct msgb *msg); + +/* Encode Speech Codec list */ +struct msgb *gsm0808_enc_speech_codec_list(struct llist_head *scl); + +/* Decode Speech Codec list */ +struct llist_head *gsm0808_dec_speech_codec_list(const void *ctx, + struct msgb *msg); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index 6fb4e9e..ad5e633 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -3,6 +3,9 @@ #pragma once #include +#include +#include +#include /* * this is from GSM 03.03 CGI but is copied in GSM 08.08 @@ -416,3 +419,17 @@ GSM0808_PAGINF_FOR_SMS = 0x01, GSM0808_PAGINF_FOR_USSD = 0x02, }; + +/* 3GPP TS 48.008 3.2.2.103 Speech Codec List */ +/* 3GPP TS 48.008 3.2.2.104 Speech Codec */ +struct gsm0808_speech_codec { + struct llist_head list; + bool fi; + bool pi; + bool pt; + bool tf; + uint8_t type; + uint16_t cfg; + bool type_extended; + bool cfg_present; +}; diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index d1897cf4..202f1ac 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #define IP_V4_ADDR_LEN 4 #define IP_V6_ADDR_LEN 16 #define IP_PORT_LEN 2 + /* Encode AoIP transport address element */ struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss) @@ -113,3 +115,175 @@ return ss; } + +/* Helper function for gsm0808_enc_speech_codec() + * and gsm0808_enc_speech_codec_list() */ +static void enc_speech_codec(struct msgb *msg, struct gsm0808_speech_codec *sc) +{ + /* See also 3GPP TS 48.008 3.2.2.103 Speech Codec List */ + uint8_t header = 0; + + if (sc->fi) + header |= (1 << 7); + if (sc->pi) + header |= (1 << 6); + if (sc->pt) + header |= (1 << 5); + if (sc->tf) + header |= (1 << 4); + if (sc->type_extended) { + header |= 0x0f; + msgb_put_u8(msg, header); + } else { + OSMO_ASSERT(sc->type < 0x0f); + header |= sc->type; + msgb_put_u8(msg, header); + return; + } + + msgb_put_u8(msg, sc->type); + + if (sc->cfg_present) + msgb_put_u16(msg, sc->cfg); +} + +/* Encode Speech Codec element */ +struct msgb *gsm0808_enc_speech_codec(struct gsm0808_speech_codec *sc) +{ + struct msgb *msg; + + OSMO_ASSERT(sc); + + msg = msgb_alloc(ELEMENT_MSGB_MAXLEN, "Speech Codec Element"); + if (!msg) + return NULL; + + enc_speech_codec(msg, sc); + + return msg; +} + +/* Decode Speech Codec element */ +struct gsm0808_speech_codec *gsm0808_dec_speech_codec(const void *ctx, + struct msgb *msg) +{ + /* See also 3GPP TS 48.008 3.2.2.103 Speech Codec List */ + uint8_t header; + struct gsm0808_speech_codec *sc; + + if (!msg) + return NULL; + + /* Malformed elements */ + if ((msg->data[0] & 0x0F) == 0x0F && msg->len < 2) + return NULL; + else if ((msg->data[0] & 0x0F) != 0x0F && msg->len < 1) + return NULL; + + header = msgb_pull_u8(msg); + sc = talloc_zero(ctx, struct gsm0808_speech_codec); + if (!sc) + return NULL; + + if (header & (1 << 7)) + sc->fi = true; + if (header & (1 << 6)) + sc->pi = true; + if (header & (1 << 5)) + sc->pt = true; + if (header & (1 << 4)) + sc->tf = true; + + if ((header & 0x0F) != 0x0F) { + sc->type = (header & 0x0F); + return sc; + } + + sc->type = msgb_pull_u8(msg); + sc->type_extended = true; + + if (msg->len < 2) + return sc; + + sc->cfg = msgb_pull_u16(msg); + sc->cfg_present = true; + + return sc; +} + +/* Encode Speech Codec list */ +struct msgb *gsm0808_enc_speech_codec_list(struct llist_head *scl) +{ + struct gsm0808_speech_codec *sc; + unsigned int scl_len; + struct msgb *msg; + + OSMO_ASSERT(scl); + + scl_len = llist_count(scl); + + /* Empty list */ + if (scl_len < 1) + return NULL; + + msg = + msgb_alloc(ELEMENT_MSGB_MAXLEN * scl_len, + "Speech Codec Element"); + if (!msg) + return NULL; + + llist_for_each_entry(sc, scl, list) { + enc_speech_codec(msg, sc); + } + + /* Prevent generating oversized TLV elements */ + if (msg->len > ELEMENT_MSGB_MAXLEN) { + free(msg); + return NULL; + } + + return msg; +} + +/* Decode Speech Codec list */ +struct llist_head *gsm0808_dec_speech_codec_list(const void *ctx, + struct msgb *msg) +{ + struct llist_head *scl = NULL; + struct gsm0808_speech_codec *sc; + unsigned int loopcount = 0; + unsigned int scl_len; + + if (!msg) + return NULL; + + scl = talloc_zero(ctx, struct llist_head); + if (!scl) + return NULL; + + INIT_LLIST_HEAD(scl); + + while (1) { + /* Ensure loop exit */ + if (loopcount > 255) + break; + + sc = gsm0808_dec_speech_codec(scl, msg); + if (sc == NULL) + break; + + llist_add(&sc->list, scl); + + loopcount++; + } + + scl_len = llist_count(scl); + + /* Empty list */ + if (scl_len < 1) { + talloc_free(scl); + return NULL; + } + + return scl; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3ad847d..c89cbe4 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -139,6 +139,10 @@ gsm0808_prepend_dtap_header; gsm0808_enc_aoip_trasp_addr; gsm0808_dec_aoip_trasp_addr; +gsm0808_enc_speech_codec; +gsm0808_dec_speech_codec; +gsm0808_enc_speech_codec_list; +gsm0808_dec_speech_codec_list; gsm0858_rsl_ul_meas_enc; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 99605d8..7f2cff1 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -307,6 +307,158 @@ msgb_free(msg); } +static void test_gsm0808_enc_dec_speech_codec(const void *ctx) +{ + struct gsm0808_speech_codec enc_sc; + struct gsm0808_speech_codec *dec_sc; + struct msgb *msg; + + memset(&enc_sc, 0, sizeof(enc_sc)); + enc_sc.fi = true; + enc_sc.pt = true; + enc_sc.type = 0x05; + + msg = gsm0808_enc_speech_codec(&enc_sc); + OSMO_ASSERT(msg); + dec_sc = gsm0808_dec_speech_codec(ctx, msg); + OSMO_ASSERT(dec_sc); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_sc, dec_sc, sizeof(enc_sc)) == 0); + + talloc_free(dec_sc); + msgb_free(msg); +} + +static void test_gsm0808_enc_dec_speech_codec_ext_with_cfg(const void *ctx) +{ + struct gsm0808_speech_codec enc_sc; + struct gsm0808_speech_codec *dec_sc; + struct msgb *msg; + + enc_sc.pi = true; + enc_sc.tf = true; + enc_sc.type = 0xab; + enc_sc.type_extended = true; + enc_sc.cfg_present = true; + enc_sc.cfg = 0xcdef; + + msg = gsm0808_enc_speech_codec(&enc_sc); + OSMO_ASSERT(msg); + dec_sc = gsm0808_dec_speech_codec(ctx, msg); + OSMO_ASSERT(dec_sc); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_sc, dec_sc, sizeof(enc_sc)) == 0); + + talloc_free(dec_sc); + msgb_free(msg); +} + +static void test_gsm0808_enc_dec_speech_codec_ext(const void *ctx) +{ + struct gsm0808_speech_codec enc_sc; + struct gsm0808_speech_codec *dec_sc; + struct msgb *msg; + + enc_sc.fi = true; + enc_sc.tf = true; + enc_sc.type = 0xf2; + enc_sc.type_extended = true; + + msg = gsm0808_enc_speech_codec(&enc_sc); + OSMO_ASSERT(msg); + dec_sc = gsm0808_dec_speech_codec(ctx, msg); + OSMO_ASSERT(dec_sc); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_sc, dec_sc, sizeof(enc_sc)) == 0); + + talloc_free(dec_sc); + msgb_free(msg); +} + +static bool speech_codec_cmp(struct gsm0808_speech_codec *a, + struct gsm0808_speech_codec *b) +{ + if (a->fi != b->fi) + return false; + if (a->pi != b->pi) + return false; + if (a->pt != b->pt) + return false; + if (a->tf != b->tf) + return false; + if (a->type != b->type) + return false; + if (a->cfg != b->cfg) + return false; + if (a->type_extended != b->type_extended) + return false; + if (a->cfg_present != b->cfg_present) + return false; + + return true; +} + +static void test_gsm0808_enc_dec_speech_codec_list(const void *ctx) +{ + struct gsm0808_speech_codec enc_sc1; + struct gsm0808_speech_codec enc_sc2; + struct gsm0808_speech_codec enc_sc3; + struct msgb *msg; + struct llist_head sc_list; + struct llist_head *sc_list_decoded; + struct gsm0808_speech_codec *sc; + + INIT_LLIST_HEAD(&sc_list); + + memset(&enc_sc1, 0, sizeof(enc_sc1)); + enc_sc1.pi = true; + enc_sc1.tf = true; + enc_sc1.type = 0xab; + enc_sc1.type_extended = true; + enc_sc1.cfg_present = true; + enc_sc1.cfg = 0xcdef; + + memset(&enc_sc2, 0, sizeof(enc_sc2)); + enc_sc2.fi = true; + enc_sc2.pt = true; + enc_sc2.type = 0x05; + + memset(&enc_sc3, 0, sizeof(enc_sc3)); + enc_sc3.fi = true; + enc_sc3.tf = true; + enc_sc3.type = 0xf2; + enc_sc3.type_extended = true; + + llist_add(&enc_sc3.list, &sc_list); + llist_add(&enc_sc2.list, &sc_list); + llist_add(&enc_sc1.list, &sc_list); + + msg = gsm0808_enc_speech_codec_list(&sc_list); + sc_list_decoded = gsm0808_dec_speech_codec_list(ctx, msg); + OSMO_ASSERT(msg->len == 0); + + llist_for_each_entry(sc, sc_list_decoded, list) { + if(sc->type == 0xab) { + OSMO_ASSERT(speech_codec_cmp(&enc_sc1,sc) == true); + } + else if(sc->type == 0x05) { + OSMO_ASSERT(speech_codec_cmp(&enc_sc2,sc) == true); + } + else if(sc->type == 0xf2) { + OSMO_ASSERT(speech_codec_cmp(&enc_sc3,sc) == true); + } + else { + OSMO_ASSERT(false); + } + } + + talloc_free(sc_list_decoded); + msgb_free(msg); +} + int main(int argc, char **argv) { void *ctx; @@ -329,6 +481,10 @@ test_prepend_dtap(); test_enc_dec_aoip_trasp_addr_v4(ctx); test_enc_dec_aoip_trasp_addr_v6(ctx); + test_gsm0808_enc_dec_speech_codec(ctx); + test_gsm0808_enc_dec_speech_codec_ext(ctx); + test_gsm0808_enc_dec_speech_codec_ext_with_cfg(ctx); + test_gsm0808_enc_dec_speech_codec_list(ctx); printf("Done\n"); -- To view, visit https://gerrit.osmocom.org/2177 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:53 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:53 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu... Message-ID: Review at https://gerrit.osmocom.org/2178 gsm0808: Add AoIP specific elements to gsm0808_create_... functions the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 284 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/2178/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index a7e102c..7ef62b2 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -20,10 +20,16 @@ #pragma once #include "tlv.h" +#include +#include struct msgb; -struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, uint16_t countrycode, int lac, uint16_t ci); +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci); +struct msgb *gsm0808_create_layer3_aoip(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + struct llist_head *scl); struct msgb *gsm0808_create_reset(void); struct msgb *gsm0808_create_reset_ack(void); struct msgb *gsm0808_create_clear_command(uint8_t reason); @@ -33,9 +39,22 @@ struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len); struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); +struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, + uint8_t chosen_channel, + uint8_t encr_alg_id, + uint8_t speech_mode, + struct sockaddr_storage + *ss, + struct + gsm0808_speech_codec *sc, + struct llist_head *scl); struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, - uint8_t chosen_channel, uint8_t encr_alg_id, + uint8_t chosen_channel, + uint8_t encr_alg_id, uint8_t speech_mode); +struct msgb *gsm0808_create_assignment_failure_aoip(uint8_t cause, + uint8_t *rr_cause, + struct llist_head *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index de80006..c37ce3e 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -27,17 +28,20 @@ #define BSSMAP_MSG_SIZE 512 #define BSSMAP_MSG_HEADROOM 128 -struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci) +struct msgb *gsm0808_create_layer3_aoip(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + struct llist_head *scl) { - struct msgb* msg; + struct msgb *msg; + struct msgb *scl_encoded; struct { uint8_t ident; struct gsm48_loc_area_id lai; uint16_t ci; } __attribute__ ((packed)) lai_ci; - msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, - "bssmap cmpl l3"); + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "bssmap cmpl l3"); if (!msg) return NULL; @@ -49,16 +53,35 @@ gsm48_generate_lai(&lai_ci.lai, cc, nc, lac); lai_ci.ci = htons(_ci); msgb_tlv_put(msg, GSM0808_IE_CELL_IDENTIFIER, sizeof(lai_ci), - (uint8_t *) &lai_ci); + (uint8_t *) & lai_ci); /* copy the layer3 data */ msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, msgb_l3len(msg_l3), msg_l3->l3h); + /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ + if (scl) { + scl_encoded = gsm0808_enc_speech_codec_list(scl); + if (!scl_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_SPEECH_CODEC_LIST, + scl_encoded->len, scl_encoded->data); + msgb_free(scl_encoded); + } + /* push the bssmap header */ - msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + msg->l3h = + msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; +} + +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci) +{ + return gsm0808_create_layer3_aoip(msg_l3, nc, cc, lac, _ci, NULL); } struct msgb *gsm0808_create_reset(void) @@ -191,12 +214,22 @@ return msg; } -struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, - uint8_t chosen_channel, uint8_t encr_alg_id, - uint8_t speech_mode) +struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, + uint8_t chosen_channel, + uint8_t encr_alg_id, + uint8_t speech_mode, + struct sockaddr_storage + *ss, + struct + gsm0808_speech_codec *sc, + struct llist_head *scl) { - struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, - "bssmap: ass compl"); + struct msgb *ss_encoded; + struct msgb *sc_encoded; + struct msgb *scl_encoded; + struct msgb *msg = + msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "bssmap: ass compl"); if (!msg) return NULL; @@ -218,17 +251,70 @@ if (speech_mode != 0) msgb_tv_put(msg, GSM0808_IE_SPEECH_VERSION, speech_mode); + /* AoIP: AoIP Transport Layer Address (BSS) 3.2.2.102 */ + if (ss) { + ss_encoded = gsm0808_enc_aoip_trasp_addr(ss); + if (!ss_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_AOIP_TRASP_ADDR, + ss_encoded->len, ss_encoded->data); + msgb_free(ss_encoded); + } + + /* AoIP: Speech Codec (Chosen) 3.2.2.104 */ + if (sc) { + sc_encoded = gsm0808_enc_speech_codec(sc); + if (!sc_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_SPEECH_CODEC, + sc_encoded->len, sc_encoded->data); + msgb_free(sc_encoded); + } + + /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ + if (scl) { + scl_encoded = gsm0808_enc_speech_codec_list(scl); + if (!scl_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_SPEECH_CODEC_LIST, + scl_encoded->len, scl_encoded->data); + msgb_free(scl_encoded); + } + /* write LSA identifier 3.2.2.15 */ - msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + msg->l3h = + msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; } -struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause) +struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, + uint8_t chosen_channel, + uint8_t encr_alg_id, + uint8_t speech_mode) { - struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, - "bssmap: ass fail"); + return gsm0808_create_assignment_completed_aoip(rr_cause, + chosen_channel, + encr_alg_id, + speech_mode, + NULL, NULL, NULL); +} + +struct msgb *gsm0808_create_assignment_failure_aoip(uint8_t cause, + uint8_t *rr_cause, + struct llist_head *scl) +{ + struct msgb *scl_encoded; + struct msgb *msg = + msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "bssmap: ass fail"); if (!msg) return NULL; @@ -242,12 +328,31 @@ /* Circuit pool 3.22.45 */ /* Circuit pool list 3.2.2.46 */ + /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ + if (scl) { + scl_encoded = gsm0808_enc_speech_codec_list(scl); + if (!scl_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_SPEECH_CODEC_LIST, + scl_encoded->len, scl_encoded->data); + msgb_free(scl_encoded); + } + /* update the size */ - msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + msg->l3h = + msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; } +struct msgb *gsm0808_create_assignment_failure(uint8_t cause, + uint8_t *rr_cause) +{ + return gsm0808_create_assignment_failure_aoip(cause, rr_cause, NULL); +} + struct msgb *gsm0808_create_clear_rqst(uint8_t cause) { struct msgb *msg; diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index c89cbe4..3c23ed8 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -125,7 +125,9 @@ gsm0808_bssap_name; gsm0808_bssmap_name; gsm0808_create_assignment_completed; +gsm0808_create_assignment_completed_aoip; gsm0808_create_assignment_failure; +gsm0808_create_assignment_failure_aoip; gsm0808_create_cipher_complete; gsm0808_create_cipher_reject; gsm0808_create_classmark_update; @@ -134,6 +136,7 @@ gsm0808_create_clear_rqst; gsm0808_create_dtap; gsm0808_create_layer3; +gsm0808_create_layer3_aoip; gsm0808_create_reset; gsm0808_create_sapi_reject; gsm0808_prepend_dtap_header; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 7f2cff1..6cfcf34 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -41,6 +41,47 @@ abort(); \ } +/* Setup a fake codec list for testing */ +static struct llist_head *setup_codec_list(const void *ctx) +{ + struct gsm0808_speech_codec *enc_sc1; + struct gsm0808_speech_codec *enc_sc2; + struct gsm0808_speech_codec *enc_sc3; + + struct llist_head *sc_list; + + sc_list = talloc_zero(ctx, struct llist_head); + enc_sc1 = talloc_zero(sc_list, struct gsm0808_speech_codec); + enc_sc2 = talloc_zero(sc_list, struct gsm0808_speech_codec); + enc_sc3 = talloc_zero(sc_list, struct gsm0808_speech_codec); + + INIT_LLIST_HEAD(sc_list); + + memset(enc_sc1, 0, sizeof(*enc_sc1)); + enc_sc1->pi = true; + enc_sc1->tf = true; + enc_sc1->type = 0xab; + enc_sc1->type_extended = true; + enc_sc1->cfg_present = true; + enc_sc1->cfg = 0xcdef; + + memset(enc_sc2, 0, sizeof(*enc_sc2)); + enc_sc2->fi = true; + enc_sc2->pt = true; + enc_sc2->type = 0x05; + + memset(enc_sc3, 0, sizeof(*enc_sc3)); + enc_sc3->fi = true; + enc_sc3->tf = true; + enc_sc3->type = 0xf2; + enc_sc3->type_extended = true; + + llist_add(&enc_sc3->list, sc_list); + llist_add(&enc_sc2->list, sc_list); + llist_add(&enc_sc1->list, sc_list); + + return sc_list; +} static void test_create_layer3(void) { @@ -56,6 +97,34 @@ msg = gsm0808_create_layer3(in_msg, 0x1122, 0x2244, 0x3366, 0x4488); VERIFY(msg, res, ARRAY_SIZE(res)); + msgb_free(msg); + msgb_free(in_msg); +} + +static void test_create_layer3_aoip(const void *ctx) +{ + static const uint8_t res[] = { + 0x00, 0x17, 0x57, 0x05, 0x08, 0x00, 0x77, 0x62, + 0x83, 0x33, 0x66, 0x44, 0x88, 0x17, 0x01, 0x23, + GSM0808_IE_SPEECH_CODEC_LIST, 0x07, 0x5f, 0xab, 0xcd, 0xef, + 0xa5, 0x9f, 0xf2 + }; + + struct msgb *msg, *in_msg; + struct llist_head *sc_list; + printf("Testing creating Layer3 (AoIP)\n"); + + sc_list = setup_codec_list(ctx); + + in_msg = msgb_alloc_headroom(512, 128, "foo"); + in_msg->l3h = in_msg->data; + msgb_v_put(in_msg, 0x23); + + msg = + gsm0808_create_layer3_aoip(in_msg, 0x1122, 0x2244, 0x3366, 0x4488, + sc_list); + VERIFY(msg, res, ARRAY_SIZE(res)); + talloc_free(sc_list); msgb_free(msg); msgb_free(in_msg); } @@ -189,6 +258,44 @@ msgb_free(msg); } +static void test_create_ass_compl_aoip(const void *ctx) +{ + struct sockaddr_storage ss; + struct sockaddr_in sin; + struct gsm0808_speech_codec sc; + struct llist_head *sc_list; + static const uint8_t res[] = + { 0x00, 0x1d, 0x02, 0x15, 0x23, 0x21, 0x42, 0x2c, 0x11, 0x40, 0x22, + GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17, 0x04, + 0xd2, GSM0808_IE_SPEECH_CODEC, 0x01, 0x9a, + GSM0808_IE_SPEECH_CODEC_LIST, 0x07, 0x5f, 0xab, 0xcd, 0xef, 0xa5, + 0x9f, 0xf2 }; + struct msgb *msg; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(1234); + inet_aton("192.168.100.23", &sin.sin_addr); + + memset(&ss, 0, sizeof(ss)); + memcpy(&ss, &sin, sizeof(sin)); + + memset(&sc, 0, sizeof(sc)); + sc.fi = true; + sc.tf = true; + sc.type = 0x0a; + + sc_list = setup_codec_list(ctx); + + printf("Testing creating Assignment Complete (AoIP)\n"); + msg = + gsm0808_create_assignment_completed_aoip(0x23, 0x42, 0x11, 0x22, + &ss, &sc, sc_list); + VERIFY(msg, res, ARRAY_SIZE(res)); + msgb_free(msg); + talloc_free(sc_list); +} + static void test_create_ass_fail() { static const uint8_t res1[] = { 0x00, 0x04, 0x03, 0x04, 0x01, 0x23 }; @@ -205,6 +312,32 @@ msg = gsm0808_create_assignment_failure(0x23, &rr_res); VERIFY(msg, res2, ARRAY_SIZE(res2)); msgb_free(msg); +} + +static void test_create_ass_fail_aoip(const void *ctx) +{ + static const uint8_t res1[] = + { 0x00, 0x0d, 0x03, 0x04, 0x01, 0x23, GSM0808_IE_SPEECH_CODEC_LIST, + 0x07, 0x5f, 0xab, 0xcd, 0xef, 0xa5, 0x9f, 0xf2 }; + static const uint8_t res2[] = + { 0x00, 0x0f, 0x03, 0x04, 0x01, 0x23, 0x15, 0x02, + GSM0808_IE_SPEECH_CODEC_LIST, 0x07, 0x5f, 0xab, + 0xcd, 0xef, 0xa5, 0x9f, 0xf2 }; + uint8_t rr_res = 2; + struct msgb *msg; + struct llist_head *sc_list; + + sc_list = setup_codec_list(ctx); + + printf("Testing creating Assignment Failure (AoIP)\n"); + msg = gsm0808_create_assignment_failure_aoip(0x23, NULL, sc_list); + VERIFY(msg, res1, ARRAY_SIZE(res1)); + msgb_free(msg); + + msg = gsm0808_create_assignment_failure_aoip(0x23, &rr_res, sc_list); + VERIFY(msg, res2, ARRAY_SIZE(res2)); + msgb_free(msg); + talloc_free(sc_list); } static void test_create_clear_rqst() @@ -467,6 +600,7 @@ printf("Testing generation of GSM0808 messages\n"); test_create_layer3(); + test_create_layer3_aoip(ctx); test_create_reset(); test_create_clear_command(); test_create_clear_complete(); @@ -475,7 +609,9 @@ test_create_cm_u(); test_create_sapi_reject(); test_create_ass_compl(); + test_create_ass_compl_aoip(ctx); test_create_ass_fail(); + test_create_ass_fail_aoip(ctx); test_create_clear_rqst(); test_create_dtap(); test_prepend_dtap(); diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index eb43126..f406551 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -1,5 +1,6 @@ Testing generation of GSM0808 messages Testing creating Layer3 +Testing creating Layer3 (AoIP) Testing creating Reset Testing creating Clear Command Testing creating Clear Complete @@ -8,7 +9,9 @@ Testing creating CM U Testing creating SAPI Reject Testing creating Assignment Complete +Testing creating Assignment Complete (AoIP) Testing creating Assignment Failure +Testing creating Assignment Failure (AoIP) Testing creating Clear Request Testing creating DTAP Testing prepend DTAP -- To view, visit https://gerrit.osmocom.org/2178 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I77f866abec1822d19871052f3c647ad782785b34 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:53 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:53 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add utils for Channel Type Message-ID: Review at https://gerrit.osmocom.org/2179 gsm0808: Add utils for Channel Type The planned support for true A over IP requires the encoding of the a Channel Type element (see also ASSIGNMENT REQUEST). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: Id0e2164d84b8cbcc6fe6a090fc7f40a1251421d7 --- M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 5 files changed, 115 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/2179/1 diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 4049a2f..6a2259f 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -43,3 +43,10 @@ /* Decode Speech Codec list */ struct llist_head *gsm0808_dec_speech_codec_list(const void *ctx, struct msgb *msg); + +/* Encode Channel Type element */ +struct msgb *gsm0808_enc_channel_type(struct gsm0808_channel_type *ct); + +/* Decode Channel Type element */ +struct gsm0808_channel_type *gsm0808_dec_channel_type(const void *ctx, + struct msgb *msg); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index ad5e633..981dda5 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -433,3 +433,12 @@ bool type_extended; bool cfg_present; }; + +/* 3GPP TS 48.008 3.2.2.11 Channel Type */ +#define CH_TYPE_PERM_SPCH_MAXLEN 9 +struct gsm0808_channel_type { + uint8_t ch_indctr; + uint8_t ch_rate_type; + uint8_t perm_spch[CH_TYPE_PERM_SPCH_MAXLEN]; + unsigned int perm_spch_len; +}; diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 202f1ac..54b8a70 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -32,6 +32,8 @@ #define IP_V6_ADDR_LEN 16 #define IP_PORT_LEN 2 +#define CHANNEL_TYPE_ELEMENT_MAXLEN 11 +#define CHANNEL_TYPE_ELEMENT_MINLEN 3 /* Encode AoIP transport address element */ struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss) @@ -287,3 +289,70 @@ return scl; } + +/* Encode Channel Type element */ +struct msgb *gsm0808_enc_channel_type(struct gsm0808_channel_type *ct) +{ + struct msgb *msg; + unsigned int i; + uint8_t byte; + + OSMO_ASSERT(ct); + OSMO_ASSERT(ct->perm_spch_len <= CHANNEL_TYPE_ELEMENT_MAXLEN-2); + + /* FIXME: Implement encoding support for Data + * and Speech + CTM Text Telephony */ + if ((ct->ch_indctr & 0x0f) != GSM0808_CHAN_SPEECH + && (ct->ch_indctr & 0x0f) != GSM0808_CHAN_SIGN) + return NULL; + + msg = msgb_alloc(ELEMENT_MSGB_MAXLEN, "Channel Type Element"); + if (!msg) + return NULL; + + msgb_put_u8(msg, ct->ch_indctr & 0x0f); + msgb_put_u8(msg, ct->ch_rate_type); + + for (i = 0; i < ct->perm_spch_len; i++) { + byte = ct->perm_spch[i]; + + if (i < ct->perm_spch_len - 1) + byte |= 0x80; + msgb_put_u8(msg, byte); + } + + return msg; +} + +/* Decode Channel Type element */ +struct gsm0808_channel_type *gsm0808_dec_channel_type(const void *ctx, + struct msgb *msg) +{ + struct gsm0808_channel_type *ct; + unsigned int i; + uint8_t byte; + + if (!msg) + return NULL; + + /* Malformed element */ + if (msg->len < CHANNEL_TYPE_ELEMENT_MINLEN) + return NULL; + + ct = talloc_zero(ctx, struct gsm0808_channel_type); + if (!ct) + return NULL; + + ct->ch_indctr = msgb_pull_u8(msg) & 0x0f; + ct->ch_rate_type = msgb_pull_u8(msg) & 0x0f; + + for (i = 0; i < ARRAY_SIZE(ct->perm_spch); i++) { + byte = msgb_pull_u8(msg); + ct->perm_spch[i] = byte & 0x7f; + if ((byte & 0x80) == 0x00) + break; + } + ct->perm_spch_len = i + 1; + + return ct; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3c23ed8..60cc742 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -146,6 +146,8 @@ gsm0808_dec_speech_codec; gsm0808_enc_speech_codec_list; gsm0808_dec_speech_codec_list; +gsm0808_enc_channel_type; +gsm0808_dec_channel_type; gsm0858_rsl_ul_meas_enc; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 6cfcf34..51edce2 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -592,6 +592,33 @@ msgb_free(msg); } +static void test_gsm0808_enc_dec_channel_type(const void *ctx) +{ + struct gsm0808_channel_type ct; + struct msgb *ct_enc; + uint8_t ct_enc_expected[] = {0x01, 0x0b, 0xa1, 0x25}; + struct gsm0808_channel_type *ct_dec; + + memset(&ct,0,sizeof(ct)); + ct.ch_indctr = GSM0808_CHAN_SPEECH; + ct.ch_rate_type = GSM0808_SPEECH_HALF_PREF; + ct.perm_spch[0] = GSM0808_PERM_FR3; + ct.perm_spch[1] = GSM0808_PERM_HR3; + ct.perm_spch_len = 2; + + ct_enc = gsm0808_enc_channel_type(&ct); + OSMO_ASSERT(ct_enc); + OSMO_ASSERT(memcmp(ct_enc_expected,ct_enc->data,ct_enc->len) == 0); + + ct_dec = gsm0808_dec_channel_type(ctx, ct_enc); + OSMO_ASSERT(ct_dec); + OSMO_ASSERT(ct_enc->len == 0); + OSMO_ASSERT(memcmp(&ct,ct_dec,sizeof(ct)) == 0); + + talloc_free(ct_dec); + msgb_free(ct_enc); +} + int main(int argc, char **argv) { void *ctx; @@ -621,6 +648,7 @@ test_gsm0808_enc_dec_speech_codec_ext(ctx); test_gsm0808_enc_dec_speech_codec_ext_with_cfg(ctx); test_gsm0808_enc_dec_speech_codec_list(ctx); + test_gsm0808_enc_dec_channel_type(ctx); printf("Done\n"); -- To view, visit https://gerrit.osmocom.org/2179 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id0e2164d84b8cbcc6fe6a090fc7f40a1251421d7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:53 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:53 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add utils for Encryption Information Message-ID: Review at https://gerrit.osmocom.org/2180 gsm0808: Add utils for Encryption Information The planned support for true A over IP requires the encoding of the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb --- M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 5 files changed, 126 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/2180/1 diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 6a2259f..2196f94 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -50,3 +50,10 @@ /* Decode Channel Type element */ struct gsm0808_channel_type *gsm0808_dec_channel_type(const void *ctx, struct msgb *msg); + +/* Encode Encryption Information element */ +struct msgb *gsm0808_enc_encrypt_info(struct gsm0808_encrypt_info *ei); + +/* Decode Encryption Information element */ +struct gsm0808_encrypt_info *gsm0808_dec_encrypt_info(const void *ctx, + struct msgb *msg); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index 981dda5..d52af9f 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -442,3 +442,13 @@ uint8_t perm_spch[CH_TYPE_PERM_SPCH_MAXLEN]; unsigned int perm_spch_len; }; + +/* 3GPP TS 48.008 3.2.2.10 Encryption Information */ +#define ENCRY_INFO_KEY_MAXLEN 252 +#define ENCRY_INFO_PERM_ALGO_MAXLEN 8 +struct gsm0808_encrypt_info { + uint8_t perm_algo[ENCRY_INFO_PERM_ALGO_MAXLEN]; + unsigned int perm_algo_len; + uint8_t key[ENCRY_INFO_KEY_MAXLEN]; + unsigned int key_len; +}; diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 54b8a70..7dfe2e9 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -34,6 +34,7 @@ #define CHANNEL_TYPE_ELEMENT_MAXLEN 11 #define CHANNEL_TYPE_ELEMENT_MINLEN 3 +#define ENCRYPT_INFO_ELEMENT_MINLEN 1 /* Encode AoIP transport address element */ struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss) @@ -356,3 +357,72 @@ return ct; } + +/* Encode Encryption Information element */ +struct msgb *gsm0808_enc_encrypt_info(struct gsm0808_encrypt_info *ei) +{ + struct msgb *msg; + unsigned int i; + uint8_t perm_algo = 0; + uint8_t *ptr; + + OSMO_ASSERT(ei); + OSMO_ASSERT(ei->key_len <= ARRAY_SIZE(ei->key)); + OSMO_ASSERT(ei->perm_algo_len <= ENCRY_INFO_PERM_ALGO_MAXLEN); + + msg = + msgb_alloc(ELEMENT_MSGB_MAXLEN, "Encryption Information Element"); + if (!msg) + return NULL; + + for (i = 0; i < ei->perm_algo_len; i++) { + /* Note: gsm_08_08.h defines the permitted algorithms + * as an enum which ranges from 0x01 to 0x08 */ + OSMO_ASSERT(ei->perm_algo[i] != 0); + OSMO_ASSERT(ei->perm_algo[i] <= ENCRY_INFO_PERM_ALGO_MAXLEN); + perm_algo |= (1 << (ei->perm_algo[i] - 1)); + } + + msgb_put_u8(msg, perm_algo); + ptr = msgb_put(msg, ei->key_len); + memcpy(ptr, ei->key, ei->key_len); + + return msg; +} + +/* Decode Encryption Information element */ +struct gsm0808_encrypt_info *gsm0808_dec_encrypt_info(const void *ctx, + struct msgb *msg) +{ + struct gsm0808_encrypt_info *ei; + uint8_t perm_algo; + unsigned int i; + uint8_t *ptr; + unsigned int perm_algo_len = 0; + + if (!msg) + return NULL; + + /* Malformed element */ + if (msg->len < ENCRYPT_INFO_ELEMENT_MINLEN) + return NULL; + + ei = talloc_zero(ctx, struct gsm0808_encrypt_info); + if (!ei) + return NULL; + + perm_algo = msgb_pull_u8(msg); + for (i = 0; i < ENCRY_INFO_PERM_ALGO_MAXLEN; i++) { + if (perm_algo & (1 << i)) { + ei->perm_algo[perm_algo_len] = i + 1; + perm_algo_len++; + } + } + ei->perm_algo_len = perm_algo_len; + + ei->key_len = msg->len; + ptr = msgb_get(msg, msg->len); + memcpy(ei->key, ptr, ei->key_len); + + return ei; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 60cc742..e64fdd9 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -148,6 +148,8 @@ gsm0808_dec_speech_codec_list; gsm0808_enc_channel_type; gsm0808_dec_channel_type; +gsm0808_enc_encrypt_info; +gsm0808_dec_encrypt_info; gsm0858_rsl_ul_meas_enc; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 51edce2..e52cba7 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -619,6 +619,42 @@ msgb_free(ct_enc); } + +static void test_gsm0808_enc_dec_encrypt_info(const void *ctx) +{ + struct gsm0808_encrypt_info ei; + struct msgb *ei_enc; + uint8_t ei_enc_expected[] = + { 0x03, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x23, 0x42 }; + struct gsm0808_encrypt_info *ei_dec; + + memset(&ei, 0, sizeof(ei)); + ei.perm_algo[0] = GSM0808_ALG_ID_A5_0; + ei.perm_algo[1] = GSM0808_ALG_ID_A5_1; + ei.perm_algo_len = 2; + ei.key[0] = 0xaa; + ei.key[1] = 0xbb; + ei.key[2] = 0xcc; + ei.key[3] = 0xdd; + ei.key[4] = 0xee; + ei.key[5] = 0xff; + ei.key[6] = 0x23; + ei.key[7] = 0x42; + ei.key_len = 8; + + ei_enc = gsm0808_enc_encrypt_info(&ei); + OSMO_ASSERT(ei_enc); + OSMO_ASSERT(memcmp(ei_enc_expected, ei_enc->data, ei_enc->len) == 0); + + ei_dec = gsm0808_dec_encrypt_info(ctx, ei_enc); + OSMO_ASSERT(ei_dec); + OSMO_ASSERT(ei_enc->len == 0); + OSMO_ASSERT(memcmp(&ei, ei_dec, sizeof(ei)) == 0); + + talloc_free(ei_dec); + msgb_free(ei_enc); +} + int main(int argc, char **argv) { void *ctx; @@ -649,6 +685,7 @@ test_gsm0808_enc_dec_speech_codec_ext_with_cfg(ctx); test_gsm0808_enc_dec_speech_codec_list(ctx); test_gsm0808_enc_dec_channel_type(ctx); + test_gsm0808_enc_dec_encrypt_info(ctx); printf("Done\n"); -- To view, visit https://gerrit.osmocom.org/2180 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:54 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:54 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add utils for Cell Identifier List Message-ID: Review at https://gerrit.osmocom.org/2181 gsm0808: Add utils for Cell Identifier List The planned support for true A over IP requires the encoding of the a Cell Identifier List element (see also BSS_MAP_MSG_PAGING). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528 --- M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 5 files changed, 195 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/2181/1 diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 2196f94..c9fd124 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -57,3 +57,10 @@ /* Decode Encryption Information element */ struct gsm0808_encrypt_info *gsm0808_dec_encrypt_info(const void *ctx, struct msgb *msg); + +/* Encode Cell Identifier List element */ +struct msgb *gsm0808_enc_cell_id_list(struct gsm0808_cell_id_list *cil); + +/* Decode Cell Identifier List element */ +struct gsm0808_cell_id_list *gsm0808_dec_cell_id_list(const void *ctx, + struct msgb *msg); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index d52af9f..ad7f8eb 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -452,3 +452,17 @@ uint8_t key[ENCRY_INFO_KEY_MAXLEN]; unsigned int key_len; }; + +/* 3GPP TS 48.008 3.2.2.10 Cell Identifier List */ +struct gsm0808_cell_id_list { + uint8_t id_discr; + struct llist_head id_list; +}; + +/* 3GPP TS 48.008 3.2.2.10 Cell Identifier List + * (Coding of i-th Cell Identification for Cell + * identification discriminator = 0101) */ +struct gsm0808_cell_id_lac { + struct llist_head list; + uint16_t lac; +}; diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 7dfe2e9..564f171 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -426,3 +426,87 @@ return ei; } + +/* Encode Cell Identifier List element */ +struct msgb *gsm0808_enc_cell_id_list(struct gsm0808_cell_id_list *cil) +{ + struct msgb *msg; + struct gsm0808_cell_id_lac *lac; + + OSMO_ASSERT(cil); + + /* FIXME: Implement support for all identifier list elements */ + OSMO_ASSERT(cil->id_discr == CELL_IDENT_LAC + || cil->id_discr == CELL_IDENT_BSS) + + msg = msgb_alloc(ELEMENT_MSGB_MAXLEN, "Cell-ID list Element"); + if (!msg) + return NULL; + + msgb_put_u8(msg, cil->id_discr & 0x0f); + + switch (cil->id_discr) { + case CELL_IDENT_LAC: + llist_for_each_entry(lac, &cil->id_list, list) { + msgb_put_u16(msg, lac->lac); + } + break; + + case CELL_IDENT_BSS: + /* Does not have any list items */ + break; + + default: + /* Unspported encoding */ + OSMO_ASSERT(false); + } + + return msg; +} + +/* Decode Cell Identifier List element */ +struct gsm0808_cell_id_list *gsm0808_dec_cell_id_list(const void *ctx, + struct msgb *msg) +{ + uint8_t id_discr; + struct gsm0808_cell_id_list *cil; + struct gsm0808_cell_id_lac *lac; + + if (!msg) + return NULL; + + id_discr = msgb_pull_u8(msg) & 0x0f; + + /* FIXME: Implement support for all identifier list elements */ + if (id_discr != CELL_IDENT_LAC && id_discr != CELL_IDENT_BSS) + return NULL; + + cil = talloc_zero(ctx, struct gsm0808_cell_id_list); + if (!cil) + return NULL; + INIT_LLIST_HEAD(&cil->id_list); + + cil->id_discr = id_discr; + + switch (id_discr) { + case CELL_IDENT_LAC: + while (msg->len >= 2) { + lac = talloc_zero(cil, struct gsm0808_cell_id_lac); + if (!lac) { + talloc_free(cil); + return NULL; + } + lac->lac = msgb_pull_u16(msg); + llist_add(&lac->list, &cil->id_list); + } + + case CELL_IDENT_BSS: + /* Does not have any list items */ + break; + default: + /* Unspported encoding */ + OSMO_ASSERT(false); + } + + return cil; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index e64fdd9..ac8d467 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -150,6 +150,8 @@ gsm0808_dec_channel_type; gsm0808_enc_encrypt_info; gsm0808_dec_encrypt_info; +gsm0808_enc_cell_id_list; +gsm0808_dec_cell_id_list; gsm0858_rsl_ul_meas_enc; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index e52cba7..c7e0d18 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -619,7 +619,6 @@ msgb_free(ct_enc); } - static void test_gsm0808_enc_dec_encrypt_info(const void *ctx) { struct gsm0808_encrypt_info ei; @@ -655,6 +654,91 @@ msgb_free(ei_enc); } +static void test_gsm0808_enc_dec_cell_id_list_lac(const void *ctx) +{ + struct gsm0808_cell_id_lac lac1; + struct gsm0808_cell_id_lac lac2; + struct gsm0808_cell_id_lac lac3; + struct msgb *msg; + struct gsm0808_cell_id_list cil; + struct gsm0808_cell_id_list *cil_decoded; + struct gsm0808_cell_id_lac *lac; + + cil.id_discr = CELL_IDENT_LAC; + INIT_LLIST_HEAD(&cil.id_list); + lac1.lac = 0x1111; + lac2.lac = 0x2222; + lac3.lac = 0x3333; + llist_add(&lac1.list, &cil.id_list); + llist_add(&lac2.list, &cil.id_list); + llist_add(&lac3.list, &cil.id_list); + + msg = gsm0808_enc_cell_id_list(&cil); + OSMO_ASSERT(msg); + cil_decoded = gsm0808_dec_cell_id_list(ctx, msg); + OSMO_ASSERT(cil_decoded); + OSMO_ASSERT(msg->len == 0); + OSMO_ASSERT(cil_decoded->id_discr == cil.id_discr); + + llist_for_each_entry(lac, &cil_decoded->id_list, list) { + OSMO_ASSERT((lac->lac == lac1.lac) || (lac->lac == lac2.lac) + || (lac->lac == lac3.lac)) + } + + talloc_free(cil_decoded); + msgb_free(msg); +} + +static void test_gsm0808_enc_dec_cell_id_list_single_lac(const void *ctx) +{ + struct gsm0808_cell_id_lac lac_enc; + struct msgb *msg; + struct gsm0808_cell_id_list cil; + struct gsm0808_cell_id_list *cil_decoded; + struct gsm0808_cell_id_lac *lac; + uint8_t cil_enc_expected[] = {0x05, 0x23, 0x42}; + cil.id_discr = CELL_IDENT_LAC; + INIT_LLIST_HEAD(&cil.id_list); + lac_enc.lac = 0x2342; + llist_add(&lac_enc.list, &cil.id_list); + + msg = gsm0808_enc_cell_id_list(&cil); + OSMO_ASSERT(msg); + OSMO_ASSERT(memcmp(cil_enc_expected,msg->data,msg->len) == 0); + + cil_decoded = gsm0808_dec_cell_id_list(ctx, msg); + OSMO_ASSERT(cil_decoded); + OSMO_ASSERT(msg->len == 0); + OSMO_ASSERT(cil_decoded->id_discr == cil.id_discr); + + llist_for_each_entry(lac, &cil_decoded->id_list, list) { + OSMO_ASSERT(lac->lac == lac_enc.lac) + } + + talloc_free(cil_decoded); + msgb_free(msg); +} + +static void test_gsm0808_enc_dec_cell_id_list_bss(const void *ctx) +{ + struct msgb *msg; + struct gsm0808_cell_id_list cil; + struct gsm0808_cell_id_list *cil_decoded; + + cil.id_discr = CELL_IDENT_BSS; + + msg = gsm0808_enc_cell_id_list(&cil); + OSMO_ASSERT(msg); + + cil_decoded = gsm0808_dec_cell_id_list(ctx, msg); + OSMO_ASSERT(cil_decoded); + OSMO_ASSERT(msg->len == 0); + OSMO_ASSERT(cil_decoded->id_discr == cil.id_discr); + + talloc_free(cil_decoded); + msgb_free(msg); +} + int main(int argc, char **argv) { void *ctx; @@ -686,6 +770,9 @@ test_gsm0808_enc_dec_speech_codec_list(ctx); test_gsm0808_enc_dec_channel_type(ctx); test_gsm0808_enc_dec_encrypt_info(ctx); + test_gsm0808_enc_dec_cell_id_list_lac(ctx); + test_gsm0808_enc_dec_cell_id_list_single_lac(ctx); + test_gsm0808_enc_dec_cell_id_list_bss(ctx); printf("Done\n"); -- To view, visit https://gerrit.osmocom.org/2181 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:54 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:54 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add create functions for CIPHER MODE COMMAND Message-ID: Review at https://gerrit.osmocom.org/2182 gsm0808: Add create functions for CIPHER MODE COMMAND gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP CIPHER MODE COMMAND message. Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 86 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/2182/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 7ef62b2..44ce763 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -34,6 +34,8 @@ struct msgb *gsm0808_create_reset_ack(void); struct msgb *gsm0808_create_clear_command(uint8_t reason); struct msgb *gsm0808_create_clear_complete(void); +struct msgb *gsm0808_create_cipher(struct gsm0808_encrypt_info *ei, + uint8_t *cipher_response_mode); struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id); struct msgb *gsm0808_create_cipher_reject(uint8_t cause); struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index c37ce3e..7e91df8 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -140,6 +140,47 @@ return msg; } +struct msgb *gsm0808_create_cipher(struct gsm0808_encrypt_info *ei, + uint8_t *cipher_response_mode) +{ + /* See also: 3GPP TS 48.008 3.2.1.30 CIPHER MODE COMMAND */ + struct msgb *msg; + struct msgb *ei_encoded; + + /* Mandatory emelent! */ + OSMO_ASSERT(ei); + + msg = + msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "cipher-mode-command"); + if (!msg) + return NULL; + + /* Message Type 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_CIPHER_MODE_CMD); + + /* Encryption Information 3.2.2.10 */ + ei_encoded = gsm0808_enc_encrypt_info(ei); + if (!ei_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_ENCRYPTION_INFORMATION, + ei_encoded->len, ei_encoded->data); + msgb_free(ei_encoded); + + /* Cipher Response Mode 3.2.2.34 */ + if (cipher_response_mode) + msgb_tv_put(msg, GSM0808_IE_CIPHER_RESPONSE_MODE, + *cipher_response_mode); + + /* pre-pend the header */ + msg->l3h = + msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id) { struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index ac8d467..2826cd8 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -128,6 +128,7 @@ gsm0808_create_assignment_completed_aoip; gsm0808_create_assignment_failure; gsm0808_create_assignment_failure_aoip; +gsm0808_create_cipher; gsm0808_create_cipher_complete; gsm0808_create_cipher_reject; gsm0808_create_classmark_update; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index c7e0d18..b3f1f40 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -162,6 +162,46 @@ msgb_free(msg); } +static void test_create_cipher() +{ + static const uint8_t res[] = + { 0x00, 0x0c, 0x53, 0x0a, 0x09, 0x03, 0xaa, + 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x23, 0x42 }; + static const uint8_t res2[] = + { 0x00, 0x0e, 0x53, 0x0a, 0x09, 0x03, 0xaa, + 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x23, 0x42, + GSM0808_IE_CIPHER_RESPONSE_MODE, 0x01 }; + struct msgb *msg; + struct gsm0808_encrypt_info ei; + uint8_t include_imeisv; + + memset(&ei, 0, sizeof(ei)); + ei.perm_algo[0] = GSM0808_ALG_ID_A5_0; + ei.perm_algo[1] = GSM0808_ALG_ID_A5_1; + ei.perm_algo_len = 2; + ei.key[0] = 0xaa; + ei.key[1] = 0xbb; + ei.key[2] = 0xcc; + ei.key[3] = 0xdd; + ei.key[4] = 0xee; + ei.key[5] = 0xff; + ei.key[6] = 0x23; + ei.key[7] = 0x42; + ei.key_len = 8; + include_imeisv = 1; + + printf("Testing creating Chipher Mode Command\n"); + msg = gsm0808_create_cipher(&ei, NULL); + OSMO_ASSERT(msg); + VERIFY(msg, res, ARRAY_SIZE(res)); + msgb_free(msg); + + msg = gsm0808_create_cipher(&ei, &include_imeisv); + OSMO_ASSERT(msg); + VERIFY(msg, res2, ARRAY_SIZE(res2)); + msgb_free(msg); +} + static void test_create_cipher_complete() { static const uint8_t res1[] = { @@ -751,6 +791,7 @@ test_create_reset(); test_create_clear_command(); test_create_clear_complete(); + test_create_cipher(); test_create_cipher_complete(); test_create_cipher_reject(); test_create_cm_u(); diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index f406551..8e2087d 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -4,6 +4,7 @@ Testing creating Reset Testing creating Clear Command Testing creating Clear Complete +Testing creating Chipher Mode Command Testing creating Cipher Complete Testing creating Cipher Reject Testing creating CM U -- To view, visit https://gerrit.osmocom.org/2182 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:55 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:55 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add create functions for BSS_MAP_MSG_PAGING Message-ID: Review at https://gerrit.osmocom.org/2183 gsm0808: Add create functions for BSS_MAP_MSG_PAGING gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_paging() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 110 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/83/2183/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 44ce763..6cd933b 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -59,6 +59,9 @@ struct llist_head *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging(char *imsi, uint32_t *tmsi, + struct gsm0808_cell_id_list *cil, + uint8_t *chan_needed); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 7e91df8..b6ae0fa 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -410,6 +410,67 @@ return msg; } +struct msgb *gsm0808_create_paging(char *imsi, uint32_t *tmsi, + struct gsm0808_cell_id_list *cil, + uint8_t *chan_needed) +{ + struct msgb *msg; + struct msgb *cil_encoded; + uint8_t mid_buf[GSM48_MI_SIZE + 2]; + int mid_len; + uint32_t tmsi_sw; + + /* Mandatory emelents! */ + OSMO_ASSERT(imsi); + OSMO_ASSERT(cil); + + /* Malformed IMSI */ + OSMO_ASSERT(strlen(imsi) <= GSM48_MI_SIZE); + + msg = + msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "paging"); + if (!msg) + return NULL; + + /* Message Type 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_PAGING); + + /* IMSI 3.2.2.6 */ + mid_len = gsm48_generate_mid_from_imsi(mid_buf, imsi); + msgb_tlv_put(msg, GSM0808_IE_IMSI, mid_len - 2, mid_buf + 2); + + /* TMSI 3.2.2.7 */ + if (tmsi) { + tmsi_sw = htonl(*tmsi); + msgb_tlv_put(msg, GSM0808_IE_TMSI, sizeof(*tmsi), + (uint8_t *) & tmsi_sw); + } + + /* Cell Identifier List 3.2.2.27 */ + if (cil) { + cil_encoded = gsm0808_enc_cell_id_list(cil); + if (!cil_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_CELL_IDENTIFIER_LIST, + cil_encoded->len, cil_encoded->data); + msgb_free(cil_encoded); + } + + /* Channel Needed 3.2.2.36 */ + if (chan_needed) { + msgb_tv_put(msg, GSM0808_IE_CHANNEL_NEEDED, + (*chan_needed) & 0x03); + } + + /* pre-pend the header */ + msg->l3h = + msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id) { uint8_t *hh = msgb_push(msg, 3); diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 2826cd8..fb06bff 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -135,6 +135,7 @@ gsm0808_create_clear_command; gsm0808_create_clear_complete; gsm0808_create_clear_rqst; +gsm0808_create_paging; gsm0808_create_dtap; gsm0808_create_layer3; gsm0808_create_layer3_aoip; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index b3f1f40..4743658 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -388,6 +389,48 @@ printf("Testing creating Clear Request\n"); msg = gsm0808_create_clear_rqst(0x23); VERIFY(msg, res, ARRAY_SIZE(res)); + msgb_free(msg); +} + +static void test_create_paging() +{ + static const uint8_t res[] = + { 0x00, 0x10, 0x52, 0x08, 0x08, 0x09, 0x10, 0x10, 0x00, 0x00, 0x00, + 0x21, 0x43, 0x1a, 0x03, 0x05, 0x23, 0x42 }; + static const uint8_t res2[] = + { 0x00, 0x16, 0x52, 0x08, 0x08, 0x09, 0x10, 0x10, 0x00, 0x00, 0x00, + 0x21, 0x43, GSM0808_IE_TMSI, 0x04, 0x12, 0x34, 0x56, 0x78, 0x1a, + 0x03, 0x05, 0x23, 0x42 }; + static const uint8_t res3[] = + { 0x00, 0x18, 0x52, 0x08, 0x08, 0x09, 0x10, 0x10, 0x00, 0x00, 0x00, + 0x21, 0x43, GSM0808_IE_TMSI, 0x04, 0x12, 0x34, 0x56, 0x78, 0x1a, + 0x03, 0x05, 0x23, 0x42, GSM0808_IE_CHANNEL_NEEDED, + RSL_CHANNEED_TCH_ForH }; + + struct msgb *msg; + struct gsm0808_cell_id_lac lac_enc; + struct gsm0808_cell_id_list cil; + uint32_t tmsi = 0x12345678; + uint8_t chan_needed = RSL_CHANNEED_TCH_ForH; + + char imsi[] = "001010000001234"; + + cil.id_discr = CELL_IDENT_LAC; + INIT_LLIST_HEAD(&cil.id_list); + lac_enc.lac = 0x2342; + llist_add(&lac_enc.list, &cil.id_list); + + printf("Testing creating Paging Request\n"); + msg = gsm0808_create_paging(imsi, NULL, &cil, NULL); + VERIFY(msg, res, ARRAY_SIZE(res)); + msgb_free(msg); + + msg = gsm0808_create_paging(imsi, &tmsi, &cil, NULL); + VERIFY(msg, res2, ARRAY_SIZE(res2)); + msgb_free(msg); + + msg = gsm0808_create_paging(imsi, &tmsi, &cil, &chan_needed); + VERIFY(msg, res3, ARRAY_SIZE(res3)); msgb_free(msg); } @@ -801,6 +844,7 @@ test_create_ass_fail(); test_create_ass_fail_aoip(ctx); test_create_clear_rqst(); + test_create_paging(); test_create_dtap(); test_prepend_dtap(); test_enc_dec_aoip_trasp_addr_v4(ctx); diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index 8e2087d..6170a7a 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -14,6 +14,7 @@ Testing creating Assignment Failure Testing creating Assignment Failure (AoIP) Testing creating Clear Request +Testing creating Paging Request Testing creating DTAP Testing prepend DTAP Done -- To view, visit https://gerrit.osmocom.org/2183 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:44:55 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:44:55 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST Message-ID: Review at https://gerrit.osmocom.org/2184 gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_assignment() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 138 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/2184/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 6cd933b..aa8148a 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -41,6 +41,11 @@ struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len); struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); +struct msgb *gsm0808_create_assignment(struct gsm0808_channel_type *ct, + uint16_t *cic, + struct sockaddr_storage *ss, + struct llist_head *scl, + uint32_t *ci); struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, uint8_t chosen_channel, uint8_t encr_alg_id, diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index b6ae0fa..b43e2eb 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -255,6 +255,86 @@ return msg; } +struct msgb *gsm0808_create_assignment(struct gsm0808_channel_type *ct, + uint16_t *cic, + struct sockaddr_storage *ss, + struct llist_head *scl, uint32_t *ci) +{ + /* See also: 3GPP TS 48.008 3.2.1.1 ASSIGNMENT REQUEST */ + struct msgb *msg; + struct msgb *ct_encoded; + uint16_t cic_sw; + struct msgb *ss_encoded; + struct msgb *scl_encoded; + uint32_t ci_sw; + + /* Mandatory emelent! */ + OSMO_ASSERT(ct); + + msg = + msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "bssmap: ass req"); + if (!msg) + return NULL; + + /* Message Type 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_ASSIGMENT_RQST); + + /* Channel Type 3.2.2.11 */ + ct_encoded = gsm0808_enc_channel_type(ct); + if (!ct_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_CHANNEL_TYPE, ct_encoded->len, + ct_encoded->data); + msgb_free(ct_encoded); + + /* Circuit Identity Code 3.2.2.2 */ + if (cic) { + cic_sw = htons(*cic); + msgb_tv_fixed_put(msg, GSM0808_IE_CIRCUIT_IDENTITY_CODE, + sizeof(cic_sw), (uint8_t *) & cic_sw); + } + + /* AoIP: AoIP Transport Layer Address (MGW) 3.2.2.102 */ + if (ss) { + ss_encoded = gsm0808_enc_aoip_trasp_addr(ss); + if (!ss_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_AOIP_TRASP_ADDR, + ss_encoded->len, ss_encoded->data); + msgb_free(ss_encoded); + } + + /* AoIP: Codec List (MSC Preferred) 3.2.2.103 */ + if (scl) { + scl_encoded = gsm0808_enc_speech_codec_list(scl); + if (!scl_encoded) { + msgb_free(msg); + return NULL; + } + msgb_tlv_put(msg, GSM0808_IE_SPEECH_CODEC_LIST, + scl_encoded->len, scl_encoded->data); + msgb_free(scl_encoded); + } + + /* AoIP: Call Identifier 3.2.2.105 */ + if (ci) { + ci_sw = htonl(*ci); + msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, sizeof(ci_sw), + (uint8_t *) & ci_sw); + } + + /* push the bssmap header */ + msg->l3h = + msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + return msg; +} + struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, uint8_t chosen_channel, uint8_t encr_alg_id, diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index fb06bff..fcd13d1 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -124,6 +124,7 @@ gsm0808_att_tlvdef; gsm0808_bssap_name; gsm0808_bssmap_name; +gsm0808_create_assignment; gsm0808_create_assignment_completed; gsm0808_create_assignment_completed_aoip; gsm0808_create_assignment_failure; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 4743658..549229b 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -280,6 +280,56 @@ msgb_free(msg); } +static void test_create_ass(const void *ctx) +{ + static const uint8_t res1[] = + { 0x00, 0x0a, 0x01, 0x0b, 0x04, 0x01, 0x0b, 0xa1, 0x25, 0x01, 0x00, + 0x04 }; + static const uint8_t res2[] = + { 0x00, 0x20, 0x01, 0x0b, 0x04, 0x01, 0x0b, 0xa1, 0x25, 0x01, 0x00, + 0x04, GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17, + 0x04, 0xd2, GSM0808_IE_SPEECH_CODEC_LIST, 0x07, 0x5f, 0xab, 0xcd, + 0xef, 0xa5, 0x9f, 0xf2, GSM0808_IE_CALL_ID, 0xaa, 0xbb, 0xcc, + 0xdd }; + + struct msgb *msg; + struct gsm0808_channel_type ct; + uint16_t cic = 0004; + struct sockaddr_storage ss; + struct sockaddr_in sin; + struct llist_head *sc_list; + uint32_t call_id = 0xAABBCCDD; + + memset(&ct, 0, sizeof(ct)); + ct.ch_indctr = GSM0808_CHAN_SPEECH; + ct.ch_rate_type = GSM0808_SPEECH_HALF_PREF; + ct.perm_spch[0] = GSM0808_PERM_FR3; + ct.perm_spch[1] = GSM0808_PERM_HR3; + ct.perm_spch_len = 2; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(1234); + inet_aton("192.168.100.23", &sin.sin_addr); + + memset(&ss, 0, sizeof(ss)); + memcpy(&ss, &sin, sizeof(sin)); + + sc_list = setup_codec_list(ctx); + + printf("Testing creating Assignment Request\n"); + msg = gsm0808_create_assignment(&ct, &cic, NULL, NULL, NULL); + OSMO_ASSERT(msg); + VERIFY(msg, res1, ARRAY_SIZE(res1)); + msgb_free(msg); + + msg = gsm0808_create_assignment(&ct, &cic, &ss, sc_list, &call_id); + OSMO_ASSERT(msg); + VERIFY(msg, res2, ARRAY_SIZE(res2)); + msgb_free(msg); + talloc_free(sc_list); +} + static void test_create_ass_compl() { static const uint8_t res1[] = { @@ -839,6 +889,7 @@ test_create_cipher_reject(); test_create_cm_u(); test_create_sapi_reject(); + test_create_ass(ctx); test_create_ass_compl(); test_create_ass_compl_aoip(ctx); test_create_ass_fail(); diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index 6170a7a..52af134 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -9,6 +9,7 @@ Testing creating Cipher Reject Testing creating CM U Testing creating SAPI Reject +Testing creating Assignment Request Testing creating Assignment Complete Testing creating Assignment Complete (AoIP) Testing creating Assignment Failure -- To view, visit https://gerrit.osmocom.org/2184 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Thu Mar 30 16:57:32 2017 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Thu, 30 Mar 2017 16:57:32 +0000 Subject: [PATCH] libosmocore[master]: gsm0808: Add utils for AoIP Transport Layer Address In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2176 to look at the new patch set (#2). gsm0808: Add utils for AoIP Transport Layer Address The planned support for true A over IP requires the encoding and decoding of a so called "AoIP Transport Layer Address" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332 --- M include/Makefile.am A include/osmocom/gsm/gsm0808_utils.h M src/gsm/Makefile.am A src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 6 files changed, 218 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/2176/2 diff --git a/include/Makefile.am b/include/Makefile.am index e2a1b12..0383d7a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -77,6 +77,7 @@ osmocom/coding/gsm0503_interleaving.h \ osmocom/coding/gsm0503_coding.h \ osmocom/gsm/gsm0808.h \ + osmocom/gsm/gsm0808_utils.h \ osmocom/gsm/gsm23003.h \ osmocom/gsm/gsm48.h \ osmocom/gsm/gsm48_ie.h \ diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h new file mode 100644 index 0000000..d4d8618 --- /dev/null +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -0,0 +1,29 @@ +/* (C) 2016 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * 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 . + * + */ +#pragma once + +#include + +/* Encode AoIP transport address element */ +struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss); + +/* Decode AoIP transport address element */ +struct sockaddr_storage *gsm0808_dec_aoip_trasp_addr(const void *ctx, + struct msgb *msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3a4a0cd..e64c9e7 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -25,7 +25,7 @@ auth_milenage.c milenage/aes-encblock.c gea.c \ milenage/aes-internal.c milenage/aes-internal-enc.c \ milenage/milenage.c gan.c ipa.c gsm0341.c apn.c \ - gsup.c gprs_gea.c gsm0503_conv.c oap.c + gsup.c gprs_gea.c gsm0503_conv.c oap.c gsm0808_utils.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c new file mode 100644 index 0000000..d1897cf4 --- /dev/null +++ b/src/gsm/gsm0808_utils.c @@ -0,0 +1,115 @@ +/* (C) 2016 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * 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 . + * + */ + +#include +#include +#include +#include +#include +#include + +#define ELEMENT_MSGB_MAXLEN 256 + +#define IP_V4_ADDR_LEN 4 +#define IP_V6_ADDR_LEN 16 +#define IP_PORT_LEN 2 + +/* Encode AoIP transport address element */ +struct msgb *gsm0808_enc_aoip_trasp_addr(struct sockaddr_storage *ss) +{ + /* See also 3GPP TS 48.008 3.2.2.102 AoIP Transport Layer Address */ + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + uint16_t port = 0; + + uint8_t *ptr; + struct msgb *msg; + + OSMO_ASSERT(ss); + OSMO_ASSERT(ss->ss_family == AF_INET || ss->ss_family == AF_INET6); + + msg = msgb_alloc(ELEMENT_MSGB_MAXLEN, "AoIP Transport Layer Address"); + if (!msg) + return NULL; + + switch (ss->ss_family) { + case AF_INET: + sin = (struct sockaddr_in *)ss; + port = ntohs(sin->sin_port); + ptr = msgb_put(msg, IP_V4_ADDR_LEN); + memcpy(ptr, &sin->sin_addr.s_addr, IP_V4_ADDR_LEN); + break; + case AF_INET6: + sin6 = (struct sockaddr_in6 *)ss; + port = ntohs(sin6->sin6_port); + ptr = msgb_put(msg, IP_V6_ADDR_LEN); + memcpy(ptr, sin6->sin6_addr.s6_addr, IP_V6_ADDR_LEN); + break; + } + + msgb_put_u16(msg, port); + return msg; +} + +/* Decode AoIP transport address element */ +struct sockaddr_storage *gsm0808_dec_aoip_trasp_addr(const void *ctx, + struct msgb *msg) +{ + /* See also 3GPP TS 48.008 3.2.2.102 AoIP Transport Layer Address */ + struct sockaddr_storage *ss; + struct sockaddr_in sin; + struct sockaddr_in6 sin6; + uint8_t *ptr; + + if (!msg) + return NULL; + + switch (msg->len) { + + case IP_V4_ADDR_LEN + IP_PORT_LEN: + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(msgb_get_u16(msg)); + ptr = msgb_get(msg, IP_V4_ADDR_LEN); + memcpy(&sin.sin_addr.s_addr, ptr, IP_V4_ADDR_LEN); + ss = talloc_zero(ctx, struct sockaddr_storage); + if (!ss) + return NULL; + memcpy(ss, &sin, sizeof(sin)); + break; + case IP_V6_ADDR_LEN + IP_PORT_LEN: + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_port = htons(msgb_get_u16(msg)); + ptr = msgb_get(msg, IP_V6_ADDR_LEN); + memcpy(sin6.sin6_addr.s6_addr, ptr, IP_V6_ADDR_LEN); + ss = talloc_zero(ctx, struct sockaddr_storage); + if (!ss) + return NULL; + memcpy(ss, &sin6, sizeof(sin6)); + break; + default: + /* Malformed element */ + return NULL; + break; + } + + return ss; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 5649e71..3ad847d 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -137,6 +137,8 @@ gsm0808_create_reset; gsm0808_create_sapi_reject; gsm0808_prepend_dtap_header; +gsm0808_enc_aoip_trasp_addr; +gsm0808_dec_aoip_trasp_addr; gsm0858_rsl_ul_meas_enc; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 98502b7..99605d8 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -19,9 +19,14 @@ */ #include +#include +#include #include #include +#include +#include +#include #define VERIFY(msg, data, len) \ if (msgb_l3len(msg) != len) { \ @@ -247,8 +252,67 @@ msgb_free(in_msg); } +static void test_enc_dec_aoip_trasp_addr_v4(const void *ctx) +{ + struct sockaddr_storage enc_addr; + struct sockaddr_storage *dec_addr; + struct sockaddr_in enc_addr_in; + struct msgb *msg; + + memset(&enc_addr_in, 0, sizeof(enc_addr_in)); + enc_addr_in.sin_family = AF_INET; + enc_addr_in.sin_port = htons(1234); + inet_aton("255.0.255.255", &enc_addr_in.sin_addr); + + memset(&enc_addr, 0, sizeof(enc_addr)); + memcpy(&enc_addr, &enc_addr_in, sizeof(enc_addr_in)); + + msg = gsm0808_enc_aoip_trasp_addr(&enc_addr); + OSMO_ASSERT(msg); + dec_addr = gsm0808_dec_aoip_trasp_addr(ctx, msg); + OSMO_ASSERT(dec_addr); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_addr, dec_addr, sizeof(enc_addr)) == 0); + + talloc_free(dec_addr); + msgb_free(msg); +} + +static void test_enc_dec_aoip_trasp_addr_v6(const void *ctx) +{ + struct sockaddr_storage enc_addr; + struct sockaddr_storage *dec_addr; + struct sockaddr_in6 enc_addr_in; + struct msgb *msg; + + memset(&enc_addr_in, 0, sizeof(enc_addr_in)); + enc_addr_in.sin6_family = AF_INET6; + enc_addr_in.sin6_port = htons(4567); + inet_pton(AF_INET6, "2001:0db8:85a3:08d3:1319:8a2e:0370:7344", + &enc_addr_in.sin6_addr); + + memset(&enc_addr, 0, sizeof(enc_addr)); + memcpy(&enc_addr, &enc_addr_in, sizeof(enc_addr_in)); + + msg = gsm0808_enc_aoip_trasp_addr(&enc_addr); + OSMO_ASSERT(msg); + dec_addr = gsm0808_dec_aoip_trasp_addr(ctx, msg); + OSMO_ASSERT(dec_addr); + OSMO_ASSERT(msg->len == 0); + + OSMO_ASSERT(memcmp(&enc_addr, dec_addr, sizeof(enc_addr)) == 0); + + talloc_free(dec_addr); + msgb_free(msg); +} + int main(int argc, char **argv) { + void *ctx; + + ctx = talloc_named_const(NULL, 0, "gsm0808_ctx"); + printf("Testing generation of GSM0808 messages\n"); test_create_layer3(); test_create_reset(); @@ -263,7 +327,13 @@ test_create_clear_rqst(); test_create_dtap(); test_prepend_dtap(); + test_enc_dec_aoip_trasp_addr_v4(ctx); + test_enc_dec_aoip_trasp_addr_v6(ctx); printf("Done\n"); + + talloc_report_full(ctx, stderr); + OSMO_ASSERT(talloc_total_blocks(ctx) == 1); + return EXIT_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/2176 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Mar 30 17:27:56 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 30 Mar 2017 17:27:56 +0000 Subject: libosmocore[master]: gsm0808: Add utils for Speech Codec List and Speech Codec In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2177/2/src/gsm/gsm0808_utils.c File src/gsm/gsm0808_utils.c: Line 151: struct msgb *gsm0808_enc_speech_codec(struct gsm0808_speech_codec *sc) I think I don't really understand the idea behind those functions. When we encode an entire message (like "ASSIGNMENT REQUEST", it makes sense to allocate a new msgb, and then send that msgb via the A interface. However, allocating msgb's for individual information elements? How do I use this API? Normally I would expect that I create some msgb for a given message type, and then add information elements to it. But this code seems to assume that every IE is its own msgb? -- To view, visit https://gerrit.osmocom.org/2177 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 30 17:29:15 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 30 Mar 2017 17:29:15 +0000 Subject: libosmocore[master]: gsm0808: Add utils for AoIP Transport Layer Address In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2176/2/src/gsm/gsm0808_utils.c File src/gsm/gsm0808_utils.c: Line 72: struct sockaddr_storage *gsm0808_dec_aoip_trasp_addr(const void *ctx, in genera we try to avoid dynamic allcoations whenever it is not needed, So I guess a more natural way to do this is to pass a caller-allocated 'struct sockaddr_storage *' as argument into the function. This way, the caller can pass the address-of a member structure of some internal state into the decoder. -- To view, visit https://gerrit.osmocom.org/2176 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 30 17:30:14 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 30 Mar 2017 17:30:14 +0000 Subject: libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu... In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2178/2/src/gsm/gsm0808.c File src/gsm/gsm0808.c: Line 64: scl_encoded = gsm0808_enc_speech_codec_list(scl); why not simply pass the msgb into the gsm0808_enc_speech_codec_list() function, so that function will msgb_put() it at the [current] end of the message? -- To view, visit https://gerrit.osmocom.org/2178 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I77f866abec1822d19871052f3c647ad782785b34 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 30 17:31:24 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 30 Mar 2017 17:31:24 +0000 Subject: libosmocore[master]: gsm0808: Add utils for Encryption Information In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2180/2/src/gsm/gsm0808_utils.c File src/gsm/gsm0808_utils.c: Line 374: msgb_alloc(ELEMENT_MSGB_MAXLEN, "Encryption Information Element"); codingstyle wise we rather break the line before the "Encryption..." string than break+indent the entire line -- To view, visit https://gerrit.osmocom.org/2180 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Mar 30 17:34:48 2017 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 30 Mar 2017 17:34:48 +0000 Subject: libosmocore[master]: gsm0808: Add utils for Cell Identifier List In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2181/2/include/osmocom/gsm/protocol/gsm_08_08.h File include/osmocom/gsm/protocol/gsm_08_08.h: Line 457: struct gsm0808_cell_id_list { also here, I would generally try to avoid resorting to linked lists and dynamic allocations. The length ofthe Cell ID List IE is limited to 256 bytes (one-octet length), and thus the total number of call_id's in the list can be computed from that. We can put an array of the maximum number of possible Cell Identifiers in the 'struct gsm0808_cell_id_list. -- To view, visit https://gerrit.osmocom.org/2181 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 31 00:36:53 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 00:36:53 +0000 Subject: [PATCH] osmo-trx[master]: config: Remove OpenBTS style sqlite configuration Message-ID: Review at https://gerrit.osmocom.org/2185 config: Remove OpenBTS style sqlite configuration OpenBTS relies on reading in configuration values from the OpenBTS.config sqlite3 database. This configuration method is not maintained and not recommended for Osmocom or OpenBTS use. Command line setup is the recommended approach. Note that when the osmo-trx logging mechanism is replaced, the sqlite dependency will be removed. Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd --- M Transceiver52M/osmo-trx.cpp 1 file changed, 2 insertions(+), 74 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/85/2185/1 diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 5e81586..e07fd8e 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -57,8 +57,6 @@ */ #define DEFAULT_TRX_PORT 5700 #define DEFAULT_TRX_IP "127.0.0.1" -#define DEFAULT_EXTREF false -#define DEFAULT_DIVERSITY false #define DEFAULT_CHANS 1 struct trx_config { @@ -86,40 +84,6 @@ volatile bool gshutdown = false; -/* Run sanity check on configuration table - * The global table constructor cannot provide notification in the - * event of failure. Make sure that we can access the database, - * write to it, and that it contains the bare minimum required keys. - */ -bool testConfig() -{ - int val = 9999; - std::string test = "asldfkjsaldkf"; - const char *key = "Log.Level"; - - /* Attempt to query */ - try { - gConfig.getStr(key); - } catch (...) { - std::cerr << std::endl; - std::cerr << "Config: Failed query required key " << key - << std::endl; - return false; - } - - /* Attempt to set a test value in the global config */ - if (!gConfig.set(test, val)) { - std::cerr << std::endl; - std::cerr << "Config: Failed to set test key" << std::endl; - return false; - } else { - gConfig.remove(test); - } - - return true; -} - - /* Setup configuration values * Don't query the existence of the Log.Level because it's a * mandatory value. That is, if it doesn't exist, the configuration @@ -130,43 +94,6 @@ bool trx_setup_config(struct trx_config *config) { std::string refstr, fillstr, divstr, mcstr, edgestr; - - if (!testConfig()) - return false; - - if (config->log_level == "") - config->log_level = gConfig.getStr("Log.Level"); - - if (!config->port) { - if (gConfig.defines("TRX.Port")) - config->port = gConfig.getNum("TRX.Port"); - else - config->port = DEFAULT_TRX_PORT; - } - - if (config->addr == "") { - if (gConfig.defines("TRX.IP")) - config->addr = gConfig.getStr("TRX.IP"); - else - config->addr = DEFAULT_TRX_IP; - } - - if (!config->extref) { - if (gConfig.defines("TRX.Reference")) - config->extref = gConfig.getNum("TRX.Reference"); - else - config->extref = DEFAULT_EXTREF; - } - - if (!config->diversity) { - if (gConfig.defines("TRX.Diversity")) - config->diversity = gConfig.getNum("TRX.Diversity"); - else - config->diversity = DEFAULT_DIVERSITY; - } - - if (!config->chans) - config->chans = DEFAULT_CHANS; if (config->mcbts && ((config->chans < 0) || (config->chans > 5))) { std::cout << "Unsupported number of channels" << std::endl; @@ -350,7 +277,8 @@ { int option; - config->port = 0; + config->addr = DEFAULT_TRX_IP; + config->port = DEFAULT_TRX_PORT; config->tx_sps = DEFAULT_TX_SPS; config->rx_sps = DEFAULT_RX_SPS; config->chans = DEFAULT_CHANS; -- To view, visit https://gerrit.osmocom.org/2185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 00:36:53 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 00:36:53 +0000 Subject: [PATCH] osmo-trx[master]: radioInterface: Remove UmTRX 'diversity' option Message-ID: Review at https://gerrit.osmocom.org/2186 radioInterface: Remove UmTRX 'diversity' option The 'diversity' option was an experimental 2 antenna receiver implementation for UmTRX. The implementation has not been maintained and current working status is unknown. In addition to code rot, Coverity is triggering errors in the associated code sections. Removal of code cleans up many cases of special handling that were necessary to accommodate the implementation. Change-Id: I46752ccf5dbcffbec806081dec03e69a0fbdcdb7 --- M Transceiver52M/Makefile.am M Transceiver52M/UHDDevice.cpp M Transceiver52M/USRPDevice.cpp M Transceiver52M/osmo-trx.cpp M Transceiver52M/radioDevice.h M Transceiver52M/radioInterface.cpp M Transceiver52M/radioInterface.h D Transceiver52M/radioInterfaceDiversity.cpp M Transceiver52M/sigProcLib.cpp 9 files changed, 13 insertions(+), 400 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/86/2186/1 diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am index 68cdf74..c2ab9ca 100644 --- a/Transceiver52M/Makefile.am +++ b/Transceiver52M/Makefile.am @@ -67,8 +67,7 @@ $(COMMON_SOURCES) \ Resampler.cpp \ radioInterfaceResamp.cpp \ - radioInterfaceMulti.cpp \ - radioInterfaceDiversity.cpp + radioInterfaceMulti.cpp bin_PROGRAMS = osmo-trx diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index c5ea4c1..ce6d1be 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -139,16 +139,6 @@ #define NUM_UHD_OFFSETS (sizeof(uhd_offsets)/sizeof(uhd_offsets[0])) /* - * Offset handling for special cases. Currently used for UmTRX dual channel - * diversity receiver only. - */ -static struct uhd_dev_offset special_offsets[] = { - { UMTRX, 1, 1, 8.0875e-5, "UmTRX diversity, 1 SPS" }, - { UMTRX, 4, 1, 5.2103e-5, "UmTRX diversity, 4 SPS" }, -}; - - -/* * Select sample rate based on device type and requested samples-per-symbol. * The base rate is either GSM symbol rate, 270.833 kHz, or the minimum * usable channel spacing of 400 kHz. @@ -156,15 +146,6 @@ static double select_rate(uhd_dev_type type, int sps, RadioDevice::InterfaceType iface) { - if (iface == RadioDevice::DIVERSITY) { - if (type == UMTRX) - return GSMRATE * 4; - - LOG(ALERT) << "Diversity supported on UmTRX only"; - return -9999.99; - } - - if ((sps != 4) && (sps != 1)) return -9999.99; @@ -499,30 +480,13 @@ return 0.0; } - /* Special cases (e.g. diversity receiver) */ - if (iface == DIVERSITY) { - if ((dev_type != UMTRX) || (rx_sps != 1)) { - LOG(ALERT) << "Unsupported device configuration"; - return 0.0; - } - - switch (tx_sps) { - case 1: - offset = &special_offsets[0]; + /* Search for matching offset value */ + for (size_t i = 0; i < NUM_UHD_OFFSETS; i++) { + if ((dev_type == uhd_offsets[i].type) && + (tx_sps == uhd_offsets[i].tx_sps) && + (rx_sps == uhd_offsets[i].rx_sps)) { + offset = &uhd_offsets[i]; break; - case 4: - default: - offset = &special_offsets[1]; - } - } else { - /* Search for matching offset value */ - for (size_t i = 0; i < NUM_UHD_OFFSETS; i++) { - if ((dev_type == uhd_offsets[i].type) && - (tx_sps == uhd_offsets[i].tx_sps) && - (rx_sps == uhd_offsets[i].rx_sps)) { - offset = &uhd_offsets[i]; - break; - } } } @@ -860,9 +824,6 @@ double _rx_rate = select_rate(dev_type, rx_sps, iface); double _tx_rate = select_rate(dev_type, tx_sps, iface); - if (iface == DIVERSITY) - _rx_rate = select_rate(dev_type, 1, iface); - if ((_tx_rate < 0.0) || (_rx_rate < 0.0)) return -1; if (set_rates(_tx_rate, _rx_rate) < 0) @@ -873,8 +834,7 @@ // Setting LMS6002D LPF to 500kHz gives us the best signal quality for (size_t i = 0; i < chans; i++) { usrp_dev->set_tx_bandwidth(500*1000*2, i); - if (iface != DIVERSITY) - usrp_dev->set_rx_bandwidth(500*1000*2, i); + usrp_dev->set_rx_bandwidth(500*1000*2, i); } } else if (dev_type == LIMESDR) { for (size_t i = 0; i < chans; i++) { @@ -917,8 +877,6 @@ // Print configuration LOG(INFO) << "\n" << usrp_dev->get_pp_string(); - if (iface == DIVERSITY) - return DIVERSITY; if (iface == MULTI_ARFCN) return MULTI_ARFCN; diff --git a/Transceiver52M/USRPDevice.cpp b/Transceiver52M/USRPDevice.cpp index 1092600..3d20411 100644 --- a/Transceiver52M/USRPDevice.cpp +++ b/Transceiver52M/USRPDevice.cpp @@ -601,7 +601,7 @@ #endif RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps, - size_t chans, bool diversity, double) + size_t chans, double) { return new USRPDevice(tx_sps); } diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index e07fd8e..40e482a 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -72,7 +72,6 @@ bool extref; bool gpsref; Transceiver::FillerType filler; - bool diversity; bool mcbts; double offset; double rssi_offset; @@ -101,7 +100,6 @@ } edgestr = config->edge ? "Enabled" : "Disabled"; - divstr = config->diversity ? "Enabled" : "Disabled"; mcstr = config->mcbts ? "Enabled" : "Disabled"; if (config->extref) @@ -142,7 +140,6 @@ ost << " Reference............... " << refstr << std::endl; ost << " C0 Filler Table......... " << fillstr << std::endl; ost << " Multi-Carrier........... " << mcstr << std::endl; - ost << " Diversity............... " << divstr << std::endl; ost << " Tuning offset........... " << config->offset << std::endl; ost << " RSSI to dBm offset...... " << config->rssi_offset << std::endl; ost << " Swap channels........... " << config->swap_channels << std::endl; @@ -172,12 +169,6 @@ case RadioDevice::RESAMP_100M: radio = new RadioInterfaceResamp(usrp, config->tx_sps, config->rx_sps); - break; - case RadioDevice::DIVERSITY: - - - radio = new RadioInterfaceDiversity(usrp, config->tx_sps, - config->chans); break; case RadioDevice::MULTI_ARFCN: radio = new RadioInterfaceMulti(usrp, config->tx_sps, @@ -257,7 +248,6 @@ " -i IP address of GSM core\n" " -p Base port number\n" " -e Enable EDGE receiver\n" - " -d Enable dual channel diversity receiver (deprecated)\n" " -m Enable multi-ARFCN transceiver (default=disabled)\n" " -x Enable external 10 MHz reference\n" " -g Enable GPSDO reference\n" @@ -288,7 +278,6 @@ config->gpsref = false; config->filler = Transceiver::FILLER_ZERO; config->mcbts = false; - config->diversity = false; config->offset = 0.0; config->rssi_offset = 0.0; config->swap_channels = false; @@ -317,9 +306,6 @@ break; case 'm': config->mcbts = true; - break; - case 'd': - config->diversity = true; break; case 'x': config->extref = true; @@ -371,24 +357,6 @@ if (config->gpsref && config->extref) { printf("External and GPSDO references unavailable at the same time\n\n"); goto bad_config; - } - - /* Special restrictions on (deprecated) diversity configuration */ - if (config->diversity) { - if (config->mcbts || config->edge) { - std::cout << "Multi-carrier/EDGE diversity unsupported" << std::endl; - goto bad_config; - } - - if (config->rx_sps != 1) { - std::cout << "Diversity only supported with 1 SPS" << std::endl; - goto bad_config; - } - - if (config->chans != 2) { - std::cout << "Diversity only supported with 2 channels" << std::endl; - goto bad_config; - } } if (config->edge && (config->filler == Transceiver::FILLER_NORM_RAND)) diff --git a/Transceiver52M/radioDevice.h b/Transceiver52M/radioDevice.h index 711d678..3624c58 100644 --- a/Transceiver52M/radioDevice.h +++ b/Transceiver52M/radioDevice.h @@ -41,7 +41,6 @@ RESAMP_64M, RESAMP_100M, MULTI_ARFCN, - DIVERSITY, }; enum ReferenceType { diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index 7a84430..d44f39d 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -31,11 +31,10 @@ #define NUMCHUNKS 4 RadioInterface::RadioInterface(RadioDevice *wRadio, size_t tx_sps, - size_t rx_sps, size_t chans, size_t diversity, + size_t rx_sps, size_t chans, int wReceiveOffset, GSM::Time wStartTime) : mRadio(wRadio), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), - mMIMO(diversity), underrun(false), overrun(false), - receiveOffset(wReceiveOffset), mOn(false) + underrun(false), overrun(false), receiveOffset(wReceiveOffset), mOn(false) { mClock.set(wStartTime); } diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h index f77cf9e..5f0b79c 100644 --- a/Transceiver52M/radioInterface.h +++ b/Transceiver52M/radioInterface.h @@ -86,8 +86,8 @@ /** constructor */ RadioInterface(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps, - size_t chans = 1, size_t diversity = 1, - int receiveOffset = 3, GSM::Time wStartTime = GSM::Time(0)); + size_t chans = 1, int receiveOffset = 3, + GSM::Time wStartTime = GSM::Time(0)); /** destructor */ virtual ~RadioInterface(); @@ -191,26 +191,4 @@ bool tuneTx(double freq, size_t chan); bool tuneRx(double freq, size_t chan); double setRxGain(double dB, size_t chan); -}; - -class RadioInterfaceDiversity : public RadioInterface { -public: - RadioInterfaceDiversity(RadioDevice* wRadio, size_t tx_sps, size_t chans); - - ~RadioInterfaceDiversity(); - - bool init(int type); - void close(); - bool tuneRx(double freq, size_t chan); - -private: - Resampler *dnsampler; - std::vector phases; - signalVector *outerRecvBuffer; - - bool mDiversity; - double mFreqSpacing; - - bool setupDiversityChannels(); - void pullBuffer(); }; diff --git a/Transceiver52M/radioInterfaceDiversity.cpp b/Transceiver52M/radioInterfaceDiversity.cpp deleted file mode 100644 index c78310c..0000000 --- a/Transceiver52M/radioInterfaceDiversity.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * SSE Convolution - * Copyright (C) 2013 Thomas Tsou - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "Resampler.h" - -extern "C" { -#include "convert.h" -} - -/* Resampling parameters for 64 MHz clocking */ -#define RESAMP_64M_INRATE 20 -#define RESAMP_64M_OUTRATE 80 - -/* Downlink block size */ -#define CHUNK 625 - -/* Universal resampling parameters */ -#define NUMCHUNKS 48 - -/* - * Resampling filter bandwidth scaling factor - * This narrows the filter cutoff relative to the output bandwidth - * of the polyphase resampler. At 4 samples-per-symbol using the - * 2 pulse Laurent GMSK approximation gives us below 0.5 degrees - * RMS phase error at the resampler output. - */ -#define RESAMP_TX4_FILTER 0.45 - -static size_t resamp_inrate = 0; -static size_t resamp_inchunk = 0; -static size_t resamp_outrate = 0; -static size_t resamp_outchunk = 0; - -RadioInterfaceDiversity::RadioInterfaceDiversity(RadioDevice *wRadio, - size_t tx_sps, size_t chans) - : RadioInterface(wRadio, tx_sps, 1, chans, 2), outerRecvBuffer(NULL), - mDiversity(false), mFreqSpacing(0.0) -{ -} - -RadioInterfaceDiversity::~RadioInterfaceDiversity() -{ - close(); -} - -void RadioInterfaceDiversity::close() -{ - delete outerRecvBuffer; - delete dnsampler; - - dnsampler = NULL; - outerRecvBuffer = NULL; - - if (recvBuffer.size()) - recvBuffer[0] = NULL; - - RadioInterface::close(); -} - -bool RadioInterfaceDiversity::setupDiversityChannels() -{ - size_t inner_rx_len; - - /* Inner and outer rates */ - resamp_inrate = RESAMP_64M_INRATE; - resamp_outrate = RESAMP_64M_OUTRATE; - resamp_inchunk = resamp_inrate * 4; - resamp_outchunk = resamp_outrate * 4; - - /* Buffer lengths */ - inner_rx_len = NUMCHUNKS * resamp_inchunk; - - /* Inside buffer must hold at least 2 bursts */ - if (inner_rx_len < 157 * mSPSRx * 2) { - LOG(ALERT) << "Invalid inner buffer size " << inner_rx_len; - return false; - } - - dnsampler = new Resampler(resamp_inrate, resamp_outrate); - if (!dnsampler->init()) { - LOG(ALERT) << "Rx resampler failed to initialize"; - return false; - } - - /* One Receive buffer and downsampler per diversity channel */ - for (size_t i = 0; i < mMIMO * mChans; i++) { - recvBuffer[i] = new RadioBuffer(NUMCHUNKS, - resamp_inchunk, 0, false); - } - - return true; -} - -/* Initialize I/O specific objects */ -bool RadioInterfaceDiversity::init(int type) -{ - int outer_rx_len; - - if ((mMIMO != 2) || (mChans != 2)) { - LOG(ALERT) << "Unsupported channel configuration " << mChans; - return false; - } - - /* Resize for channel combination */ - sendBuffer.resize(mChans); - recvBuffer.resize(mChans * mMIMO); - convertSendBuffer.resize(mChans); - convertRecvBuffer.resize(mChans); - mReceiveFIFO.resize(mChans); - phases.resize(mChans); - - if (!setupDiversityChannels()) - return false; - - outer_rx_len = resamp_outchunk; - - for (size_t i = 0; i < mChans; i++) { - /* Full rate float and integer outer receive buffers */ - convertRecvBuffer[i] = new short[outer_rx_len * 2]; - - /* Send buffers (not-resampled) */ - sendBuffer[i] = new RadioBuffer(NUMCHUNKS, CHUNK * mSPSTx, 0, true); - convertSendBuffer[i] = new short[CHUNK * mSPSTx * 2]; - } - - outerRecvBuffer = new signalVector(outer_rx_len, dnsampler->len()); - - return true; -} - -bool RadioInterfaceDiversity::tuneRx(double freq, size_t chan) -{ - double f0, f1; - - if (chan > 1) - return false; - - if (!mRadio->setRxFreq(freq, chan)) - return false; - - f0 = mRadio->getRxFreq(0); - f1 = mRadio->getRxFreq(1); - - mFreqSpacing = f1 - f0; - - if (abs(mFreqSpacing) <= 600e3) - mDiversity = true; - else - mDiversity = false; - - return true; -} - -/* Receive a timestamped chunk from the device */ -void RadioInterfaceDiversity::pullBuffer() -{ - bool local_underrun; - int rc, num, path0, path1; - signalVector *shift, *base; - float *in, *out, rate = -mFreqSpacing * 2.0 * M_PI / 1.08333333e6; - - if (recvBuffer[0]->getFreeSegments() <= 0) - return; - - /* Outer buffer access size is fixed */ - num = mRadio->readSamples(convertRecvBuffer, - resamp_outchunk, - &overrun, - readTimestamp, - &local_underrun); - if ((size_t) num != resamp_outchunk) { - LOG(ALERT) << "Receive error " << num; - return; - } - - for (size_t i = 0; i < mChans; i++) { - convert_short_float((float *) outerRecvBuffer->begin(), - convertRecvBuffer[i], 2 * resamp_outchunk); - - if (!i) { - path0 = 0; - path1 = 2; - } else { - path0 = 3; - path1 = 1; - } - - /* Diversity path 1 */ - base = outerRecvBuffer; - in = (float *) base->begin(); - out = (float *) recvBuffer[path0]->getWriteSegment(); - - rc = dnsampler->rotate(in, resamp_outchunk, - out, resamp_inchunk); - if (rc < 0) { - LOG(ALERT) << "Sample rate downsampling error"; - } - - /* Enable path 2 if Nyquist bandwidth is sufficient */ - if (!mDiversity) - continue; - - /* Diversity path 2 */ - shift = new signalVector(base->size(), base->getStart()); - in = (float *) shift->begin(); - out = (float *) recvBuffer[path1]->getWriteSegment(); - - rate = i ? -rate : rate; - if (!frequencyShift(shift, base, rate, phases[i], &phases[i])) { - LOG(ALERT) << "Frequency shift failed"; - } - - rc = dnsampler->rotate(in, resamp_outchunk, - out, resamp_inchunk); - if (rc < 0) { - LOG(ALERT) << "Sample rate downsampling error"; - } - - delete shift; - } - - underrun |= local_underrun; - readTimestamp += (TIMESTAMP) resamp_outchunk; -} diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 4c2222c..ce062a4 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -654,51 +654,6 @@ return pulse; } -signalVector* frequencyShift(signalVector *y, - signalVector *x, - float freq, - float startPhase, - float *finalPhase) -{ - - if (!x) return NULL; - - if (y==NULL) { - y = new signalVector(x->size()); - y->isReal(x->isReal()); - if (y==NULL) return NULL; - } - - if (y->size() < x->size()) return NULL; - - float phase = startPhase; - signalVector::iterator yP = y->begin(); - signalVector::iterator xPEnd = x->end(); - signalVector::iterator xP = x->begin(); - - if (x->isReal()) { - while (xP < xPEnd) { - (*yP++) = expjLookup(phase)*( (xP++)->real() ); - phase += freq; - } - } - else { - while (xP < xPEnd) { - (*yP++) = (*xP++)*expjLookup(phase); - phase += freq; - if (phase > 2 * M_PI) - phase -= 2 * M_PI; - else if (phase < -2 * M_PI) - phase += 2 * M_PI; - } - } - - - if (finalPhase) *finalPhase = phase; - - return y; -} - signalVector* reverseConjugate(signalVector *b) { signalVector *tmp = new signalVector(b->size()); -- To view, visit https://gerrit.osmocom.org/2186 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I46752ccf5dbcffbec806081dec03e69a0fbdcdb7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 00:40:01 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 00:40:01 +0000 Subject: [PATCH] osmo-trx[master]: radioInterface: Remove UmTRX 'diversity' option In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2186 to look at the new patch set (#2). radioInterface: Remove UmTRX 'diversity' option The 'diversity' option was an experimental 2 antenna receiver implementation for UmTRX. The implementation has not been maintained and current working status is unknown. In addition to code rot, Coverity is triggering errors in the associated code sections. Removal of code cleans up many cases of special handling that were necessary to accommodate the implementation. Change-Id: I46752ccf5dbcffbec806081dec03e69a0fbdcdb7 --- M Transceiver52M/Makefile.am M Transceiver52M/UHDDevice.cpp M Transceiver52M/USRPDevice.cpp M Transceiver52M/osmo-trx.cpp M Transceiver52M/radioDevice.h M Transceiver52M/radioInterface.cpp M Transceiver52M/radioInterface.h D Transceiver52M/radioInterfaceDiversity.cpp M Transceiver52M/sigProcLib.cpp 9 files changed, 13 insertions(+), 400 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/86/2186/2 diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am index 68cdf74..c2ab9ca 100644 --- a/Transceiver52M/Makefile.am +++ b/Transceiver52M/Makefile.am @@ -67,8 +67,7 @@ $(COMMON_SOURCES) \ Resampler.cpp \ radioInterfaceResamp.cpp \ - radioInterfaceMulti.cpp \ - radioInterfaceDiversity.cpp + radioInterfaceMulti.cpp bin_PROGRAMS = osmo-trx diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index c5ea4c1..ce6d1be 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -139,16 +139,6 @@ #define NUM_UHD_OFFSETS (sizeof(uhd_offsets)/sizeof(uhd_offsets[0])) /* - * Offset handling for special cases. Currently used for UmTRX dual channel - * diversity receiver only. - */ -static struct uhd_dev_offset special_offsets[] = { - { UMTRX, 1, 1, 8.0875e-5, "UmTRX diversity, 1 SPS" }, - { UMTRX, 4, 1, 5.2103e-5, "UmTRX diversity, 4 SPS" }, -}; - - -/* * Select sample rate based on device type and requested samples-per-symbol. * The base rate is either GSM symbol rate, 270.833 kHz, or the minimum * usable channel spacing of 400 kHz. @@ -156,15 +146,6 @@ static double select_rate(uhd_dev_type type, int sps, RadioDevice::InterfaceType iface) { - if (iface == RadioDevice::DIVERSITY) { - if (type == UMTRX) - return GSMRATE * 4; - - LOG(ALERT) << "Diversity supported on UmTRX only"; - return -9999.99; - } - - if ((sps != 4) && (sps != 1)) return -9999.99; @@ -499,30 +480,13 @@ return 0.0; } - /* Special cases (e.g. diversity receiver) */ - if (iface == DIVERSITY) { - if ((dev_type != UMTRX) || (rx_sps != 1)) { - LOG(ALERT) << "Unsupported device configuration"; - return 0.0; - } - - switch (tx_sps) { - case 1: - offset = &special_offsets[0]; + /* Search for matching offset value */ + for (size_t i = 0; i < NUM_UHD_OFFSETS; i++) { + if ((dev_type == uhd_offsets[i].type) && + (tx_sps == uhd_offsets[i].tx_sps) && + (rx_sps == uhd_offsets[i].rx_sps)) { + offset = &uhd_offsets[i]; break; - case 4: - default: - offset = &special_offsets[1]; - } - } else { - /* Search for matching offset value */ - for (size_t i = 0; i < NUM_UHD_OFFSETS; i++) { - if ((dev_type == uhd_offsets[i].type) && - (tx_sps == uhd_offsets[i].tx_sps) && - (rx_sps == uhd_offsets[i].rx_sps)) { - offset = &uhd_offsets[i]; - break; - } } } @@ -860,9 +824,6 @@ double _rx_rate = select_rate(dev_type, rx_sps, iface); double _tx_rate = select_rate(dev_type, tx_sps, iface); - if (iface == DIVERSITY) - _rx_rate = select_rate(dev_type, 1, iface); - if ((_tx_rate < 0.0) || (_rx_rate < 0.0)) return -1; if (set_rates(_tx_rate, _rx_rate) < 0) @@ -873,8 +834,7 @@ // Setting LMS6002D LPF to 500kHz gives us the best signal quality for (size_t i = 0; i < chans; i++) { usrp_dev->set_tx_bandwidth(500*1000*2, i); - if (iface != DIVERSITY) - usrp_dev->set_rx_bandwidth(500*1000*2, i); + usrp_dev->set_rx_bandwidth(500*1000*2, i); } } else if (dev_type == LIMESDR) { for (size_t i = 0; i < chans; i++) { @@ -917,8 +877,6 @@ // Print configuration LOG(INFO) << "\n" << usrp_dev->get_pp_string(); - if (iface == DIVERSITY) - return DIVERSITY; if (iface == MULTI_ARFCN) return MULTI_ARFCN; diff --git a/Transceiver52M/USRPDevice.cpp b/Transceiver52M/USRPDevice.cpp index 1092600..3d20411 100644 --- a/Transceiver52M/USRPDevice.cpp +++ b/Transceiver52M/USRPDevice.cpp @@ -601,7 +601,7 @@ #endif RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps, - size_t chans, bool diversity, double) + size_t chans, double) { return new USRPDevice(tx_sps); } diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index e07fd8e..40e482a 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -72,7 +72,6 @@ bool extref; bool gpsref; Transceiver::FillerType filler; - bool diversity; bool mcbts; double offset; double rssi_offset; @@ -101,7 +100,6 @@ } edgestr = config->edge ? "Enabled" : "Disabled"; - divstr = config->diversity ? "Enabled" : "Disabled"; mcstr = config->mcbts ? "Enabled" : "Disabled"; if (config->extref) @@ -142,7 +140,6 @@ ost << " Reference............... " << refstr << std::endl; ost << " C0 Filler Table......... " << fillstr << std::endl; ost << " Multi-Carrier........... " << mcstr << std::endl; - ost << " Diversity............... " << divstr << std::endl; ost << " Tuning offset........... " << config->offset << std::endl; ost << " RSSI to dBm offset...... " << config->rssi_offset << std::endl; ost << " Swap channels........... " << config->swap_channels << std::endl; @@ -172,12 +169,6 @@ case RadioDevice::RESAMP_100M: radio = new RadioInterfaceResamp(usrp, config->tx_sps, config->rx_sps); - break; - case RadioDevice::DIVERSITY: - - - radio = new RadioInterfaceDiversity(usrp, config->tx_sps, - config->chans); break; case RadioDevice::MULTI_ARFCN: radio = new RadioInterfaceMulti(usrp, config->tx_sps, @@ -257,7 +248,6 @@ " -i IP address of GSM core\n" " -p Base port number\n" " -e Enable EDGE receiver\n" - " -d Enable dual channel diversity receiver (deprecated)\n" " -m Enable multi-ARFCN transceiver (default=disabled)\n" " -x Enable external 10 MHz reference\n" " -g Enable GPSDO reference\n" @@ -288,7 +278,6 @@ config->gpsref = false; config->filler = Transceiver::FILLER_ZERO; config->mcbts = false; - config->diversity = false; config->offset = 0.0; config->rssi_offset = 0.0; config->swap_channels = false; @@ -317,9 +306,6 @@ break; case 'm': config->mcbts = true; - break; - case 'd': - config->diversity = true; break; case 'x': config->extref = true; @@ -371,24 +357,6 @@ if (config->gpsref && config->extref) { printf("External and GPSDO references unavailable at the same time\n\n"); goto bad_config; - } - - /* Special restrictions on (deprecated) diversity configuration */ - if (config->diversity) { - if (config->mcbts || config->edge) { - std::cout << "Multi-carrier/EDGE diversity unsupported" << std::endl; - goto bad_config; - } - - if (config->rx_sps != 1) { - std::cout << "Diversity only supported with 1 SPS" << std::endl; - goto bad_config; - } - - if (config->chans != 2) { - std::cout << "Diversity only supported with 2 channels" << std::endl; - goto bad_config; - } } if (config->edge && (config->filler == Transceiver::FILLER_NORM_RAND)) diff --git a/Transceiver52M/radioDevice.h b/Transceiver52M/radioDevice.h index 711d678..3624c58 100644 --- a/Transceiver52M/radioDevice.h +++ b/Transceiver52M/radioDevice.h @@ -41,7 +41,6 @@ RESAMP_64M, RESAMP_100M, MULTI_ARFCN, - DIVERSITY, }; enum ReferenceType { diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index 7a84430..d44f39d 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -31,11 +31,10 @@ #define NUMCHUNKS 4 RadioInterface::RadioInterface(RadioDevice *wRadio, size_t tx_sps, - size_t rx_sps, size_t chans, size_t diversity, + size_t rx_sps, size_t chans, int wReceiveOffset, GSM::Time wStartTime) : mRadio(wRadio), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), - mMIMO(diversity), underrun(false), overrun(false), - receiveOffset(wReceiveOffset), mOn(false) + underrun(false), overrun(false), receiveOffset(wReceiveOffset), mOn(false) { mClock.set(wStartTime); } diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h index f77cf9e..97f1e70 100644 --- a/Transceiver52M/radioInterface.h +++ b/Transceiver52M/radioInterface.h @@ -86,8 +86,8 @@ /** constructor */ RadioInterface(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps, - size_t chans = 1, size_t diversity = 1, - int receiveOffset = 3, GSM::Time wStartTime = GSM::Time(0)); + size_t chans = 1, int receiveOffset = 3, + GSM::Time wStartTime = GSM::Time(0)); /** destructor */ virtual ~RadioInterface(); @@ -191,26 +191,4 @@ bool tuneTx(double freq, size_t chan); bool tuneRx(double freq, size_t chan); double setRxGain(double dB, size_t chan); -}; - -class RadioInterfaceDiversity : public RadioInterface { -public: - RadioInterfaceDiversity(RadioDevice* wRadio, size_t tx_sps, size_t chans); - - ~RadioInterfaceDiversity(); - - bool init(int type); - void close(); - bool tuneRx(double freq, size_t chan); - -private: - Resampler *dnsampler; - std::vector phases; - signalVector *outerRecvBuffer; - - bool mDiversity; - double mFreqSpacing; - - bool setupDiversityChannels(); - void pullBuffer(); }; diff --git a/Transceiver52M/radioInterfaceDiversity.cpp b/Transceiver52M/radioInterfaceDiversity.cpp deleted file mode 100644 index c78310c..0000000 --- a/Transceiver52M/radioInterfaceDiversity.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * SSE Convolution - * Copyright (C) 2013 Thomas Tsou - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "Resampler.h" - -extern "C" { -#include "convert.h" -} - -/* Resampling parameters for 64 MHz clocking */ -#define RESAMP_64M_INRATE 20 -#define RESAMP_64M_OUTRATE 80 - -/* Downlink block size */ -#define CHUNK 625 - -/* Universal resampling parameters */ -#define NUMCHUNKS 48 - -/* - * Resampling filter bandwidth scaling factor - * This narrows the filter cutoff relative to the output bandwidth - * of the polyphase resampler. At 4 samples-per-symbol using the - * 2 pulse Laurent GMSK approximation gives us below 0.5 degrees - * RMS phase error at the resampler output. - */ -#define RESAMP_TX4_FILTER 0.45 - -static size_t resamp_inrate = 0; -static size_t resamp_inchunk = 0; -static size_t resamp_outrate = 0; -static size_t resamp_outchunk = 0; - -RadioInterfaceDiversity::RadioInterfaceDiversity(RadioDevice *wRadio, - size_t tx_sps, size_t chans) - : RadioInterface(wRadio, tx_sps, 1, chans, 2), outerRecvBuffer(NULL), - mDiversity(false), mFreqSpacing(0.0) -{ -} - -RadioInterfaceDiversity::~RadioInterfaceDiversity() -{ - close(); -} - -void RadioInterfaceDiversity::close() -{ - delete outerRecvBuffer; - delete dnsampler; - - dnsampler = NULL; - outerRecvBuffer = NULL; - - if (recvBuffer.size()) - recvBuffer[0] = NULL; - - RadioInterface::close(); -} - -bool RadioInterfaceDiversity::setupDiversityChannels() -{ - size_t inner_rx_len; - - /* Inner and outer rates */ - resamp_inrate = RESAMP_64M_INRATE; - resamp_outrate = RESAMP_64M_OUTRATE; - resamp_inchunk = resamp_inrate * 4; - resamp_outchunk = resamp_outrate * 4; - - /* Buffer lengths */ - inner_rx_len = NUMCHUNKS * resamp_inchunk; - - /* Inside buffer must hold at least 2 bursts */ - if (inner_rx_len < 157 * mSPSRx * 2) { - LOG(ALERT) << "Invalid inner buffer size " << inner_rx_len; - return false; - } - - dnsampler = new Resampler(resamp_inrate, resamp_outrate); - if (!dnsampler->init()) { - LOG(ALERT) << "Rx resampler failed to initialize"; - return false; - } - - /* One Receive buffer and downsampler per diversity channel */ - for (size_t i = 0; i < mMIMO * mChans; i++) { - recvBuffer[i] = new RadioBuffer(NUMCHUNKS, - resamp_inchunk, 0, false); - } - - return true; -} - -/* Initialize I/O specific objects */ -bool RadioInterfaceDiversity::init(int type) -{ - int outer_rx_len; - - if ((mMIMO != 2) || (mChans != 2)) { - LOG(ALERT) << "Unsupported channel configuration " << mChans; - return false; - } - - /* Resize for channel combination */ - sendBuffer.resize(mChans); - recvBuffer.resize(mChans * mMIMO); - convertSendBuffer.resize(mChans); - convertRecvBuffer.resize(mChans); - mReceiveFIFO.resize(mChans); - phases.resize(mChans); - - if (!setupDiversityChannels()) - return false; - - outer_rx_len = resamp_outchunk; - - for (size_t i = 0; i < mChans; i++) { - /* Full rate float and integer outer receive buffers */ - convertRecvBuffer[i] = new short[outer_rx_len * 2]; - - /* Send buffers (not-resampled) */ - sendBuffer[i] = new RadioBuffer(NUMCHUNKS, CHUNK * mSPSTx, 0, true); - convertSendBuffer[i] = new short[CHUNK * mSPSTx * 2]; - } - - outerRecvBuffer = new signalVector(outer_rx_len, dnsampler->len()); - - return true; -} - -bool RadioInterfaceDiversity::tuneRx(double freq, size_t chan) -{ - double f0, f1; - - if (chan > 1) - return false; - - if (!mRadio->setRxFreq(freq, chan)) - return false; - - f0 = mRadio->getRxFreq(0); - f1 = mRadio->getRxFreq(1); - - mFreqSpacing = f1 - f0; - - if (abs(mFreqSpacing) <= 600e3) - mDiversity = true; - else - mDiversity = false; - - return true; -} - -/* Receive a timestamped chunk from the device */ -void RadioInterfaceDiversity::pullBuffer() -{ - bool local_underrun; - int rc, num, path0, path1; - signalVector *shift, *base; - float *in, *out, rate = -mFreqSpacing * 2.0 * M_PI / 1.08333333e6; - - if (recvBuffer[0]->getFreeSegments() <= 0) - return; - - /* Outer buffer access size is fixed */ - num = mRadio->readSamples(convertRecvBuffer, - resamp_outchunk, - &overrun, - readTimestamp, - &local_underrun); - if ((size_t) num != resamp_outchunk) { - LOG(ALERT) << "Receive error " << num; - return; - } - - for (size_t i = 0; i < mChans; i++) { - convert_short_float((float *) outerRecvBuffer->begin(), - convertRecvBuffer[i], 2 * resamp_outchunk); - - if (!i) { - path0 = 0; - path1 = 2; - } else { - path0 = 3; - path1 = 1; - } - - /* Diversity path 1 */ - base = outerRecvBuffer; - in = (float *) base->begin(); - out = (float *) recvBuffer[path0]->getWriteSegment(); - - rc = dnsampler->rotate(in, resamp_outchunk, - out, resamp_inchunk); - if (rc < 0) { - LOG(ALERT) << "Sample rate downsampling error"; - } - - /* Enable path 2 if Nyquist bandwidth is sufficient */ - if (!mDiversity) - continue; - - /* Diversity path 2 */ - shift = new signalVector(base->size(), base->getStart()); - in = (float *) shift->begin(); - out = (float *) recvBuffer[path1]->getWriteSegment(); - - rate = i ? -rate : rate; - if (!frequencyShift(shift, base, rate, phases[i], &phases[i])) { - LOG(ALERT) << "Frequency shift failed"; - } - - rc = dnsampler->rotate(in, resamp_outchunk, - out, resamp_inchunk); - if (rc < 0) { - LOG(ALERT) << "Sample rate downsampling error"; - } - - delete shift; - } - - underrun |= local_underrun; - readTimestamp += (TIMESTAMP) resamp_outchunk; -} diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 4c2222c..ce062a4 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -654,51 +654,6 @@ return pulse; } -signalVector* frequencyShift(signalVector *y, - signalVector *x, - float freq, - float startPhase, - float *finalPhase) -{ - - if (!x) return NULL; - - if (y==NULL) { - y = new signalVector(x->size()); - y->isReal(x->isReal()); - if (y==NULL) return NULL; - } - - if (y->size() < x->size()) return NULL; - - float phase = startPhase; - signalVector::iterator yP = y->begin(); - signalVector::iterator xPEnd = x->end(); - signalVector::iterator xP = x->begin(); - - if (x->isReal()) { - while (xP < xPEnd) { - (*yP++) = expjLookup(phase)*( (xP++)->real() ); - phase += freq; - } - } - else { - while (xP < xPEnd) { - (*yP++) = (*xP++)*expjLookup(phase); - phase += freq; - if (phase > 2 * M_PI) - phase -= 2 * M_PI; - else if (phase < -2 * M_PI) - phase += 2 * M_PI; - } - } - - - if (finalPhase) *finalPhase = phase; - - return y; -} - signalVector* reverseConjugate(signalVector *b) { signalVector *tmp = new signalVector(b->size()); -- To view, visit https://gerrit.osmocom.org/2186 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I46752ccf5dbcffbec806081dec03e69a0fbdcdb7 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 31 00:43:58 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 00:43:58 +0000 Subject: [PATCH] osmo-trx[master]: config: Remove OpenBTS style sqlite configuration In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2185 to look at the new patch set (#2). config: Remove OpenBTS style sqlite configuration OpenBTS relies on reading in configuration values from the OpenBTS.config sqlite3 database. This configuration method is not maintained and not recommended for Osmocom or OpenBTS use. Command line setup is the recommended approach. Note that when the osmo-trx logging mechanism is replaced, the sqlite dependency will be removed. Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd --- M Transceiver52M/osmo-trx.cpp 1 file changed, 4 insertions(+), 80 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/85/2185/2 diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 5e81586..717cfa0 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -49,16 +49,9 @@ */ #define DEFAULT_RX_SPS 1 -/* Default configuration parameters - * Note that these values are only used if the particular key does not - * exist in the configuration database. IP port and address values will - * typically be overwritten by the OpenBTS.db values. Other values will - * not be in the database by default. - */ +/* Default configuration parameters */ #define DEFAULT_TRX_PORT 5700 #define DEFAULT_TRX_IP "127.0.0.1" -#define DEFAULT_EXTREF false -#define DEFAULT_DIVERSITY false #define DEFAULT_CHANS 1 struct trx_config { @@ -86,40 +79,6 @@ volatile bool gshutdown = false; -/* Run sanity check on configuration table - * The global table constructor cannot provide notification in the - * event of failure. Make sure that we can access the database, - * write to it, and that it contains the bare minimum required keys. - */ -bool testConfig() -{ - int val = 9999; - std::string test = "asldfkjsaldkf"; - const char *key = "Log.Level"; - - /* Attempt to query */ - try { - gConfig.getStr(key); - } catch (...) { - std::cerr << std::endl; - std::cerr << "Config: Failed query required key " << key - << std::endl; - return false; - } - - /* Attempt to set a test value in the global config */ - if (!gConfig.set(test, val)) { - std::cerr << std::endl; - std::cerr << "Config: Failed to set test key" << std::endl; - return false; - } else { - gConfig.remove(test); - } - - return true; -} - - /* Setup configuration values * Don't query the existence of the Log.Level because it's a * mandatory value. That is, if it doesn't exist, the configuration @@ -130,43 +89,6 @@ bool trx_setup_config(struct trx_config *config) { std::string refstr, fillstr, divstr, mcstr, edgestr; - - if (!testConfig()) - return false; - - if (config->log_level == "") - config->log_level = gConfig.getStr("Log.Level"); - - if (!config->port) { - if (gConfig.defines("TRX.Port")) - config->port = gConfig.getNum("TRX.Port"); - else - config->port = DEFAULT_TRX_PORT; - } - - if (config->addr == "") { - if (gConfig.defines("TRX.IP")) - config->addr = gConfig.getStr("TRX.IP"); - else - config->addr = DEFAULT_TRX_IP; - } - - if (!config->extref) { - if (gConfig.defines("TRX.Reference")) - config->extref = gConfig.getNum("TRX.Reference"); - else - config->extref = DEFAULT_EXTREF; - } - - if (!config->diversity) { - if (gConfig.defines("TRX.Diversity")) - config->diversity = gConfig.getNum("TRX.Diversity"); - else - config->diversity = DEFAULT_DIVERSITY; - } - - if (!config->chans) - config->chans = DEFAULT_CHANS; if (config->mcbts && ((config->chans < 0) || (config->chans > 5))) { std::cout << "Unsupported number of channels" << std::endl; @@ -350,7 +272,9 @@ { int option; - config->port = 0; + config->log_level = "NOTICE"; + config->addr = DEFAULT_TRX_IP; + config->port = DEFAULT_TRX_PORT; config->tx_sps = DEFAULT_TX_SPS; config->rx_sps = DEFAULT_RX_SPS; config->chans = DEFAULT_CHANS; -- To view, visit https://gerrit.osmocom.org/2185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 31 02:34:18 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 02:34:18 +0000 Subject: [PATCH] osmo-trx[master]: Resampler: Fix non-array delete for filter taps Message-ID: Review at https://gerrit.osmocom.org/2187 Resampler: Fix non-array delete for filter taps Change-Id: I59cdb01809da5940c74aaae9d17f413aefbf04b2 Fixes: Coverity CID 149349 --- M Transceiver52M/Resampler.cpp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/87/2187/1 diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp index 8a73b79..9a4ea5b 100644 --- a/Transceiver52M/Resampler.cpp +++ b/Transceiver52M/Resampler.cpp @@ -112,7 +112,7 @@ } } - delete proto; + delete[] proto; return true; } -- To view, visit https://gerrit.osmocom.org/2187 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I59cdb01809da5940c74aaae9d17f413aefbf04b2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 02:40:22 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 02:40:22 +0000 Subject: [PATCH] osmo-trx[master]: Transceiver: Remove unsigned negative compare of TSC Message-ID: Review at https://gerrit.osmocom.org/2188 Transceiver: Remove unsigned negative compare of TSC Change-Id: I49f30699786c52736ef334dae61f7bbd65d878d5 Fixes: Coverity CID 149353, 149356 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/osmo-trx.cpp 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/88/2188/1 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 4616fea..66eff7f 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -788,9 +788,9 @@ // set TSC unsigned TSC; sscanf(buffer, "%3s %s %d", cmdcheck, command, &TSC); - if ((TSC < 0) || (TSC > 7)) + if (TSC > 7) { sprintf(response, "RSP SETTSC 1 %d", TSC); - else { + } else { LOG(NOTICE) << "Changing TSC from " << mTSC << " to " << TSC; mTSC = TSC; sprintf(response,"RSP SETTSC 0 %d", TSC); diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 5e81586..b36c081 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -168,7 +168,7 @@ if (!config->chans) config->chans = DEFAULT_CHANS; - if (config->mcbts && ((config->chans < 0) || (config->chans > 5))) { + if (config->mcbts && config->chans > 5) { std::cout << "Unsupported number of channels" << std::endl; return false; } -- To view, visit https://gerrit.osmocom.org/2188 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I49f30699786c52736ef334dae61f7bbd65d878d5 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 02:40:51 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 02:40:51 +0000 Subject: [PATCH] osmo-trx[master]: Transceiver: Remove unsigned negative compares In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2188 to look at the new patch set (#2). Transceiver: Remove unsigned negative compares Change-Id: I49f30699786c52736ef334dae61f7bbd65d878d5 Fixes: Coverity CID 149353, 149356 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/osmo-trx.cpp 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/88/2188/2 diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 4616fea..66eff7f 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -788,9 +788,9 @@ // set TSC unsigned TSC; sscanf(buffer, "%3s %s %d", cmdcheck, command, &TSC); - if ((TSC < 0) || (TSC > 7)) + if (TSC > 7) { sprintf(response, "RSP SETTSC 1 %d", TSC); - else { + } else { LOG(NOTICE) << "Changing TSC from " << mTSC << " to " << TSC; mTSC = TSC; sprintf(response,"RSP SETTSC 0 %d", TSC); diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 5e81586..b36c081 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -168,7 +168,7 @@ if (!config->chans) config->chans = DEFAULT_CHANS; - if (config->mcbts && ((config->chans < 0) || (config->chans > 5))) { + if (config->mcbts && config->chans > 5) { std::cout << "Unsupported number of channels" << std::endl; return false; } -- To view, visit https://gerrit.osmocom.org/2188 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I49f30699786c52736ef334dae61f7bbd65d878d5 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Mar 31 11:52:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 11:52:44 +0000 Subject: pysim[master]: Fix select control parameter In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (2 comments) doesn't hurt, but... https://gerrit.osmocom.org/#/c/2174/1/pySim/cards.py File pySim/cards.py: Line 428: self._scc.sel_ctrl = "000C" why are the get_ / set_ methods added when no-one is actually using them? Every sim card model would simply set it in the constructor, right? https://gerrit.osmocom.org/#/c/2174/1/pySim/commands.py File pySim/commands.py: Line 51: data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4" + self._sel_ctrl + "02" + i) this also doesn't use sel_ctrl() -- To view, visit https://gerrit.osmocom.org/2174 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1993a267c952bf37d5de1cb4e1107f445614c17b Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 31 11:54:01 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 11:54:01 +0000 Subject: pysim[master]: fix writing of ICCID for sysmo-usim-sjs1 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/2175 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ief85aa07c562d8d7b2a6dec302d2f485d0b1e577 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 31 12:04:07 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 12:04:07 +0000 Subject: [PATCH] openbsc[master]: jenkins.sh: Iu: use libosmo-sccp, -netif master Message-ID: Review at https://gerrit.osmocom.org/2189 jenkins.sh: Iu: use libosmo-sccp,-netif master The iu specific branches of libosmo-sccp and libosmo-netif have recently been merged to master. Change-Id: I9465d7b956c3bd65d6e8a387e6710235672352e8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/89/2189/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 08e16b9..323ae04 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -17,14 +17,9 @@ export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -if [ "x$IU" = "x--enable-iu" ]; then - netif_branch="sysmocom/sctp" - sccp_branch="sysmocom/iu" -fi - osmo-build-dep.sh libosmo-abis -osmo-build-dep.sh libosmo-netif $netif_branch -osmo-build-dep.sh libosmo-sccp $sccp_branch +osmo-build-dep.sh libosmo-netif +osmo-build-dep.sh libosmo-sccp PARALLEL_MAKE="" osmo-build-dep.sh libsmpp34 osmo-build-dep.sh openggsn -- To view, visit https://gerrit.osmocom.org/2189 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9465d7b956c3bd65d6e8a387e6710235672352e8 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Mar 31 12:04:30 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 12:04:30 +0000 Subject: [MERGED] osmo-sim-auth[master]: cosmetic: add/tweak log output, add vim indenting marker In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: add/tweak log output, add vim indenting marker ...................................................................... cosmetic: add/tweak log output, add vim indenting marker While testing the sysmoUSIM, I found that I wanted to see errors more prominently and some output for cases that lacked any response at all. Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 --- M card/USIM.py 1 file changed, 13 insertions(+), 10 deletions(-) Approvals: Max: Looks good to me, but someone else must approve Neels Hofmeyr: Verified Harald Welte: Looks good to me, approved diff --git a/card/USIM.py b/card/USIM.py index d8cbb85..a5adc5b 100644 --- a/card/USIM.py +++ b/card/USIM.py @@ -242,8 +242,7 @@ # prepare input data for authentication if ctx in ('3G', 'VGCS', 'GBA', 'MBMS') and len(RAND) != 16 \ and len(AUTN) != 16: - if self.dbg: - print '[WNG] authenticate: bad parameters' + print '[ERR] missing parameters or wrong length' return None inp = [] @@ -265,8 +264,7 @@ # to avoid desynchronizing our USIM counter P2 = 0x80 if len(RAND) != 16: - if self.dbg: - print '[WNG] bad parameters' + print '[ERR] RAND has wrong length (%d, should be 16)' % len(RAND) return None # override input value for 2G authent inp = [len(RAND)] + RAND @@ -284,11 +282,14 @@ return values # not adapted to 2G context with Kc, RES: to be confirmed... if val[0] == 0xDB: - if P2 == 0x81 and self.dbg: - print '[+] Successful 3G authentication. ' \ - 'Get [RES, CK, IK(, Kc)]' - elif P2 == 0x84 and self.dbg: - print '[+] Successful GBA authentication. Get [RES]' + if self.dbg: + if P2 == 0x81: + print '[+] Successful 3G authentication. ' \ + 'Get [RES, CK, IK(, Kc)]' + elif P2 == 0x84: + print '[+] Successful GBA authentication. Get [RES]' + else: + print '[+] response: %s' % hex(val) values = LV_parser(val[1:]) # returned values can be (RES, CK, IK) or (RES, CK, IK, Kc) return values @@ -297,6 +298,8 @@ print '[+] Synchronization failure. Get [AUTS]' values = LV_parser(val[1:]) return values + elif self.dbg: + print '[+] response: %s' % hex(val) #else: if self.dbg: print '[+] authentication error: %s' % self.coms() @@ -398,5 +401,5 @@ #bf from MF, and recursively under each DF #bf from each AID and recursively under each DF in AID pass - +# vim: tabstop=4 shiftwidth=4 expandtab -- To view, visit https://gerrit.osmocom.org/2052 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia2ac1215ae948558324627f76e28c72a23dc6a68 Gerrit-PatchSet: 2 Gerrit-Project: osmo-sim-auth Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Mar 31 16:33:43 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Fri, 31 Mar 2017 16:33:43 +0000 Subject: [PATCH] openbsc[master]: VTY: add the dyn_ts_allow_tch_f option Message-ID: Review at https://gerrit.osmocom.org/2190 VTY: add the dyn_ts_allow_tch_f option This option allows to enable or disable TCH/F allocation on the TCH/F_TCH/H_PDCH timeslots. Until now, source code modification was required to enable this feature. See http://osmocom.org/issues/1778 for details. Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon-cs/common_cs_vty.c M openbsc/src/osmo-nitb/bsc_hack.c 4 files changed, 29 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/90/2190/1 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e9ba173..284d053 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -384,7 +384,6 @@ /* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */ bool dyn_ts_allow_tch_f; - /* TODO: vty for this; related: OS#1781 */ /* all active subscriber connections. */ struct llist_head subscr_conns; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index b1747aa..66b30cd 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -821,6 +821,8 @@ vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE); vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE); vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); + vty_out(vty, " dyn_ts_allow_tch_f %d%s", + gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE); vty_out(vty, " subscriber-keep-in-ram %d%s", gsmnet->subscr_group->keep_subscr, VTY_NEWLINE); if (gsmnet->tz.override != 0) { diff --git a/openbsc/src/libcommon-cs/common_cs_vty.c b/openbsc/src/libcommon-cs/common_cs_vty.c index 08a7581..76336a1 100644 --- a/openbsc/src/libcommon-cs/common_cs_vty.c +++ b/openbsc/src/libcommon-cs/common_cs_vty.c @@ -197,6 +197,18 @@ return CMD_SUCCESS; } +DEFUN(cfg_net_dyn_ts_allow_tch_f, + cfg_net_dyn_ts_allow_tch_f_cmd, + "dyn_ts_allow_tch_f (0|1)", + "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n" + "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n" + "Allow TCH/F on TCH_F_TCH_H_PDCH\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false; + return CMD_SUCCESS; +} + DEFUN(cfg_net_subscr_keep, cfg_net_subscr_keep_cmd, "subscriber-keep-in-ram (0|1)", @@ -295,6 +307,7 @@ install_element(GSMNET_NODE, &cfg_net_timezone_cmd); install_element(GSMNET_NODE, &cfg_net_timezone_dst_cmd); install_element(GSMNET_NODE, &cfg_net_no_timezone_cmd); + install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd); return CMD_SUCCESS; } diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index dd90b8b..73a070f 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -301,6 +301,20 @@ } else DEBUGP(DMNCC, "Using internal MNCC handler.\n"); + /* + * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS + * always imply the possibility to have a mix of TCH/F and + * TCH/H channels; if two phones request a TCH/F and a TCH/H, + * respectively, they cannot call each other. If we deny TCH/F, + * they will both fall back to TCH/H, and dynamic channels are + * usable. See http://osmocom.org/issues/1778. + * + * A third-party MSC may well be able to handle a TCH/H TCH/F + * mismatch. Moreover, this option may be overwritten in the + * config file or in VTY. + */ + bsc_gsmnet->dyn_ts_allow_tch_f = false; + /* Read the config */ rc = bsc_network_configure(config_file); if (rc < 0) { @@ -312,19 +326,6 @@ smpp_openbsc_start(bsc_gsmnet); #endif bsc_api_init(bsc_gsmnet, msc_bsc_api()); - - /* - * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS - * always imply the possibility to have a mix of TCH/F and - * TCH/H channels; if two phones request a TCH/F and a TCH/H, - * respectively, they cannot call each other. If we deny TCH/F, - * they will both fall back to TCH/H, and dynamic channels are - * usable. See http://osmocom.org/issues/1778. - * - * A third-party MSC may well be able to handle a TCH/H TCH/F - * mismatch. - */ - bsc_gsmnet->dyn_ts_allow_tch_f = false; /* start control interface after reading config for * ctrl_vty_get_bind_addr() */ -- To view, visit https://gerrit.osmocom.org/2190 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Fri Mar 31 19:58:27 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 19:58:27 +0000 Subject: openbsc[master]: VTY: add the dyn_ts_allow_tch_f option In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (3 comments) excellent, thanks! just some minor cosmetics... https://gerrit.osmocom.org/#/c/2190/1//COMMIT_MSG Commit Message: Line 13: See http://osmocom.org/issues/1778 for details. Please always reference osmocom.org issues using the OS# marker: Related: OS#1778 This way the link can be picked up easily by machines. https://gerrit.osmocom.org/#/c/2190/1/openbsc/src/osmo-nitb/bsc_hack.c File openbsc/src/osmo-nitb/bsc_hack.c: Line 305: * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS indenting Line 310: * usable. See http://osmocom.org/issues/1778. again use 'OS#1778' -- To view, visit https://gerrit.osmocom.org/2190 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:02:35 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 20:02:35 +0000 Subject: [MERGED] openbsc[master]: LU counters: count completion and failure, not messages sent In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: LU counters: count completion and failure, not messages sent ...................................................................... LU counters: count completion and failure, not messages sent >From a human admin viewpoint it doesn't make sense to count the messages sent: When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect the MS to respond with a TMSI Realloc Complete message. When that fails to come through, the LU actually ends in failure, even though a LU Accept was sent. If a conn breaks/vanishes during LU, we cancel the LU without sending any reply at all, so the failed LU would not be counted. Instead, count Location Updating results, i.e. completion and failures. (With the new VLR developments, LU counters need to be triggered in completely different places, and this patch prepares for that by providing sensible counters.) Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libmsc/gsm_04_08.c M openbsc/src/libmsc/vty_interface_layer3.c 3 files changed, 38 insertions(+), 20 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e9ba173..17cc804 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -218,8 +218,8 @@ MSC_CTR_LOC_UPDATE_TYPE_NORMAL, MSC_CTR_LOC_UPDATE_TYPE_PERIODIC, MSC_CTR_LOC_UPDATE_TYPE_DETACH, - MSC_CTR_LOC_UPDATE_RESP_REJECT, - MSC_CTR_LOC_UPDATE_RESP_ACCEPT, + MSC_CTR_LOC_UPDATE_FAILED, + MSC_CTR_LOC_UPDATE_COMPLETED, MSC_CTR_SMS_SUBMITTED, MSC_CTR_SMS_NO_RECEIVER, MSC_CTR_SMS_DELIVERED, @@ -240,8 +240,8 @@ [MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type.normal", "Received location update normal requests."}, [MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type.periodic", "Received location update periodic requests."}, [MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type.detach", "Received location update detach indication."}, - [MSC_CTR_LOC_UPDATE_RESP_REJECT] = {"loc_update_resp.reject", "Sent location update reject responses."}, - [MSC_CTR_LOC_UPDATE_RESP_ACCEPT] = {"loc_update_resp.accept", "Sent location update accept responses."}, + [MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp.failed", "Rejected location updates."}, + [MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp.completed", "Successful location updates."}, [MSC_CTR_SMS_SUBMITTED] = {"sms.submitted", "Received a RPDU from a MS (MO)."}, [MSC_CTR_SMS_NO_RECEIVER] = {"sms.no_receiver", "Counts SMS which couldn't routed because no receiver found."}, [MSC_CTR_SMS_DELIVERED] = {"sms.delivered", "Global SMS Deliver attempts."}, diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index c910d71..31392f3 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -295,7 +295,7 @@ } } -static void release_loc_updating_req(struct gsm_subscriber_connection *conn, int release) +static void _release_loc_updating_req(struct gsm_subscriber_connection *conn, int release) { if (!conn->loc_operation) return; @@ -310,11 +310,31 @@ msc_release_connection(conn); } +static void loc_updating_failure(struct gsm_subscriber_connection *conn, int release) +{ + if (!conn->loc_operation) + return; + LOGP(DMM, LOGL_ERROR, "Location Updating failed for %s\n", + subscr_name(conn->subscr)); + rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_FAILED]); + _release_loc_updating_req(conn, release); +} + +static void loc_updating_success(struct gsm_subscriber_connection *conn, int release) +{ + if (!conn->loc_operation) + return; + LOGP(DMM, LOGL_INFO, "Location Updating completed for %s\n", + subscr_name(conn->subscr)); + rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_COMPLETED]); + _release_loc_updating_req(conn, release); +} + static void allocate_loc_updating_req(struct gsm_subscriber_connection *conn) { if (conn->loc_operation) LOGP(DMM, LOGL_ERROR, "Connection already had operation.\n"); - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); conn->loc_operation = talloc_zero(tall_locop_ctx, struct gsm_loc_updating_operation); @@ -349,9 +369,11 @@ * The gsm0408_loc_upd_acc sends a MI with the TMSI. The * MS needs to respond with a TMSI REALLOCATION COMPLETE * (even if the TMSI is the same). + * If avoid_tmsi == true, we don't send a TMSI, we don't + * expect a reply and Location Updating is done. */ if (avoid_tmsi) - release_loc_updating_req(conn, 1); + loc_updating_success(conn, 1); return rc; } @@ -364,7 +386,7 @@ switch (event) { case GSM_SECURITY_AUTH_FAILED: - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); break; case GSM_SECURITY_ALREADY: @@ -407,7 +429,7 @@ * Cancel any outstanding location updating request * operation taking place on the subscriber connection. */ - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); /* We might need to cancel the paging response or such. */ if (conn->sec_operation && conn->sec_operation->cb) { @@ -459,8 +481,6 @@ struct gsm_bts *bts = conn->bts; struct msgb *msg; - rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT]); - msg = gsm48_create_loc_upd_rej(cause); if (!msg) { LOGP(DMM, LOGL_ERROR, "Failed to create msg for LOCATION UPDATING REJECT.\n"); @@ -507,8 +527,6 @@ } DEBUGP(DMM, "-> LOCATION UPDATE ACCEPT\n"); - - rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT]); return gsm48_conn_sendmsg(msg, conn, NULL); } @@ -566,7 +584,7 @@ } if (!conn->subscr && conn->loc_operation) { gsm0408_loc_upd_rej(conn, net->reject_cause); - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); return 0; } if (conn->loc_operation) @@ -595,7 +613,7 @@ LOGP(DMM, LOGL_DEBUG, "Location Updating Request procedure timedout.\n"); gsm0408_loc_upd_rej(conn, conn->network->reject_cause); - release_loc_updating_req(conn, 1); + loc_updating_failure(conn, 1); } static void schedule_reject(struct gsm_subscriber_connection *conn) @@ -672,7 +690,7 @@ subscr = subscr_create(conn->network, mi_string); if (!subscr) { gsm0408_loc_upd_rej(conn, conn->network->reject_cause); - release_loc_updating_req(conn, 0); + loc_updating_failure(conn, 0); /* FIXME: set release == true? */ return 0; } break; @@ -1401,7 +1419,7 @@ case GSM48_MT_MM_TMSI_REALL_COMPL: DEBUGP(DMM, "TMSI Reallocation Completed. Subscriber: %s\n", subscr_name(conn->subscr)); - release_loc_updating_req(conn, 1); + loc_updating_success(conn, 1); break; case GSM48_MT_MM_IMSI_DETACH_IND: rc = gsm48_rx_mm_imsi_detach_ind(conn, msg); diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 1bc9372..f631bcc 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -827,9 +827,9 @@ vty_out(vty, "IMSI Detach Indications : %lu%s", net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_DETACH].current, VTY_NEWLINE); - vty_out(vty, "Location Update Response: %lu accept, %lu reject%s", - net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT].current, - net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT].current, + vty_out(vty, "Location Updating Results: %lu completed, %lu failed%s", + net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_COMPLETED].current, + net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_FAILED].current, VTY_NEWLINE); vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, " "%lu completed, %lu failed%s", -- To view, visit https://gerrit.osmocom.org/2097 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:03:36 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 20:03:36 +0000 Subject: openbsc[master]: jenkins.sh: Iu: use libosmo-sccp,-netif master In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2189 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9465d7b956c3bd65d6e8a387e6710235672352e8 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:03:44 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 20:03:44 +0000 Subject: [MERGED] openbsc[master]: jenkins.sh: Iu: use libosmo-sccp, -netif master In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins.sh: Iu: use libosmo-sccp,-netif master ...................................................................... jenkins.sh: Iu: use libosmo-sccp,-netif master The iu specific branches of libosmo-sccp and libosmo-netif have recently been merged to master. Change-Id: I9465d7b956c3bd65d6e8a387e6710235672352e8 --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 7 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 08e16b9..323ae04 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -17,14 +17,9 @@ export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" -if [ "x$IU" = "x--enable-iu" ]; then - netif_branch="sysmocom/sctp" - sccp_branch="sysmocom/iu" -fi - osmo-build-dep.sh libosmo-abis -osmo-build-dep.sh libosmo-netif $netif_branch -osmo-build-dep.sh libosmo-sccp $sccp_branch +osmo-build-dep.sh libosmo-netif +osmo-build-dep.sh libosmo-sccp PARALLEL_MAKE="" osmo-build-dep.sh libsmpp34 osmo-build-dep.sh openggsn -- To view, visit https://gerrit.osmocom.org/2189 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9465d7b956c3bd65d6e8a387e6710235672352e8 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:04:59 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 20:04:59 +0000 Subject: libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:05:11 2017 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 31 Mar 2017 20:05:11 +0000 Subject: [MERGED] libosmocore[master]: jenkins: also test build in separate dir In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: jenkins: also test build in separate dir ...................................................................... jenkins: also test build in separate dir To make sure that new patches don't break a build done in another dir than srcdir, make jenkins verify that it still works. Even though 'make distcheck' also tests a build from a separate dir, this does not verify that BUILT_SOURCES are generated properly. If these already exist in the source tree from a previous 'make' issued in the source tree, the BUILT_SOURCES are not regenerated during 'make distcheck'. Hence a separate test run is necessary to ensure stability of new patches. Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e --- M contrib/jenkins.sh 1 file changed, 12 insertions(+), 0 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 656f02f..0c11682 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -10,3 +10,15 @@ || cat-testlogs.sh $MAKE distcheck \ || cat-testlogs.sh + +# verify build in dir other than source tree +rm -rf * +git checkout . +autoreconf --install --force +mkdir builddir +cd builddir +../configure --enable-static +$MAKE $PARALLEL_MAKE check \ + || cat-testlogs.sh +$MAKE distcheck \ + || cat-testlogs.sh -- To view, visit https://gerrit.osmocom.org/1998 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4b31538c155941fd241bcd33b0d39f2f8491ac1e Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:40:13 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Fri, 31 Mar 2017 20:40:13 +0000 Subject: [PATCH] openbsc[master]: VTY: add the dyn_ts_allow_tch_f option In-Reply-To: References: Message-ID: Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2190 to look at the new patch set (#2). VTY: add the dyn_ts_allow_tch_f option This option allows to enable or disable TCH/F allocation on the TCH/F_TCH/H_PDCH timeslots. Until now, source code modification was required to enable this feature. Related: OS#1778 Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712 --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon-cs/common_cs_vty.c M openbsc/src/osmo-nitb/bsc_hack.c 4 files changed, 29 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/90/2190/2 diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e9ba173..284d053 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -384,7 +384,6 @@ /* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */ bool dyn_ts_allow_tch_f; - /* TODO: vty for this; related: OS#1781 */ /* all active subscriber connections. */ struct llist_head subscr_conns; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index b1747aa..66b30cd 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -821,6 +821,8 @@ vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE); vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE); vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); + vty_out(vty, " dyn_ts_allow_tch_f %d%s", + gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE); vty_out(vty, " subscriber-keep-in-ram %d%s", gsmnet->subscr_group->keep_subscr, VTY_NEWLINE); if (gsmnet->tz.override != 0) { diff --git a/openbsc/src/libcommon-cs/common_cs_vty.c b/openbsc/src/libcommon-cs/common_cs_vty.c index 08a7581..76336a1 100644 --- a/openbsc/src/libcommon-cs/common_cs_vty.c +++ b/openbsc/src/libcommon-cs/common_cs_vty.c @@ -197,6 +197,18 @@ return CMD_SUCCESS; } +DEFUN(cfg_net_dyn_ts_allow_tch_f, + cfg_net_dyn_ts_allow_tch_f_cmd, + "dyn_ts_allow_tch_f (0|1)", + "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n" + "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n" + "Allow TCH/F on TCH_F_TCH_H_PDCH\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false; + return CMD_SUCCESS; +} + DEFUN(cfg_net_subscr_keep, cfg_net_subscr_keep_cmd, "subscriber-keep-in-ram (0|1)", @@ -295,6 +307,7 @@ install_element(GSMNET_NODE, &cfg_net_timezone_cmd); install_element(GSMNET_NODE, &cfg_net_timezone_dst_cmd); install_element(GSMNET_NODE, &cfg_net_no_timezone_cmd); + install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd); return CMD_SUCCESS; } diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index dd90b8b..d8029cd 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -301,6 +301,20 @@ } else DEBUGP(DMNCC, "Using internal MNCC handler.\n"); + /* + * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS + * always imply the possibility to have a mix of TCH/F and + * TCH/H channels; if two phones request a TCH/F and a TCH/H, + * respectively, they cannot call each other. If we deny TCH/F, + * they will both fall back to TCH/H, and dynamic channels are + * usable. See OS#1778. + * + * A third-party MSC may well be able to handle a TCH/H TCH/F + * mismatch. Moreover, this option may be overwritten in the + * config file or in VTY. + */ + bsc_gsmnet->dyn_ts_allow_tch_f = false; + /* Read the config */ rc = bsc_network_configure(config_file); if (rc < 0) { @@ -312,19 +326,6 @@ smpp_openbsc_start(bsc_gsmnet); #endif bsc_api_init(bsc_gsmnet, msc_bsc_api()); - - /* - * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS - * always imply the possibility to have a mix of TCH/F and - * TCH/H channels; if two phones request a TCH/F and a TCH/H, - * respectively, they cannot call each other. If we deny TCH/F, - * they will both fall back to TCH/H, and dynamic channels are - * usable. See http://osmocom.org/issues/1778. - * - * A third-party MSC may well be able to handle a TCH/H TCH/F - * mismatch. - */ - bsc_gsmnet->dyn_ts_allow_tch_f = false; /* start control interface after reading config for * ctrl_vty_get_bind_addr() */ -- To view, visit https://gerrit.osmocom.org/2190 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Mar 31 20:40:58 2017 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Fri, 31 Mar 2017 20:40:58 +0000 Subject: openbsc[master]: VTY: add the dyn_ts_allow_tch_f option In-Reply-To: References: Message-ID: Patch Set 2: > (3 comments) > > excellent, thanks! just some minor cosmetics... Thanks for review! Fixed. -- To view, visit https://gerrit.osmocom.org/2190 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 31 21:40:23 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 21:40:23 +0000 Subject: [MERGED] osmo-trx[master]: Resampler: Fix initialization return checking In-Reply-To: References: Message-ID: Tom Tsou has submitted this change and it was merged. Change subject: Resampler: Fix initialization return checking ...................................................................... Resampler: Fix initialization return checking Greater-than comparison was used on boolean type. Change-Id: Ia3b71b3a06b34a6fd781bf197ecf9d5cc1711d13 --- M Transceiver52M/Resampler.cpp 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Tom Tsou: Looks good to me, approved Max: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp index 8a73b79..72b11a9 100644 --- a/Transceiver52M/Resampler.cpp +++ b/Transceiver52M/Resampler.cpp @@ -191,7 +191,7 @@ bool Resampler::init(float bw) { /* Filterbank filter internals */ - if (initFilters(bw) < 0) + if (!initFilters(bw)) return false; /* Precompute filterbank paths */ -- To view, visit https://gerrit.osmocom.org/2159 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia3b71b3a06b34a6fd781bf197ecf9d5cc1711d13 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 21:41:04 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 21:41:04 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Remove unreachable code and no-effect checks In-Reply-To: References: Message-ID: Tom Tsou has submitted this change and it was merged. Change subject: sigProcLib: Remove unreachable code and no-effect checks ...................................................................... sigProcLib: Remove unreachable code and no-effect checks Unreachable path and negative value inspection on unsigned types. Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Fixes: Coverity CID 165239, 165238, 165236 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 2 insertions(+), 6 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 4c2222c..9673d99 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1773,10 +1773,6 @@ /* Normalize our channel gain */ *amp = *amp / sync->gain; - /* Compenate for residual rotation with dual Laurent pulse */ - if (sps == 4) - *amp = *amp * complex(0.0, 1.0); - /* Compensate for residuate time lag */ *toa = *toa - sync->toa; @@ -1894,7 +1890,7 @@ int rc, target, head, tail; CorrelationSequence *sync; - if ((tsc < 0) || (tsc > 7)) + if (tsc > 7) return -SIGERR_UNSUPPORTED; target = 3 + 58 + 16 + 5; @@ -1913,7 +1909,7 @@ int rc, target, head, tail; CorrelationSequence *sync; - if ((tsc < 0) || (tsc > 7)) + if (tsc > 7) return -SIGERR_UNSUPPORTED; target = 3 + 58 + 16 + 5; -- To view, visit https://gerrit.osmocom.org/2171 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If53b4b03550b0a7656c808cfe96806252153eb2f Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 21:41:04 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 21:41:04 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Check return status on downsampling In-Reply-To: References: Message-ID: Tom Tsou has submitted this change and it was merged. Change subject: sigProcLib: Check return status on downsampling ...................................................................... sigProcLib: Check return status on downsampling Improper length values will cause the polyphase resampler rotation to fail. Check return and return NULL on error. Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Fixes: Coverity CID 165235 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 6 insertions(+), 2 deletions(-) Approvals: Tom Tsou: Looks good to me, approved Harald Welte: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 9673d99..4bb41a9 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1962,8 +1962,12 @@ out = new signalVector(DOWNSAMPLE_OUT_LEN); memcpy(in->begin(), burst.begin(), DOWNSAMPLE_IN_LEN * 2 * sizeof(float)); - dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN, - (float *) out->begin(), DOWNSAMPLE_OUT_LEN); + if (dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN, + (float *) out->begin(), DOWNSAMPLE_OUT_LEN) < 0) { + delete out; + out = NULL; + } + delete in; return out; }; -- To view, visit https://gerrit.osmocom.org/2172 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3ad22f9fd7a20754f589c04258dcca3770474a9b Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 21:44:18 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 21:44:18 +0000 Subject: [MERGED] osmo-trx[master]: sigProcLib: Fix negative value check on unsigned value In-Reply-To: References: Message-ID: Tom Tsou has submitted this change and it was merged. Change subject: sigProcLib: Fix negative value check on unsigned value ...................................................................... sigProcLib: Fix negative value check on unsigned value Convert negative value check on unsigned value to zero check to avoid potential divide-by-zero error condition. Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Fixes: Coverity CID 165059 --- M Transceiver52M/sigProcLib.cpp 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Tom Tsou: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 4bb41a9..c09047b 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1712,7 +1712,7 @@ signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2; float energy = 0.0; - if (windowLength < 0) windowLength = 20; + if (windowLength == 0) return 0.0; if (windowLength > rxBurst.size()) windowLength = rxBurst.size(); for (unsigned i = 0; i < windowLength; i++) { energy += windowItr->norm2(); -- To view, visit https://gerrit.osmocom.org/2163 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257 Gerrit-PatchSet: 3 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Fri Mar 31 21:52:47 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 21:52:47 +0000 Subject: osmo-trx[master]: Resampler: Fix non-array delete for filter taps In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2187 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I59cdb01809da5940c74aaae9d17f413aefbf04b2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Mar 31 21:53:06 2017 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Fri, 31 Mar 2017 21:53:06 +0000 Subject: osmo-trx[master]: Transceiver: Remove unsigned negative compares In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2188 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I49f30699786c52736ef334dae61f7bbd65d878d5 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Tom Tsou Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No