From gerrit-no-reply at lists.osmocom.org Thu Dec 1 02:05:02 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 1 Dec 2016 02:05:02 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: dynamic timeslots: add BSC level config instructions Message-ID: Review at https://gerrit.osmocom.org/1352 dynamic timeslots: add BSC level config instructions Add high level description on and a config example for dynamic timeslots in a new chapter featured in the OsmoBSC and OsmoNITB manuals. >From the OsmoBTS manual's chapter on dynamic timeslots, add references to the above. Change-Id: I44ff1e4c2340c65ff23e85408fc6d6a45ea9e046 --- M OsmoBTS/chapters/dynamic-timeslots.adoc M common/chapters/bts.adoc 2 files changed, 127 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/52/1352/1 diff --git a/OsmoBTS/chapters/dynamic-timeslots.adoc b/OsmoBTS/chapters/dynamic-timeslots.adoc index 29dff5b..7c43d18 100644 --- a/OsmoBTS/chapters/dynamic-timeslots.adoc +++ b/OsmoBTS/chapters/dynamic-timeslots.adoc @@ -7,11 +7,14 @@ The Abis message handling for dynamic timeslots is independent of the BTS model. However, dynamic switchover will only work for BTS models that implement the internal API to reconnect a timeslot (_bts_model_ts_disconnect()_ and -_bts_model_ts_connect()_). Currently, these BTS models support dynamic -timeslots: +_bts_model_ts_connect()_, see also <>). + +Currently, these OsmoBTS models support dynamic timeslots: * _osmo-bts-sysmo_ * _osmo-bts-litecell15_ * _osmo-bts-trx_ -See also <>. +Dynamic timeslots are driven by the BSC and need to be configured there. When +using OsmoBSC or OsmoNITB, see the BTS configuration chapter on dynamic +timeslots in <> or <>, respectively. diff --git a/common/chapters/bts.adoc b/common/chapters/bts.adoc index c9fda7f..80c91d6 100644 --- a/common/chapters/bts.adoc +++ b/common/chapters/bts.adoc @@ -267,3 +267,124 @@ Configures the various GPRS NS related timers. Please check the GPRS NS specification for the detailed meaning of those timers. + + +=== Dynamic Timeslot Configuration (TCH / PDCH) + +A dynamic timeslot is in principle a voice timeslot (TCH) that is used to serve +GPRS data (PDCH) when no voice call is active on it. This enhances GPRS +bandwidth while no voice calls are active, which is dynamically scaled down as +voice calls need to be served. This is a tremendous improvement in service over +statically assigning a fixed number of timeslots for voice and data. + +Dynamic timeslots work both with OsmoNITB as well as with OsmoBSC driven by a +third-party MSC. The causality is as follows: to establish a voice call, the +MSC requests a logical channel of a given TCH kind from the BSC. The BSC +assigns such a channel from a BTS' TRX's timeslot of its choice. The knowledge +that a given timeslot is dynamic exists only on the BSC level. When the MSC +asks for a logical channel, the BSC may switch off PDCH on a dynamic timeslot +and then assign a logical TCH channel on it. Hence, though compatibility with +the BTS needs to be ensured, any MSC is compatible with dynamic timeslots by +definition. + +OsmoBSC and OsmoNITB support two kinds of dynamic timeslot handling, configured +via the `network` / `bts` / `trx` / `timeslot` / `phys_chan_config` +configuration. Not all BTS models support dynamic channels. + +[[dyn_ts_compat]] +.Dynamic timeslot support by various BTS models +[cols="50%,25%,25%"] +|=== +| |`TCH/F_TCH/H_PDCH` |`TCH/F_PDCH` +|ip.access nanoBTS |- |supported +|Ericsson RBS |supported |- +|sysmoBTS using _osmo-bts-sysmo_ |supported |supported +|various SDR platforms using _osmo-bts-trx_ |supported |supported +|Nutaq Litecell 1.5 using _osmo-bts-litecell15_ |supported |supported +|Octasic OctBTS using _osmo-bts-octphy_ | - | - +|=== + +The _OsmoBTS Abis Protocol Specification_ <> describes the +non-standard RSL messages used for these timeslot kinds. + +NOTE: Same as for dedicated PDCH timeslots, you need to enable GPRS and operate +a PCU, SGSN and GGSN to provide the actual data service. + +==== Osmocom Style Dynamic Timeslots (TCH/F_TCH/H_PDCH) + +Timeslots of the `TCH/F_TCH/H_PDCH` type dynamically switch between TCH/F, +TCH/H and PDCH, depending on the channel kind requested by the MSC. The RSL +messaging for `TCH/F_TCH/H_PDCH` timeslots is compatible with Ericsson RBS. + +BTS models supporting this timeslot kind are shown in <>. + +NOTE: At the time of writing, OsmoNITB disables TCH/F on this timeslot type due +to transcoding limitations. Operation of OsmoBSC with a third-party MSC is not +affected by this limitation. See https://osmocom.org/issues/1778. + +==== ip.access Style Dynamic Timeslots (TCH/F_PDCH) + +Timeslots of the `TCH/F_PDCH` type dynamically switch between TCH/F and PDCH. +The RSL messaging for `TCH/F_PDCH` timeslots is compatible with ip.access +nanoBTS. + +BTS models supporting this timeslot kind are shown in <>. + +==== Avoid PDCH Exhaustion + +To avoid disrupting GPRS, configure at least one timeslot as dedicated PDCH. +With only dynamic timeslots, a given number of voice calls would convert all +timeslots to TCH, and no PDCH timeslots would be left for GPRS service. + +==== Dynamic Timeslot Configuration Examples + +This is an extract of an _osmo-nitb_ or _openbsc_ config file. A timeslot +configuration with five Osmocom style dynamic timeslots and one dedicated PDCH +may look like this: + +---- +network + bts 0 + trx 0 + timeslot 0 + phys_chan_config CCCH+SDCCH4 + timeslot 1 + phys_chan_config SDCCH8 + timeslot 2 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 3 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 4 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 5 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 6 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 7 + phys_chan_config PDCH +---- + +With the ip.access nanoBTS, only `TCH/F_PDCH` dynamic timeslots are supported, +and hence a nanoBTS configuration may look like this: + +---- +network + bts 0 + trx 0 + timeslot 0 + phys_chan_config CCCH+SDCCH4 + timeslot 1 + phys_chan_config SDCCH8 + timeslot 2 + phys_chan_config TCH/F_PDCH + timeslot 3 + phys_chan_config TCH/F_PDCH + timeslot 4 + phys_chan_config TCH/F_PDCH + timeslot 5 + phys_chan_config TCH/F_PDCH + timeslot 6 + phys_chan_config TCH/F_PDCH + timeslot 7 + phys_chan_config PDCH +---- -- To view, visit https://gerrit.osmocom.org/1352 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I44ff1e4c2340c65ff23e85408fc6d6a45ea9e046 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 1 14:48:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:48:26 +0000 Subject: osmo-pcu[master]: debian: fix: add pcuif_proto.h to osmo-pcu.install In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1348 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib8e185900826baadcc96fcde1491903dbaf85f8b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu 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 Thu Dec 1 14:48:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:48:33 +0000 Subject: [MERGED] osmo-pcu[master]: debian: fix: add pcuif_proto.h to osmo-pcu.install In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: debian: fix: add pcuif_proto.h to osmo-pcu.install ...................................................................... debian: fix: add pcuif_proto.h to osmo-pcu.install Following 68fc12775fac03e5e26a008dfa68c92498bfb772 'Install the pcuif_proto.h header file' we need to add pcuif_proto.h to the debian install file. Change-Id: Ib8e185900826baadcc96fcde1491903dbaf85f8b --- M debian/osmo-pcu.install 1 file changed, 1 insertion(+), 0 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/debian/osmo-pcu.install b/debian/osmo-pcu.install index 1f9a8e0..768719c 100644 --- a/debian/osmo-pcu.install +++ b/debian/osmo-pcu.install @@ -1,2 +1,3 @@ etc/osmocom/osmo-pcu.cfg usr/bin/osmo-pcu +usr/include/osmocom/pcu/pcuif_proto.h -- To view, visit https://gerrit.osmocom.org/1348 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib8e185900826baadcc96fcde1491903dbaf85f8b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu 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 Thu Dec 1 14:49:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:49:09 +0000 Subject: osmo-bts[master]: trx: Add "maxdlynb" VTY command to control max TA for Normal... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1246 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib5d255299668ac1ef9f0ce95e016f55ba3c82277 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts 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 Dec 1 14:49:15 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:49:15 +0000 Subject: [MERGED] osmo-bts[master]: trx: Add "maxdlynb" VTY command to control max TA for Normal... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: trx: Add "maxdlynb" VTY command to control max TA for Normal Bursts. ...................................................................... trx: Add "maxdlynb" VTY command to control max TA for Normal Bursts. Originally `maxdly` command in osmo-trx was contrlling max TA for Normal Bursts. This was not a proper behaviour, because it was used to "control maximum distance a handset can attach from" which is controlled by Access Bursts max TA. Osmo-trx was corrected to apply `maxdly` to Access Bursts and a new command was introduced to contrl max TA for Normal Bursts - `maxdlynb`. This patch adds support for this configuration command into osmo-bts-trx. If you wonder why would you need that - some test equipment (namely R&S CMD57) has really bad timing sync and can generate signal a few symbols off. That prevents osmo-trx from properly receiving otherwise perfectly good bursts generated by CMD57. This configuration is a solution for this. Change-Id: Ib5d255299668ac1ef9f0ce95e016f55ba3c82277 --- M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/l1_if.h M src/osmo-bts-trx/trx_if.c M src/osmo-bts-trx/trx_if.h M src/osmo-bts-trx/trx_vty.c 5 files changed, 68 insertions(+), 1 deletion(-) Approvals: Tom Tsou: Looks good to me, but someone else must approve Harald Welte: 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 ea2088b..202a05e 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -197,6 +197,10 @@ trx_if_cmd_setmaxdly(l1h, l1h->config.maxdly); l1h->config.maxdly_sent = 1; } + if (l1h->config.maxdlynb_valid && !l1h->config.maxdlynb_sent) { + trx_if_cmd_setmaxdlynb(l1h, l1h->config.maxdlynb); + l1h->config.maxdlynb_sent = 1; + } for (tn = 0; tn < TRX_NR_TS; tn++) { if (l1h->config.slottype_valid[tn] @@ -217,6 +221,7 @@ plink->u.osmotrx.power_sent = 0; } l1h->config.maxdly_sent = 0; + l1h->config.maxdlynb_sent = 0; for (tn = 0; tn < TRX_NR_TS; tn++) l1h->config.slottype_sent[tn] = 0; } diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h index 187303c..f0b2e67 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -24,6 +24,10 @@ int maxdly; int maxdly_sent; + int maxdlynb_valid; + int maxdlynb; + int maxdlynb_sent; + uint8_t slotmask; int slottype_valid[TRX_NR_TS]; diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 42d383c..989e77a 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -281,6 +281,11 @@ return trx_ctrl_cmd(l1h, 0, "SETMAXDLY", "%d", dly); } +int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly) +{ + return trx_ctrl_cmd(l1h, 0, "SETMAXDLYNB", "%d", dly); +} + int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, uint8_t type) { return trx_ctrl_cmd(l1h, 1, "SETSLOT", "%d %d", tn, type); diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h index 8659c4a..fdc8a8d 100644 --- a/src/osmo-bts-trx/trx_if.h +++ b/src/osmo-bts-trx/trx_if.h @@ -22,6 +22,7 @@ int trx_if_cmd_setrxgain(struct trx_l1h *l1h, int db); int trx_if_cmd_setpower(struct trx_l1h *l1h, int db); int trx_if_cmd_setmaxdly(struct trx_l1h *l1h, int dly); +int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly); int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, uint8_t type); int trx_if_cmd_rxtune(struct trx_l1h *l1h, uint16_t arfcn); int trx_if_cmd_txtune(struct trx_l1h *l1h, uint16_t arfcn); diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c index 3aec8ba..ca347e8 100644 --- a/src/osmo-bts-trx/trx_vty.c +++ b/src/osmo-bts-trx/trx_vty.c @@ -105,6 +105,11 @@ VTY_NEWLINE); else vty_out(vty, " maxdly : undefined%s", VTY_NEWLINE); + if (l1h->config.maxdlynb_valid) + vty_out(vty, " maxdlynb : %d%s", l1h->config.maxdlynb, + VTY_NEWLINE); + else + vty_out(vty, " maxdlynb : undefined%s", VTY_NEWLINE); for (tn = 0; tn < TRX_NR_TS; tn++) { if (!((1 << tn) & l1h->config.slotmask)) vty_out(vty, " slot #%d: unsupported%s", tn, @@ -239,7 +244,13 @@ DEFUN(cfg_phyinst_maxdly, cfg_phyinst_maxdly_cmd, "osmotrx maxdly <0-31>", - "Set the maximum delay of GSM symbols\n" + "Set the maximum acceptable delay of an Access Burst (in GSM symbols)." + " Access Burst is the first burst a mobile transmits in order to establish" + " a connection and it is used to estimate Timing Advance (TA) which is" + " then applied to Normal Bursts to compensate for signal delay due to" + " distance. So changing this setting effectively changes maximum range of" + " the cell, because if we receive an Access Burst with a delay higher than" + " this value, it will be ignored and connection is dropped.\n" "GSM symbols (approx. 1.1km per symbol)\n") { struct phy_instance *pinst = vty->index; @@ -248,6 +259,31 @@ l1h->config.maxdly = atoi(argv[0]); l1h->config.maxdly_valid = 1; l1h->config.maxdly_sent = 0; + l1if_provision_transceiver_trx(l1h); + + return CMD_SUCCESS; +} + + +DEFUN(cfg_phyinst_maxdlynb, cfg_phyinst_maxdlynb_cmd, + "osmotrx maxdlynb <0-31>", + "Set the maximum acceptable delay of a Normal Burst (in GSM symbols)." + " USE FOR TESTING ONLY, DON'T CHANGE IN PRODUCTION USE!" + " During normal operation, Normal Bursts delay are controled by a Timing" + " Advance control loop and thus Normal Bursts arrive to a BTS with no more" + " than a couple GSM symbols, which is already taken into account in osmo-trx." + " So changing this setting will have no effect in production installations" + " except increasing osmo-trx CPU load. This setting is only useful when" + " testing with a transmitter which can't precisely synchronize to the BTS" + " downlink signal, like e.g. R&S CMD57.\n" + "GSM symbols (approx. 1.1km per symbol)\n") +{ + struct phy_instance *pinst = vty->index; + struct trx_l1h *l1h = pinst->u.osmotrx.hdl; + + l1h->config.maxdlynb = atoi(argv[0]); + l1h->config.maxdlynb_valid = 1; + l1h->config.maxdlynb_sent = 0; l1if_provision_transceiver_trx(l1h); return CMD_SUCCESS; @@ -400,6 +436,18 @@ return CMD_SUCCESS; } +DEFUN(cfg_phyinst_no_maxdlynb, cfg_phyinst_no_maxdlynb_cmd, + "no osmotrx maxdlynb", + NO_STR "Unset the maximum delay of GSM symbols\n") +{ + struct phy_instance *pinst = vty->index; + struct trx_l1h *l1h = pinst->u.osmotrx.hdl; + + l1h->config.maxdlynb_valid = 0; + + return CMD_SUCCESS; +} + DEFUN(cfg_phy_transc_ip, cfg_phy_transc_ip_cmd, "osmotrx ip HOST", OSMOTRX_STR @@ -458,6 +506,8 @@ if (l1h->config.maxdly_valid) vty_out(vty, " maxdly %d%s", l1h->config.maxdly, VTY_NEWLINE); + if (l1h->config.maxdlynb_valid) + vty_out(vty, " maxdlynb %d%s", l1h->config.maxdlynb, VTY_NEWLINE); if (l1h->config.slotmask != 0xff) vty_out(vty, " slotmask %d %d %d %d %d %d %d %d%s", l1h->config.slotmask & 1, @@ -520,6 +570,8 @@ install_element(PHY_INST_NODE, &cfg_phy_power_on_cmd); install_element(PHY_INST_NODE, &cfg_phyinst_maxdly_cmd); install_element(PHY_INST_NODE, &cfg_phyinst_no_maxdly_cmd); + install_element(PHY_INST_NODE, &cfg_phyinst_maxdlynb_cmd); + install_element(PHY_INST_NODE, &cfg_phyinst_no_maxdlynb_cmd); return 0; } -- To view, visit https://gerrit.osmocom.org/1246 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib5d255299668ac1ef9f0ce95e016f55ba3c82277 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts 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 Thu Dec 1 14:49:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:49:41 +0000 Subject: osmo-bts[master]: DTX DL AMR: rewrite FSM recursion In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1225 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If39b68083d23a4a35f468a5d75f54eb733ebfd14 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 Dec 1 14:49:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:49:43 +0000 Subject: [MERGED] osmo-bts[master]: DTX DL AMR: rewrite FSM recursion In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: DTX DL AMR: rewrite FSM recursion ...................................................................... DTX DL AMR: rewrite FSM recursion Add explicit state for recursion (sending the different payload data in response to the RTS request for same FN) and corresponding transition. Remove ST_FACCH_V as with new explicit recursion handling it becomes unreacheable. This makes it easier to maintain preemption (interruption of current procedure due to FACCH or Inhibition). This also reduces the number of possible transitions out of each state thus reducing graph's cyclomatic complexity. Change-Id: If39b68083d23a4a35f468a5d75f54eb733ebfd14 --- M include/osmo-bts/dtx_dl_amr_fsm.h M include/osmo-bts/msg_utils.h M src/common/dtx_dl_amr_fsm.c M src/common/msg_utils.c M src/osmo-bts-litecell15/l1_if.c M src/osmo-bts-litecell15/tch.c M src/osmo-bts-sysmo/l1_if.c M src/osmo-bts-sysmo/tch.c 8 files changed, 270 insertions(+), 137 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/dtx_dl_amr_fsm.h b/include/osmo-bts/dtx_dl_amr_fsm.h index 8b19595..4fb2f25 100644 --- a/include/osmo-bts/dtx_dl_amr_fsm.h +++ b/include/osmo-bts/dtx_dl_amr_fsm.h @@ -14,10 +14,13 @@ ST_SID_F2, ST_F1_INH, ST_U_INH, + ST_F1_INH_REC, + ST_U_INH_REC, ST_SID_U, ST_ONSET_V, ST_ONSET_F, - ST_FACCH_V, + ST_ONSET_V_REC, + ST_ONSET_F_REC, ST_FACCH, }; diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 4f9868c..7321045 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -29,6 +29,8 @@ void lchan_set_marker(bool t, struct gsm_lchan *lchan); bool dtx_dl_amr_enabled(const struct gsm_lchan *lchan); void dtx_dispatch(struct gsm_lchan *lchan, enum dtx_dl_amr_fsm_events e); +bool dtx_recursion(const struct gsm_lchan *lchan); +void dtx_int_signal(struct gsm_lchan *lchan); void dtx_cache_payload(struct gsm_lchan *lchan, const uint8_t *l1_payload, size_t length, uint32_t fn, int update); int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl, diff --git a/src/common/dtx_dl_amr_fsm.c b/src/common/dtx_dl_amr_fsm.c index 5075957..d903b0c 100644 --- a/src/common/dtx_dl_amr_fsm.c +++ b/src/common/dtx_dl_amr_fsm.c @@ -96,11 +96,8 @@ void dtx_fsm_f1_inh(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_VOICE: - osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); - break; - case E_FACCH: - osmo_fsm_inst_state_chg(fi, ST_ONSET_F, 0, 0); + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_F1_INH_REC, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -112,11 +109,34 @@ void dtx_fsm_u_inh(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_VOICE: + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_U_INH_REC, 0, 0); + break; + default: + LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); + OSMO_ASSERT(0); + break; + } +} + +void dtx_fsm_f1_inh_rec(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case E_COMPL: osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); break; - case E_FACCH: - osmo_fsm_inst_state_chg(fi, ST_FACCH, 0, 0); + default: + LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); + OSMO_ASSERT(0); + break; + } +} + +void dtx_fsm_u_inh_rec(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -155,13 +175,8 @@ void dtx_fsm_onset_v(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_SID_F: - case E_SID_U: - case E_VOICE: - osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); - break; - case E_FACCH: - osmo_fsm_inst_state_chg(fi, ST_FACCH_V, 0, 0); + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_ONSET_V_REC, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -173,14 +188,8 @@ void dtx_fsm_onset_f(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_SID_F: - case E_SID_U: - break; - case E_VOICE: - osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); - break; - case E_FACCH: - osmo_fsm_inst_state_chg(fi, ST_FACCH, 0, 0); + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_ONSET_F_REC, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -189,17 +198,24 @@ } } -void dtx_fsm_facch_v(struct osmo_fsm_inst *fi, uint32_t event, void *data) +void dtx_fsm_onset_v_rec(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_FACCH: - break; - case E_VOICE: + case E_COMPL: osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); break; - case E_SID_U: + default: + LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); + OSMO_ASSERT(0); break; - case E_SID_F: + } +} + +void dtx_fsm_onset_f_rec(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_FACCH, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -211,13 +227,14 @@ void dtx_fsm_facch(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { + case E_SID_U: + case E_SID_F: case E_FACCH: break; case E_VOICE: osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); break; - case E_SID_U: - case E_SID_F: + case E_COMPL: osmo_fsm_inst_state_chg(fi, ST_SID_F1, 0, 0); break; default: @@ -244,28 +261,42 @@ .action = dtx_fsm_sid_f1, }, /* SID-FIRST P2 (only for AMR HR): - actual start of silence period in case of AMR HR*/ + actual start of silence period in case of AMR HR */ [ST_SID_F2]= { .in_event_mask = X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_ONSET_V), .name = "SID-FIRST (P2)", .action = dtx_fsm_sid_f2, }, - /* SID-FIRST Inhibited: - incoming SPEECH or FACCH (only for AMR HR) */ + /* SID-FIRST Inhibited: incoming SPEECH (only for AMR HR) */ [ST_F1_INH]= { - .in_event_mask = X(E_VOICE) | X(E_FACCH), - .out_state_mask = X(ST_VOICE) | X(ST_FACCH_V), + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_F1_INH_REC), .name = "SID-FIRST (Inh)", .action = dtx_fsm_f1_inh, }, - /* SID-UPDATE Inhibited: - incoming SPEECH or FACCH (only for AMR HR) */ + /* SID-UPDATE Inhibited: incoming SPEECH (only for AMR HR) */ [ST_U_INH]= { - .in_event_mask = X(E_VOICE) | X(E_FACCH), - .out_state_mask = X(ST_VOICE) | X(ST_FACCH), + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_U_INH_REC), .name = "SID-UPDATE (Inh)", .action = dtx_fsm_u_inh, + }, + /* SID-FIRST Inhibition recursion in progress: + Inhibit itself was already sent, now have to send the voice that caused it */ + [ST_F1_INH_REC]= { + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_VOICE), + .name = "SID-FIRST (Inh, Rec)", + .action = dtx_fsm_f1_inh_rec, + }, + /* SID-UPDATE Inhibition recursion in progress: + Inhibit itself was already sent, now have to send the voice that caused it */ + [ST_U_INH_REC]= { + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_VOICE), + .name = "SID-UPDATE (Inh, Rec)", + .action = dtx_fsm_u_inh_rec, }, /* Silence period with periodic comfort noise data updates */ [ST_SID_U]= { @@ -276,31 +307,39 @@ }, /* ONSET - end of silent period due to incoming SPEECH frame */ [ST_ONSET_V]= { - .in_event_mask = X(E_SID_F) | X(E_SID_U) | X(E_VOICE) | X(E_FACCH), - .out_state_mask = X(ST_VOICE) | X(ST_FACCH_V), + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_ONSET_V_REC), .name = "ONSET (SPEECH)", .action = dtx_fsm_onset_v, }, /* ONSET - end of silent period due to incoming FACCH frame */ [ST_ONSET_F]= { - .in_event_mask = X(E_VOICE) | X(E_FACCH) | X(E_SID_U) | X(E_SID_F), - .out_state_mask = X(ST_VOICE) | X(ST_FACCH), + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_ONSET_F_REC), .name = "ONSET (FACCH)", .action = dtx_fsm_onset_f, }, - /* FACCH sending state: SPEECH was observed before so once we're done - FSM should get back to VOICE state */ - [ST_FACCH_V]= { - .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_SID_U) | X(E_SID_F), - .out_state_mask = X(ST_FACCH_V) | X(ST_VOICE) | X(ST_SID_F1), - .name = "FACCH (SPEECH)", - .action = dtx_fsm_facch_v, + /* ONSET recursion in progress: + ONSET itself was already sent, now have to send the voice that caused it */ + [ST_ONSET_V_REC]= { + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_VOICE), + .name = "ONSET (SPEECH, Rec)", + .action = dtx_fsm_onset_v_rec, + }, + /* ONSET recursion in progress: + ONSET itself was already sent, now have to send the data that caused it */ + [ST_ONSET_F_REC]= { + .in_event_mask = X(E_COMPL), + .out_state_mask = X(ST_FACCH), + .name = "ONSET (FACCH, Rec)", + .action = dtx_fsm_onset_f_rec, }, /* FACCH sending state: no SPEECH was observed before so once we're done FSM should get back to silent period via SID-FIRST */ [ST_FACCH]= { - .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_SID_U) | X(E_SID_F), - .out_state_mask = X(ST_FACCH_V) | X(ST_VOICE) | X(ST_SID_F1), + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_COMPL) | X(E_SID_U) | X(E_SID_F), + .out_state_mask = X(ST_VOICE) | X(ST_SID_F1), .name = "FACCH", .action = dtx_fsm_facch, }, @@ -310,7 +349,7 @@ { E_VOICE, "Voice" }, { E_ONSET, "ONSET" }, { E_FACCH, "FACCH" }, - { E_COMPL, "Complete P1 -> P2" }, + { E_COMPL, "Complete" }, { E_INHIB, "Inhibit" }, { E_SID_F, "SID-FIRST" }, { E_SID_U, "SID-UPDATE" }, diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index b876443..c5081b4 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -120,8 +121,15 @@ lchan->tch.dtx.len = copy_len + amr; /* SID FIRST is special because it's both sent and cached: */ if (update == 0) { - lchan->tch.dtx.fn = fn; lchan->tch.dtx.is_update = false; /* Mark SID FIRST explicitly */ + /* for non-AMR case - always update FN for incoming SID FIRST */ + if (!amr || + (dtx_dl_amr_enabled(lchan) && + lchan->tch.dtx.dl_amr_fsm->state != ST_SID_U)) + lchan->tch.dtx.fn = fn; + /* for AMR case - do not update FN if SID FIRST arrives in a + middle of silence: this should not be happening according to + the spec */ } memcpy(lchan->tch.dtx.cache + amr, l1_payload, copy_len); @@ -148,12 +156,16 @@ int8_t sti, cmi; int rc; - if (rtp_pl == NULL) { /* SID-FIRST P1 -> P2 */ + if (lchan->type == GSM_LCHAN_TCH_H && /* SID-FIRST P1 -> P2 completion */ + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { *len = 3; memcpy(l1_payload, lchan->tch.dtx.cache, 2); - dtx_dispatch(lchan, E_COMPL); + dtx_dispatch(lchan, E_SID_U); return 0; } + + if (!rtp_pl_len) + return -EBADMSG; rc = osmo_amr_rtp_dec(rtp_pl, rtp_pl_len, &cmr, &cmi, &ft, &bfi, &sti); if (rc < 0) { @@ -199,10 +211,15 @@ } if (ft == AMR_SID) { - dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, sti); - if (lchan->tch.dtx.dl_amr_fsm->state == ST_VOICE) + if (lchan->tch.dtx.dl_amr_fsm->state == ST_VOICE) { + /* SID FIRST/UPDATE scheduling logic relies on SID FIRST + being sent first hence we have to force caching of SID + as FIRST regardless of actually decoded type */ + dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, false); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_F, (void *)lchan); + } else + dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, sti); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, sti ? E_SID_U : E_SID_F, (void *)lchan); @@ -220,11 +237,14 @@ return 0; } +/* STI is located in payload byte 6, cache contains 2 byte prefix (CMR/CMI) + * STI set = SID UPDATE, STI unset = SID FIRST + */ static inline void dtx_sti_set(struct gsm_lchan *lchan) { lchan->tch.dtx.cache[6 + 2] |= STI_BIT_MASK; } -/* STI is located in payload byte 6, cache contains 2 byte prefix (CMR/CMI) */ + static inline void dtx_sti_unset(struct gsm_lchan *lchan) { lchan->tch.dtx.cache[6 + 2] &= ~STI_BIT_MASK; @@ -241,17 +261,27 @@ uint32_t dx26 = 120 * (fn - lchan->tch.dtx.fn); /* We're resuming after FACCH interruption */ - if (lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH || - lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F) { + if (lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH) { /* force STI bit to 0 so cache is treated as SID FIRST */ dtx_sti_unset(lchan); lchan->tch.dtx.is_update = false; - osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_F, - (void *)lchan); - /* this FN was already used for ONSET message so we just prepare - things for next one */ + /* check that this FN has not been used for FACCH message + already: we rely here on the order of RTS arrival from L1 - we + expect that PH-DATA.req ALWAYS comes before PH-TCH.req for the + same FN */ + if (lchan->tch.dtx.fn != LCHAN_FN_DUMMY) { + /* FACCH interruption is over */ + dtx_dispatch(lchan, E_COMPL); + return false; + } else + lchan->tch.dtx.fn = fn; + /* this FN was already used for FACCH or ONSET message so we just + prepare things for next one */ return true; } + + if (lchan->tch.dtx.dl_amr_fsm->state == ST_VOICE) + return true; /* according to 3GPP TS 26.093 A.5.1.1: (*26) to avoid float math, add 1 FN tolerance (-120) */ @@ -297,6 +327,11 @@ return false; } +/*! \brief Check if DTX DL AMR is enabled for a given lchan (it have proper type, + * FSM is allocated etc.) + * \param[in] lchan Logical channel on which we check scheduling + * \returns true if DTX DL AMR is enabled, false otherwise + */ bool dtx_dl_amr_enabled(const struct gsm_lchan *lchan) { if (lchan->ts->trx->bts->dtxd && @@ -306,6 +341,31 @@ return false; } +/*! \brief Check if DTX DL AMR FSM state is recursive: requires secondary + * response to a single RTS request from L1. + * \param[in] lchan Logical channel on which we check scheduling + * \returns true if DTX DL AMR FSM state is recursive, false otherwise + */ +bool dtx_recursion(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + + if (lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH || + lchan->tch.dtx.dl_amr_fsm->state == ST_F1_INH || + lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F || + lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_V || + lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F_REC || + lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_V_REC) + return true; + + return false; +} + +/*! \brief Send signal to FSM: with proper check if DIX is enabled for this lchan + * \param[in] lchan Logical channel on which we check scheduling + * \param[in] e DTX DL AMR FSM Event + */ void dtx_dispatch(struct gsm_lchan *lchan, enum dtx_dl_amr_fsm_events e) { if (dtx_dl_amr_enabled(lchan)) @@ -313,7 +373,23 @@ (void *)lchan); } -/* repeat last SID if possible, returns SID length + 1 or 0 */ +/*! \brief Send internal signal to FSM: check that DTX is enabled for this chan, + * check that current FSM and lchan states are permitting such signal. + * Note: this should be the only way to dispatch E_COMPL to FSM from + * BTS code. + * \param[in] lchan Logical channel on which we check scheduling + */ +void dtx_int_signal(struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return; + + if ((lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) || + dtx_recursion(lchan)) + dtx_dispatch(lchan, E_COMPL); +} + /*! \brief Repeat last SID if possible in case of DTX * \param[in] lchan Logical channel on which we check scheduling * \param[in] dst Buffer to copy last SID into @@ -334,13 +410,26 @@ return 0; if (lchan->tch.dtx.len) { + if (dtx_dl_amr_enabled(lchan)) { + if ((lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2) || + (lchan->type == GSM_LCHAN_TCH_F && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1)) { + /* advance FSM in case we've just sent SID FIRST + to restore silence after FACCH interruption */ + osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_SID_U, (void *)lchan); + dtx_sti_unset(lchan); + } else if (lchan->tch.dtx.dl_amr_fsm->state == + ST_SID_U) { + /* enforce SID UPDATE for next repetition: it + might have been altered by FACCH handling */ + dtx_sti_set(lchan); + lchan->tch.dtx.is_update = true; + } + } memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len); lchan->tch.dtx.fn = fn; - /* enforce SID UPDATE for next repetition - it might have - been altered by FACCH handling */ - dtx_sti_set(lchan); - if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U) - lchan->tch.dtx.is_update = true; return lchan->tch.dtx.len + 1; } diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index 4a6c739..632e769 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -339,7 +340,6 @@ uint32_t u32Fn; uint8_t u8Tn, subCh, u8BlockNbr = 0, sapi = 0; uint8_t chan_nr, link_id; - bool rec = false; int len; if (!msg) { @@ -355,6 +355,7 @@ u32Fn = l1sap->u.data.fn; u8Tn = L1SAP_CHAN2TS(chan_nr); subCh = 0x1f; + lchan = get_lchan_by_chan_nr(trx, chan_nr); if (L1SAP_IS_LINK_SACCH(link_id)) { sapi = GsmL1_Sapi_Sacch; if (!L1SAP_IS_CHAN_TCHF(chan_nr)) @@ -404,8 +405,7 @@ if (len) { /* data request */ GsmL1_Prim_t *l1p = msgb_l1prim(l1msg); - lchan = get_lchan_by_chan_nr(trx, chan_nr); - + data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh, u8BlockNbr, len); if (use_cache) memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, lchan->tch.dtx.facch, msgb_l2len(msg)); @@ -423,20 +423,25 @@ memcpy(lchan->tch.dtx.facch, msg->l2h, msgb_l2len(msg)); /* prepare ONSET message */ - len = 3; l1p->u.phDataReq.msgUnitParam.u8Buffer[0] = GsmL1_TchPlType_Amr_Onset; /* ignored CMR/CMI pair */ l1p->u.phDataReq.msgUnitParam.u8Buffer[1] = 0; l1p->u.phDataReq.msgUnitParam.u8Buffer[2] = 0; - /* ONSET is ready, recursive call is necessary */ - rec = true; + /* update length */ + data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, + subCh, u8BlockNbr, 3); + /* update FN so it can be checked by TCH silence + resume handler */ + lchan->tch.dtx.fn = LCHAN_FN_DUMMY; } + } else if (dtx_dl_amr_enabled(lchan) && + lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH) { + /* update FN so it can be checked by TCH silence + resume handler */ + lchan->tch.dtx.fn = LCHAN_FN_DUMMY; } - - data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh, u8BlockNbr, len); - - if (!rec && !use_cache) { + else { OSMO_ASSERT(msgb_l2len(msg) <= sizeof(l1p->u.phDataReq.msgUnitParam.u8Buffer)); memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, msg->l2h, msgb_l2len(msg)); @@ -455,9 +460,10 @@ if (osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], l1msg) != 0) { LOGP(DL1P, LOGL_ERROR, "MQ_L1_WRITE queue full. Dropping msg.\n"); msgb_free(l1msg); - } + } else + dtx_int_signal(lchan); - if (rec) + if (dtx_recursion(lchan)) ph_data_req(trx, msg, l1sap, true); return 0; } @@ -536,8 +542,9 @@ } /* send message to DSP's queue */ osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg); + dtx_int_signal(lchan); - if (rc > 0 && trx->bts->dtxd) /* DTX: send voice after ONSET was sent */ + if (dtx_recursion(lchan)) /* DTX: send voice after ONSET was sent */ return ph_tch_req(trx, l1sap->oph.msg, l1sap, true, false); return 0; diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c index 7495073..de3c7e3 100644 --- a/src/osmo-bts-litecell15/tch.c +++ b/src/osmo-bts-litecell15/tch.c @@ -305,9 +305,6 @@ *payload_type = GsmL1_TchPlType_Amr; rtppayload_to_l1_amr(l1_payload + 2, rtp_pl, rtp_pl_len, ft); - /* force STI bit to 0 to make sure resume after FACCH - works properly */ - l1_payload[6 + 2] &= ~16; return 0; case ST_SID_F2: *payload_type = GsmL1_TchPlType_Amr; @@ -326,7 +323,6 @@ return 1; case ST_SID_U: return -EAGAIN; - case ST_FACCH_V: case ST_FACCH: return -EBADMSG; default: @@ -496,19 +492,17 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_AMR: if (lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 && dtx_dl_amr_enabled(lchan)) { + /* we have to explicitly handle sending SID FIRST P2 for + AMR HR in here */ *payload_type = GsmL1_TchPlType_Amr_SidFirstP2; rc = dtx_dl_amr_fsm_step(lchan, NULL, 0, fn, l1_payload, false, &(msu_param->u8Size), NULL); - if (rc < 0) { - msgb_free(msg); - return NULL; - } - return msg; - } else - *payload_type = GsmL1_TchPlType_Amr; + if (rc == 0) + return msg; + } + *payload_type = GsmL1_TchPlType_Amr; break; case GSM48_CMODE_SPEECH_V1: if (lchan->type == GSM_LCHAN_TCH_F) @@ -524,13 +518,12 @@ return NULL; } - if (dtx_dl_amr_enabled(lchan)) { - rc = repeat_last_sid(lchan, l1_payload, fn); - if (!rc) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = rc; + rc = repeat_last_sid(lchan, l1_payload, fn); + if (!rc) { + msgb_free(msg); + return NULL; } + msu_param->u8Size = rc; + return msg; } diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 61ffe39..ed643fc 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -334,7 +335,6 @@ uint32_t u32Fn; uint8_t u8Tn, subCh, u8BlockNbr = 0, sapi = 0; uint8_t chan_nr, link_id; - bool rec = false; int len; if (!msg) { @@ -350,6 +350,7 @@ u32Fn = l1sap->u.data.fn; u8Tn = L1SAP_CHAN2TS(chan_nr); subCh = 0x1f; + lchan = get_lchan_by_chan_nr(trx, chan_nr); if (L1SAP_IS_LINK_SACCH(link_id)) { sapi = GsmL1_Sapi_Sacch; if (!L1SAP_IS_CHAN_TCHF(chan_nr)) @@ -399,8 +400,7 @@ if (len) { /* data request */ GsmL1_Prim_t *l1p = msgb_l1prim(l1msg); - lchan = get_lchan_by_chan_nr(trx, chan_nr); - + data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh, u8BlockNbr, len); if (use_cache) memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, lchan->tch.dtx.facch, msgb_l2len(msg)); @@ -418,20 +418,25 @@ memcpy(lchan->tch.dtx.facch, msg->l2h, msgb_l2len(msg)); /* prepare ONSET message */ - len = 3; l1p->u.phDataReq.msgUnitParam.u8Buffer[0] = GsmL1_TchPlType_Amr_Onset; /* ignored CMR/CMI pair */ l1p->u.phDataReq.msgUnitParam.u8Buffer[1] = 0; l1p->u.phDataReq.msgUnitParam.u8Buffer[2] = 0; - /* ONSET is ready, recursive call is necessary */ - rec = true; + /* update length */ + data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, + subCh, u8BlockNbr, 3); + /* update FN so it can be checked by TCH silence + resume handler */ + lchan->tch.dtx.fn = LCHAN_FN_DUMMY; } + } else if (dtx_dl_amr_enabled(lchan) && + lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH) { + /* update FN so it can be checked by TCH silence + resume handler */ + lchan->tch.dtx.fn = LCHAN_FN_DUMMY; } - - data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh, u8BlockNbr, len); - - if (!rec && !use_cache) { + else { OSMO_ASSERT(msgb_l2len(msg) <= sizeof(l1p->u.phDataReq.msgUnitParam.u8Buffer)); memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, msg->l2h, msgb_l2len(msg)); @@ -450,9 +455,10 @@ if (osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], l1msg) != 0) { LOGP(DL1P, LOGL_ERROR, "MQ_L1_WRITE queue full. Dropping msg.\n"); msgb_free(l1msg); - } + } else + dtx_int_signal(lchan); - if (rec) + if (dtx_recursion(lchan)) ph_data_req(trx, msg, l1sap, true); return 0; } @@ -531,8 +537,9 @@ } /* send message to DSP's queue */ osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg); + dtx_int_signal(lchan); - if (rc > 0 && trx->bts->dtxd) /* DTX: send voice after ONSET was sent */ + if (dtx_recursion(lchan)) /* DTX: send voice after ONSET was sent */ return ph_tch_req(trx, l1sap->oph.msg, l1sap, true, false); return 0; diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index addb2ff..16c2cf3 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -403,9 +403,6 @@ *payload_type = GsmL1_TchPlType_Amr; rtppayload_to_l1_amr(l1_payload + 2, rtp_pl, rtp_pl_len, ft); - /* force STI bit to 0 to make sure resume after FACCH - works properly */ - l1_payload[6 + 2] &= ~16; return 0; case ST_SID_F2: *payload_type = GsmL1_TchPlType_Amr; @@ -424,7 +421,6 @@ return 1; case ST_SID_U: return -EAGAIN; - case ST_FACCH_V: case ST_FACCH: return -EBADMSG; default: @@ -598,19 +594,17 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_AMR: if (lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 && dtx_dl_amr_enabled(lchan)) { + /* we have to explicitly handle sending SID FIRST P2 for + AMR HR in here */ *payload_type = GsmL1_TchPlType_Amr_SidFirstP2; rc = dtx_dl_amr_fsm_step(lchan, NULL, 0, fn, l1_payload, false, &(msu_param->u8Size), NULL); - if (rc < 0) { - msgb_free(msg); - return NULL; - } - return msg; - } else - *payload_type = GsmL1_TchPlType_Amr; + if (rc == 0) + return msg; + } + *payload_type = GsmL1_TchPlType_Amr; break; case GSM48_CMODE_SPEECH_V1: if (lchan->type == GSM_LCHAN_TCH_F) @@ -626,13 +620,12 @@ return NULL; } - if (dtx_dl_amr_enabled(lchan)) { - rc = repeat_last_sid(lchan, l1_payload, fn); - if (!rc) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = rc; + rc = repeat_last_sid(lchan, l1_payload, fn); + if (!rc) { + msgb_free(msg); + return NULL; } + msu_param->u8Size = rc; + return msg; } -- To view, visit https://gerrit.osmocom.org/1225 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If39b68083d23a4a35f468a5d75f54eb733ebfd14 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 Thu Dec 1 14:53:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:53:07 +0000 Subject: [PATCH] libosmo-netif[master]: stream-client: check read() return value before using it as ... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1334 to look at the new patch set (#2). stream-client: check read() return value before using it as length input to memcpy Change-Id: Id962821c71b3a1c4c01c1131eb809b8ec8eaa062 Fixes: Coverity CID 57859 --- M examples/stream-client.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/34/1334/2 diff --git a/examples/stream-client.c b/examples/stream-client.c index c54db02..b0aea5e 100644 --- a/examples/stream-client.c +++ b/examples/stream-client.c @@ -72,8 +72,9 @@ int ret; ret = read(STDIN_FILENO, buf, sizeof(buf)); - LOGP(DSTREAMTEST, LOGL_NOTICE, "read %d byte from keyboard\n", ret); + if (ret < 0) + return ret; msg = msgb_alloc(1024, "STREAMCLIENT/test"); if (msg == NULL) { -- To view, visit https://gerrit.osmocom.org/1334 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id962821c71b3a1c4c01c1131eb809b8ec8eaa062 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 Thu Dec 1 14:53:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:53:07 +0000 Subject: [PATCH] libosmo-netif[master]: rs232: Don't pass negative number to strerror() In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1335 to look at the new patch set (#2). rs232: Don't pass negative number to strerror() Change-Id: Ia777221cd0472cd1e7aa79e5146b07048a545dd8 Fixes: Coverity CID 57860 --- M src/rs232.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/35/1335/2 diff --git a/src/rs232.c b/src/rs232.c index 14b2d6e..798bf72 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -230,7 +230,7 @@ if (rc < 0) { close(bfd->fd); LOGP(DLINP, LOGL_ERROR, "rs232: could not register FD: %s\n", - strerror(rc)); + strerror(-rc)); return rc; } -- To view, visit https://gerrit.osmocom.org/1335 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia777221cd0472cd1e7aa79e5146b07048a545dd8 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 Thu Dec 1 14:53:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:53:07 +0000 Subject: [PATCH] libosmo-netif[master]: osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1336 to look at the new patch set (#2). osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling osmo_sock_init() never returns -1 + errno EINPROGRESS. It will return a positive fd in case the connect operation is in progress. Therefore, the related code in osmo_stream_cli_open2() was impossible to execute. Change-Id: Id3483d1d1d4d2eabba94729ea29e5c93b33abff0 Fixes: Coverity CID 57861 --- M src/stream.c 1 file changed, 3 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/36/1336/2 diff --git a/src/stream.c b/src/stream.c index 0ef54c6..a30fd04 100644 --- a/src/stream.c +++ b/src/stream.c @@ -308,16 +308,9 @@ ret = osmo_sock_init(AF_INET, SOCK_STREAM, cli->proto, cli->addr, cli->port, OSMO_SOCK_F_CONNECT); - if (ret < 0) { - if (errno != EINPROGRESS) { - if (reconnect) { - osmo_timer_schedule(&cli->timer, cli->reconnect_timeout, 0); - cli->state = STREAM_CLI_STATE_CONNECTING; - return 0; - } else - return ret; - } - } + if (ret < 0) + return ret; + cli->ofd.fd = ret; if (osmo_fd_register(&cli->ofd) < 0) { close(ret); -- To view, visit https://gerrit.osmocom.org/1336 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id3483d1d1d4d2eabba94729ea29e5c93b33abff0 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 Thu Dec 1 14:54:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:35 +0000 Subject: libosmo-netif[master]: rs232-write: Check return value of osmo_fd_register() In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1331 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If40e85600ca1dfbda5975d7aa92cccdb11f9c34d Gerrit-PatchSet: 3 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 Dec 1 14:54:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:39 +0000 Subject: libosmo-netif[master]: stream-client: Check for osmo_fd_register() return value In-Reply-To: References: Message-ID: Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/1332 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1b5fa97d14e69ff502b6deba0fd898a01e53420f 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 Thu Dec 1 14:54:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:51 +0000 Subject: [MERGED] libosmo-netif[master]: stream-client: Check for osmo_fd_register() return value In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream-client: Check for osmo_fd_register() return value ...................................................................... stream-client: Check for osmo_fd_register() return value Change-Id: I1b5fa97d14e69ff502b6deba0fd898a01e53420f Fixes: Coverity CID 57633 --- M examples/stream-client.c 1 file changed, 6 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/examples/stream-client.c b/examples/stream-client.c index 112d78b..c54db02 100644 --- a/examples/stream-client.c +++ b/examples/stream-client.c @@ -93,6 +93,7 @@ int main(void) { struct osmo_fd *kbd_ofd; + int rc; tall_test = talloc_named_const(NULL, 1, "osmo_stream_cli_test"); @@ -127,7 +128,11 @@ kbd_ofd->when = BSC_FD_READ; kbd_ofd->data = conn; kbd_ofd->cb = kbd_cb; - osmo_fd_register(kbd_ofd); + rc = osmo_fd_register(kbd_ofd); + if (rc < 0) { + LOGP(DSTREAMTEST, LOGL_ERROR, "FD Register\n"); + exit(EXIT_FAILURE); + } LOGP(DSTREAMTEST, LOGL_NOTICE, "Entering main loop\n"); -- To view, visit https://gerrit.osmocom.org/1332 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1b5fa97d14e69ff502b6deba0fd898a01e53420f 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 Thu Dec 1 14:54:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:51 +0000 Subject: [MERGED] libosmo-netif[master]: rs232-write: Check return value of osmo_fd_register() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: rs232-write: Check return value of osmo_fd_register() ...................................................................... rs232-write: Check return value of osmo_fd_register() Change-Id: If40e85600ca1dfbda5975d7aa92cccdb11f9c34d Fixes: Coverity CID 57632 --- M examples/rs232-write.c 1 file changed, 6 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/examples/rs232-write.c b/examples/rs232-write.c index 11498f3..d5aee68 100644 --- a/examples/rs232-write.c +++ b/examples/rs232-write.c @@ -347,6 +347,7 @@ int main(void) { struct osmo_fd *kbd_ofd; + int rc; tall_test = talloc_named_const(NULL, 1, "osmo_rs232_test"); @@ -379,7 +380,11 @@ kbd_ofd->when = BSC_FD_READ; kbd_ofd->data = NULL; kbd_ofd->cb = kbd_cb; - osmo_fd_register(kbd_ofd); + rc = osmo_fd_register(kbd_ofd); + if (rc < 0) { + LOGP(DRS232TEST, LOGL_ERROR, "FD Register\n"); + exit(EXIT_FAILURE); + } while(1) { osmo_select_main(0); -- To view, visit https://gerrit.osmocom.org/1331 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If40e85600ca1dfbda5975d7aa92cccdb11f9c34d Gerrit-PatchSet: 3 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 Dec 1 14:54:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:52 +0000 Subject: [MERGED] libosmo-netif[master]: osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling ...................................................................... osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling osmo_sock_init() never returns -1 + errno EINPROGRESS. It will return a positive fd in case the connect operation is in progress. Therefore, the related code in osmo_stream_cli_open2() was impossible to execute. Change-Id: Id3483d1d1d4d2eabba94729ea29e5c93b33abff0 Fixes: Coverity CID 57861 --- M src/stream.c 1 file changed, 3 insertions(+), 10 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/stream.c b/src/stream.c index 0ef54c6..a30fd04 100644 --- a/src/stream.c +++ b/src/stream.c @@ -308,16 +308,9 @@ ret = osmo_sock_init(AF_INET, SOCK_STREAM, cli->proto, cli->addr, cli->port, OSMO_SOCK_F_CONNECT); - if (ret < 0) { - if (errno != EINPROGRESS) { - if (reconnect) { - osmo_timer_schedule(&cli->timer, cli->reconnect_timeout, 0); - cli->state = STREAM_CLI_STATE_CONNECTING; - return 0; - } else - return ret; - } - } + if (ret < 0) + return ret; + cli->ofd.fd = ret; if (osmo_fd_register(&cli->ofd) < 0) { close(ret); -- To view, visit https://gerrit.osmocom.org/1336 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id3483d1d1d4d2eabba94729ea29e5c93b33abff0 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 Thu Dec 1 14:54:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:52 +0000 Subject: [MERGED] libosmo-netif[master]: rs232: Don't pass negative number to strerror() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: rs232: Don't pass negative number to strerror() ...................................................................... rs232: Don't pass negative number to strerror() Change-Id: Ia777221cd0472cd1e7aa79e5146b07048a545dd8 Fixes: Coverity CID 57860 --- M src/rs232.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/rs232.c b/src/rs232.c index 14b2d6e..798bf72 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -230,7 +230,7 @@ if (rc < 0) { close(bfd->fd); LOGP(DLINP, LOGL_ERROR, "rs232: could not register FD: %s\n", - strerror(rc)); + strerror(-rc)); return rc; } -- To view, visit https://gerrit.osmocom.org/1335 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia777221cd0472cd1e7aa79e5146b07048a545dd8 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 Thu Dec 1 14:54:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 14:54:52 +0000 Subject: [MERGED] libosmo-netif[master]: stream-client: check read() return value before using it as ... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: stream-client: check read() return value before using it as length input to memcpy ...................................................................... stream-client: check read() return value before using it as length input to memcpy Change-Id: Id962821c71b3a1c4c01c1131eb809b8ec8eaa062 Fixes: Coverity CID 57859 --- M examples/stream-client.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/examples/stream-client.c b/examples/stream-client.c index c54db02..b0aea5e 100644 --- a/examples/stream-client.c +++ b/examples/stream-client.c @@ -72,8 +72,9 @@ int ret; ret = read(STDIN_FILENO, buf, sizeof(buf)); - LOGP(DSTREAMTEST, LOGL_NOTICE, "read %d byte from keyboard\n", ret); + if (ret < 0) + return ret; msg = msgb_alloc(1024, "STREAMCLIENT/test"); if (msg == NULL) { -- To view, visit https://gerrit.osmocom.org/1334 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id962821c71b3a1c4c01c1131eb809b8ec8eaa062 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 Thu Dec 1 15:08:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:08:05 +0000 Subject: [PATCH] libosmo-netif[master]: ipa-stream-{client, server}: Add missing #include Message-ID: Review at https://gerrit.osmocom.org/1353 ipa-stream-{client,server}: Add missing #include This lead to compiler warnings on FreeBSD, as setsockopt() is undefined. Change-Id: Ie0ee3e48adfd0cd252703ec020cef28cf76ca223 --- M examples/ipa-stream-client.c M examples/ipa-stream-server.c 2 files changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/53/1353/1 diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index e139a00..05ad4f5 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c index 4a7a0d2..b475552 100644 --- a/examples/ipa-stream-server.c +++ b/examples/ipa-stream-server.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1353 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie0ee3e48adfd0cd252703ec020cef28cf76ca223 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:09:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:09:53 +0000 Subject: osmo-pcu[master]: BTS: accept also relative frame numbers with rach requst In-Reply-To: References: Message-ID: Patch Set 2: I'm not 100% sure yet if we don't introduce some race condition here. It might be, that we'd need to use some kind of modulo / wrap-around arithmetic. I didn't have the time to think this fully through, but that's why it isn't +2 or merged yet. -- To view, visit https://gerrit.osmocom.org/1205 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaa182d8d29c6a0f5fa06064c2eb48b21b1ba2775 Gerrit-PatchSet: 2 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 Thu Dec 1 15:19:27 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:19:27 +0000 Subject: osmo-pcu[master]: BTS: accept also relative frame numbers with rach requst In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 I thought about it some more and made a drawing with a timeline (personally handed over to philipp). I believe there is an issue that needs to be adressed before this can be merged master. Might be worth a unit test case. -- To view, visit https://gerrit.osmocom.org/1205 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaa182d8d29c6a0f5fa06064c2eb48b21b1ba2775 Gerrit-PatchSet: 2 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 Thu Dec 1 15:20:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:20:41 +0000 Subject: osmo-bts[master]: Remove duplicated code In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9 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 Thu Dec 1 15:20:42 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:20:42 +0000 Subject: [MERGED] osmo-bts[master]: Remove duplicated code In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Remove duplicated code ...................................................................... Remove duplicated code Remove lchan deactivation related code duplication to facilitate future use for dynamic CCCH re-activation. Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9 --- M include/osmo-bts/bts_model.h M include/osmo-bts/rsl.h M src/common/rsl.c M src/osmo-bts-litecell15/lc15bts_vty.c M src/osmo-bts-litecell15/oml.c M src/osmo-bts-octphy/l1_oml.c M src/osmo-bts-sysmo/oml.c M src/osmo-bts-sysmo/sysmobts_vty.c M src/osmo-bts-trx/l1_if.c M tests/handover/handover_test.c M tests/stubs.c 11 files changed, 45 insertions(+), 21 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h index 7e2d088..7a87d78 100644 --- a/include/osmo-bts/bts_model.h +++ b/include/osmo-bts/bts_model.h @@ -45,6 +45,9 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); +int bts_model_lchan_deactivate(struct gsm_lchan *lchan); +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan); + void bts_model_abis_close(struct gsm_bts *bts); int bts_model_ctrl_cmds_install(struct gsm_bts *bts); diff --git a/include/osmo-bts/rsl.h b/include/osmo-bts/rsl.h index 4311ffd..d542ff6 100644 --- a/include/osmo-bts/rsl.h +++ b/include/osmo-bts/rsl.h @@ -26,6 +26,8 @@ int rsl_tx_rf_rel_ack(struct gsm_lchan *lchan); int rsl_tx_hando_det(struct gsm_lchan *lchan, uint8_t *ho_delay); +int lchan_deactivate(struct gsm_lchan *lchan); + /* call-back for LAPDm code, called when it wants to send msgs UP */ int lapdm_rll_tx_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx); diff --git a/src/common/rsl.c b/src/common/rsl.c index 6c8f5cc..880136c 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -2448,6 +2448,12 @@ return ret; } +int lchan_deactivate(struct gsm_lchan *lchan) +{ + lchan->ciph_state = 0; + return bts_model_lchan_deactivate(lchan); +} + int down_rsl(struct gsm_bts_trx *trx, struct msgb *msg) { struct abis_rsl_common_hdr *rslh = msgb_l2(msg); diff --git a/src/osmo-bts-litecell15/lc15bts_vty.c b/src/osmo-bts-litecell15/lc15bts_vty.c index c5d404c..0ffe663 100644 --- a/src/osmo-bts-litecell15/lc15bts_vty.c +++ b/src/osmo-bts-litecell15/lc15bts_vty.c @@ -46,15 +46,14 @@ #include #include #include +#include #include #include "lc15bts.h" #include "l1_if.h" #include "utils.h" - extern int lchan_activate(struct gsm_lchan *lchan); -extern int lchan_deactivate(struct gsm_lchan *lchan); #define TRX_STR "Transceiver related commands\n" "TRX number\n" diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c index 689ba70..8afa2a2 100644 --- a/src/osmo-bts-litecell15/oml.c +++ b/src/osmo-bts-litecell15/oml.c @@ -1656,10 +1656,9 @@ queue_sapi_command(lchan, cmd); } -int lchan_deactivate(struct gsm_lchan *lchan) +int bts_model_lchan_deactivate(struct gsm_lchan *lchan) { lchan_set_state(lchan, LCHAN_S_REL_REQ); - lchan->ciph_state = 0; /* FIXME: do this in common/\*.c */ enqueue_rel_marker(lchan); return 0; } @@ -1674,7 +1673,7 @@ queue_sapi_command(lchan, cmd); } -static int lchan_deactivate_sacch(struct gsm_lchan *lchan) +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { enqueue_sacch_rel_marker(lchan); return 0; @@ -1858,7 +1857,7 @@ /* Only de-activate the SACCH if the lchan is active */ if (lchan->state != LCHAN_S_ACTIVE) return 0; - return lchan_deactivate_sacch(lchan); + return bts_model_lchan_deactivate_sacch(lchan); } int bts_model_trx_deact_rf(struct gsm_bts_trx *trx) diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c index db416ba..5865625 100644 --- a/src/osmo-bts-octphy/l1_oml.c +++ b/src/osmo-bts-octphy/l1_oml.c @@ -884,7 +884,7 @@ queue_sapi_command(lchan, cmd); } -static int lchan_deactivate_sacch(struct gsm_lchan *lchan) +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { enqueue_sacch_rel_marker(lchan); return 0; @@ -895,7 +895,7 @@ /* Only de-activate the SACCH if the lchan is active */ if (lchan->state != LCHAN_S_ACTIVE) return 0; - return lchan_deactivate_sacch(lchan); + return bts_model_lchan_deactivate_sacch(lchan); } @@ -913,10 +913,9 @@ queue_sapi_command(lchan, cmd); } -static int lchan_deactivate(struct gsm_lchan *lchan) +int bts_model_lchan_deactivate(struct gsm_lchan *lchan) { lchan_set_state(lchan, LCHAN_S_REL_REQ); - lchan->ciph_state = 0; /* FIXME: do this in common *.c */ enqueue_rel_marker(lchan); return 0; } diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index ed02c74..b23d992 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -1676,10 +1676,9 @@ queue_sapi_command(lchan, cmd); } -int lchan_deactivate(struct gsm_lchan *lchan) +int bts_model_lchan_deactivate(struct gsm_lchan *lchan) { lchan_set_state(lchan, LCHAN_S_REL_REQ); - lchan->ciph_state = 0; /* FIXME: do this in common/\*.c */ enqueue_rel_marker(lchan); return 0; } @@ -1694,7 +1693,7 @@ queue_sapi_command(lchan, cmd); } -static int lchan_deactivate_sacch(struct gsm_lchan *lchan) +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { enqueue_sacch_rel_marker(lchan); return 0; @@ -1878,7 +1877,7 @@ /* Only de-activate the SACCH if the lchan is active */ if (lchan->state != LCHAN_S_ACTIVE) return 0; - return lchan_deactivate_sacch(lchan); + return bts_model_lchan_deactivate_sacch(lchan); } int bts_model_trx_deact_rf(struct gsm_bts_trx *trx) diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index c829c49..e67d8be 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -42,15 +42,14 @@ #include #include #include +#include #include #include "femtobts.h" #include "l1_if.h" #include "utils.h" - extern int lchan_activate(struct gsm_lchan *lchan); -extern int lchan_deactivate(struct gsm_lchan *lchan); #define TRX_STR "Transceiver related commands\n" "TRX number\n" diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 202a05e..3d5f52e 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -144,6 +144,23 @@ return 0; } +int bts_model_lchan_deactivate(struct gsm_lchan *lchan) +{ + struct phy_instance *pinst = trx_phy_instance(lchan->ts->trx); + struct trx_l1h *l1h = pinst->u.osmotrx.hdl; + + /* set lchan inactive */ + lchan_set_state(lchan, LCHAN_S_NONE); + + return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_DEDIC, 0); +} + +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) +{ + struct phy_instance *pinst = trx_phy_instance(lchan->ts->trx); + struct trx_l1h *l1h = pinst->u.osmotrx.hdl; + return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_SACCH, 0); +} /* * transceiver provisioning @@ -646,16 +663,13 @@ break; } /* deactivate associated channel */ - trx_sched_set_lchan(&l1h->l1s, chan_nr, LID_SACCH, 0); + bts_model_lchan_deactivate_sacch(lchan); if (!l1sap->u.info.u.act_req.sacch_only) { - /* set lchan inactive */ - lchan_set_state(lchan, LCHAN_S_NONE); /* deactivate dedicated channel */ - trx_sched_set_lchan(&l1h->l1s, chan_nr, LID_DEDIC, 0); + lchan_deactivate(lchan); /* confirm only on dedicated channel */ mph_info_chan_confirm(l1h, chan_nr, PRIM_INFO_DEACTIVATE, 0); - lchan->ciph_state = 0; /* FIXME: do this in common/\*.c */ } break; default: diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index d1dc34a..a7a66d0 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -275,3 +275,5 @@ int bts_model_adjst_ms_pwr(struct gsm_lchan *lchan) { return 0; } int bts_model_ts_disconnect(struct gsm_bts_trx_ts *ts) { return 0; } int bts_model_ts_connect(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config as_pchan) { return 0; } +int bts_model_lchan_deactivate(struct gsm_lchan *lchan) { return 0; } +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { return 0; } diff --git a/tests/stubs.c b/tests/stubs.c index c680db0..f969cb3 100644 --- a/tests/stubs.c +++ b/tests/stubs.c @@ -40,6 +40,8 @@ int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power) { return 0; } +int bts_model_lchan_deactivate(struct gsm_lchan *lchan) { return 0; } +int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { return 0; } int bts_model_adjst_ms_pwr(struct gsm_lchan *lchan) { return 0; } -- To view, visit https://gerrit.osmocom.org/1046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9 Gerrit-PatchSet: 8 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 Dec 1 15:21:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:21:07 +0000 Subject: osmo-bts[master]: Fix AGCH/PCH proportional allocation In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1099 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e Gerrit-PatchSet: 3 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:21:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:21:30 +0000 Subject: libosmo-netif[master]: ipa-stream-{client, server}: Add missing #include In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1353 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie0ee3e48adfd0cd252703ec020cef28cf76ca223 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 Dec 1 15:21:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:21:31 +0000 Subject: [MERGED] libosmo-netif[master]: ipa-stream-{client, server}: Add missing #include In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: ipa-stream-{client,server}: Add missing #include ...................................................................... ipa-stream-{client,server}: Add missing #include This lead to compiler warnings on FreeBSD, as setsockopt() is undefined. Change-Id: Ie0ee3e48adfd0cd252703ec020cef28cf76ca223 --- M examples/ipa-stream-client.c M examples/ipa-stream-server.c 2 files changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index e139a00..05ad4f5 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c index 4a7a0d2..b475552 100644 --- a/examples/ipa-stream-server.c +++ b/examples/ipa-stream-server.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1353 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie0ee3e48adfd0cd252703ec020cef28cf76ca223 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 Dec 1 15:21:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:21:51 +0000 Subject: osmo-bts[master]: cosmetic: vty prompts: add space after '#' In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1220 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If0591a359e77f01abb76c4113181af7a7733ddd4 Gerrit-PatchSet: 2 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 Dec 1 15:21:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:21:52 +0000 Subject: [MERGED] osmo-bts[master]: cosmetic: vty prompts: add space after '#' In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: cosmetic: vty prompts: add space after '#' ...................................................................... cosmetic: vty prompts: add space after '#' Typically, our VTY prompts have space after the '#', but some of the osmo-bts VTY prompts don't: OsmoBTS# configure terminal OsmoBTS(config)# bts 0 OsmoBTS(bts)#gsmtap-sapi ccch Add spaces after the '#' to yield e.g. OsmoBTS(bts)# gsmtap-sapi ccch Change-Id: If0591a359e77f01abb76c4113181af7a7733ddd4 --- M src/common/vty.c 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/vty.c b/src/common/vty.c index 607b231..0fffca0 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -179,13 +179,13 @@ static struct cmd_node bts_node = { BTS_NODE, - "%s(bts)#", + "%s(bts)# ", 1, }; static struct cmd_node trx_node = { TRX_NODE, - "%s(trx)#", + "%s(trx)# ", 1, }; @@ -897,13 +897,13 @@ static struct cmd_node phy_node = { PHY_NODE, - "%s(phy)#", + "%s(phy)# ", 1, }; static struct cmd_node phy_inst_node = { PHY_INST_NODE, - "%s(phy-inst)#", + "%s(phy-inst)# ", 1, }; -- To view, visit https://gerrit.osmocom.org/1220 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If0591a359e77f01abb76c4113181af7a7733ddd4 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:24:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:24:49 +0000 Subject: osmo-pcu[master]: Add statistics in the ms and tbf level. In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 please explain why none of the existing counter/statistics infrastructure of libosmocore (e.g. the rate_ctr like it is used for the 'show bts statistics'). Also, a look into osmo-sgsn might help, where we also keep throughput statistics for each PDP context. -- To view, visit https://gerrit.osmocom.org/1345 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:25:17 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:25:17 +0000 Subject: osmo-gsm-manuals[master]: dynamic timeslots: add BSC level config instructions In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1352 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I44ff1e4c2340c65ff23e85408fc6d6a45ea9e046 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals 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 Dec 1 15:25:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:25:18 +0000 Subject: [MERGED] osmo-gsm-manuals[master]: dynamic timeslots: add BSC level config instructions In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: dynamic timeslots: add BSC level config instructions ...................................................................... dynamic timeslots: add BSC level config instructions Add high level description on and a config example for dynamic timeslots in a new chapter featured in the OsmoBSC and OsmoNITB manuals. >From the OsmoBTS manual's chapter on dynamic timeslots, add references to the above. Change-Id: I44ff1e4c2340c65ff23e85408fc6d6a45ea9e046 --- M OsmoBTS/chapters/dynamic-timeslots.adoc M common/chapters/bts.adoc 2 files changed, 127 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/OsmoBTS/chapters/dynamic-timeslots.adoc b/OsmoBTS/chapters/dynamic-timeslots.adoc index 29dff5b..7c43d18 100644 --- a/OsmoBTS/chapters/dynamic-timeslots.adoc +++ b/OsmoBTS/chapters/dynamic-timeslots.adoc @@ -7,11 +7,14 @@ The Abis message handling for dynamic timeslots is independent of the BTS model. However, dynamic switchover will only work for BTS models that implement the internal API to reconnect a timeslot (_bts_model_ts_disconnect()_ and -_bts_model_ts_connect()_). Currently, these BTS models support dynamic -timeslots: +_bts_model_ts_connect()_, see also <>). + +Currently, these OsmoBTS models support dynamic timeslots: * _osmo-bts-sysmo_ * _osmo-bts-litecell15_ * _osmo-bts-trx_ -See also <>. +Dynamic timeslots are driven by the BSC and need to be configured there. When +using OsmoBSC or OsmoNITB, see the BTS configuration chapter on dynamic +timeslots in <> or <>, respectively. diff --git a/common/chapters/bts.adoc b/common/chapters/bts.adoc index c9fda7f..80c91d6 100644 --- a/common/chapters/bts.adoc +++ b/common/chapters/bts.adoc @@ -267,3 +267,124 @@ Configures the various GPRS NS related timers. Please check the GPRS NS specification for the detailed meaning of those timers. + + +=== Dynamic Timeslot Configuration (TCH / PDCH) + +A dynamic timeslot is in principle a voice timeslot (TCH) that is used to serve +GPRS data (PDCH) when no voice call is active on it. This enhances GPRS +bandwidth while no voice calls are active, which is dynamically scaled down as +voice calls need to be served. This is a tremendous improvement in service over +statically assigning a fixed number of timeslots for voice and data. + +Dynamic timeslots work both with OsmoNITB as well as with OsmoBSC driven by a +third-party MSC. The causality is as follows: to establish a voice call, the +MSC requests a logical channel of a given TCH kind from the BSC. The BSC +assigns such a channel from a BTS' TRX's timeslot of its choice. The knowledge +that a given timeslot is dynamic exists only on the BSC level. When the MSC +asks for a logical channel, the BSC may switch off PDCH on a dynamic timeslot +and then assign a logical TCH channel on it. Hence, though compatibility with +the BTS needs to be ensured, any MSC is compatible with dynamic timeslots by +definition. + +OsmoBSC and OsmoNITB support two kinds of dynamic timeslot handling, configured +via the `network` / `bts` / `trx` / `timeslot` / `phys_chan_config` +configuration. Not all BTS models support dynamic channels. + +[[dyn_ts_compat]] +.Dynamic timeslot support by various BTS models +[cols="50%,25%,25%"] +|=== +| |`TCH/F_TCH/H_PDCH` |`TCH/F_PDCH` +|ip.access nanoBTS |- |supported +|Ericsson RBS |supported |- +|sysmoBTS using _osmo-bts-sysmo_ |supported |supported +|various SDR platforms using _osmo-bts-trx_ |supported |supported +|Nutaq Litecell 1.5 using _osmo-bts-litecell15_ |supported |supported +|Octasic OctBTS using _osmo-bts-octphy_ | - | - +|=== + +The _OsmoBTS Abis Protocol Specification_ <> describes the +non-standard RSL messages used for these timeslot kinds. + +NOTE: Same as for dedicated PDCH timeslots, you need to enable GPRS and operate +a PCU, SGSN and GGSN to provide the actual data service. + +==== Osmocom Style Dynamic Timeslots (TCH/F_TCH/H_PDCH) + +Timeslots of the `TCH/F_TCH/H_PDCH` type dynamically switch between TCH/F, +TCH/H and PDCH, depending on the channel kind requested by the MSC. The RSL +messaging for `TCH/F_TCH/H_PDCH` timeslots is compatible with Ericsson RBS. + +BTS models supporting this timeslot kind are shown in <>. + +NOTE: At the time of writing, OsmoNITB disables TCH/F on this timeslot type due +to transcoding limitations. Operation of OsmoBSC with a third-party MSC is not +affected by this limitation. See https://osmocom.org/issues/1778. + +==== ip.access Style Dynamic Timeslots (TCH/F_PDCH) + +Timeslots of the `TCH/F_PDCH` type dynamically switch between TCH/F and PDCH. +The RSL messaging for `TCH/F_PDCH` timeslots is compatible with ip.access +nanoBTS. + +BTS models supporting this timeslot kind are shown in <>. + +==== Avoid PDCH Exhaustion + +To avoid disrupting GPRS, configure at least one timeslot as dedicated PDCH. +With only dynamic timeslots, a given number of voice calls would convert all +timeslots to TCH, and no PDCH timeslots would be left for GPRS service. + +==== Dynamic Timeslot Configuration Examples + +This is an extract of an _osmo-nitb_ or _openbsc_ config file. A timeslot +configuration with five Osmocom style dynamic timeslots and one dedicated PDCH +may look like this: + +---- +network + bts 0 + trx 0 + timeslot 0 + phys_chan_config CCCH+SDCCH4 + timeslot 1 + phys_chan_config SDCCH8 + timeslot 2 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 3 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 4 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 5 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 6 + phys_chan_config TCH/F_TCH/H_PDCH + timeslot 7 + phys_chan_config PDCH +---- + +With the ip.access nanoBTS, only `TCH/F_PDCH` dynamic timeslots are supported, +and hence a nanoBTS configuration may look like this: + +---- +network + bts 0 + trx 0 + timeslot 0 + phys_chan_config CCCH+SDCCH4 + timeslot 1 + phys_chan_config SDCCH8 + timeslot 2 + phys_chan_config TCH/F_PDCH + timeslot 3 + phys_chan_config TCH/F_PDCH + timeslot 4 + phys_chan_config TCH/F_PDCH + timeslot 5 + phys_chan_config TCH/F_PDCH + timeslot 6 + phys_chan_config TCH/F_PDCH + timeslot 7 + phys_chan_config PDCH +---- -- To view, visit https://gerrit.osmocom.org/1352 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I44ff1e4c2340c65ff23e85408fc6d6a45ea9e046 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:25:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:25:26 +0000 Subject: [MERGED] osmo-bts[master]: Fix AGCH/PCH proportional allocation In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix AGCH/PCH proportional allocation ...................................................................... Fix AGCH/PCH proportional allocation Do not assume that 1 == BS_AG_BLKS_RES but take that information from SI3. Note: due to current implementation quirks we activate channels before SI3 obtained, than we deactivate channels upon receiving SI3 and activate them again. This might not be necessary once we migrate to proper OML state machines. This affects lc15 and sysmo hw. Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e Related: OS#1575 --- M include/osmo-bts/bts.h M include/osmo-bts/rsl.h M src/common/l1sap.c M src/common/paging.c M src/common/rsl.c M src/common/sysinfo.c M src/osmo-bts-litecell15/l1_if.c M src/osmo-bts-litecell15/oml.c M src/osmo-bts-sysmo/l1_if.c M src/osmo-bts-sysmo/oml.c 10 files changed, 44 insertions(+), 50 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index ec58edd..567772e 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -36,7 +36,7 @@ int lchan_init_lapdm(struct gsm_lchan *lchan); void load_timer_start(struct gsm_bts *bts); - +uint8_t num_agch(struct gsm_bts_trx *trx, const char * arg); void bts_update_status(enum bts_global_status which, int on); int trx_ms_pwr_ctrl_is_osmo(struct gsm_bts_trx *trx); diff --git a/include/osmo-bts/rsl.h b/include/osmo-bts/rsl.h index d542ff6..a2a6e3d 100644 --- a/include/osmo-bts/rsl.h +++ b/include/osmo-bts/rsl.h @@ -9,6 +9,7 @@ LCHAN_REL_ACT_RSL, LCHAN_REL_ACT_PCU, LCHAN_REL_ACT_OML, + LCHAN_REL_ACT_REACT, }; #define LCHAN_FN_DUMMY 0xFFFFFFFF diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 553011f..82aa1ac 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -205,7 +205,8 @@ /* send primitive as gsmtap */ static int gsmtap_ph_data(struct osmo_phsap_prim *l1sap, uint8_t *chan_type, - uint8_t *ss, uint32_t fn, uint8_t **data, int *len) + uint8_t *ss, uint32_t fn, uint8_t **data, int *len, + uint8_t num_agch) { struct msgb *msg = l1sap->oph.msg; uint8_t chan_nr, link_id; @@ -229,10 +230,9 @@ } else if (L1SAP_IS_CHAN_BCCH(chan_nr)) { *chan_type = GSMTAP_CHANNEL_BCCH; } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) { -#warning Set BS_AG_BLKS_RES /* The sapi depends on DSP configuration, not * on the actual SYSTEM INFORMATION 3. */ - if (L1SAP_FN2CCCHBLOCK(fn) >= 1) + if (L1SAP_FN2CCCHBLOCK(fn) >= num_agch) *chan_type = GSMTAP_CHANNEL_PCH; else *chan_type = GSMTAP_CHANNEL_AGCH; @@ -312,7 +312,7 @@ &len); else rc = gsmtap_ph_data(l1sap, &chan_type, &ss, fn, &data, - &len); + &len, num_agch(trx, "GSMTAP")); break; case OSMO_PRIM(PRIM_PH_RACH, PRIM_OP_INDICATION): rc = gsmtap_ph_rach(l1sap, &chan_type, &tn, &ss, &fn, &data, @@ -615,10 +615,9 @@ } } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) { p = msgb_put(msg, GSM_MACBLOCK_LEN); -#warning "TODO: Yet another assumption that BS_AG_BLKS_RES=1" - /* if CCCH block is 0, it is AGCH */ rc = bts_ccch_copy_msg(trx->bts, p, &g_time, - (L1SAP_FN2CCCHBLOCK(fn) < 1)); + (L1SAP_FN2CCCHBLOCK(fn) < + num_agch(trx, "PH-RTS-IND"))); if (rc <= 0) memcpy(p, fill_frame, GSM_MACBLOCK_LEN); } diff --git a/src/common/paging.c b/src/common/paging.c index f75f12d..957d609 100644 --- a/src/common/paging.c +++ b/src/common/paging.c @@ -538,12 +538,6 @@ struct paging_state *ps = btsb->paging_state; struct gsm48_system_information_type_3 *si3 = (void *) bts->si_buf[SYSINFO_TYPE_3]; -#warning "TODO: Remove this when setting u8NbrOfAgch is implemented properly" - if (si3->control_channel_desc.bs_ag_blks_res != 1) - LOGP(DPAG, LOGL_ERROR, - "Paging: BS_AG_BLKS_RES = %d != 1 not fully supported\n", - si3->control_channel_desc.bs_ag_blks_res); - paging_si_update(ps, &si3->control_channel_desc); } return 0; diff --git a/src/common/rsl.c b/src/common/rsl.c index 880136c..8d1175d 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -295,6 +295,14 @@ LOGP(DRSL, LOGL_INFO, " Rx RSL BCCH INFO (SI%s)\n", get_value_string(osmo_sitype_strs, osmo_si)); + if (SYSINFO_TYPE_3 == osmo_si && trx->nr == 0 && + num_agch(trx, "RSL") != 1) { + lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]); + /* will be reactivated by sapi_deactivate_cb() */ + trx->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind = + LCHAN_REL_ACT_REACT; + } + if (SYSINFO_TYPE_2quater == osmo_si) { si2q = (struct gsm48_system_information_type_2quater *) bts->si_buf[SYSINFO_TYPE_2quater]; diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index ee42da2..d0a476d 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -22,6 +22,7 @@ #include #include +#include #include #define BTS_HAS_SI(bts, sinum) ((bts)->si_valid & (1 << sinum)) @@ -132,6 +133,19 @@ return NULL; } +uint8_t num_agch(struct gsm_bts_trx *trx, const char * arg) +{ + struct gsm_bts *b = trx->bts; + struct gsm48_system_information_type_3 *si3; + if (BTS_HAS_SI(b, SYSINFO_TYPE_3)) { + si3 = GSM_BTS_SI(b, SYSINFO_TYPE_3); + return si3->control_channel_desc.bs_ag_blks_res; + } + LOGP(DL1P, LOGL_ERROR, "%s: Unable to determine actual BS_AG_BLKS_RES " + "value as SI3 is not available yet, fallback to 1\n", arg); + return 1; +} + uint8_t *lchan_sacch_get(struct gsm_lchan *lchan) { uint32_t tmp; diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index 632e769..d959338 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -1188,22 +1188,6 @@ return l1if_handle_ind(fl1h, msg); } -#if 0 -/* called by RSL if the BCCH SI has been modified */ -int sysinfo_has_changed(struct gsm_bts *bts, int si) -{ - /* FIXME: Determine BS_AG_BLKS_RES and - * * set cfgParams.u.agch.u8NbrOfAgch - * * determine implications on paging - */ - /* FIXME: Check for Extended BCCH presence */ - /* FIXME: Check for CCCH_CONF */ - /* FIXME: Check for BS_PA_MFRMS: update paging */ - - return 0; -} -#endif - static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data) { diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c index 8afa2a2..64c868c 100644 --- a/src/osmo-bts-litecell15/oml.c +++ b/src/osmo-bts-litecell15/oml.c @@ -1025,8 +1025,7 @@ lch_par->rach.u8Bsic = lchan->ts->trx->bts->bsic; break; case GsmL1_Sapi_Agch: -#warning Set BS_AG_BLKS_RES - lch_par->agch.u8NbrOfAgch = 1; + lch_par->agch.u8NbrOfAgch = num_agch(lchan->ts->trx, lchan->name); break; case GsmL1_Sapi_TchH: case GsmL1_Sapi_TchF: @@ -1566,6 +1565,12 @@ lchan_set_state(lchan, LCHAN_S_NONE); mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0); + + /* Reactivate CCCH due to SI3 update in RSL */ + if (lchan->rel_act_kind == LCHAN_REL_ACT_REACT) { + lchan->rel_act_kind = LCHAN_REL_ACT_RSL; + lchan_activate(lchan); + } return 0; } diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index ed643fc..2a3caf9 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -1176,22 +1176,6 @@ return l1if_handle_ind(fl1h, msg); } -#if 0 -/* called by RSL if the BCCH SI has been modified */ -int sysinfo_has_changed(struct gsm_bts *bts, int si) -{ - /* FIXME: Determine BS_AG_BLKS_RES and - * * set cfgParams.u.agch.u8NbrOfAgch - * * determine implications on paging - */ - /* FIXME: Check for Extended BCCH presence */ - /* FIXME: Check for CCCH_CONF */ - /* FIXME: Check for BS_PA_MFRMS: update paging */ - - return 0; -} -#endif - static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data) { diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index b23d992..01752d1 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -1040,8 +1040,7 @@ lch_par->rach.u8Bsic = lchan->ts->trx->bts->bsic; break; case GsmL1_Sapi_Agch: -#warning Set BS_AG_BLKS_RES - lch_par->agch.u8NbrOfAgch = 1; + lch_par->agch.u8NbrOfAgch = num_agch(lchan->ts->trx, lchan->name); break; case GsmL1_Sapi_TchH: case GsmL1_Sapi_TchF: @@ -1586,6 +1585,12 @@ lchan_set_state(lchan, LCHAN_S_NONE); mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0); + + /* Reactivate CCCH due to SI3 update in RSL */ + if (lchan->rel_act_kind == LCHAN_REL_ACT_REACT) { + lchan->rel_act_kind = LCHAN_REL_ACT_RSL; + lchan_activate(lchan); + } return 0; } -- To view, visit https://gerrit.osmocom.org/1099 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e 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 From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:26:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:26:24 +0000 Subject: libosmocore[master]: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1346 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice44dcaaf798f93af3652a96c567f8e16a6cf784 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore 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 Thu Dec 1 15:26:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:26:30 +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 For BSC-located pcu the BSC must understand the PDCH chan request. Change-Id: Ice44dcaaf798f93af3652a96c567f8e16a6cf784 --- 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 767aa3d..c05b62e 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1456,6 +1456,8 @@ CHREQ_T_PAG_R_TCH_F, CHREQ_T_PAG_R_TCH_FH, CHREQ_T_LMU, + CHREQ_T_PDCH_ONE_PHASE, + CHREQ_T_PDCH_TWO_PHASE, CHREQ_T_RESERVED_SDCCH, CHREQ_T_RESERVED_IGNORE, }; -- To view, visit https://gerrit.osmocom.org/1346 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ice44dcaaf798f93af3652a96c567f8e16a6cf784 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:27:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:27:43 +0000 Subject: osmo-bts[master]: Save seq. num. of RTP in Control Buffer In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1343/1/include/osmo-bts/msg_utils.h File include/osmo-bts/msg_utils.h: Line 20: #define rtpmsg_seq(x) (&(x)->cb[1]) your comment states something about uint16_t, but the code simply dereferences the cb[] array, whcih is of 'long' type. -- To view, visit https://gerrit.osmocom.org/1343 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts 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 Dec 1 15:52:21 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:52:21 +0000 Subject: libosmocore[master]: gsm0480: code dup: introduce and use gsm0480_l3hdr_push() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1339 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I54fce6053ab8362015686fe22dbcd38bf1366700 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 Dec 1 15:52:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:52:31 +0000 Subject: libosmocore[master]: gsm0480: add gsm0480_create_ussd_notify() and *_release_comp... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1340 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia80e32c7105359915bfad3cc5621a1c09caf20f0 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 Thu Dec 1 15:54:16 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:54:16 +0000 Subject: libosmocore[master]: gsm0480.c: code dup: have common msgb alloc functions In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1341/2/src/gsm/gsm0480.c File src/gsm/gsm0480.c: Line 37: return msgb_alloc_headroom(1024, 128, name); I'm not quite sure if it is a good idea to hard-code message headroom sizes inside a library. The application might have a much better understanding of the kind of protocol stacking and headers it wishes to push in front of the message, particularly with L3 type messages where we have no idea of the amount of headers the various complex RAN protocols and their transport layers may add. -- To view, visit https://gerrit.osmocom.org/1341 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I029551dd74410ad6f326ce52eb7a75d912d3b875 Gerrit-PatchSet: 2 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 Thu Dec 1 15:54:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:54:35 +0000 Subject: [MERGED] libosmocore[master]: gsm0480: add gsm0480_create_ussd_notify() and *_release_comp... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm0480: add gsm0480_create_ussd_notify() and *_release_complete() ...................................................................... gsm0480: add gsm0480_create_ussd_notify() and *_release_complete() Add two functions to create USSD messages. Moves and generalizes code from openbsc. Pending: use the new functions in openbsc. It looks like _release_complete() should also set trans_id and direction flag; but since this is moving code from openbsc that is apparently working, just place a fixme comment and don't change the functionality. Change-Id: Ia80e32c7105359915bfad3cc5621a1c09caf20f0 --- M include/osmocom/gsm/gsm0480.h M src/gsm/gsm0480.c M src/gsm/libosmogsm.map 3 files changed, 33 insertions(+), 0 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/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h index f49ca6b..6ca23e9 100644 --- a/include/osmocom/gsm/gsm0480.h +++ b/include/osmocom/gsm/gsm0480.h @@ -32,6 +32,8 @@ struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text); struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text); struct msgb *gsm0480_create_notifySS(const char *text); +struct msgb *gsm0480_create_ussd_notify(int level, const char *text); +struct msgb *gsm0480_create_ussd_release_complete(void); int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id); int gsm0480_wrap_facility(struct msgb *msg); diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index cab4d01..3c23f6f 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -540,3 +540,32 @@ gh->msg_type = msg_type; return gh; } + +struct msgb *gsm0480_create_ussd_notify(int level, const char *text) +{ + struct msgb *msg; + + msg = gsm0480_create_unstructuredSS_Notify(level, text); + if (!msg) + return NULL; + + gsm0480_wrap_invoke(msg, GSM0480_OP_CODE_USS_NOTIFY, 0); + gsm0480_wrap_facility(msg); + + gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS, GSM0480_MTYPE_REGISTER); + return msg; +} + +struct msgb *gsm0480_create_ussd_release_complete(void) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(1024, 128, "GSM 04.80 USSD REL COMPL"); + if (!msg) + return NULL; + + /* FIXME: should this set trans_id and TI direction flag? */ + gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS, + GSM0480_MTYPE_RELEASE_COMPLETE); + return msg; +} diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index f0baa21..3e7333c 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -63,6 +63,8 @@ gsm0480_create_notifySS; gsm0480_create_unstructuredSS_Notify; gsm0480_create_ussd_resp; +gsm0480_create_ussd_notify; +gsm0480_create_ussd_release_complete; gsm0480_decode_ussd_request; gsm0480_decode_ss_request; gsm0480_wrap_facility; -- To view, visit https://gerrit.osmocom.org/1340 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia80e32c7105359915bfad3cc5621a1c09caf20f0 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 Dec 1 15:54:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:54:35 +0000 Subject: [MERGED] libosmocore[master]: gsm0480: code dup: introduce and use gsm0480_l3hdr_push() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm0480: code dup: introduce and use gsm0480_l3hdr_push() ...................................................................... gsm0480: code dup: introduce and use gsm0480_l3hdr_push() Add function gsm0480_l3hdr_push() to push a struct gsm48_hdr to the start of a msgb. Use in gsm0480.c and gsm0411_utils.c. Further callers of the new function will follow in openbsc as well as another libosmocore patch for ussd. Change-Id: I54fce6053ab8362015686fe22dbcd38bf1366700 --- M include/osmocom/gsm/gsm0480.h M src/gsm/gsm0411_utils.c M src/gsm/gsm0480.c 3 files changed, 19 insertions(+), 13 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h index deac322..f49ca6b 100644 --- a/include/osmocom/gsm/gsm0480.h +++ b/include/osmocom/gsm/gsm0480.h @@ -35,3 +35,6 @@ int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id); int gsm0480_wrap_facility(struct msgb *msg); + +struct gsm48_hdr *gsm0480_l3hdr_push(struct msgb *msg, uint8_t proto_discr, + uint8_t msg_type); diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c index af57963..5d18b12 100644 --- a/src/gsm/gsm0411_utils.c +++ b/src/gsm/gsm0411_utils.c @@ -315,12 +315,7 @@ int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans, uint8_t msg_type) { - struct gsm48_hdr *gh; - - gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); - /* Outgoing needs the highest bit set */ - gh->proto_discr = proto | (trans << 4); - gh->msg_type = msg_type; - + /* Outgoing proto_discr needs the highest bit set */ + gsm0480_l3hdr_push(msg, proto | (trans << 4), msg_type); return 0; } diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index d628d92..cab4d01 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -486,7 +486,6 @@ struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text) { struct msgb *msg; - struct gsm48_hdr *gh; uint8_t *ptr8; int response_len; @@ -525,10 +524,19 @@ msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY); /* And finally pre-pend the L3 header */ - gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); - gh->proto_discr = GSM48_PDISC_NC_SS | trans_id - | (1<<7); /* TI direction = 1 */ - gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE; - + gsm0480_l3hdr_push(msg, + GSM48_PDISC_NC_SS | trans_id + | (1<<7) /* TI direction = 1 */, + GSM0480_MTYPE_RELEASE_COMPLETE); return msg; } + +struct gsm48_hdr *gsm0480_l3hdr_push(struct msgb *msg, uint8_t proto_discr, + uint8_t msg_type) +{ + struct gsm48_hdr *gh; + gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); + gh->proto_discr = proto_discr; + gh->msg_type = msg_type; + return gh; +} -- To view, visit https://gerrit.osmocom.org/1339 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I54fce6053ab8362015686fe22dbcd38bf1366700 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 Thu Dec 1 15:55:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:55:48 +0000 Subject: libosmo-netif[master]: examples/stream-server.c: use read() rc instead of strlen() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1307 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibaafdd49d9446a12fe7d0e2f5b2039da3ffc7ea9 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 Dec 1 15:55:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:55:49 +0000 Subject: [MERGED] libosmo-netif[master]: examples/stream-server.c: use read() rc instead of strlen() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: examples/stream-server.c: use read() rc instead of strlen() ...................................................................... examples/stream-server.c: use read() rc instead of strlen() Fixes: CID#57922 Change-Id: Ibaafdd49d9446a12fe7d0e2f5b2039da3ffc7ea9 --- M examples/stream-server.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/examples/stream-server.c b/examples/stream-server.c index 82fb20a..c1bfd66 100644 --- a/examples/stream-server.c +++ b/examples/stream-server.c @@ -93,6 +93,8 @@ int ret; ret = read(STDIN_FILENO, buf, sizeof(buf)); + if (ret < 1) + return 0; LOGP(DSTREAMTEST, LOGL_NOTICE, "read %d byte from keyboard\n", ret); @@ -106,8 +108,8 @@ LOGP(DSTREAMTEST, LOGL_ERROR, "cannot allocate message\n"); return 0; } - ptr = msgb_put(msg, strlen(buf)); - memcpy(ptr, buf, strlen(buf)); + ptr = msgb_put(msg, ret); + memcpy(ptr, buf, ret); osmo_stream_srv_send(conn, msg); LOGP(DSTREAMTEST, LOGL_NOTICE, "message of %d bytes sent\n", msg->len); -- To view, visit https://gerrit.osmocom.org/1307 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibaafdd49d9446a12fe7d0e2f5b2039da3ffc7ea9 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 1 15:56:44 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:56:44 +0000 Subject: libosmocore[master]: wqueue: Reject messges if queue is considered full In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1243 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae Gerrit-PatchSet: 1 Gerrit-Project: libosmocore 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 Thu Dec 1 15:58:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:58:07 +0000 Subject: osmo-bts[master]: bursts test: test_pdtch: pre-init result mem In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1338 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4547f47c4150759d5c4ab790e34e91b784b03b39 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 Dec 1 15:58:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:58:35 +0000 Subject: openbsc[master]: IuPS: properly update ra_id on GMM Attach Request In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1306 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia06458758362e76925690b1757d8ced95e9609e4 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 Dec 1 15:58:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:58:41 +0000 Subject: [MERGED] openbsc[master]: IuPS: properly update ra_id on GMM Attach Request In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: IuPS: properly update ra_id on GMM Attach Request ...................................................................... IuPS: properly update ra_id on GMM Attach Request For new MM contexts, the ra_id was correctly obtained from the ue_ctx, but in case an MM ctx is re-used and the ra_id changed, the new ra_id was not copied to the MM context; instead, the ra_id was overwritten with uninitialized data. Always initialize the local ra_id variable from the ue_ctx->ra_id for Iu connections; it is used further below to update the ctx->ra_id. For the case of a brand new Iu MM ctx, the ctx->ra_id then gets initialized a second time. We could technically drop the init in sgsn_mm_ctx_alloc_iu(), but it doesn't hurt either way. Fixes: CID#57936 Change-Id: Ia06458758362e76925690b1757d8ced95e9609e4 --- M openbsc/src/gprs/gprs_gmm.c 1 file changed, 2 insertions(+), 4 deletions(-) Approvals: Harald Welte: 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 1fc2784..363b457 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -65,10 +65,7 @@ #include #include #include - -#ifdef BUILD_IU #include -#endif #include @@ -1076,7 +1073,8 @@ if (!msg->dst) { /* Gb mode */ cid = bssgp_parse_cell_id(&ra_id, msgb_bcid(msg)); - } + } else + ra_id = ((struct ue_conn_ctx*)msg->dst)->ra_id; /* MS network capability 10.5.5.12 */ msnc_len = *cur++; -- To view, visit https://gerrit.osmocom.org/1306 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia06458758362e76925690b1757d8ced95e9609e4 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 Dec 1 15:59:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 15:59:39 +0000 Subject: osmo-pcu[master]: Add debugging log for RLC data block decoding In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1342 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8c197bdc4cd1330cbab0adfd188336d27682cec4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: mrinal Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 1 16:13:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 16:13:51 +0000 Subject: libosmocore[master]: vty/vty.c: Check return value of tc{get, set}attr() calls In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 apparently this breaks the 'vty' test case. So we probably _ahve_ to ignore the result of tc[gs]attr() as it will only succeed on a real tty? -- To view, visit https://gerrit.osmocom.org/1298 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I488ebf882ea12d5f9136563234c0da1018ea2ccd Gerrit-PatchSet: 2 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 Dec 1 16:16:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 1 Dec 2016 16:16:34 +0000 Subject: openbsc[master]: mgcp_network.c: Use libosmocore socket functions In-Reply-To: References: Message-ID: Patch Set 2: -Code-Review not quite sure how this breaks the vty test ?!? -- To view, visit https://gerrit.osmocom.org/1318 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1de4de12245847a6d30d1bf7c91dc813d2178dee Gerrit-PatchSet: 2 Gerrit-Project: openbsc 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 Dec 1 17:56:13 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 1 Dec 2016 17:56:13 +0000 Subject: openbsc[master]: sgsn_test: Fix missing = in == type check In-Reply-To: References: Message-ID: Patch Set 3: How about correcting our coding style to always use "constant == variable" comparison to avoid such errors altogether? -- To view, visit https://gerrit.osmocom.org/1322 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I696a7d25d2f4d19922e05a7e83c4aeec5c44fb07 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 1 17:56:40 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 1 Dec 2016 17:56:40 +0000 Subject: openbsc[master]: sgsn_test: Fix missing = in == type check In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1322 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I696a7d25d2f4d19922e05a7e83c4aeec5c44fb07 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 1 19:46:49 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 1 Dec 2016 19:46:49 +0000 Subject: openbsc[master]: bsc vty: rename show_net_cmd to bsc_show_net_cmd In-Reply-To: References: Message-ID: Patch Set 7: Shouldn't you also correct vty_test_runner.py? This should fail vty tests otherwise. -- To view, visit https://gerrit.osmocom.org/1135 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifb86698cd57a09f03b935b6d3fcea87eff4cd397 Gerrit-PatchSet: 7 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 Thu Dec 1 19:47:26 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 1 Dec 2016 19:47:26 +0000 Subject: openbsc[master]: bsc vty: rename show_net_cmd to bsc_show_net_cmd In-Reply-To: References: Message-ID: Patch Set 7: Ah, nevermind, it's just function rename, sorry for the noise. -- To view, visit https://gerrit.osmocom.org/1135 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifb86698cd57a09f03b935b6d3fcea87eff4cd397 Gerrit-PatchSet: 7 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 Fri Dec 2 00:59:36 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 2 Dec 2016 00:59:36 +0000 Subject: [PATCH] openbsc[master]: abis_om2k: fix typo that declared non-existent struct gsm_bt... Message-ID: Review at https://gerrit.osmocom.org/1354 abis_om2k: fix typo that declared non-existent struct gsm_bts_trx_s The typo was recently committed in 80ccb952676cb4a068410991c5d53d19f228f695, "OM2000: Fix missing dynamic TCH initialization" Change-Id: I8e3eec8cf63494962fa31d85a0ec9db9a9e5df46 --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/54/1354/1 diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 0dffb15..6b334d4 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1682,7 +1682,7 @@ /* if we have just received opinfo accept for the timeslot, * start dynamic TCH switching procedures */ if (omfp->mo->addr.class == OM2K_MO_CLS_TS) { - struct gsm_bts_trx_s *ts; + struct gsm_bts_trx_ts *ts; ts = mo2obj(omfp->trx->bts, &omfp->mo->addr); dyn_ts_init(ts); } -- To view, visit https://gerrit.osmocom.org/1354 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8e3eec8cf63494962fa31d85a0ec9db9a9e5df46 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 2 06:10:15 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 2 Dec 2016 06:10:15 +0000 Subject: osmo-pcu[master]: Add debugging log for RLC data block decoding In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Verified+1 -- To view, visit https://gerrit.osmocom.org/1342 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8c197bdc4cd1330cbab0adfd188336d27682cec4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: mrinal Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 2 09:11:06 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 2 Dec 2016 09:11:06 +0000 Subject: libosmocore[master]: vty/vty.c: Check return value of tc{get, set}attr() calls In-Reply-To: References: Message-ID: Patch Set 2: So most likely the: socketpair(AF_UNIX, SOCK_STREAM, 0, data->sock); and not being termios capable. So yeah, it is best to mark it as invalid/intended behavior in coverity! -- To view, visit https://gerrit.osmocom.org/1298 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I488ebf882ea12d5f9136563234c0da1018ea2ccd Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 2 09:12:31 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 2 Dec 2016 09:12:31 +0000 Subject: libosmocore[master]: Add function to get uninterrupted bit run In-Reply-To: References: Message-ID: Patch Set 10: Code-Review-1 Okay, the coding style fix OSMO_ASSERT( and not OSMO_ASSERT ( and then I will run the test with lcov and look at the coverage of the method. We are getting there. -- To view, visit https://gerrit.osmocom.org/415 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26 Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: prasadkg Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: arvind.sirsikar Gerrit-Reviewer: prasadkg Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 2 09:13:58 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 2 Dec 2016 09:13:58 +0000 Subject: osmo-pcu[master]: Add debugging log for RLC data block decoding In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1342 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8c197bdc4cd1330cbab0adfd188336d27682cec4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: mrinal Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 2 09:15:54 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 2 Dec 2016 09:15:54 +0000 Subject: [MERGED] osmo-pcu[master]: Add debugging log for RLC data block decoding In-Reply-To: References: Message-ID: arvind.sirsikar has submitted this change and it was merged. Change subject: Add debugging log for RLC data block decoding ...................................................................... Add debugging log for RLC data block decoding Added debugging log for RLC UL Data Block decoding for both GPRS/EGPRS cases. Change-Id: I8c197bdc4cd1330cbab0adfd188336d27682cec4 --- M src/decoding.cpp M tests/tbf/TbfTest.err 2 files changed, 10 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, but someone else must approve arvind.sirsikar: Looks good to me, but someone else must approve; Verified Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/src/decoding.cpp b/src/decoding.cpp index 6ae4b16..0dbb10a 100644 --- a/src/decoding.cpp +++ b/src/decoding.cpp @@ -76,6 +76,9 @@ } else if (li->li == 127 && li->e == 1) { /* TS 44.060, table 10.4.14a.1, row 3 & 5 */ /* only filling bytes left */ + LOGP(DRLCMACUL, LOGL_DEBUG, "UL DATA LI contains " + "only filling bytes with extention octet: LI=%d, E=%d, count=%d\n", + li->li, li->e, num_chunks); break; } else if (li->li > 0) { /* TS 44.060, table 10.4.14a.1, row 1 & 2b */ @@ -88,6 +91,9 @@ return -EINVAL; } + LOGP(DRLCMACUL, LOGL_DEBUG, "UL DATA LI contains " + "extention octet: LI=%d, E=%d, count=%d\n", + li->li, li->e, num_chunks); num_chunks += 1; if (e == 1) { @@ -161,6 +167,9 @@ chunks[num_chunks].is_complete = li->li || is_last_block; + LOGP(DRLCMACUL, LOGL_DEBUG, "UL DATA LI contains " + "extention octet: LI=%d, M=%d, E=%d, count=%d\n", + li->li, li->m, li->e, num_chunks); num_chunks += 1; if (e == 1 && m == 1) { diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index a680812..2647551 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -6460,6 +6460,7 @@ - Raising V(R) to 2 - Taking block 1 out, raising V(Q) to 2 - Assembling frames: (len=44) +UL DATA LI contains extention octet: LI=0, E=1, count=0 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW EGPRS) complete UL frame len=44 LLC [PCU -> SGSN] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW EGPRS) len=44 No bctx -- To view, visit https://gerrit.osmocom.org/1342 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8c197bdc4cd1330cbab0adfd188336d27682cec4 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: mrinal Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 2 09:45:48 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Fri, 2 Dec 2016 09:45:48 +0000 Subject: [PATCH] libosmocore[master]: Add function to get uninterrupted bit run In-Reply-To: References: Message-ID: Hello Harald Welte, arvind.sirsikar, Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/415 to look at the new patch set (#11). Add function to get uninterrupted bit run Function bitvec_rl_curbit added to get number of uninterrupted bits run in vector starting from the current bit till max number of bits. Test case is added to check bitvec_rl_curbit. Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26 --- M include/osmocom/core/bitvec.h M src/bitvec.c M tests/bitvec/bitvec_test.c M tests/bitvec/bitvec_test.ok 4 files changed, 89 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/15/415/11 diff --git a/include/osmocom/core/bitvec.h b/include/osmocom/core/bitvec.h index 19e2af8..0e17ba7 100644 --- a/include/osmocom/core/bitvec.h +++ b/include/osmocom/core/bitvec.h @@ -89,6 +89,7 @@ void bitvec_to_string_r(const struct bitvec *bv, char *str); void bitvec_zero(struct bitvec *bv); unsigned bitvec_rl(const struct bitvec *bv, bool b); +unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits); void bitvec_shiftl(struct bitvec *bv, unsigned int n); int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits); unsigned int bitvec_add_array(struct bitvec *bv, const uint32_t *array, diff --git a/src/bitvec.c b/src/bitvec.c index 38148ac..c895cff 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -575,6 +575,51 @@ return bv->cur_bit; } +/*! \brief Return number (bits) of uninterrupted bit run in vector + * starting from the current bit + * \param[in] bv The boolean vector to work on + * \param[in] b The boolean, sequence of 1's or 0's to be checked + * \param[in] max_bits Total Number of Uncmopresed bits + * \returns Number of consecutive bits of \p b in \p bv and cur_bit will + * \go to cur_bit + number of consecutive bit + */ +unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits) +{ + unsigned i = 0; + unsigned j = 8; + int temp_res = 0; + int count = 0; + unsigned readIndex = bv->cur_bit; + unsigned remaining_bits = max_bits % 8; + unsigned remaining_bytes = max_bits / 8; + unsigned byte_mask = 0xFF; + + if (readIndex % 8) { + for (j -= (readIndex % 8) ; j > 0 ; j--) { + if (readIndex < max_bits && bitvec_read_field(bv, &readIndex, 1) == b) + temp_res++; + else { + bv->cur_bit--; + return temp_res; + } + } + } + for (i = (readIndex / 8); + i < (remaining_bits ? remaining_bytes + 1 : remaining_bytes); + i++, count++) { + if ((b ? byte_mask : 0) != bv->data[i]) { + bv->cur_bit = (count * 8 + + leading_bits(bv->data[i], b) + readIndex); + return count * 8 + + leading_bits(bv->data[i], b) + temp_res; + } + } + bv->cur_bit = (temp_res + (count * 8)) + readIndex; + if (bv->cur_bit > max_bits) + bv->cur_bit = max_bits; + return (bv->cur_bit - readIndex + temp_res); +} + /*! \brief Shifts bitvec to the left, n MSB bits lost */ void bitvec_shiftl(struct bitvec *bv, unsigned n) { diff --git a/tests/bitvec/bitvec_test.c b/tests/bitvec/bitvec_test.c index a98a91c..d0bc30c 100644 --- a/tests/bitvec/bitvec_test.c +++ b/tests/bitvec/bitvec_test.c @@ -150,6 +150,18 @@ } } +static inline void test_bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits, + int result ) +{ + int num = 0; + int readIndex = bv->cur_bit; + OSMO_ASSERT(bv->cur_bit < max_bits); + num = bitvec_rl_curbit(bv, b, max_bits); + readIndex += num; + OSMO_ASSERT(bv->cur_bit == readIndex); + OSMO_ASSERT(num == result); +} + static void test_array() { struct bitvec b; @@ -245,7 +257,35 @@ test_array(); - printf("\nbitvec ok.\n"); + printf("\nbitvec_runlength....\n"); + bitvec_zero(&bv); + bitvec_set_uint(&bv, 0xff, 8); + bv.cur_bit -= 8; + test_bitvec_rl_curbit(&bv, 1, 64, 8); + + bitvec_zero(&bv); + bitvec_set_uint(&bv, 0xfc, 8); + bv.cur_bit -= 8; + test_bitvec_rl_curbit(&bv, 1, 64, 6); + + bitvec_zero(&bv); + test_bitvec_rl_curbit(&bv, 0, 52, 52); + + bitvec_zero(&bv); + bitvec_set_uint(&bv, 0xfc, 8); + bv.cur_bit -= 2; + test_bitvec_rl_curbit(&bv, 0, 64, 58); + + bitvec_zero(&bv); + bitvec_set_uint(&bv, 0x07, 8); + bitvec_set_uint(&bv, 0xf8, 8); + bv.cur_bit -= 11; + test_bitvec_rl_curbit(&bv, 1, 64, 8); + + bitvec_zero(&bv); + test_bitvec_rl_curbit(&bv, 1, 64, 0); + + printf("\nbitvec ok.\n"); return 0; } diff --git a/tests/bitvec/bitvec_test.ok b/tests/bitvec/bitvec_test.ok index e256108..6281973 100644 --- a/tests/bitvec/bitvec_test.ok +++ b/tests/bitvec/bitvec_test.ok @@ -166,4 +166,6 @@ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ +bitvec_runlength.... + bitvec ok. -- To view, visit https://gerrit.osmocom.org/415 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26 Gerrit-PatchSet: 11 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: prasadkg Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: arvind.sirsikar Gerrit-Reviewer: prasadkg Gerrit-Reviewer: pravin From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: channel_mode_from_lchan(): Add missing break statement In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1328 to look at the new patch set (#4). channel_mode_from_lchan(): Add missing break statement GSM48_CMODE_DATA_6k0 was not properly terminated and thus resulted in a bug. Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Fixes: Coverity CID 148207 --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/28/1328/4 diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index b7f7a75..3a676c0 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -453,6 +453,7 @@ lchan->csd_mode); return -EINVAL; } + break; default: LOGP(DRSL, LOGL_ERROR, "unsupported lchan->tch_mode %u\n", -- To view, visit https://gerrit.osmocom.org/1328 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: Replace local make_sock() function with libosmocore osmo_fd_... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1317 to look at the new patch set (#4). Replace local make_sock() function with libosmocore osmo_fd_init_ofd() The local 'make_sock()' function should have been deprecated since 2011, when we started to have general socket related utility functions in libosmocore. Fixes: Coverity CID 57645 Change-Id: I2329da82d2b6612e281086ca67c7836b97e03d3d --- M openbsc/include/openbsc/Makefile.am D openbsc/include/openbsc/socket.h M openbsc/src/ipaccess/ipaccess-proxy.c M openbsc/src/libcommon/Makefile.am D openbsc/src/libcommon/socket.c M openbsc/src/osmo-bsc_nat/bsc_nat.c M openbsc/src/osmo-bsc_nat/bsc_ussd.c 7 files changed, 40 insertions(+), 147 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/17/1317/4 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 2b54c43..c5a2e91 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -74,7 +74,6 @@ slhc.h \ smpp.h \ sms_queue.h \ - socket.h \ system_information.h \ token_auth.h \ transaction.h \ diff --git a/openbsc/include/openbsc/socket.h b/openbsc/include/openbsc/socket.h deleted file mode 100644 index 0fd85f1..0000000 --- a/openbsc/include/openbsc/socket.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _BSC_SOCKET_H -#define _BSC_SOCKET_H - -#include - -#ifndef IPPROTO_GRE -#define IPPROTO_GRE 47 -#endif - -int make_sock(struct osmo_fd *bfd, int proto, - uint32_t ip, uint16_t port, int priv_nr, - int (*cb)(struct osmo_fd *fd, unsigned int what), void *data); - -#endif /* _BSC_SOCKET_H */ diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index 9e8ec88..bb52a48 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,6 @@ #include #include #include -#include #include /* one instance of an ip.access protocol proxy */ @@ -369,8 +369,12 @@ /* Create UDP socket for BTS packet injection */ udp_port = 10000 + (site_id % 1000)*100 + (bts_id % 100); - ret = make_sock(&ipbc->udp_bts_fd, IPPROTO_UDP, INADDR_ANY, udp_port, - UDP_TO_BTS, udp_fd_cb, ipbc); + ipbc->udp_bts_fd.cb = udp_fd_cb; + ipbc->udp_bts_fd.data = ipbc; + ipbc->udp_bts_fd.priv_nr = UDP_TO_BTS; + ret = osmo_sock_init_ofd(&ipbc->udp_bts_fd, AF_INET, SOCK_DGRAM, + IPPROTO_UDP, "0.0.0.0", udp_port, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); if (ret < 0) goto err_udp_bts; DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection " @@ -378,8 +382,12 @@ /* Create UDP socket for BSC packet injection */ udp_port = 20000 + (site_id % 1000)*100 + (bts_id % 100); - ret = make_sock(&ipbc->udp_bsc_fd, IPPROTO_UDP, INADDR_ANY, udp_port, - UDP_TO_BSC, udp_fd_cb, ipbc); + ipbc->udp_bsc_fd.cb = udp_fd_cb; + ipbc->udp_bsc_fd.data = ipbc; + ipbc->udp_bsc_fd.priv_nr = UDP_TO_BSC; + ret = osmo_sock_init_ofd(&ipbc->udp_bsc_fd, AF_INET, SOCK_DGRAM, + IPPROTO_UDP, "0.0.0.0", udp_port, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); if (ret < 0) goto err_udp_bsc; DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection " @@ -391,12 +399,14 @@ struct sockaddr_in sock; socklen_t len = sizeof(sock); struct in_addr addr; - uint32_t ip; inet_aton(listen_ipaddr, &addr); - ip = ntohl(addr.s_addr); /* make_sock() needs host byte order */ - ret = make_sock(&ipbc->gprs_ns_fd, IPPROTO_UDP, ip, 0, 0, - gprs_ns_cb, ipbc); + + ipbc->gprs_ns_fd.cb = gprs_ns_cb; + ipbc->gprs_ns_fd.data = ipbc; + ret = osmo_sock_init_ofd(&ipbc->gprs_ns_fd, AF_INET, SOCK_DGRAM, + IPPROTO_UDP, inet_ntoa(addr), 0, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "Creating the GPRS socket failed.\n"); goto err_udp_bsc; @@ -1063,15 +1073,20 @@ ipp->reconn_timer.data = ipp; /* Listen for OML connections */ - ret = make_sock(&ipp->oml_listen_fd, IPPROTO_TCP, INADDR_ANY, - IPA_TCP_PORT_OML, OML_FROM_BTS, listen_fd_cb, NULL); + ipp->oml_listen_fd.cb = listen_fd_cb; + ipp->oml_listen_fd.priv_nr = OML_FROM_BTS; + ret = osmo_sock_init_ofd(&ipp->oml_listen_fd, AF_INET, SOCK_STREAM, + IPPROTO_TCP, "0.0.0.0", IPA_TCP_PORT_OML, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); if (ret < 0) return ret; /* Listen for RSL connections */ - ret = make_sock(&ipp->rsl_listen_fd, IPPROTO_TCP, INADDR_ANY, - IPA_TCP_PORT_RSL, RSL_FROM_BTS, listen_fd_cb, NULL); - + ipp->rsl_listen_fd.cb =listen_fd_cb; + ipp->rsl_listen_fd.priv_nr = RSL_FROM_BTS; + ret = osmo_sock_init_ofd(&ipp->rsl_listen_fd, AF_INET, SOCK_STREAM, + IPPROTO_TCP, "0.0.0.0", IPA_TCP_PORT_RSL, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); if (ret < 0) return ret; diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6cfebc2..93b188d 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,7 +23,6 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ - socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ $(NULL) diff --git a/openbsc/src/libcommon/socket.c b/openbsc/src/libcommon/socket.c deleted file mode 100644 index 2a64767..0000000 --- a/openbsc/src/libcommon/socket.c +++ /dev/null @@ -1,111 +0,0 @@ -/* OpenBSC sokcet code, taken from Abis input driver for ip.access */ - -/* (C) 2009 by Harald Welte - * (C) 2010 by Holger Hans Peter Freyther - * (C) 2010 by On-Waves - * - * 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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -int make_sock(struct osmo_fd *bfd, int proto, - uint32_t ip, uint16_t port, int priv_nr, - int (*cb)(struct osmo_fd *fd, unsigned int what), void *data) -{ - struct sockaddr_in addr; - int ret, on = 1; - int type = SOCK_STREAM; - - switch (proto) { - case IPPROTO_TCP: - type = SOCK_STREAM; - break; - case IPPROTO_UDP: - type = SOCK_DGRAM; - break; -#ifdef IPPROTO_GRE - case IPPROTO_GRE: - type = SOCK_RAW; - break; -#endif - default: - return -EINVAL; - } - - bfd->fd = socket(AF_INET, type, proto); - bfd->cb = cb; - bfd->when = BSC_FD_READ; - bfd->data = data; - bfd->priv_nr = priv_nr; - - if (bfd->fd < 0) { - LOGP(DLINP, LOGL_ERROR, "could not create socket.\n"); - return -EIO; - } - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - if (ip != INADDR_ANY) - addr.sin_addr.s_addr = htonl(ip); - else - addr.sin_addr.s_addr = INADDR_ANY; - - setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - ret = bind(bfd->fd, (struct sockaddr *) &addr, sizeof(addr)); - if (ret < 0) { - LOGP(DLINP, LOGL_ERROR, "could not bind socket %s\n", - strerror(errno)); - close(bfd->fd); - return -EIO; - } - - if (proto == IPPROTO_TCP) { - ret = listen(bfd->fd, 1); - if (ret < 0) { - perror("listen"); - close(bfd->fd); - return ret; - } - } - - ret = osmo_fd_register(bfd); - if (ret < 0) { - perror("register_listen_fd"); - close(bfd->fd); - return ret; - } - return 0; -} diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index a4dd679..933cfeb 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -59,6 +58,7 @@ #include #include #include +#include #include #include @@ -1684,8 +1684,11 @@ bsc_msc_connect(nat->msc_con); /* wait for the BSC */ - rc = make_sock(&bsc_listen, IPPROTO_TCP, ntohl(local_addr.s_addr), - 5000, 0, ipaccess_listen_bsc_cb, nat); + bsc_listen.cb = ipaccess_listen_bsc_cb; + bsc_listen.data = nat; + rc = osmo_sock_init_ofd(&bsc_listen, AF_INET, SOCK_STREAM, IPPROTO_TCP, + inet_ntoa(local_addr), 5000, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); if (rc != 0) { fprintf(stderr, "Failed to listen for BSC.\n"); exit(1); diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c index 2f68381..b052eb8 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c +++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c @@ -24,10 +24,10 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -287,8 +287,10 @@ inet_aton(nat->ussd_local, &addr); nat->ussd_listen.data = nat; - return make_sock(&nat->ussd_listen, IPPROTO_TCP, - ntohl(addr.s_addr), 5001, 0, ussd_listen_cb, nat); + nat->ussd_listen.cb = ussd_listen_cb; + return osmo_sock_init_ofd(&nat->ussd_listen, AF_INET, SOCK_STREAM, + IPPROTO_TCP, inet_ntoa(addr), 5001, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); } static int forward_ussd_simple(struct nat_sccp_connection *con, struct msgb *input) -- To view, visit https://gerrit.osmocom.org/1317 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2329da82d2b6612e281086ca67c7836b97e03d3d Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: mgcp_network.c: Use libosmocore socket functions In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1318 to look at the new patch set (#4). mgcp_network.c: Use libosmocore socket functions Use libosmocore osmo_sock_init_ofd() in mgcp_create_bind(), rather than using a hand-coded version using OS socket functions. The locally implemented verison of the code didn't check setsockopt() return value. Change-Id: I1de4de12245847a6d30d1bf7c91dc813d2178dee Fixes: Coverity CID 57646 --- M openbsc/src/libmgcp/mgcp_network.c 1 file changed, 4 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/18/1318/4 diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c index abce6e4..a98a60f 100644 --- a/openbsc/src/libmgcp/mgcp_network.c +++ b/openbsc/src/libmgcp/mgcp_network.c @@ -28,10 +28,10 @@ #include #include -#include #include #include +#include #include #include @@ -884,28 +884,9 @@ int mgcp_create_bind(const char *source_addr, struct osmo_fd *fd, int port) { - struct sockaddr_in addr; - int on = 1; - - fd->fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd->fd < 0) { - LOGP(DMGCP, LOGL_ERROR, "Failed to create UDP port.\n"); - return -1; - } - - setsockopt(fd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - inet_aton(source_addr, &addr.sin_addr); - - if (bind(fd->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - close(fd->fd); - fd->fd = -1; - return -1; - } - - return 0; + return osmo_sock_init_ofd(fd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, + source_addr, port, + OSMO_SOCK_F_BIND|OSMO_SOCK_F_NONBLOCK); } int mgcp_set_ip_tos(int fd, int tos) -- To view, visit https://gerrit.osmocom.org/1318 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1de4de12245847a6d30d1bf7c91dc813d2178dee Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: bsc_ctrl: Ensure we don't pass NULL string into strtok_r() In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1323 to look at the new patch set (#4). bsc_ctrl: Ensure we don't pass NULL string into strtok_r() Change-Id: I03bea132377c0136b55b6fdad99a5d92da12e692 Fixes: Coverity CID 135180 --- M openbsc/src/osmo-bsc/osmo_bsc_ctrl.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/23/1323/4 diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index 3010b55..78647d3 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -612,6 +612,7 @@ char *saveptr = NULL; char *inp, *cic, *alert, *text; + OSMO_ASSERT(cmd); inp = talloc_strdup(cmd, value); cic = strtok_r(inp, ",", &saveptr); -- To view, visit https://gerrit.osmocom.org/1323 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I03bea132377c0136b55b6fdad99a5d92da12e692 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: mgcp_protocol: Ensure we don't call strtok_r with NULL data In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1324 to look at the new patch set (#4). mgcp_protocol: Ensure we don't call strtok_r with NULL data Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Fixes: Coverity CID 135181 --- M openbsc/src/libmgcp/mgcp_protocol.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/24/1324/4 diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 2e728cb..18398fc 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -447,6 +447,7 @@ int i = 0; char *elem, *save = NULL; + OSMO_ASSERT(data); pdata->trans = "000000"; for (elem = strtok_r(data, " ", &save); elem; -- To view, visit https://gerrit.osmocom.org/1324 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: cfg_bts_si2quater_neigh_add(): Don't call strerror() on nega... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1325 to look at the new patch set (#4). cfg_bts_si2quater_neigh_add(): Don't call strerror() on negative value Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Fixes: Coverity CID 135185 --- M openbsc/src/libbsc/bsc_vty.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/25/1325/4 diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 9ed19aa..0076591 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -2995,7 +2995,7 @@ r = osmo_earfcn_add(e, arfcn, meas); if (r < 0) { - vty_out(vty, "Unable to add arfcn %u: %s%s", arfcn, strerror(r), + vty_out(vty, "Unable to add arfcn %u: %s%s", arfcn, strerror(-r), VTY_NEWLINE); return CMD_WARNING; } -- To view, visit https://gerrit.osmocom.org/1325 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: bsc_vty: Fix missing break statements in switch() In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1326 to look at the new patch set (#4). bsc_vty: Fix missing break statements in switch() Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Fixes: Coverity CID 135188 Fixes: Coverity CID 135190 --- M openbsc/src/libbsc/bsc_vty.c 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/26/1326/4 diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 0076591..9da8a70 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -3049,9 +3049,11 @@ case -ENOMEM: vty_out(vty, "Unable to add arfcn: max number of UARFCNs (%u) " "reached%s", MAX_EARFCN_LIST, VTY_NEWLINE); + return CMD_WARNING; case -ENOSPC: vty_out(vty, "Warning: not enough space in si2quater for a " "given arfcn%s", VTY_NEWLINE); + return CMD_WARNING; case -EADDRINUSE: vty_out(vty, "Unable to add arfcn: (%u, %u) is already added%s", arfcn, scramble, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/1326 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: gsm0408_test.c: Don't pass negative value to strerror() In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1327 to look at the new patch set (#4). gsm0408_test.c: Don't pass negative value to strerror() Change-Id: I4fcf24ec1bc974a3189486d2372b9713d7fdab70 Fixes: Coverity CID 135192 --- M openbsc/tests/gsm0408/gsm0408_test.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/27/1327/4 diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 0c7b5ce..3d93152 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -89,7 +89,7 @@ { int r = osmo_earfcn_add(e, earfcn, bw); if (r) - printf("failed to add EARFCN %u: %s\n", earfcn, strerror(r)); + printf("failed to add EARFCN %u: %s\n", earfcn, strerror(-r)); else printf("added EARFCN %u - ", earfcn); } -- To view, visit https://gerrit.osmocom.org/1327 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4fcf24ec1bc974a3189486d2372b9713d7fdab70 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 11:58:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 11:58:10 +0000 Subject: [PATCH] openbsc[master]: libmsc/db: Prevent subscr->extension without NULL termination In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1311 to look at the new patch set (#4). libmsc/db: Prevent subscr->extension without NULL termination Change-Id: Ic1ae7b2d9dde8dab8f7795e5baa8918424f5f393 Fixes: Coverity CID 57622 --- M openbsc/src/libmsc/db.c 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/11/1311/4 diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..c212fcd 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -837,8 +837,10 @@ } string = dbi_result_get_string(result, "extension"); - if (string) + if (string) { strncpy(subscr->extension, string, GSM_EXTENSION_LENGTH); + subscr->extension[sizeof(subscr->extension)-1] = '\0'; + } subscr->lac = dbi_result_get_ulonglong(result, "lac"); -- To view, visit https://gerrit.osmocom.org/1311 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic1ae7b2d9dde8dab8f7795e5baa8918424f5f393 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 12:08:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:08:56 +0000 Subject: openbsc[master]: factor out gen of USSD notify and release complete to libosm... In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1129 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I33a84e3c28576ced91d2ea24103123431f551173 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 Fri Dec 2 12:09:12 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:12 +0000 Subject: openbsc[master]: factor out gen of USSD notify and release complete to libosm... In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1129 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I33a84e3c28576ced91d2ea24103123431f551173 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 Fri Dec 2 12:09:17 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:17 +0000 Subject: [MERGED] openbsc[master]: factor out gen of USSD notify and release complete to libosm... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: factor out gen of USSD notify and release complete to libosmocore ...................................................................... factor out gen of USSD notify and release complete to libosmocore Both libmsc and libbsc will need distinct gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete() functions, since there will be distinct subscriber connection structs. Rename to msc_send_ussd_notify() and msc_send_ussd_release_complete(), and add the same in libbsc with bsc_ prefix in new file gsm_04_80_utils.c. In preparation of this patch, the message generation part of these functions has been added to libosmocore as gsm0480_create_ussd_notify() and gsm0480_create_ussd_release_complete(). Use these. Adjust all libmsc and libbsc callers according to use the msc_* or bsc_* implementation, respectively. Change-Id: I33a84e3c28576ced91d2ea24103123431f551173 --- M openbsc/include/openbsc/gsm_04_80.h M openbsc/src/libbsc/Makefile.am A openbsc/src/libbsc/gsm_04_80_utils.c M openbsc/src/libmsc/gsm_04_80.c M openbsc/src/libmsc/vty_interface_layer3.c M openbsc/src/osmo-bsc/osmo_bsc_api.c M openbsc/src/osmo-bsc/osmo_bsc_ctrl.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_sccp.c 10 files changed, 64 insertions(+), 38 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h index 74701ac..d65f640 100644 --- a/openbsc/include/openbsc/gsm_04_80.h +++ b/openbsc/include/openbsc/gsm_04_80.h @@ -14,7 +14,12 @@ const struct msgb *msg, const struct ss_request *request); -int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text); -int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn); +int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, + const char *text); +int msc_send_ussd_release_complete(struct gsm_subscriber_connection *conn); + +int bsc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, + const char *text); +int bsc_send_ussd_release_complete(struct gsm_subscriber_connection *conn); #endif diff --git a/openbsc/src/libbsc/Makefile.am b/openbsc/src/libbsc/Makefile.am index 8c53817..b8e77e6 100644 --- a/openbsc/src/libbsc/Makefile.am +++ b/openbsc/src/libbsc/Makefile.am @@ -41,6 +41,7 @@ bsc_api.c \ bsc_msc.c bsc_vty.c \ gsm_04_08_utils.c \ + gsm_04_80_utils.c \ bsc_init.c \ bts_init.c \ bsc_rf_ctrl.c \ diff --git a/openbsc/src/libbsc/gsm_04_80_utils.c b/openbsc/src/libbsc/gsm_04_80_utils.c new file mode 100644 index 0000000..e0db81e --- /dev/null +++ b/openbsc/src/libbsc/gsm_04_80_utils.c @@ -0,0 +1,40 @@ +/* OpenBSC utility functions for 3GPP TS 04.80 */ + +/* (C) 2016 by sysmocom s.m.f.c. GmbH + * + * 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 + +int bsc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, + const char *text) +{ + struct msgb *msg = gsm0480_create_ussd_notify(level, text); + if (!msg) + return -1; + return gsm0808_submit_dtap(conn, msg, 0, 0); +} + +int bsc_send_ussd_release_complete(struct gsm_subscriber_connection *conn) +{ + struct msgb *msg = gsm0480_create_ussd_release_complete(); + if (!msg) + return -1; + return gsm0808_submit_dtap(conn, msg, 0, 0); +} diff --git a/openbsc/src/libmsc/gsm_04_80.c b/openbsc/src/libmsc/gsm_04_80.c index 1744455..479d6fb 100644 --- a/openbsc/src/libmsc/gsm_04_80.c +++ b/openbsc/src/libmsc/gsm_04_80.c @@ -138,38 +138,18 @@ return gsm0808_submit_dtap(conn, msg, 0, 0); } -int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text) +int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, const char *text) { - struct gsm48_hdr *gh; - struct msgb *msg; - - msg = gsm0480_create_unstructuredSS_Notify(level, text); + struct msgb *msg = gsm0480_create_ussd_notify(level, text); if (!msg) return -1; - - gsm0480_wrap_invoke(msg, GSM0480_OP_CODE_USS_NOTIFY, 0); - gsm0480_wrap_facility(msg); - - /* And finally pre-pend the L3 header */ - gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); - gh->proto_discr = GSM48_PDISC_NC_SS; - gh->msg_type = GSM0480_MTYPE_REGISTER; - return gsm0808_submit_dtap(conn, msg, 0, 0); } -int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn) +int msc_send_ussd_release_complete(struct gsm_subscriber_connection *conn) { - struct gsm48_hdr *gh; - struct msgb *msg; - - msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REL COMPL"); + struct msgb *msg = gsm0480_create_ussd_release_complete(); if (!msg) return -1; - - gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh)); - gh->proto_discr = GSM48_PDISC_NC_SS; - gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE; - return gsm0808_submit_dtap(conn, msg, 0, 0); } diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 0b360b8..edece51 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -473,8 +473,8 @@ return CMD_WARNING; } - gsm0480_send_ussdNotify(conn, level, text); - gsm0480_send_releaseComplete(conn); + msc_send_ussd_notify(conn, level, text); + msc_send_ussd_release_complete(conn); subscr_put(subscr); talloc_free(text); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c index d31e6c1..7a3ef70 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_api.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c @@ -205,8 +205,8 @@ gsm48_tx_mm_serv_ack(conn); LOGP(DMSC, LOGL_INFO, "Sending USSD message: '%s'\n", text); - gsm0480_send_ussdNotify(conn, 1, text); - gsm0480_send_releaseComplete(conn); + bsc_send_ussd_notify(conn, 1, text); + bsc_send_ussd_release_complete(conn); } /* diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index 3010b55..40e1960 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -598,8 +598,8 @@ * the release complete when we get a returnResultLast * for this invoke id. */ - gsm0480_send_releaseComplete(conn); - gsm0480_send_ussdNotify(conn, alert, text_str); + bsc_send_ussd_release_complete(conn); + bsc_send_ussd_notify(conn, alert, text_str); cmd->reply = "Found a connection"; break; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c index 14e0b71..66c6406 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_filter.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_filter.c @@ -246,8 +246,8 @@ int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn) { - gsm0480_send_ussdNotify(conn, 1, conn->sccp_con->msc->ussd_welcome_txt); - gsm0480_send_releaseComplete(conn); + bsc_send_ussd_notify(conn, 1, conn->sccp_con->msc->ussd_welcome_txt); + bsc_send_ussd_release_complete(conn); return 0; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_grace.c b/openbsc/src/osmo-bsc/osmo_bsc_grace.c index e6194ab..6409a3a 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_grace.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_grace.c @@ -112,8 +112,8 @@ if (lchan->state != LCHAN_S_ACTIVE) return -1; - gsm0480_send_ussdNotify(conn, 0, text); - gsm0480_send_releaseComplete(conn); + bsc_send_ussd_notify(conn, 0, text); + bsc_send_ussd_release_complete(conn); return 0; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c index 86b27be..2fafed6 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c @@ -285,8 +285,8 @@ return; /* send USSD notification */ - gsm0480_send_ussdNotify(conn, 1, conn->sccp_con->msc->ussd_msc_lost_txt); - gsm0480_send_releaseComplete(conn); + bsc_send_ussd_notify(conn, 1, conn->sccp_con->msc->ussd_msc_lost_txt); + bsc_send_ussd_release_complete(conn); } static void bsc_notify_and_close_conns(struct bsc_msc_connection *msc_con) -- To view, visit https://gerrit.osmocom.org/1129 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I33a84e3c28576ced91d2ea24103123431f551173 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 Fri Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: move to libcommon-cs: network VTY that isn't BSC-specific In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: move to libcommon-cs: network VTY that isn't BSC-specific ...................................................................... move to libcommon-cs: network VTY that isn't BSC-specific Keep only BSC specific bits of the 'network' VTY node in bsc_vty.c, move more general VTY commands to common_cs_vty.c. Add arg to common_cs_vty_init() to pass a config_write_net() function. Pass a libbsc specific config_write_net() function. Future: upcoming omso-cscn will re-use the VTY bits moved to libcommon-cs and pass a different config_write_net() function. Change-Id: I871b7b32a0c56fdce983e409cf244ec487d24e71 --- M openbsc/include/openbsc/common_cs.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon-cs/common_cs_vty.c 3 files changed, 211 insertions(+), 194 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/common_cs.h b/openbsc/include/openbsc/common_cs.h index caecfeb..6dc956f 100644 --- a/openbsc/include/openbsc/common_cs.h +++ b/openbsc/include/openbsc/common_cs.h @@ -22,5 +22,6 @@ uint16_t network_code, mncc_recv_cb_t mncc_recv); -int common_cs_vty_init(struct gsm_network *network); +int common_cs_vty_init(struct gsm_network *network, + int (* config_write_net )(struct vty *)); struct gsm_network *gsmnet_from_vty(struct vty *v); diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index c8aa43c..d7d62bb 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -54,15 +54,13 @@ #include #include +#include + #include #include "../../bscconfig.h" -#define NETWORK_STR "Configure the GSM network\n" -#define CODE_CMD_STR "Code commands\n" -#define NAME_CMD_STR "Name Commands\n" -#define NAME_STR "Name to use\n" #define LCHAN_NR_STR "Logical Channel Number\n" @@ -105,12 +103,6 @@ { BTS_LOC_FIX_2D, "fix2d" }, { BTS_LOC_FIX_3D, "fix3d" }, { 0, NULL } -}; - -struct cmd_node net_node = { - GSMNET_NODE, - "%s(config-net)# ", - 1, }; struct cmd_node bts_node = { @@ -1386,133 +1378,6 @@ return CMD_SUCCESS; } -DEFUN(cfg_net, - cfg_net_cmd, - "network", NETWORK_STR) -{ - vty->index = gsmnet_from_vty(vty); - vty->node = GSMNET_NODE; - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_ncc, - cfg_net_ncc_cmd, - "network country code <1-999>", - "Set the GSM network country code\n" - "Country commands\n" - CODE_CMD_STR - "Network Country Code to use\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->country_code = atoi(argv[0]); - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_mnc, - cfg_net_mnc_cmd, - "mobile network code <0-999>", - "Set the GSM mobile network code\n" - "Network Commands\n" - CODE_CMD_STR - "Mobile Network Code to use\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->network_code = atoi(argv[0]); - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_name_short, - cfg_net_name_short_cmd, - "short name NAME", - "Set the short GSM network name\n" NAME_CMD_STR NAME_STR) -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]); - return CMD_SUCCESS; -} - -DEFUN(cfg_net_name_long, - cfg_net_name_long_cmd, - "long name NAME", - "Set the long GSM network name\n" NAME_CMD_STR NAME_STR) -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]); - return CMD_SUCCESS; -} - -DEFUN(cfg_net_auth_policy, - cfg_net_auth_policy_cmd, - "auth policy (closed|accept-all|regexp|token)", - "Authentication (not cryptographic)\n" - "Set the GSM network authentication policy\n" - "Require the MS to be activated in HLR\n" - "Accept all MS, whether in HLR or not\n" - "Use regular expression for IMSI authorization decision\n" - "Use SMS-token based authentication\n") -{ - enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]); - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->auth_policy = policy; - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_authorize_regexp, cfg_net_authorize_regexp_cmd, - "authorized-regexp REGEXP", - "Set regexp for IMSI which will be used for authorization decision\n" - "Regular expression, IMSIs matching it are allowed to use the network\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - if (gsm_parse_reg(gsmnet, &gsmnet->authorized_regexp, - &gsmnet->authorized_reg_str, argc, argv) != 0) { - vty_out(vty, "%%Failed to parse the authorized-regexp: '%s'%s", - argv[0], VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_reject_cause, - cfg_net_reject_cause_cmd, - "location updating reject cause <2-111>", - "Set the reject cause of location updating reject\n" - "Set the reject cause of location updating reject\n" - "Set the reject cause of location updating reject\n" - "Set the reject cause of location updating reject\n" - "Cause Value as Per GSM TS 04.08\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->reject_cause = atoi(argv[0]); - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_encryption, - cfg_net_encryption_cmd, - "encryption a5 (0|1|2|3)", - "Encryption options\n" - "A5 encryption\n" "A5/0: No encryption\n" - "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n" - "A5/3: 'New' Secure Encryption\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->a5_encryption= atoi(argv[0]); - - return CMD_SUCCESS; -} - DEFUN(cfg_net_neci, cfg_net_neci_cmd, "neci (0|1)", @@ -1523,35 +1388,6 @@ gsmnet->neci = atoi(argv[0]); gsm_net_update_ctype(gsmnet); - return CMD_SUCCESS; -} - -DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd, - "rrlp mode (none|ms-based|ms-preferred|ass-preferred)", - "Radio Resource Location Protocol\n" - "Set the Radio Resource Location Protocol Mode\n" - "Don't send RRLP request\n" - "Request MS-based location\n" - "Request any location, prefer MS-based\n" - "Request any location, prefer MS-assisted\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]); - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd, - "mm info (0|1)", - "Mobility Management\n" - "Send MM INFO after LOC UPD ACCEPT\n" - "Disable\n" "Enable\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - - gsmnet->send_mm_info = atoi(argv[0]); - return CMD_SUCCESS; } @@ -1704,17 +1540,6 @@ vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * " "configuration options of BTS instead%s", VTY_NEWLINE); return CMD_SUCCESS; -} - -DEFUN(cfg_net_subscr_keep, - cfg_net_subscr_keep_cmd, - "subscriber-keep-in-ram (0|1)", - "Keep unused subscribers in RAM.\n" - "Delete unused subscribers\n" "Keep unused subscribers\n") -{ - struct gsm_network *gsmnet = gsmnet_from_vty(vty); - gsmnet->subscr_group->keep_subscr = atoi(argv[0]); - return CMD_SUCCESS; } /* per-BTS configuration */ @@ -4087,7 +3912,7 @@ "BTS Vendor/Type\n", "\n", "", 0); - common_cs_vty_init(network); + common_cs_vty_init(network, config_write_net); install_element_ve(&show_net_cmd); install_element_ve(&show_bts_cmd); @@ -4102,20 +3927,7 @@ logging_vty_add_cmds(cat); osmo_stats_vty_add_cmds(); - install_element(CONFIG_NODE, &cfg_net_cmd); - install_node(&net_node, config_write_net); - vty_install_default(GSMNET_NODE); - install_element(GSMNET_NODE, &cfg_net_ncc_cmd); - install_element(GSMNET_NODE, &cfg_net_mnc_cmd); - install_element(GSMNET_NODE, &cfg_net_name_short_cmd); - install_element(GSMNET_NODE, &cfg_net_name_long_cmd); - install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); - install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd); - install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd); - install_element(GSMNET_NODE, &cfg_net_encryption_cmd); install_element(GSMNET_NODE, &cfg_net_neci_cmd); - install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd); - install_element(GSMNET_NODE, &cfg_net_mm_info_cmd); install_element(GSMNET_NODE, &cfg_net_handover_cmd); install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd); install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd); @@ -4136,7 +3948,6 @@ install_element(GSMNET_NODE, &cfg_net_T3122_cmd); install_element(GSMNET_NODE, &cfg_net_T3141_cmd); install_element(GSMNET_NODE, &cfg_net_dtx_cmd); - install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd); install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); install_element(GSMNET_NODE, &cfg_bts_cmd); diff --git a/openbsc/src/libcommon-cs/common_cs_vty.c b/openbsc/src/libcommon-cs/common_cs_vty.c index 11ed50f..bab3712 100644 --- a/openbsc/src/libcommon-cs/common_cs_vty.c +++ b/openbsc/src/libcommon-cs/common_cs_vty.c @@ -19,15 +19,220 @@ * */ +#include + +#include +#include +#include + +#include + #include +#include + +struct cmd_node net_node = { + GSMNET_NODE, + "%s(config-net)# ", + 1, +}; + +#define NETWORK_STR "Configure the GSM network\n" +#define CODE_CMD_STR "Code commands\n" +#define NAME_CMD_STR "Name Commands\n" +#define NAME_STR "Name to use\n" + +DEFUN(cfg_net, + cfg_net_cmd, + "network", NETWORK_STR) +{ + vty->index = gsmnet_from_vty(vty); + vty->node = GSMNET_NODE; + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_ncc, + cfg_net_ncc_cmd, + "network country code <1-999>", + "Set the GSM network country code\n" + "Country commands\n" + CODE_CMD_STR + "Network Country Code to use\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->country_code = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_mnc, + cfg_net_mnc_cmd, + "mobile network code <0-999>", + "Set the GSM mobile network code\n" + "Network Commands\n" + CODE_CMD_STR + "Mobile Network Code to use\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->network_code = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_name_short, + cfg_net_name_short_cmd, + "short name NAME", + "Set the short GSM network name\n" NAME_CMD_STR NAME_STR) +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]); + return CMD_SUCCESS; +} + +DEFUN(cfg_net_name_long, + cfg_net_name_long_cmd, + "long name NAME", + "Set the long GSM network name\n" NAME_CMD_STR NAME_STR) +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]); + return CMD_SUCCESS; +} + +DEFUN(cfg_net_auth_policy, + cfg_net_auth_policy_cmd, + "auth policy (closed|accept-all|regexp|token)", + "Authentication (not cryptographic)\n" + "Set the GSM network authentication policy\n" + "Require the MS to be activated in HLR\n" + "Accept all MS, whether in HLR or not\n" + "Use regular expression for IMSI authorization decision\n" + "Use SMS-token based authentication\n") +{ + enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]); + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->auth_policy = policy; + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_authorize_regexp, cfg_net_authorize_regexp_cmd, + "authorized-regexp REGEXP", + "Set regexp for IMSI which will be used for authorization decision\n" + "Regular expression, IMSIs matching it are allowed to use the network\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + if (gsm_parse_reg(gsmnet, &gsmnet->authorized_regexp, + &gsmnet->authorized_reg_str, argc, argv) != 0) { + vty_out(vty, "%%Failed to parse the authorized-regexp: '%s'%s", + argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_reject_cause, + cfg_net_reject_cause_cmd, + "location updating reject cause <2-111>", + "Set the reject cause of location updating reject\n" + "Set the reject cause of location updating reject\n" + "Set the reject cause of location updating reject\n" + "Set the reject cause of location updating reject\n" + "Cause Value as Per GSM TS 04.08\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->reject_cause = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_encryption, + cfg_net_encryption_cmd, + "encryption a5 (0|1|2|3)", + "Encryption options\n" + "A5 encryption\n" "A5/0: No encryption\n" + "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n" + "A5/3: 'New' Secure Encryption\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->a5_encryption= atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd, + "rrlp mode (none|ms-based|ms-preferred|ass-preferred)", + "Radio Resource Location Protocol\n" + "Set the Radio Resource Location Protocol Mode\n" + "Don't send RRLP request\n" + "Request MS-based location\n" + "Request any location, prefer MS-based\n" + "Request any location, prefer MS-assisted\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd, + "mm info (0|1)", + "Mobility Management\n" + "Send MM INFO after LOC UPD ACCEPT\n" + "Disable\n" "Enable\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->send_mm_info = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_subscr_keep, + cfg_net_subscr_keep_cmd, + "subscriber-keep-in-ram (0|1)", + "Keep unused subscribers in RAM.\n" + "Delete unused subscribers\n" "Keep unused subscribers\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + gsmnet->subscr_group->keep_subscr = atoi(argv[0]); + return CMD_SUCCESS; +} static struct gsm_network *vty_global_gsm_network = NULL; /* initialize VTY elements used in both BSC and MSC */ -int common_cs_vty_init(struct gsm_network *network) +int common_cs_vty_init(struct gsm_network *network, + int (* config_write_net )(struct vty *)) { OSMO_ASSERT(vty_global_gsm_network == NULL); vty_global_gsm_network = network; + + install_element(CONFIG_NODE, &cfg_net_cmd); + install_node(&net_node, config_write_net); + vty_install_default(GSMNET_NODE); + install_element(GSMNET_NODE, &cfg_net_ncc_cmd); + install_element(GSMNET_NODE, &cfg_net_mnc_cmd); + install_element(GSMNET_NODE, &cfg_net_name_short_cmd); + install_element(GSMNET_NODE, &cfg_net_name_long_cmd); + install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); + install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd); + install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd); + install_element(GSMNET_NODE, &cfg_net_encryption_cmd); + install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd); + install_element(GSMNET_NODE, &cfg_net_mm_info_cmd); + install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd); + + return CMD_SUCCESS; } struct gsm_network *gsmnet_from_vty(struct vty *v) -- To view, visit https://gerrit.osmocom.org/1134 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I871b7b32a0c56fdce983e409cf244ec487d24e71 Gerrit-PatchSet: 8 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 Fri Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: reinvent connection_for_subscr() and move to libmsc In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: reinvent connection_for_subscr() and move to libmsc ...................................................................... reinvent connection_for_subscr() and move to libmsc Implement connection_for_subscr() from a completely different angle: instead of looking up lchans in bts structs, look up the subscriber in the global list of gsm_subscriber_connection. static lchan_find() is thus obsoleted. All callers of connection_for_subscr() live in libmsc, so move to libmsc. The move and edit are done in a single commit since the old and new implementation have nothing in common. Future: osmo-cscn will use this, without bts being present. Remove implementation of connection_for_subscr() from channel_test.c -- it is possible that the abort() in there was intended for a regression test, but actually it seems the implementation was merely added for linking reasons, and the abort() added to guard against the NULL return value: no comment nor the commit log indicate that the abort() is test critical; the addition was the only change in channel_test.c for that commit; at the same time a connection_for_subscr() call was added in libmsc. Change-Id: I5e0ba0ecf1726ebd540800f4e98fdfc937c904ff --- M openbsc/src/libbsc/chan_alloc.c M openbsc/src/libmsc/gsm_subscriber.c M openbsc/tests/channel/channel_test.c 3 files changed, 14 insertions(+), 35 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 367139c..0f4d90a 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -481,39 +481,6 @@ return 1; } -static struct gsm_lchan* lchan_find(struct gsm_bts *bts, struct gsm_subscriber *subscr) { - struct gsm_bts_trx *trx; - int ts_no, lchan_no; - - llist_for_each_entry(trx, &bts->trx_list, list) { - for (ts_no = 0; ts_no < 8; ++ts_no) { - for (lchan_no = 0; lchan_no < TS_MAX_LCHAN; ++lchan_no) { - struct gsm_lchan *lchan = - &trx->ts[ts_no].lchan[lchan_no]; - if (lchan->conn && subscr == lchan->conn->subscr) - return lchan; - } - } - } - - return NULL; -} - -struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr) -{ - struct gsm_bts *bts; - struct gsm_network *net = subscr->group->net; - struct gsm_lchan *lchan; - - llist_for_each_entry(bts, &net->bts_list, list) { - lchan = lchan_find(bts, subscr); - if (lchan) - return lchan->conn; - } - - return NULL; -} - void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts) { struct gsm_bts_trx *trx; diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c index 08198c7..4ec0ead 100644 --- a/openbsc/src/libmsc/gsm_subscriber.c +++ b/openbsc/src/libmsc/gsm_subscriber.c @@ -374,3 +374,17 @@ { db_subscriber_expire(sgrp->net, subscr_expire_callback); } + +struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr) +{ + /* FIXME: replace this with a backpointer in gsm_subscriber? */ + struct gsm_network *net = subscr->group->net; + struct gsm_subscriber_connection *conn; + + llist_for_each_entry(conn, &net->subscr_conns, entry) { + if (conn->subscr == subscr) + return conn; + } + + return NULL; +} diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 351bb5a..c69c701 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -138,8 +138,6 @@ void gsm48_secure_channel() {} void paging_request_stop() {} void vty_out() {} -void* connection_for_subscr(void) { abort(); return NULL; } - struct tlv_definition nm_att_tlvdef; -- To view, visit https://gerrit.osmocom.org/1136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5e0ba0ecf1726ebd540800f4e98fdfc937c904ff Gerrit-PatchSet: 8 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 Fri Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: split subscr_con_allocate()/_free() in bsc_ and msc_ In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: split subscr_con_allocate()/_free() in bsc_ and msc_ ...................................................................... split subscr_con_allocate()/_free() in bsc_ and msc_ Rename current subscr_con_allocate() and subscr_con_free to bsc_*, and add two separate msc_subscr_con_allocate() and _free(). The msc_subscr_con_free() ignores all lchan members. In libbsc use bsc_*, in libmsc use msc_*. Change-Id: I3cf7c7cafdf4672ec7b26058bba8a77159855257 Future: there will be distinct subscr conns for libbsc and libmsc. --- M openbsc/include/openbsc/gsm_data.h M openbsc/src/libbsc/bsc_api.c M openbsc/src/libmsc/gsm_04_08.c M openbsc/src/libmsc/osmo_msc.c M openbsc/src/osmo-bsc/osmo_bsc_api.c M openbsc/src/osmo-bsc/osmo_bsc_bssap.c M openbsc/src/osmo-bsc/osmo_bsc_sccp.c 7 files changed, 42 insertions(+), 13 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 f820ba3..04d1126 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -522,8 +522,11 @@ int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat); int gsm_bts_model_register(struct gsm_bts_model *model); -struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan); -void subscr_con_free(struct gsm_subscriber_connection *conn); +struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan *lchan); +void bsc_subscr_con_free(struct gsm_subscriber_connection *conn); + +struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network); +void msc_subscr_con_free(struct gsm_subscriber_connection *conn); struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_type type, diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 207e12a..395002a 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -239,7 +239,7 @@ return 0; } -struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan) +struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan *lchan) { struct gsm_subscriber_connection *conn; struct gsm_network *net = lchan->ts->trx->bts->network; @@ -256,8 +256,7 @@ return conn; } -/* TODO: move subscriber put here... */ -void subscr_con_free(struct gsm_subscriber_connection *conn) +void bsc_subscr_con_free(struct gsm_subscriber_connection *conn) { if (!conn) return; @@ -682,7 +681,7 @@ } else { /* allocate a new connection */ rc = BSC_API_CONN_POL_REJECT; - lchan->conn = subscr_con_allocate(msg->lchan); + lchan->conn = bsc_subscr_con_allocate(msg->lchan); if (!lchan->conn) { lchan_release(lchan, 1, RSL_REL_NORMAL); return -1; @@ -693,7 +692,7 @@ if (rc != BSC_API_CONN_POL_ACCEPT) { lchan->conn->lchan = NULL; - subscr_con_free(lchan->conn); + bsc_subscr_con_free(lchan->conn); lchan_release(lchan, 1, RSL_REL_NORMAL); } } @@ -852,7 +851,7 @@ gsm0808_clear(conn); if (destruct) - subscr_con_free(conn); + bsc_subscr_con_free(conn); } static void handle_chan_ack(struct gsm_subscriber_connection *conn, diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index d10f8cf..34492bb 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -3683,6 +3683,33 @@ return 0; } +struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network) +{ + struct gsm_subscriber_connection *conn; + + conn = talloc_zero(network, struct gsm_subscriber_connection); + if (!conn) + return NULL; + + conn->network = network; + llist_add_tail(&conn->entry, &network->subscr_conns); + return conn; +} + +void msc_subscr_con_free(struct gsm_subscriber_connection *conn) +{ + if (!conn) + return; + + if (conn->subscr) { + subscr_put(conn->subscr); + conn->subscr = NULL; + } + + llist_del(&conn->entry); + talloc_free(conn); +} + /* Main entry point for GSM 04.08/44.008 Layer 3 data (e.g. from the BSC). */ int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg) { diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c index 604c100..12a5117 100644 --- a/openbsc/src/libmsc/osmo_msc.c +++ b/openbsc/src/libmsc/osmo_msc.c @@ -173,5 +173,5 @@ conn->in_release = 1; gsm0808_clear(conn); - subscr_con_free(conn); + msc_subscr_con_free(conn); } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c index 7a3ef70..49e5796 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_api.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c @@ -330,7 +330,7 @@ _conn->sccp_con = NULL; if (complete_layer3(_conn, msg, msc) != BSC_API_CONN_POL_ACCEPT) { gsm0808_clear(_conn); - subscr_con_free(_conn); + bsc_subscr_con_free(_conn); return 1; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c index a60940d..f38c97f 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c @@ -185,7 +185,7 @@ if (conn->conn) { LOGP(DMSC, LOGL_INFO, "Releasing all transactions on %p\n", conn); gsm0808_clear(conn->conn); - subscr_con_free(conn->conn); + bsc_subscr_con_free(conn->conn); conn->conn = NULL; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c index 2fafed6..a571438 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c @@ -84,7 +84,7 @@ LOGP(DMSC, LOGL_ERROR, "ERROR: The lchan is still associated.\n"); gsm0808_clear(con_data->conn); - subscr_con_free(con_data->conn); + bsc_subscr_con_free(con_data->conn); con_data->conn = NULL; } @@ -107,7 +107,7 @@ { if (data->conn) { gsm0808_clear(data->conn); - subscr_con_free(data->conn); + bsc_subscr_con_free(data->conn); data->conn = NULL; } -- To view, visit https://gerrit.osmocom.org/1139 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3cf7c7cafdf4672ec7b26058bba8a77159855257 Gerrit-PatchSet: 9 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 Fri Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: gsm_subscriber_connection: mark BSC specific items In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm_subscriber_connection: mark BSC specific items ...................................................................... gsm_subscriber_connection: mark BSC specific items This is intended to prepare for splitting gsm_subscriber_connection into BSC and MSC specific structs, to make the splitting patch more readable. Change-Id: Ib9666225fb9bfec2cf1e364343560571869fe6a7 --- M openbsc/include/openbsc/gsm_data.h 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Neels Hofmeyr: 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 04d1126..ac573c4 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -132,19 +132,19 @@ int mncc_rtp_connect_pending; /* bsc structures */ - struct osmo_bsc_sccp_con *sccp_con; + struct osmo_bsc_sccp_con *sccp_con; /* BSC */ /* back pointers */ struct gsm_network *network; int in_release; - struct gsm_lchan *lchan; - struct gsm_lchan *ho_lchan; - struct gsm_bts *bts; + struct gsm_lchan *lchan; /* BSC */ + struct gsm_lchan *ho_lchan; /* BSC */ + struct gsm_bts *bts; /* BSC */ /* for assignment handling */ - struct osmo_timer_list T10; - struct gsm_lchan *secondary_lchan; + struct osmo_timer_list T10; /* BSC */ + struct gsm_lchan *secondary_lchan; /* BSC */ }; -- To view, visit https://gerrit.osmocom.org/1142 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib9666225fb9bfec2cf1e364343560571869fe6a7 Gerrit-PatchSet: 9 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 Fri Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: sms_next_rp_msg_ref(): use direct pointer to next_rp_ref cou... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: sms_next_rp_msg_ref(): use direct pointer to next_rp_ref counter ...................................................................... sms_next_rp_msg_ref(): use direct pointer to next_rp_ref counter libbsc and libmsc will have separate subscriber connection structs. Hence don't rely on gsm_subscriber_connection, but work on a direct pointer to the counter for the next RP reference. The only very thin function in gsm_04_11_helper.c thus becomes obsolete: drop the entire file. Change-Id: I2a2e9ba6a981a385d1f8f07acbe03536ffed0072 --- M openbsc/include/openbsc/gsm_04_11.h M openbsc/src/libcommon-cs/common_cs.c M openbsc/src/libmsc/Makefile.am M openbsc/src/libmsc/gsm_04_11.c D openbsc/src/libmsc/gsm_04_11_helper.c M openbsc/tests/gsm0408/gsm0408_test.c 6 files changed, 20 insertions(+), 43 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_04_11.h b/openbsc/include/openbsc/gsm_04_11.h index 00c3a19..149de90 100644 --- a/openbsc/include/openbsc/gsm_04_11.h +++ b/openbsc/include/openbsc/gsm_04_11.h @@ -38,5 +38,5 @@ struct gsm_sms *sms); void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn); -uint8_t sms_next_rp_msg_ref(struct gsm_subscriber_connection *conn); +uint8_t sms_next_rp_msg_ref(uint8_t *next_rp_ref); #endif diff --git a/openbsc/src/libcommon-cs/common_cs.c b/openbsc/src/libcommon-cs/common_cs.c index 8d09b7e..3149580 100644 --- a/openbsc/src/libcommon-cs/common_cs.c +++ b/openbsc/src/libcommon-cs/common_cs.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include /* Warning: if bsc_network_init() is not called, some of the members of * gsm_network are not initialized properly and must not be used! (In @@ -113,3 +115,16 @@ gh->data[0] = cause; return msg; } + +uint8_t sms_next_rp_msg_ref(uint8_t *next_rp_ref) +{ + const uint8_t rp_msg_ref = *next_rp_ref; + /* + * This should wrap as the valid range is 0 to 255. We only + * transfer one SMS at a time so we don't need to check if + * the id has been already assigned. + */ + *next_rp_ref += 1; + + return rp_msg_ref; +} diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index d236d3a..9d966db 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -27,7 +27,6 @@ db.c \ gsm_04_08.c \ gsm_04_11.c \ - gsm_04_11_helper.c \ gsm_04_80.c \ gsm_subscriber.c \ mncc.c \ diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index 3a2effe..48a87e0 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -873,7 +873,7 @@ struct msgb *msg = gsm411_msgb_alloc(); struct gsm_trans *trans; uint8_t *data, *rp_ud_len; - uint8_t msg_ref = sms_next_rp_msg_ref(conn); + uint8_t msg_ref = sms_next_rp_msg_ref(&conn->next_rp_ref); int transaction_id; int rc; diff --git a/openbsc/src/libmsc/gsm_04_11_helper.c b/openbsc/src/libmsc/gsm_04_11_helper.c deleted file mode 100644 index f48c6de..0000000 --- a/openbsc/src/libmsc/gsm_04_11_helper.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Helpers for SMS/GSM 04.11 */ -/* - * (C) 2014 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 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 - -uint8_t sms_next_rp_msg_ref(struct gsm_subscriber_connection *conn) -{ - const uint8_t rp_msg_ref = conn->next_rp_ref; - /* - * This should wrap as the valid range is 0 to 255. We only - * transfer one SMS at a time so we don't need to check if - * the id has been already assigned. - */ - conn->next_rp_ref += 1; - - return rp_msg_ref; -} - diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 0c7b5ce..9e7babb 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -563,15 +563,15 @@ memset(&conn, 0, sizeof(conn)); conn.next_rp_ref = 255; - res = sms_next_rp_msg_ref(&conn); + res = sms_next_rp_msg_ref(&conn.next_rp_ref); printf("Allocated reference: %d\n", res); OSMO_ASSERT(res == 255); - res = sms_next_rp_msg_ref(&conn); + res = sms_next_rp_msg_ref(&conn.next_rp_ref); printf("Allocated reference: %d\n", res); OSMO_ASSERT(res == 0); - res = sms_next_rp_msg_ref(&conn); + res = sms_next_rp_msg_ref(&conn.next_rp_ref); printf("Allocated reference: %d\n", res); OSMO_ASSERT(res == 1); } -- To view, visit https://gerrit.osmocom.org/1131 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2a2e9ba6a981a385d1f8f07acbe03536ffed0072 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 Fri Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: Move timezone settings up to network level In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Move timezone settings up to network level ...................................................................... Move timezone settings up to network level Time zone used to be configurable per-BTS. In the upcoming MSC-split, no BTS structures will be available on the MSC level. To simplify, drop the ability to manage several time zones in a core network and place the time zone config on the network VTY level, i.e. in gsm_network. If we are going to re-add fine grained time zone settings, it should probably be tied to the LAC. Adjust time zone VTY config code (to be moved to libcommon-cs in subsequent commit). Adjust time zone Ctrl Interface code. Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8 --- M openbsc/include/openbsc/gsm_data.h M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libmsc/gsm_04_08.c M openbsc/src/osmo-bsc/osmo_bsc_ctrl.c M openbsc/src/osmo-bsc/osmo_bsc_filter.c M openbsc/tests/bsc/bsc_test.c M openbsc/tests/ctrl_test_runner.py M openbsc/tests/vty_test_runner.py 9 files changed, 98 insertions(+), 99 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 d4a4d6d..f820ba3 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -273,6 +273,13 @@ #define GSM_T3113_DEFAULT 60 #define GSM_T3122_DEFAULT 10 +struct gsm_tz { + int override; /* if 0, use system's time zone instead. */ + int hr; /* hour */ + int mn; /* minute */ + int dst; /* daylight savings */ +}; + struct gsm_network { /* global parameters */ uint16_t country_code; @@ -367,6 +374,13 @@ /* all active subscriber connections. */ struct llist_head subscr_conns; + + /* if override is nonzero, this timezone data is used for all MM + * contexts. */ + /* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable + * BTS|RNC specific timezone overrides for multi-tz networks in + * OsmoCSCN, this should be tied to the location area code (LAC). */ + struct gsm_tz tz; }; struct osmo_esme; diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index af79485..4ec4f69 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -679,14 +679,6 @@ /* buffers where we put the pre-computed SI */ sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE]; - /* TimeZone hours, mins, and bts specific */ - struct { - int hr; - int mn; - int override; - int dst; - } tz; - /* ip.accesss Unit ID's have Site/BTS/TRX layout */ union { struct { diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index e3f0464..7afa8e1 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -554,14 +554,6 @@ if (bts->dtxd) vty_out(vty, " dtx downlink%s", VTY_NEWLINE); vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); - if (bts->tz.override != 0) { - if (bts->tz.dst) - vty_out(vty, " timezone %d %d %d%s", - bts->tz.hr, bts->tz.mn, bts->tz.dst, VTY_NEWLINE); - else - vty_out(vty, " timezone %d %d%s", - bts->tz.hr, bts->tz.mn, VTY_NEWLINE); - } vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE); vty_out(vty, " cell reselection hysteresis %u%s", bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); @@ -817,6 +809,15 @@ vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); vty_out(vty, " subscriber-keep-in-ram %d%s", gsmnet->subscr_group->keep_subscr, VTY_NEWLINE); + if (gsmnet->tz.override != 0) { + if (gsmnet->tz.dst) + vty_out(vty, " timezone %d %d %d%s", + gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst, + VTY_NEWLINE); + else + vty_out(vty, " timezone %d %d%s", + gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE); + } return CMD_SUCCESS; } @@ -1735,10 +1736,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_bts_timezone, - cfg_bts_timezone_cmd, +DEFUN(cfg_net_timezone, + cfg_net_timezone_cmd, "timezone <-19-19> (0|15|30|45)", - "Set the Timezone Offset of this BTS\n" + "Set the Timezone Offset of the network\n" "Timezone offset (hours)\n" "Timezone offset (00 minutes)\n" "Timezone offset (15 minutes)\n" @@ -1746,22 +1747,22 @@ "Timezone offset (45 minutes)\n" ) { - struct gsm_bts *bts = vty->index; + struct gsm_network *net = vty->index; int tzhr = atoi(argv[0]); int tzmn = atoi(argv[1]); - bts->tz.hr = tzhr; - bts->tz.mn = tzmn; - bts->tz.dst = 0; - bts->tz.override = 1; + net->tz.hr = tzhr; + net->tz.mn = tzmn; + net->tz.dst = 0; + net->tz.override = 1; return CMD_SUCCESS; } -DEFUN(cfg_bts_timezone_dst, - cfg_bts_timezone_dst_cmd, +DEFUN(cfg_net_timezone_dst, + cfg_net_timezone_dst_cmd, "timezone <-19-19> (0|15|30|45) <0-2>", - "Set the Timezone Offset of this BTS\n" + "Set the Timezone Offset of the network\n" "Timezone offset (hours)\n" "Timezone offset (00 minutes)\n" "Timezone offset (15 minutes)\n" @@ -1770,28 +1771,28 @@ "DST offset (hours)\n" ) { - struct gsm_bts *bts = vty->index; + struct gsm_network *net = vty->index; int tzhr = atoi(argv[0]); int tzmn = atoi(argv[1]); int tzdst = atoi(argv[2]); - bts->tz.hr = tzhr; - bts->tz.mn = tzmn; - bts->tz.dst = tzdst; - bts->tz.override = 1; + net->tz.hr = tzhr; + net->tz.mn = tzmn; + net->tz.dst = tzdst; + net->tz.override = 1; return CMD_SUCCESS; } -DEFUN(cfg_bts_no_timezone, - cfg_bts_no_timezone_cmd, +DEFUN(cfg_net_no_timezone, + cfg_net_no_timezone_cmd, "no timezone", NO_STR - "Disable BTS specific timezone\n") + "Disable network timezone override, use system tz\n") { - struct gsm_bts *bts = vty->index; + struct gsm_network *net = vty->index; - bts->tz.override = 0; + net->tz.override = 0; return CMD_SUCCESS; } @@ -3949,6 +3950,9 @@ install_element(GSMNET_NODE, &cfg_net_T3141_cmd); install_element(GSMNET_NODE, &cfg_net_dtx_cmd); install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); + 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_bts_cmd); install_node(&bts_node, config_write_bts); @@ -3967,9 +3971,6 @@ install_element(BTS_NODE, &cfg_bts_bsic_cmd); install_element(BTS_NODE, &cfg_bts_unit_id_cmd); install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd); - install_element(BTS_NODE, &cfg_bts_timezone_cmd); - install_element(BTS_NODE, &cfg_bts_timezone_dst_cmd); - install_element(BTS_NODE, &cfg_bts_no_timezone_cmd); install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd); install_element(BTS_NODE, &cfg_bts_nokia_site_no_loc_rel_cnf_cmd); install_element(BTS_NODE, &cfg_bts_nokia_site_bts_reset_timer_cnf_cmd); diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 3e362fa..d10f8cf 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -733,7 +733,6 @@ struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 MM INF"); struct gsm48_hdr *gh; struct gsm_network *net = conn->network; - struct gsm_bts *bts = conn->bts; uint8_t *ptr8; int name_len, name_pad; @@ -821,23 +820,23 @@ ptr8[5] = bcdify(gmt_time->tm_min); ptr8[6] = bcdify(gmt_time->tm_sec); - if (bts->tz.override) { + if (net->tz.override) { /* Convert tz.hr and tz.mn to units */ - if (bts->tz.hr < 0) { - tzunits = ((bts->tz.hr/-1)*4); - tzunits = tzunits + (bts->tz.mn/15); + if (net->tz.hr < 0) { + tzunits = ((net->tz.hr/-1)*4); + tzunits = tzunits + (net->tz.mn/15); ptr8[7] = bcdify(tzunits); /* Set negative time */ ptr8[7] |= 0x08; } else { - tzunits = bts->tz.hr*4; - tzunits = tzunits + (bts->tz.mn/15); + tzunits = net->tz.hr*4; + tzunits = tzunits + (net->tz.mn/15); ptr8[7] = bcdify(tzunits); } /* Convert DST value */ - if (bts->tz.dst >= 0 && bts->tz.dst <= 2) - dst = bts->tz.dst; + if (net->tz.dst >= 0 && net->tz.dst <= 2) + dst = net->tz.dst; } else { /* Need to get GSM offset and convert into 15 min units */ diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index 40e1960..f10a74a 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -362,18 +362,15 @@ return 1; } -CTRL_CMD_DEFINE(bts_timezone, "timezone"); -static int get_bts_timezone(struct ctrl_cmd *cmd, void *data) +CTRL_CMD_DEFINE(net_timezone, "timezone"); +static int get_net_timezone(struct ctrl_cmd *cmd, void *data) { - struct gsm_bts *bts = (struct gsm_bts *) cmd->node; - if (!bts) { - cmd->reply = "bts not found."; - return CTRL_CMD_ERROR; - } + struct gsm_network *net = (struct gsm_network*)cmd->node; - if (bts->tz.override) + struct gsm_tz *tz = &net->tz; + if (tz->override) cmd->reply = talloc_asprintf(cmd, "%d,%d,%d", - bts->tz.hr, bts->tz.mn, bts->tz.dst); + tz->hr, tz->mn, tz->dst); else cmd->reply = talloc_asprintf(cmd, "off"); @@ -385,16 +382,11 @@ return CTRL_CMD_REPLY; } -static int set_bts_timezone(struct ctrl_cmd *cmd, void *data) +static int set_net_timezone(struct ctrl_cmd *cmd, void *data) { char *saveptr, *hourstr, *minstr, *dststr, *tmp = 0; int override; - struct gsm_bts *bts = (struct gsm_bts *) cmd->node; - - if (!bts) { - cmd->reply = "bts not found."; - return CTRL_CMD_ERROR; - } + struct gsm_network *net = (struct gsm_network*)cmd->node; tmp = talloc_strdup(cmd, cmd->value); if (!tmp) @@ -409,25 +401,26 @@ if (hourstr != NULL) override = strcasecmp(hourstr, "off") != 0; - bts->tz.override = override; + struct gsm_tz *tz = &net->tz; + tz->override = override; if (override) { - bts->tz.hr = hourstr ? atol(hourstr) : 0; - bts->tz.mn = minstr ? atol(minstr) : 0; - bts->tz.dst = dststr ? atol(dststr) : 0; + tz->hr = hourstr ? atol(hourstr) : 0; + tz->mn = minstr ? atol(minstr) : 0; + tz->dst = dststr ? atol(dststr) : 0; } talloc_free(tmp); tmp = NULL; - return get_bts_timezone(cmd, data); + return get_net_timezone(cmd, data); oom: cmd->reply = "OOM"; return CTRL_CMD_ERROR; } -static int verify_bts_timezone(struct ctrl_cmd *cmd, const char *value, void *data) +static int verify_net_timezone(struct ctrl_cmd *cmd, const char *value, void *data) { char *saveptr, *hourstr, *minstr, *dststr, *tmp; int override, tz_hours, tz_mins, tz_dst; @@ -655,7 +648,7 @@ rc = ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_loc); if (rc) goto end; - rc = ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_timezone); + rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timezone); if (rc) goto end; rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_msc_connection_status); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c index 66c6406..d5ca2fd 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_filter.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_filter.c @@ -270,23 +270,24 @@ return 0; /* Is TZ patching enabled? */ - if (!bts->tz.override) + struct gsm_tz *tz = &bts->network->tz; + if (!tz->override) return 0; /* Convert tz.hr and tz.mn to units */ - if (bts->tz.hr < 0) { - tzunits = -bts->tz.hr*4; + if (tz->hr < 0) { + tzunits = -tz->hr*4; tzbsd |= 0x08; } else - tzunits = bts->tz.hr*4; + tzunits = tz->hr*4; - tzunits = tzunits + (bts->tz.mn/15); + tzunits = tzunits + (tz->mn/15); tzbsd |= (tzunits % 10)*0x10 + (tzunits / 10); /* Convert DST value */ - if (bts->tz.dst >= 0 && bts->tz.dst <= 2) - dst = bts->tz.dst; + if (tz->dst >= 0 && tz->dst <= 2) + dst = tz->dst; if (TLVP_PRESENT(&tp, GSM48_IE_UTC)) { LOGP(DMSC, LOGL_DEBUG, diff --git a/openbsc/tests/bsc/bsc_test.c b/openbsc/tests/bsc/bsc_test.c index 6d41941..7174828 100644 --- a/openbsc/tests/bsc/bsc_test.c +++ b/openbsc/tests/bsc/bsc_test.c @@ -147,10 +147,10 @@ struct msgb *msg = msgb_alloc(4096, "test-message"); int is_set = 0; - bts->tz.hr = get_int(test_def->params, test_def->n_params, "tz_hr", 0, &is_set); - bts->tz.mn = get_int(test_def->params, test_def->n_params, "tz_mn", 0, &is_set); - bts->tz.dst = get_int(test_def->params, test_def->n_params, "tz_dst", 0, &is_set); - bts->tz.override = 1; + net->tz.hr = get_int(test_def->params, test_def->n_params, "tz_hr", 0, &is_set); + net->tz.mn = get_int(test_def->params, test_def->n_params, "tz_mn", 0, &is_set); + net->tz.dst = get_int(test_def->params, test_def->n_params, "tz_dst", 0, &is_set); + net->tz.override = 1; printf("Going to test item: %d\n", i); msg->l3h = msgb_put(msg, test_def->length); diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py index bed685a..4fd831f 100644 --- a/openbsc/tests/ctrl_test_runner.py +++ b/openbsc/tests/ctrl_test_runner.py @@ -331,41 +331,41 @@ self.assertEquals(r['value'], 'state=off,policy=on') def testTimezone(self): - r = self.do_get('bts.0.timezone') + r = self.do_get('timezone') self.assertEquals(r['mtype'], 'GET_REPLY') - self.assertEquals(r['var'], 'bts.0.timezone') + self.assertEquals(r['var'], 'timezone') self.assertEquals(r['value'], 'off') - r = self.do_set('bts.0.timezone', '-2,15,2') + r = self.do_set('timezone', '-2,15,2') self.assertEquals(r['mtype'], 'SET_REPLY') - self.assertEquals(r['var'], 'bts.0.timezone') + self.assertEquals(r['var'], 'timezone') self.assertEquals(r['value'], '-2,15,2') - r = self.do_get('bts.0.timezone') + r = self.do_get('timezone') self.assertEquals(r['mtype'], 'GET_REPLY') - self.assertEquals(r['var'], 'bts.0.timezone') + self.assertEquals(r['var'], 'timezone') self.assertEquals(r['value'], '-2,15,2') # Test invalid input - r = self.do_set('bts.0.timezone', '-2,15,2,5,6,7') + r = self.do_set('timezone', '-2,15,2,5,6,7') self.assertEquals(r['mtype'], 'SET_REPLY') - self.assertEquals(r['var'], 'bts.0.timezone') + self.assertEquals(r['var'], 'timezone') self.assertEquals(r['value'], '-2,15,2') - r = self.do_set('bts.0.timezone', '-2,15') + r = self.do_set('timezone', '-2,15') self.assertEquals(r['mtype'], 'ERROR') - r = self.do_set('bts.0.timezone', '-2') + r = self.do_set('timezone', '-2') self.assertEquals(r['mtype'], 'ERROR') - r = self.do_set('bts.0.timezone', '1') + r = self.do_set('timezone', '1') - r = self.do_set('bts.0.timezone', 'off') + r = self.do_set('timezone', 'off') self.assertEquals(r['mtype'], 'SET_REPLY') - self.assertEquals(r['var'], 'bts.0.timezone') + self.assertEquals(r['var'], 'timezone') self.assertEquals(r['value'], 'off') - r = self.do_get('bts.0.timezone') + r = self.do_get('timezone') self.assertEquals(r['mtype'], 'GET_REPLY') - self.assertEquals(r['var'], 'bts.0.timezone') + self.assertEquals(r['var'], 'timezone') self.assertEquals(r['value'], 'off') def testMcc(self): diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index a73dadd..cf2cf18 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -651,7 +651,6 @@ self.vty.enable() self.vty.verify("configure terminal", ['']) self.vty.verify("network", ['']) - self.vty.verify("bts 0", ['']) # Test invalid input self.vty.verify("timezone", ['% Command incomplete.']) -- To view, visit https://gerrit.osmocom.org/1137 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8 Gerrit-PatchSet: 9 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 Dec 2 12:09:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:18 +0000 Subject: [MERGED] openbsc[master]: tests: drop unused libmsc, unneeded duplicate libbsc linking In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: tests: drop unused libmsc, unneeded duplicate libbsc linking ...................................................................... tests: drop unused libmsc, unneeded duplicate libbsc linking Because of libcommon-cs, tests/gsm0408,subscr,trau no longer need libmsc. Change-Id: I9073eba41a1cd3136ed7a9def6fe8aaf282eaa18 --- M openbsc/tests/gsm0408/Makefile.am M openbsc/tests/subscr/Makefile.am M openbsc/tests/trau/Makefile.am 3 files changed, 0 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/gsm0408/Makefile.am b/openbsc/tests/gsm0408/Makefile.am index 9739ee9..ae81c2c 100644 --- a/openbsc/tests/gsm0408/Makefile.am +++ b/openbsc/tests/gsm0408/Makefile.am @@ -24,7 +24,6 @@ gsm0408_test_LDADD = \ $(top_builddir)/src/libbsc/libbsc.a \ - $(top_builddir)/src/libmsc/libmsc.a \ $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ $(top_builddir)/src/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ diff --git a/openbsc/tests/subscr/Makefile.am b/openbsc/tests/subscr/Makefile.am index 52e7947..ad8b20c 100644 --- a/openbsc/tests/subscr/Makefile.am +++ b/openbsc/tests/subscr/Makefile.am @@ -31,8 +31,6 @@ subscr_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/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ diff --git a/openbsc/tests/trau/Makefile.am b/openbsc/tests/trau/Makefile.am index a446f79..1d014ba 100644 --- a/openbsc/tests/trau/Makefile.am +++ b/openbsc/tests/trau/Makefile.am @@ -31,8 +31,6 @@ trau_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/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ -- To view, visit https://gerrit.osmocom.org/1132 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9073eba41a1cd3136ed7a9def6fe8aaf282eaa18 Gerrit-PatchSet: 8 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 Fri Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: global gsm_network: move allocation further up In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: global gsm_network: move allocation further up ...................................................................... global gsm_network: move allocation further up Now that bsc_network_alloc() is separate, move it to before the VTY init (a subsequent patch will pass the gsm_network instance as a parameter to vty_init()). bsc_hack.c: drop the comment that says about the VTY init: "This needs to precede handle_options()" -- it is not accurate. Actually move the handle_options() above both vty_init() and the bsc_network_alloc() calls, to be able to decide which mncc callback to pass to bsc_network_alloc. It would make sense to set this later on, but that would require further refactoring of the bsc_network_init() and gsm_network_init() signatures, so not in this patch. Change-Id: Ie6a7037e703b5a2d08ceeb20d35f197aaddc9d1b --- M openbsc/src/osmo-bsc/osmo_bsc_main.c M openbsc/src/osmo-nitb/bsc_hack.c 2 files changed, 25 insertions(+), 23 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index b6b1ae1..1d96bb4 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -194,6 +194,13 @@ tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc"); msgb_talloc_ctx_init(tall_bsc_ctx, 0); + /* Allocate global gsm_network struct */ + rc = bsc_network_alloc(NULL); + if (rc) { + fprintf(stderr, "Allocation failed. exiting.\n"); + exit(1); + } + osmo_init_logging(&log_info); osmo_stats_init(tall_bsc_ctx); @@ -220,11 +227,7 @@ /* initialize SCCP */ sccp_set_log_area(DSCCP); - rc = bsc_network_alloc(NULL); - if (rc) { - fprintf(stderr, "Allocation failed. exiting.\n"); - exit(1); - } + /* Read the config */ rc = bsc_network_configure(config_file); if (rc < 0) { fprintf(stderr, "Bootstrapping the network failed. exiting.\n"); diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index ccd3b74..c3ecf4c 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -270,7 +270,18 @@ osmo_stats_init(tall_bsc_ctx); bts_init(); - /* This needs to precede handle_options() */ + /* Parse options */ + handle_options(argc, argv); + + /* Allocate global gsm_network struct; choose socket/internal MNCC */ + rc = bsc_network_alloc(mncc_sock_path? + mncc_sock_from_cc : int_mncc_recv); + if (rc) { + fprintf(stderr, "Allocation failed. Exiting.\n"); + exit(1); + } + + /* Initialize VTY */ vty_init(&vty_info); bsc_vty_init(&log_info, bsc_gsmnet); ctrl_vty_init(tall_bsc_ctx); @@ -280,25 +291,13 @@ return -1; #endif - /* parse options */ - handle_options(argc, argv); - - /* internal MNCC handler or MNCC socket? */ - if (mncc_sock_path) { - rc = bsc_network_alloc(mncc_sock_from_cc); - if (rc) { - fprintf(stderr, "Allocation failed. Exiting.\n"); - exit(1); - } + /* Initialize MNCC socket if appropriate */ + if (mncc_sock_path) mncc_sock_init(bsc_gsmnet, mncc_sock_path); - } else { + else DEBUGP(DMNCC, "Using internal MNCC handler.\n"); - rc = bsc_network_alloc(int_mncc_recv); - if (rc) { - fprintf(stderr, "Allocation failed. Exiting.\n"); - exit(1); - } - } + + /* Read the config */ rc = bsc_network_configure(config_file); if (rc < 0) { fprintf(stderr, "Reading config failed. Exiting.\n"); -- To view, visit https://gerrit.osmocom.org/1150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie6a7037e703b5a2d08ceeb20d35f197aaddc9d1b Gerrit-PatchSet: 6 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 Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: move to libcommon-cs: net timezone VTY config In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: move to libcommon-cs: net timezone VTY config ...................................................................... move to libcommon-cs: net timezone VTY config Leave the timezone VTY output in libbsc's config_write_net(), until the BSC/MSC separation of struct gsm_network is completed. Change-Id: I9712b2e07b4f1ab8d2e4ad40a8d771e98ed25b20 --- M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon-cs/common_cs_vty.c 2 files changed, 64 insertions(+), 64 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 7afa8e1..b9519b4 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1736,67 +1736,6 @@ return CMD_SUCCESS; } -DEFUN(cfg_net_timezone, - cfg_net_timezone_cmd, - "timezone <-19-19> (0|15|30|45)", - "Set the Timezone Offset of the network\n" - "Timezone offset (hours)\n" - "Timezone offset (00 minutes)\n" - "Timezone offset (15 minutes)\n" - "Timezone offset (30 minutes)\n" - "Timezone offset (45 minutes)\n" - ) -{ - struct gsm_network *net = vty->index; - int tzhr = atoi(argv[0]); - int tzmn = atoi(argv[1]); - - net->tz.hr = tzhr; - net->tz.mn = tzmn; - net->tz.dst = 0; - net->tz.override = 1; - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_timezone_dst, - cfg_net_timezone_dst_cmd, - "timezone <-19-19> (0|15|30|45) <0-2>", - "Set the Timezone Offset of the network\n" - "Timezone offset (hours)\n" - "Timezone offset (00 minutes)\n" - "Timezone offset (15 minutes)\n" - "Timezone offset (30 minutes)\n" - "Timezone offset (45 minutes)\n" - "DST offset (hours)\n" - ) -{ - struct gsm_network *net = vty->index; - int tzhr = atoi(argv[0]); - int tzmn = atoi(argv[1]); - int tzdst = atoi(argv[2]); - - net->tz.hr = tzhr; - net->tz.mn = tzmn; - net->tz.dst = tzdst; - net->tz.override = 1; - - return CMD_SUCCESS; -} - -DEFUN(cfg_net_no_timezone, - cfg_net_no_timezone_cmd, - "no timezone", - NO_STR - "Disable network timezone override, use system tz\n") -{ - struct gsm_network *net = vty->index; - - net->tz.override = 0; - - return CMD_SUCCESS; -} - DEFUN(cfg_bts_unit_id, cfg_bts_unit_id_cmd, "ip.access unit_id <0-65534> <0-255>", @@ -3950,9 +3889,6 @@ install_element(GSMNET_NODE, &cfg_net_T3141_cmd); install_element(GSMNET_NODE, &cfg_net_dtx_cmd); install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); - 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_bts_cmd); install_node(&bts_node, config_write_bts); diff --git a/openbsc/src/libcommon-cs/common_cs_vty.c b/openbsc/src/libcommon-cs/common_cs_vty.c index bab3712..7f8b495 100644 --- a/openbsc/src/libcommon-cs/common_cs_vty.c +++ b/openbsc/src/libcommon-cs/common_cs_vty.c @@ -208,6 +208,67 @@ return CMD_SUCCESS; } +DEFUN(cfg_net_timezone, + cfg_net_timezone_cmd, + "timezone <-19-19> (0|15|30|45)", + "Set the Timezone Offset of the network\n" + "Timezone offset (hours)\n" + "Timezone offset (00 minutes)\n" + "Timezone offset (15 minutes)\n" + "Timezone offset (30 minutes)\n" + "Timezone offset (45 minutes)\n" + ) +{ + struct gsm_network *net = vty->index; + int tzhr = atoi(argv[0]); + int tzmn = atoi(argv[1]); + + net->tz.hr = tzhr; + net->tz.mn = tzmn; + net->tz.dst = 0; + net->tz.override = 1; + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_timezone_dst, + cfg_net_timezone_dst_cmd, + "timezone <-19-19> (0|15|30|45) <0-2>", + "Set the Timezone Offset of the network\n" + "Timezone offset (hours)\n" + "Timezone offset (00 minutes)\n" + "Timezone offset (15 minutes)\n" + "Timezone offset (30 minutes)\n" + "Timezone offset (45 minutes)\n" + "DST offset (hours)\n" + ) +{ + struct gsm_network *net = vty->index; + int tzhr = atoi(argv[0]); + int tzmn = atoi(argv[1]); + int tzdst = atoi(argv[2]); + + net->tz.hr = tzhr; + net->tz.mn = tzmn; + net->tz.dst = tzdst; + net->tz.override = 1; + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_no_timezone, + cfg_net_no_timezone_cmd, + "no timezone", + NO_STR + "Disable network timezone override, use system tz\n") +{ + struct gsm_network *net = vty->index; + + net->tz.override = 0; + + return CMD_SUCCESS; +} + static struct gsm_network *vty_global_gsm_network = NULL; /* initialize VTY elements used in both BSC and MSC */ @@ -231,6 +292,9 @@ install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd); install_element(GSMNET_NODE, &cfg_net_mm_info_cmd); install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd); + 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); return CMD_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/1138 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9712b2e07b4f1ab8d2e4ad40a8d771e98ed25b20 Gerrit-PatchSet: 9 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 Fri Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: osmo-nitb: exit when MNCC socket init failed In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: osmo-nitb: exit when MNCC socket init failed ...................................................................... osmo-nitb: exit when MNCC socket init failed Change-Id: Icef97bb5da9840b810fe6f4b4da6abd4baa66915 --- M openbsc/src/osmo-nitb/bsc_hack.c 1 file changed, 7 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index c3ecf4c..992d4c8 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -292,9 +292,13 @@ #endif /* Initialize MNCC socket if appropriate */ - if (mncc_sock_path) - mncc_sock_init(bsc_gsmnet, mncc_sock_path); - else + if (mncc_sock_path) { + rc = mncc_sock_init(bsc_gsmnet, mncc_sock_path); + if (rc) { + fprintf(stderr, "MNCC socket initialization failed. exiting.\n"); + exit(1); + } + } else DEBUGP(DMNCC, "Using internal MNCC handler.\n"); /* Read the config */ -- To view, visit https://gerrit.osmocom.org/1141 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icef97bb5da9840b810fe6f4b4da6abd4baa66915 Gerrit-PatchSet: 9 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 Fri Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: bsc vty: rename show_net_cmd to bsc_show_net_cmd In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bsc vty: rename show_net_cmd to bsc_show_net_cmd ...................................................................... bsc vty: rename show_net_cmd to bsc_show_net_cmd Future: there will be an MSC-land show-net-cmd, so rename to something with bsc in its name. Change-Id: Ifb86698cd57a09f03b935b6d3fcea87eff4cd397 --- M openbsc/src/libbsc/bsc_vty.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index d7d62bb..e3f0464 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -205,7 +205,7 @@ VTY_NEWLINE); } -DEFUN(show_net, show_net_cmd, "show network", +DEFUN(bsc_show_net, bsc_show_net_cmd, "show network", SHOW_STR "Display information about a GSM NETWORK\n") { struct gsm_network *net = gsmnet_from_vty(vty); @@ -3914,7 +3914,7 @@ common_cs_vty_init(network, config_write_net); - install_element_ve(&show_net_cmd); + install_element_ve(&bsc_show_net_cmd); install_element_ve(&show_bts_cmd); install_element_ve(&show_trx_cmd); install_element_ve(&show_ts_cmd); -- To view, visit https://gerrit.osmocom.org/1135 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifb86698cd57a09f03b935b6d3fcea87eff4cd397 Gerrit-PatchSet: 8 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 Fri Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: split bsc_bootstrap_network() in alloc and config In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: split bsc_bootstrap_network() in alloc and config ...................................................................... split bsc_bootstrap_network() in alloc and config For patch clarity, keep some code dup to be removed in a subsequent patch. In the same sense don't change the fact that mncc_sock_init()'s return value is ignored. The global gsm_network instance 'bsc_gsmnet' is basically only used by the VTY, and a future patch will "hide" that global in a vty .c file. In a nutshell, I want to - first allocate a gsm_network, - then initialize the VTY passing the gsm_network pointer, - and then read the config file using the initialized VTY. So far, bsc_bootstrap_network() allocates the gsm_network and reads the config file right away, which only works by sharing the extern bsc_gsmnet pointer, which I would like to uncouple. Change-Id: I480a09a31a79766ad07b627dd5238b7e37f3be7a --- M openbsc/include/openbsc/bss.h M openbsc/src/libbsc/bsc_init.c M openbsc/src/osmo-bsc/osmo_bsc_main.c M openbsc/src/osmo-nitb/bsc_hack.c 4 files changed, 33 insertions(+), 13 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/bss.h b/openbsc/include/openbsc/bss.h index d73776f..9f16bf7 100644 --- a/openbsc/include/openbsc/bss.h +++ b/openbsc/include/openbsc/bss.h @@ -6,7 +6,8 @@ struct msgb; /* start and stop network */ -extern int bsc_bootstrap_network(mncc_recv_cb_t mncc_recv, const char *cfg_file); +extern int bsc_network_alloc(mncc_recv_cb_t mncc_recv); +extern int bsc_network_configure(const char *cfg_file); extern int bsc_shutdown_net(struct gsm_network *net); /* register all supported BTS */ diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 917dd73..9e913d6 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -476,12 +476,8 @@ return 0; } -int bsc_bootstrap_network(mncc_recv_cb_t mncc_recv, const char *config_file) +int bsc_network_alloc(mncc_recv_cb_t mncc_recv) { - struct gsm_bts *bts; - int rc; - - /* initialize our data structures */ bsc_gsmnet = bsc_network_init(tall_bsc_ctx, 1, 1, mncc_recv); if (!bsc_gsmnet) return -ENOMEM; @@ -489,6 +485,14 @@ bsc_gsmnet->name_long = talloc_strdup(bsc_gsmnet, "OpenBSC"); bsc_gsmnet->name_short = talloc_strdup(bsc_gsmnet, "OpenBSC"); + return 0; +} + +int bsc_network_configure(const char *config_file) +{ + struct gsm_bts *bts; + int rc; + rc = vty_read_config_file(config_file, NULL); if (rc < 0) { LOGP(DNM, LOGL_FATAL, "Failed to parse the config file: '%s'\n", config_file); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index daab55b..b6b1ae1 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -220,8 +220,12 @@ /* initialize SCCP */ sccp_set_log_area(DSCCP); - - rc = bsc_bootstrap_network(NULL, config_file); + rc = bsc_network_alloc(NULL); + if (rc) { + fprintf(stderr, "Allocation failed. exiting.\n"); + exit(1); + } + rc = bsc_network_configure(config_file); if (rc < 0) { fprintf(stderr, "Bootstrapping the network failed. exiting.\n"); exit(1); diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 552ab4f..ccd3b74 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -285,15 +285,26 @@ /* internal MNCC handler or MNCC socket? */ if (mncc_sock_path) { - rc = bsc_bootstrap_network(mncc_sock_from_cc, config_file); - if (rc >= 0) - mncc_sock_init(bsc_gsmnet, mncc_sock_path); + rc = bsc_network_alloc(mncc_sock_from_cc); + if (rc) { + fprintf(stderr, "Allocation failed. Exiting.\n"); + exit(1); + } + mncc_sock_init(bsc_gsmnet, mncc_sock_path); } else { DEBUGP(DMNCC, "Using internal MNCC handler.\n"); - rc = bsc_bootstrap_network(int_mncc_recv, config_file); + rc = bsc_network_alloc(int_mncc_recv); + if (rc) { + fprintf(stderr, "Allocation failed. Exiting.\n"); + exit(1); + } } - if (rc < 0) + rc = bsc_network_configure(config_file); + if (rc < 0) { + fprintf(stderr, "Reading config failed. Exiting.\n"); exit(1); + } + #ifdef BUILD_SMPP smpp_openbsc_start(bsc_gsmnet); #endif -- To view, visit https://gerrit.osmocom.org/1140 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I480a09a31a79766ad07b627dd5238b7e37f3be7a 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 Fri Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: factor out & introduce struct gsm_encr, in common_cs.h In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: factor out & introduce struct gsm_encr, in common_cs.h ...................................................................... factor out & introduce struct gsm_encr, in common_cs.h Factor out encryption info from struct gsm_lchan as struct gsm_encr, placed in common_cs.h. Change-Id: I94015fb9dd511c37c1e3058a0963c780b3f700ac Future: this will be used by libmsc's subscriber connection, for osmo-cscn. --- M openbsc/include/openbsc/common_cs.h M openbsc/include/openbsc/gsm_data_shared.h 2 files changed, 11 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/common_cs.h b/openbsc/include/openbsc/common_cs.h index 8549a83..172d6e6 100644 --- a/openbsc/include/openbsc/common_cs.h +++ b/openbsc/include/openbsc/common_cs.h @@ -7,6 +7,14 @@ typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *); +#define MAX_A5_KEY_LEN (128/8) + +struct gsm_encr { + uint8_t alg_id; + uint8_t key_len; + uint8_t key[MAX_A5_KEY_LEN]; +}; + struct gsm_network *gsm_network_init(void *ctx, uint16_t country_code, uint16_t network_code, diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 97fde83..af79485 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -24,6 +24,8 @@ #include #endif +#include + struct osmo_bsc_data; struct osmo_bsc_sccp_con; @@ -117,7 +119,6 @@ struct osmo_fsm_inst *fsm; }; -#define MAX_A5_KEY_LEN (128/8) #define A38_XOR_MIN_KEY_LEN 12 #define A38_XOR_MAX_KEY_LEN 16 #define A38_COMP128_KEY_LEN 16 @@ -219,11 +220,7 @@ uint8_t bs_power; uint8_t ms_power; /* Encryption information */ - struct { - uint8_t alg_id; - uint8_t key_len; - uint8_t key[MAX_A5_KEY_LEN]; - } encr; + struct gsm_encr encr; /* AMR bits */ uint8_t mr_ms_lv[7]; -- To view, visit https://gerrit.osmocom.org/1130 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I94015fb9dd511c37c1e3058a0963c780b3f700ac Gerrit-PatchSet: 8 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 Fri Dec 2 12:09:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:19 +0000 Subject: [MERGED] openbsc[master]: move to libcommon-cs: global vty gsm_network pointer In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: move to libcommon-cs: global vty gsm_network pointer ...................................................................... move to libcommon-cs: global vty gsm_network pointer Move gsmnet_from_vty() and the bsc_gsmnet global to common_cs_vty.c. Rename bsc_gsmnet to vty_global_gsm_network and make it static to common_cs_vty.c, to clearly mark the global variable for VTY use only. Introduce common_cs_vty_init() to set vty_global_gsm_network. Change-Id: I26c5c47de08f899b896813d09612d5cb2f8e42d6 --- M openbsc/include/openbsc/common_cs.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon-cs/common_cs_vty.c 3 files changed, 32 insertions(+), 17 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/common_cs.h b/openbsc/include/openbsc/common_cs.h index 172d6e6..caecfeb 100644 --- a/openbsc/include/openbsc/common_cs.h +++ b/openbsc/include/openbsc/common_cs.h @@ -7,6 +7,8 @@ typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *); +struct vty; + #define MAX_A5_KEY_LEN (128/8) struct gsm_encr { @@ -19,3 +21,6 @@ uint16_t country_code, uint16_t network_code, mncc_recv_cb_t mncc_recv); + +int common_cs_vty_init(struct gsm_network *network); +struct gsm_network *gsmnet_from_vty(struct vty *v); diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 9ed19aa..c8aa43c 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -131,21 +131,6 @@ 1, }; -extern struct gsm_network *bsc_gsmnet; - -struct gsm_network *gsmnet_from_vty(struct vty *v) -{ - /* In case we read from the config file, the vty->priv cannot - * point to a struct telnet_connection, and thus conn->priv - * will not point to the gsm_network structure */ -#if 0 - struct telnet_connection *conn = v->priv; - return (struct gsm_network *) conn->priv; -#else - return bsc_gsmnet; -#endif -} - static int dummy_config_write(struct vty *v) { return CMD_SUCCESS; @@ -3989,7 +3974,7 @@ uint8_t buf[88]; int rc; - bts = gsm_bts_num(bsc_gsmnet, bts_nr); + bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); if (!bts) { vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); return CMD_WARNING; @@ -4040,7 +4025,7 @@ int ts_nr = atoi(argv[2]); int activate; - bts = gsm_bts_num(bsc_gsmnet, bts_nr); + bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); if (!bts) { vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); return CMD_WARNING; @@ -4102,6 +4087,7 @@ "BTS Vendor/Type\n", "\n", "", 0); + common_cs_vty_init(network); install_element_ve(&show_net_cmd); install_element_ve(&show_bts_cmd); diff --git a/openbsc/src/libcommon-cs/common_cs_vty.c b/openbsc/src/libcommon-cs/common_cs_vty.c index 99aa0cf..11ed50f 100644 --- a/openbsc/src/libcommon-cs/common_cs_vty.c +++ b/openbsc/src/libcommon-cs/common_cs_vty.c @@ -1,6 +1,7 @@ /* Code used by both libbsc and libmsc (common_cs means "BSC or MSC"). * * (C) 2016 by sysmocom s.m.f.c. + * (C) 2008-2010 by Harald Welte * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -17,3 +18,26 @@ * along with this program. If not, see . * */ + +#include + +static struct gsm_network *vty_global_gsm_network = NULL; + +/* initialize VTY elements used in both BSC and MSC */ +int common_cs_vty_init(struct gsm_network *network) +{ + OSMO_ASSERT(vty_global_gsm_network == NULL); + vty_global_gsm_network = network; +} + +struct gsm_network *gsmnet_from_vty(struct vty *v) +{ + /* It can't hurt to force callers to continue to pass the vty instance + * to this function, in case we'd like to retrieve the global + * gsm_network instance from the vty at some point in the future. But + * until then, just return the global pointer, which should have been + * initialized by common_cs_vty_init(). + */ + OSMO_ASSERT(vty_global_gsm_network); + return vty_global_gsm_network; +} -- To view, visit https://gerrit.osmocom.org/1133 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I26c5c47de08f899b896813d09612d5cb2f8e42d6 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 Fri Dec 2 12:09:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:40 +0000 Subject: openbsc[master]: abis_om2k: fix typo that declared non-existent struct gsm_bt... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1354 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8e3eec8cf63494962fa31d85a0ec9db9a9e5df46 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 Fri Dec 2 12:09:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:09:41 +0000 Subject: [MERGED] openbsc[master]: abis_om2k: fix typo that declared non-existent struct gsm_bt... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: abis_om2k: fix typo that declared non-existent struct gsm_bts_trx_s ...................................................................... abis_om2k: fix typo that declared non-existent struct gsm_bts_trx_s The typo was recently committed in 80ccb952676cb4a068410991c5d53d19f228f695, "OM2000: Fix missing dynamic TCH initialization" Change-Id: I8e3eec8cf63494962fa31d85a0ec9db9a9e5df46 --- M openbsc/src/libbsc/abis_om2000.c 1 file changed, 1 insertion(+), 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 0dffb15..6b334d4 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1682,7 +1682,7 @@ /* if we have just received opinfo accept for the timeslot, * start dynamic TCH switching procedures */ if (omfp->mo->addr.class == OM2K_MO_CLS_TS) { - struct gsm_bts_trx_s *ts; + struct gsm_bts_trx_ts *ts; ts = mo2obj(omfp->trx->bts, &omfp->mo->addr); dyn_ts_init(ts); } -- To view, visit https://gerrit.osmocom.org/1354 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8e3eec8cf63494962fa31d85a0ec9db9a9e5df46 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 Fri Dec 2 12:10:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 12:10:04 +0000 Subject: [MERGED] osmo-bts[master]: bursts test: test_pdtch: pre-init result mem In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bursts test: test_pdtch: pre-init result mem ...................................................................... bursts test: test_pdtch: pre-init result mem Fixes: CID#57943 Change-Id: I4547f47c4150759d5c4ab790e34e91b784b03b39 --- M tests/bursts/bursts_test.c 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/bursts/bursts_test.c b/tests/bursts/bursts_test.c index 43764ab..d4bb3e0 100644 --- a/tests/bursts/bursts_test.c +++ b/tests/bursts/bursts_test.c @@ -349,6 +349,8 @@ int n_errors, n_bits_total; int rc; + memset(result, 0xff, len); + /* zero the not coded tail bits */ switch (len) { case 34: -- To view, visit https://gerrit.osmocom.org/1338 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4547f47c4150759d5c4ab790e34e91b784b03b39 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 2 13:32:36 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 13:32:36 +0000 Subject: openbsc[master]: abisip-find: check bsc_fd_register() result In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1321 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I72d713725d287d32ec90506099751aeb9b15ef15 Gerrit-PatchSet: 4 Gerrit-Project: openbsc 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 Dec 2 13:32:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 13:32:39 +0000 Subject: openbsc[master]: bsc_ctrl: Ensure we don't pass NULL string into strtok_r() In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1323 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I03bea132377c0136b55b6fdad99a5d92da12e692 Gerrit-PatchSet: 4 Gerrit-Project: openbsc 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 Dec 2 13:32:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 13:32:41 +0000 Subject: openbsc[master]: mgcp_protocol: Ensure we don't call strtok_r with NULL data In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1324 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Gerrit-PatchSet: 4 Gerrit-Project: openbsc 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 Dec 2 13:32:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 13:32:43 +0000 Subject: openbsc[master]: cfg_bts_si2quater_neigh_add(): Don't call strerror() on nega... In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1325 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Gerrit-PatchSet: 4 Gerrit-Project: openbsc 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 Dec 2 13:32:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 13:32:48 +0000 Subject: openbsc[master]: gsm0408_test.c: Don't pass negative value to strerror() In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1327 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4fcf24ec1bc974a3189486d2372b9713d7fdab70 Gerrit-PatchSet: 4 Gerrit-Project: openbsc 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 Dec 2 13:32:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 13:32:51 +0000 Subject: openbsc[master]: channel_mode_from_lchan(): Add missing break statement In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1328 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Gerrit-PatchSet: 4 Gerrit-Project: openbsc 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 Dec 2 17:17:39 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 2 Dec 2016 17:17:39 +0000 Subject: libosmocore[master]: gsm0480.c: code dup: have common msgb alloc functions In-Reply-To: References: Message-ID: Patch Set 3: > I'm not quite sure if it is a good idea to hard-code message headroom sizes inside a library. Basically, you're saying that the API to create USSD messages is flawed in that it implies a fixed headroom. I agree, but this patch doesn't really change anything about that; it merely takes the existing assumptions spread out across various functions and combines it in one place. If We Have The Time (tm) we could enhance the API to allow for explicit buffer sizes in another patch. Also I don't think this patch here is really important, just looked like it would be neat to tidy up a little. Feel free to drop. -- To view, visit https://gerrit.osmocom.org/1341 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I029551dd74410ad6f326ce52eb7a75d912d3b875 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 Fri Dec 2 17:19:46 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 2 Dec 2016 17:19:46 +0000 Subject: libosmocore[master]: gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ... In-Reply-To: References: Message-ID: Patch Set 2: For the record, this was reverted: https://lists.osmocom.org/pipermail/openbsc/2016-December/009906.html -- To view, visit https://gerrit.osmocom.org/1346 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice44dcaaf798f93af3652a96c567f8e16a6cf784 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus 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 Dec 2 17:23:43 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 2 Dec 2016 17:23:43 +0000 Subject: osmo-pcu[master]: BTS: accept also relative frame numbers with rach requst In-Reply-To: References: Message-ID: Patch Set 2: (2 comments) minor cosmetics... https://gerrit.osmocom.org/#/c/1205/2//COMMIT_MSG Commit Message: Line 17: The pcu continusly receives frame number updates with the GSM time continuously https://gerrit.osmocom.org/#/c/1205/2/src/bts.cpp File src/bts.cpp: Line 487: /* Santizize frame number */ "Sanitize" Is this explained in a spec? looks pretty magic to me, would appreciate some more reasoning in the comment. -- To view, visit https://gerrit.osmocom.org/1205 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaa182d8d29c6a0f5fa06064c2eb48b21b1ba2775 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 2 21:39:20 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 21:39:20 +0000 Subject: [PATCH] libosmocore[master]: logging: Extend log_target with call-back for un-formatted l... Message-ID: Review at https://gerrit.osmocom.org/1355 logging: Extend log_target with call-back for un-formatted log line Some targets might not want to receive only an opaque, pre-formatted string, but rather the unformatted arguments with metadata like sub-system/level/file/line. We solve this by introducing a log_target->output_raw() function pointer. If a target specifies this function, it takes precedence over the regular log_target->output() function. Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd --- M include/osmocom/core/logging.h M src/logging.c 2 files changed, 21 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/1355/1 diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 3da9d33..581ebce 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -207,13 +207,29 @@ }; /*! \brief call-back function to be called when the logging framework - * wants to log somethnig. + * wants to log a fully formatted string * \param[in] target logging target * \param[in] level log level of currnet message * \param[in] string the string that is to be written to the log */ void (*output) (struct log_target *target, unsigned int level, const char *string); + + /*! \brief alternative call-back function to which the logging + * framework passes the unfortmatted input arguments, + * i.e. bypassing the internal string formatter + * \param[in] target logging target + * \param[in] subsys logging sub-system + * \param[in] level logging level + * \param[in] file soure code file name + * \param[in] line source code file line number + * \param[in] cont continuation of previous statement? + * \param[in] format format string + * \param[in] ap vararg list of printf arguments + */ + void (*raw_output)(struct log_target *target, int subsys, + unsigned int level, const char *file, int line, + int cont, const char *format, va_list ap); }; /* use the above macros */ diff --git a/src/logging.c b/src/logging.c index 9e30d5f..165d822 100644 --- a/src/logging.c +++ b/src/logging.c @@ -385,7 +385,10 @@ * in undefined state. Since _output uses vsnprintf and it may * be called several times, we have to pass a copy of ap. */ va_copy(bp, ap); - _output(tar, subsys, level, file, line, cont, format, bp); + if (tar->raw_output) + tar->raw_output(tar, subsys, level, file, line, cont, format, bp); + else + _output(tar, subsys, level, file, line, cont, format, bp); va_end(bp); } } -- To view, visit https://gerrit.osmocom.org/1355 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 2 21:39:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 21:39:22 +0000 Subject: [PATCH] libosmocore[master]: gsmtap: Add defintions for GSMTAP based remote logging Message-ID: Review at https://gerrit.osmocom.org/1356 gsmtap: Add defintions for GSMTAP based remote logging Often it is useful to have log statements from the osmocom programs synchronized with protocol traces. So rather than having to open the pcap file with GSMTAP or other protocol data side-by-side with the textual log of one or more network elements, we simply pass the log lines around as GSMTAP messages, which can then be displayed in-order and interspersed with the protocol messages inside wireshark. Change-Id: I33ab530e10ef0311b6f80b731e61894f20b4b3e7 --- M include/osmocom/core/gsmtap.h 1 file changed, 19 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/1356/1 diff --git a/include/osmocom/core/gsmtap.h b/include/osmocom/core/gsmtap.h index c35582e..bcfc7bd 100644 --- a/include/osmocom/core/gsmtap.h +++ b/include/osmocom/core/gsmtap.h @@ -45,6 +45,7 @@ #define GSMTAP_TYPE_LTE_RRC 0x0d /* LTE interface */ #define GSMTAP_TYPE_LTE_MAC 0x0e /* LTE MAC interface */ #define GSMTAP_TYPE_LTE_MAC_FRAMED 0x0f /* LTE MAC with context hdr */ +#define GSMTAP_TYPE_OSMOCORE_LOG 0x10 /* libosmocore logging */ /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ @@ -255,3 +256,21 @@ uint8_t res; /*!< reserved for future use (RFU) */ } __attribute__((packed)); + +/*! \brief Structure of the GTMTAP libosmocore logging header */ +struct gsmtap_osmocore_log_hdr { + struct { + uint32_t sec; + uint32_t usec; + } ts; + char proc_name[16]; /*!< name of process */ + uint32_t pid; /*!< process ID */ + uint8_t level; /*!< logging level */ + uint8_t _pad[3]; + /* TODO: color */ + char subsys[16]; /*!< logging sub-system */ + struct { + char name[32]; /*!< source file name */ + uint32_t line_nr;/*!< line number */ + } src_file; +} __attribute__((packed)); -- To view, visit https://gerrit.osmocom.org/1356 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33ab530e10ef0311b6f80b731e61894f20b4b3e7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 2 21:39:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 21:39:22 +0000 Subject: [PATCH] libosmocore[master]: Implement GSMTAP log target Message-ID: Review at https://gerrit.osmocom.org/1357 Implement GSMTAP log target This target wraps the to-be-logged string (With metadata) into a GSMTAP packet and sends it to the configured destination address. Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 --- M TODO-RELEASE M include/osmocom/core/logging.h M src/Makefile.am M src/logging.c A src/logging_gsmtap.c M src/vty/logging_vty.c 6 files changed, 184 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/1357/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 648b6a6..17f6521 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -4,3 +4,4 @@ libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker +libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..ad775b9 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -9,6 +9,7 @@ #include #include #include +#include #include /*! \brief Maximum number of logging contexts */ @@ -122,6 +123,7 @@ struct log_info; struct vty; +struct gsmtap_inst; typedef void log_print_filters(struct vty *vty, const struct log_info *info, @@ -156,6 +158,7 @@ LOG_TGT_TYPE_FILE, /*!< \brief text file logging */ LOG_TGT_TYPE_STDERR, /*!< \brief stderr logging */ LOG_TGT_TYPE_STRRB, /*!< \brief osmo_strrb-backed logging */ + LOG_TGT_TYPE_GSMTAP, /*!< \brief GSMTAP network logging */ }; /*! \brief structure representing a logging target */ @@ -204,6 +207,12 @@ struct { void *rb; } tgt_rb; + + struct { + struct gsmtap_inst *gsmtap_inst; + const char *ident; + const char *hostname; + } tgt_gsmtap; }; /*! \brief call-back function to be called when the logging framework @@ -254,6 +263,7 @@ void log_set_print_category(struct log_target *target, int); void log_set_log_level(struct log_target *target, int log_level); void log_parse_category_mask(struct log_target *target, const char* mask); +const char* log_category_name(int subsys); int log_parse_level(const char *lvl); const char *log_level_str(unsigned int lvl); int log_parse_category(const char *category); @@ -267,6 +277,10 @@ struct log_target *log_target_create_file(const char *fname); struct log_target *log_target_create_syslog(const char *ident, int option, int facility); +struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, + const char *ident, + bool ofd_wq_mode, + bool add_sink); int log_target_file_reopen(struct log_target *tgt); int log_targets_reopen(void); diff --git a/src/Makefile.am b/src/Makefile.am index 74bdb21..6a9c675 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ libosmocore_la_SOURCES = timer.c timer_gettimeofday.c select.c signal.c msgb.c bits.c \ bitvec.c bitcomp.c statistics.c fsm.c \ write_queue.c utils.c socket.c \ - logging.c logging_syslog.c rate_ctr.c \ + logging.c logging_syslog.c logging_gsmtap.c rate_ctr.c \ gsmtap_util.c crc16.c panic.c backtrace.c \ conv.c application.c rbtree.c strrb.c \ loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \ diff --git a/src/logging.c b/src/logging.c index 165d822..1516a7d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -240,7 +240,7 @@ return NULL; } -static const char* category_name(int subsys) +const char* log_category_name(int subsys) { if (subsys < osmo_log_info->num_cat) return osmo_log_info->cat[subsys].name; @@ -290,7 +290,7 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } if (target->print_category) { - ret = snprintf(buf + offset, rem, "%s ", category_name(subsys)); + ret = snprintf(buf + offset, rem, "%s ", log_category_name(subsys)); if (ret < 0) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); diff --git a/src/logging_gsmtap.c b/src/logging_gsmtap.c new file mode 100644 index 0000000..24fa9ce --- /dev/null +++ b/src/logging_gsmtap.c @@ -0,0 +1,134 @@ +/* GSMTAP network logging support code */ + +/* (C) 2016 by Harald Welte + * 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. + * + */ + +/*! \addtogroup logging + * @{ + */ + +/*! \file logging_gsmtap.c */ + +#include "../config.h" + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STRINGS_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +#define GSMTAP_LOG_MAX_SIZE 4096 + +static void _gsmtap_raw_output(struct log_target *target, int subsys, + unsigned int level, const char *file, + int line, int cont, const char *format, + va_list ap) +{ + struct msgb *msg; + struct gsmtap_hdr *gh; + struct gsmtap_osmocore_log_hdr *golh; + const char *subsys_name = log_category_name(subsys); + struct timeval tv; + int rc; + + /* get timestamp ASAP */ + osmo_gettimeofday(&tv, NULL); + + msg = msgb_alloc(sizeof(*gh)+sizeof(*golh)+GSMTAP_LOG_MAX_SIZE, + "GSMTAP logging"); + + /* GSMTAP header */ + gh = (struct gsmtap_hdr *) msgb_put(msg, sizeof(*gh)); + memset(gh, 0, sizeof(*gh)); + gh->version = GSMTAP_VERSION; + gh->hdr_len = sizeof(*gh)/4; + gh->type = GSMTAP_TYPE_OSMOCORE_LOG; + + /* Logging header */ + golh = (struct gsmtap_osmocore_log_hdr *) msgb_put(msg, sizeof(*golh)); + osmo_strlcpy(golh->proc_name, target->tgt_gsmtap.ident, + sizeof(golh->proc_name)); + if (subsys) + osmo_strlcpy(golh->subsys, subsys_name, sizeof(golh->subsys)); + else + golh->subsys[0] = '\0'; + osmo_strlcpy(golh->src_file.name, file, sizeof(golh->src_file.name)); + golh->src_file.line_nr = line; + golh->level = level; + /* we always store the timestamp in the message, irrespective + * of hat prrint_[ext_]timestamp say */ + golh->ts.sec = htonl(tv.tv_sec); + golh->ts.usec = htonl(tv.tv_usec); + + rc = vsnprintf((char *) msg->tail, msgb_tailroom(msg), format, ap); + if (rc < 0) + return; + msgb_put(msg, rc); + + gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg); +} + +/*! \brief Create a new logging target for GSMTAP logging + * \param[in] ident string identifier + * \returns Log target in case of success, NULL in case of error + */ +struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, + const char *ident, + bool ofd_wq_mode, + bool add_sink) +{ + struct log_target *target; + struct gsmtap_inst *gti; + + target = log_target_create(); + if (!target) + return NULL; + + gti = gsmtap_source_init(host, port, ofd_wq_mode); + if (!gti) { + log_target_destroy(target); + return NULL; + } + + if (add_sink) + gsmtap_source_add_sink(gti); + + target->tgt_gsmtap.gsmtap_inst = gti; + target->tgt_gsmtap.ident = talloc_strdup(target, ident); + target->tgt_gsmtap.hostname = talloc_strdup(target, host); + + target->type = LOG_TGT_TYPE_GSMTAP; + target->raw_output = _gsmtap_raw_output; + + return target; +} + +/* @} */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index d2fca81..cf3ec21 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -498,6 +499,32 @@ } #endif /* HAVE_SYSLOG_H */ +DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd, + "log gsmtap [HOSTNAME]", + LOG_STR "Logging via GSMTAP\n") +{ + const char *hostname = argv[0]; + struct log_target *tgt; + + tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); + if (!tgt) { + tgt = log_target_create_gsmtap(hostname, GSMTAP_UDP_PORT, + host.app_info->name, false, + true); + if (!tgt) { + vty_out(vty, "%% Unable to create GSMTAP log%s", + VTY_NEWLINE); + return CMD_WARNING; + } + log_add_target(tgt); + } + + vty->index = tgt; + vty->node = CFG_LOG_NODE; + + return CMD_SUCCESS; +} + DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, "log stderr", LOG_STR "Logging via STDERR of the process\n") @@ -652,6 +679,10 @@ vty_out(vty, "log alarms %zu%s", log_target_rb_avail_size(tgt), VTY_NEWLINE); break; + case LOG_TGT_TYPE_GSMTAP: + vty_out(vty, "log gsmtap %s%s", + tgt->tgt_gsmtap.hostname, VTY_NEWLINE); + break; } vty_out(vty, " logging filter all %u%s", @@ -744,4 +775,5 @@ install_element(CONFIG_NODE, &cfg_log_syslog_local_cmd); install_element(CONFIG_NODE, &cfg_no_log_syslog_cmd); #endif + install_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); } -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 2 21:59:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 21:59:02 +0000 Subject: libosmocore[master]: logging: Extend log_target with call-back for un-formatted l... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1355 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd 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 Dec 2 21:59:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 21:59:08 +0000 Subject: libosmocore[master]: gsmtap: Add defintions for GSMTAP based remote logging In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1356 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I33ab530e10ef0311b6f80b731e61894f20b4b3e7 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 Dec 2 21:59:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 21:59:43 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 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 Dec 2 22:09:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 2 Dec 2016 22:09:48 +0000 Subject: [PATCH] libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1357 to look at the new patch set (#2). Implement GSMTAP log target This target wraps the to-be-logged string (With metadata) into a GSMTAP packet and sends it to the configured destination address. Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 --- M TODO-RELEASE M include/osmocom/core/logging.h M src/Makefile.am M src/logging.c A src/logging_gsmtap.c M src/vty/logging_vty.c 6 files changed, 184 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/1357/2 diff --git a/TODO-RELEASE b/TODO-RELEASE index 648b6a6..17f6521 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -4,3 +4,4 @@ libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker +libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..ad775b9 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -9,6 +9,7 @@ #include #include #include +#include #include /*! \brief Maximum number of logging contexts */ @@ -122,6 +123,7 @@ struct log_info; struct vty; +struct gsmtap_inst; typedef void log_print_filters(struct vty *vty, const struct log_info *info, @@ -156,6 +158,7 @@ LOG_TGT_TYPE_FILE, /*!< \brief text file logging */ LOG_TGT_TYPE_STDERR, /*!< \brief stderr logging */ LOG_TGT_TYPE_STRRB, /*!< \brief osmo_strrb-backed logging */ + LOG_TGT_TYPE_GSMTAP, /*!< \brief GSMTAP network logging */ }; /*! \brief structure representing a logging target */ @@ -204,6 +207,12 @@ struct { void *rb; } tgt_rb; + + struct { + struct gsmtap_inst *gsmtap_inst; + const char *ident; + const char *hostname; + } tgt_gsmtap; }; /*! \brief call-back function to be called when the logging framework @@ -254,6 +263,7 @@ void log_set_print_category(struct log_target *target, int); void log_set_log_level(struct log_target *target, int log_level); void log_parse_category_mask(struct log_target *target, const char* mask); +const char* log_category_name(int subsys); int log_parse_level(const char *lvl); const char *log_level_str(unsigned int lvl); int log_parse_category(const char *category); @@ -267,6 +277,10 @@ struct log_target *log_target_create_file(const char *fname); struct log_target *log_target_create_syslog(const char *ident, int option, int facility); +struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, + const char *ident, + bool ofd_wq_mode, + bool add_sink); int log_target_file_reopen(struct log_target *tgt); int log_targets_reopen(void); diff --git a/src/Makefile.am b/src/Makefile.am index 74bdb21..6a9c675 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ libosmocore_la_SOURCES = timer.c timer_gettimeofday.c select.c signal.c msgb.c bits.c \ bitvec.c bitcomp.c statistics.c fsm.c \ write_queue.c utils.c socket.c \ - logging.c logging_syslog.c rate_ctr.c \ + logging.c logging_syslog.c logging_gsmtap.c rate_ctr.c \ gsmtap_util.c crc16.c panic.c backtrace.c \ conv.c application.c rbtree.c strrb.c \ loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \ diff --git a/src/logging.c b/src/logging.c index 165d822..1516a7d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -240,7 +240,7 @@ return NULL; } -static const char* category_name(int subsys) +const char* log_category_name(int subsys) { if (subsys < osmo_log_info->num_cat) return osmo_log_info->cat[subsys].name; @@ -290,7 +290,7 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } if (target->print_category) { - ret = snprintf(buf + offset, rem, "%s ", category_name(subsys)); + ret = snprintf(buf + offset, rem, "%s ", log_category_name(subsys)); if (ret < 0) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); diff --git a/src/logging_gsmtap.c b/src/logging_gsmtap.c new file mode 100644 index 0000000..85f8c28 --- /dev/null +++ b/src/logging_gsmtap.c @@ -0,0 +1,134 @@ +/* GSMTAP network logging support code */ + +/* (C) 2016 by Harald Welte + * 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. + * + */ + +/*! \addtogroup logging + * @{ + */ + +/*! \file logging_gsmtap.c */ + +#include "../config.h" + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STRINGS_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +#define GSMTAP_LOG_MAX_SIZE 4096 + +static void _gsmtap_raw_output(struct log_target *target, int subsys, + unsigned int level, const char *file, + int line, int cont, const char *format, + va_list ap) +{ + struct msgb *msg; + struct gsmtap_hdr *gh; + struct gsmtap_osmocore_log_hdr *golh; + const char *subsys_name = log_category_name(subsys); + struct timeval tv; + int rc; + + /* get timestamp ASAP */ + osmo_gettimeofday(&tv, NULL); + + msg = msgb_alloc(sizeof(*gh)+sizeof(*golh)+GSMTAP_LOG_MAX_SIZE, + "GSMTAP logging"); + + /* GSMTAP header */ + gh = (struct gsmtap_hdr *) msgb_put(msg, sizeof(*gh)); + memset(gh, 0, sizeof(*gh)); + gh->version = GSMTAP_VERSION; + gh->hdr_len = sizeof(*gh)/4; + gh->type = GSMTAP_TYPE_OSMOCORE_LOG; + + /* Logging header */ + golh = (struct gsmtap_osmocore_log_hdr *) msgb_put(msg, sizeof(*golh)); + osmo_strlcpy(golh->proc_name, target->tgt_gsmtap.ident, + sizeof(golh->proc_name)); + if (subsys_name) + osmo_strlcpy(golh->subsys, subsys_name+1, sizeof(golh->subsys)); + else + golh->subsys[0] = '\0'; + osmo_strlcpy(golh->src_file.name, file, sizeof(golh->src_file.name)); + golh->src_file.line_nr = htonl(line); + golh->level = level; + /* we always store the timestamp in the message, irrespective + * of hat prrint_[ext_]timestamp say */ + golh->ts.sec = htonl(tv.tv_sec); + golh->ts.usec = htonl(tv.tv_usec); + + rc = vsnprintf((char *) msg->tail, msgb_tailroom(msg), format, ap); + if (rc < 0) + return; + msgb_put(msg, rc); + + gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg); +} + +/*! \brief Create a new logging target for GSMTAP logging + * \param[in] ident string identifier + * \returns Log target in case of success, NULL in case of error + */ +struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, + const char *ident, + bool ofd_wq_mode, + bool add_sink) +{ + struct log_target *target; + struct gsmtap_inst *gti; + + target = log_target_create(); + if (!target) + return NULL; + + gti = gsmtap_source_init(host, port, ofd_wq_mode); + if (!gti) { + log_target_destroy(target); + return NULL; + } + + if (add_sink) + gsmtap_source_add_sink(gti); + + target->tgt_gsmtap.gsmtap_inst = gti; + target->tgt_gsmtap.ident = talloc_strdup(target, ident); + target->tgt_gsmtap.hostname = talloc_strdup(target, host); + + target->type = LOG_TGT_TYPE_GSMTAP; + target->raw_output = _gsmtap_raw_output; + + return target; +} + +/* @} */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index d2fca81..cf3ec21 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -498,6 +499,32 @@ } #endif /* HAVE_SYSLOG_H */ +DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd, + "log gsmtap [HOSTNAME]", + LOG_STR "Logging via GSMTAP\n") +{ + const char *hostname = argv[0]; + struct log_target *tgt; + + tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); + if (!tgt) { + tgt = log_target_create_gsmtap(hostname, GSMTAP_UDP_PORT, + host.app_info->name, false, + true); + if (!tgt) { + vty_out(vty, "%% Unable to create GSMTAP log%s", + VTY_NEWLINE); + return CMD_WARNING; + } + log_add_target(tgt); + } + + vty->index = tgt; + vty->node = CFG_LOG_NODE; + + return CMD_SUCCESS; +} + DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, "log stderr", LOG_STR "Logging via STDERR of the process\n") @@ -652,6 +679,10 @@ vty_out(vty, "log alarms %zu%s", log_target_rb_avail_size(tgt), VTY_NEWLINE); break; + case LOG_TGT_TYPE_GSMTAP: + vty_out(vty, "log gsmtap %s%s", + tgt->tgt_gsmtap.hostname, VTY_NEWLINE); + break; } vty_out(vty, " logging filter all %u%s", @@ -744,4 +775,5 @@ install_element(CONFIG_NODE, &cfg_log_syslog_local_cmd); install_element(CONFIG_NODE, &cfg_no_log_syslog_cmd); #endif + install_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); } -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 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 Mon Dec 5 10:34:50 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Mon, 5 Dec 2016 10:34:50 +0000 Subject: [PATCH] osmo-pcu[master]: Add statistics in the ms and tbf level. 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/1345 to look at the new patch set (#3). Add statistics in the ms and tbf level. Adds DL throughput in show ms imsi . Adds the number of coding schemes counter and rlc nacked counter at TBf level. Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c --- M src/gprs_rlcmac_meas.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp 5 files changed, 78 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/45/1345/3 diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp index 5a2e38e..d6bbc19 100644 --- a/src/gprs_rlcmac_meas.cpp +++ b/src/gprs_rlcmac_meas.cpp @@ -179,6 +179,8 @@ if (elapsed < 128) return 0; + tbf->m_bw.dl_throughput = (tbf->m_bw.dl_bw_octets/elapsed); + LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: " "%d KBits/s\n", tbf->imsi(), tbf->tlli(), tbf->m_bw.dl_bw_octets / elapsed); diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index ca7f7ad..371a679 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -76,6 +76,8 @@ vty_out(vty, " V(A)=%d V(S)=%d nBSN=%d%s", win->v_a(), win->v_s(), win->resend_needed(), win->window_stalled() ? " STALLED" : ""); + vty_out(vty, "%s", VTY_NEWLINE); + vty_out_rate_ctr_group(vty, " ", tbf->tbf_ctrs); } vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE); } @@ -176,11 +178,15 @@ ms->ul_tbf()->tfi(), ms->ul_tbf()->state_name(), VTY_NEWLINE); - if (ms->dl_tbf()) + if (ms->dl_tbf()) { vty_out(vty, " Downlink TBF: TFI=%d, state=%s%s", ms->dl_tbf()->tfi(), ms->dl_tbf()->state_name(), VTY_NEWLINE); + vty_out(vty, " Current DL Throughput: %d Kbps %s", + ms->dl_tbf()->m_bw.dl_throughput, + VTY_NEWLINE); + } llist_for_each(i_tbf, &ms->old_tbfs()) vty_out(vty, " Old %-19s TFI=%d, state=%s%s", diff --git a/src/tbf.cpp b/src/tbf.cpp index 25209e4..40c0615 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -33,6 +33,7 @@ extern "C" { #include #include +#include } #include @@ -41,6 +42,31 @@ extern void *tall_pcu_ctx; static void tbf_timer_cb(void *_tbf); + +static const struct rate_ctr_desc tbf_ctr_description[] = { + { "rlc.nacked", "RLC Nacked " }, + { "gprs.downlink.cs1", "CS1 Downlink " }, + { "gprs.downlink.cs2", "CS2 Downlink " }, + { "gprs.downlink.cs3", "CS3 Downlink " }, + { "gprs.downlink.cs4", "CS4 Downlink " }, + { "egprs.downlink.mcs1", "MCS1 Downlink " }, + { "egprs.downlink.mcs2", "MCS2 Downlink " }, + { "egprs.downlink.mcs3", "MCS3 Downlink " }, + { "egprs.downlink.mcs4", "MCS4 Downlink " }, + { "egprs.downlink.mcs5", "MCS5 Downlink " }, + { "egprs.downlink.mcs6", "MCS6 Downlink " }, + { "egprs.downlink.mcs7", "MCS7 Downlink " }, + { "egprs.downlink.mcs8", "MCS8 Downlink " }, + { "egprs.downlink.mcs9", "MCS9 Downlink " }, +}; + +static const struct rate_ctr_group_desc tbf_ctrg_desc = { + "pcu.tbf", + "TBF Statistics", + OSMO_STATS_CLASS_UNKNOWN, + ARRAY_SIZE(tbf_ctr_description), + tbf_ctr_description, +}; gprs_rlcmac_tbf::Meas::Meas() : rssi_sum(0), @@ -325,6 +351,9 @@ if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_ul_aborted(); } else { + gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); + rate_ctr_group_free(dl_tbf->tbf_ctrs); + tbf->bts->tbf_dl_freed(); if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_dl_aborted(); @@ -732,7 +761,8 @@ gprs_rlcmac_dl_tbf::BandWidth::BandWidth() : dl_bw_octets(0), dl_loss_lost(0), - dl_loss_received(0) + dl_loss_received(0), + dl_throughput(0) { timerclear(&dl_bw_tv); timerclear(&dl_loss_tv); @@ -814,6 +844,9 @@ gettimeofday(&tbf->m_bw.dl_bw_tv, NULL); gettimeofday(&tbf->m_bw.dl_loss_tv, NULL); + tbf->tbf_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0); + rate_ctr_init(tbf); + return tbf; } diff --git a/src/tbf.h b/src/tbf.h index 1e98a24..41ae8b0 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -79,6 +79,23 @@ GPRS_RLCMAC_UL_TBF }; +enum tbf_counters { + TBF_CTR_RLC_NACKED, + TBF_CTR_GPRS_DL_CS1, + TBF_CTR_GPRS_DL_CS2, + TBF_CTR_GPRS_DL_CS3, + TBF_CTR_GPRS_DL_CS4, + TBF_CTR_EGPRS_DL_MCS1, + TBF_CTR_EGPRS_DL_MCS2, + TBF_CTR_EGPRS_DL_MCS3, + TBF_CTR_EGPRS_DL_MCS4, + TBF_CTR_EGPRS_DL_MCS5, + TBF_CTR_EGPRS_DL_MCS6, + TBF_CTR_EGPRS_DL_MCS7, + TBF_CTR_EGPRS_DL_MCS8, + TBF_CTR_EGPRS_DL_MCS9, +}; + #define GPRS_RLCMAC_FLAG_CCCH 0 /* assignment on CCCH */ #define GPRS_RLCMAC_FLAG_PACCH 1 /* assignment on PACCH */ #define GPRS_RLCMAC_FLAG_UL_DATA 2 /* uplink data received */ @@ -224,6 +241,8 @@ */ uint8_t m_tfi; time_t m_created_ts; + + struct rate_ctr_group *tbf_ctrs; protected: gprs_rlcmac_bts *bts_data() const; @@ -399,6 +418,7 @@ struct BandWidth { struct timeval dl_bw_tv; /* timestamp for dl bw calculation */ uint32_t dl_bw_octets; /* number of octets since bw_tv */ + uint32_t dl_throughput; /* throughput to be displayed in stats */ struct timeval dl_loss_tv; /* timestamp for loss calculation */ uint16_t dl_loss_lost; /* sum of lost packets */ diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index c6f3945..48a8301 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -949,6 +949,7 @@ ms()->update_error_rate(this, error_rate); m_window.update(bts, rbb, first_bsn, &lost, &received); + rate_ctr_add(&tbf_ctrs->ctr[TBF_CTR_RLC_NACKED], lost); /* report lost and received packets */ gprs_rlcmac_received_lost(this, received, lost); @@ -1007,6 +1008,7 @@ m_window.update(bts, show_rbb, ssn, &lost, &received); + rate_ctr_add(&tbf_ctrs->ctr[TBF_CTR_RLC_NACKED], lost); /* report lost and received packets */ gprs_rlcmac_received_lost(this, received, lost); @@ -1342,45 +1344,58 @@ switch (coding_scheme) { case GprsCodingScheme::CS1 : bts->gprs_dl_cs1(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS1]); break; case GprsCodingScheme::CS2 : bts->gprs_dl_cs2(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS2]); break; case GprsCodingScheme::CS3 : bts->gprs_dl_cs3(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS3]); break; case GprsCodingScheme::CS4 : bts->gprs_dl_cs4(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS4]); break; } } else { switch (coding_scheme) { case GprsCodingScheme::MCS1 : bts->egprs_dl_mcs1(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS1]); break; case GprsCodingScheme::MCS2 : bts->egprs_dl_mcs2(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS2]); break; case GprsCodingScheme::MCS3 : bts->egprs_dl_mcs3(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS3]); break; case GprsCodingScheme::MCS4 : bts->egprs_dl_mcs4(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS4]); break; case GprsCodingScheme::MCS5 : bts->egprs_dl_mcs5(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS5]); break; case GprsCodingScheme::MCS6 : bts->egprs_dl_mcs6(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS6]); break; case GprsCodingScheme::MCS7 : bts->egprs_dl_mcs7(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS7]); break; case GprsCodingScheme::MCS8 : bts->egprs_dl_mcs8(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS8]); break; case GprsCodingScheme::MCS9 : bts->egprs_dl_mcs9(); + rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS9]); break; } } -- To view, visit https://gerrit.osmocom.org/1345 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 5 11:11:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 11:11:03 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 2: Just for the record, as discussed today: would be much faster to send raw string with formatters and data and let wireshark do string formatting. Although this might open up can of worms with string format vulnerabilities. -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 11:35:07 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 11:35:07 +0000 Subject: [PATCH] openbsc[master]: bsc_control.py: convert to python3 Message-ID: Review at https://gerrit.osmocom.org/1358 bsc_control.py: convert to python3 Let's be consistent with other .py in contrib and use python3 explicitly. Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 --- M openbsc/contrib/bsc_control.py 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/58/1358/1 diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index 125a0c9..28235af 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- mode: python-mode; py-indent-tabs-mode: nil -*- from optparse import OptionParser @@ -9,7 +9,7 @@ def connect(host, port): if verbose: - print "Connecting to host %s:%i" % (host, port) + print("Connecting to host %s:%i" % (host, port)) sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sck.setblocking(1) @@ -20,7 +20,7 @@ (r, c) = Ctrl().cmd(var, value) sck.send(c) answer = Ctrl().del_header(sck.recv(4096)) - return (answer,) + Ctrl().verify(answer, r, var, value) + return (answer,) + Ctrl().verify(answer.decode('utf-8'), r, var, value) def set_var(sck, var, val): do_set_get(sck, var, val) @@ -63,20 +63,20 @@ if len(args) < 2: parser.error("Set requires var and value arguments") (a, _, _) = do_set_get(sock, args[0], ' '.join(args[1:])) - print "Got message:", a + print("Got message:", a) if options.cmd_get: if len(args) != 1: parser.error("Get requires the var argument") (a, _, _) = do_set_get(sock, args[0]) - print "Got message:", a + print("Got message:", a) if options.monitor: while True: data = sock.recv(1024) if len(data) == 0: - print "Connection is gone." + print("Connection is gone.") break - print "Got message:", Ctrl().del_header(data) + print("Got message:", Ctrl().del_header(data)) sock.close() -- To view, visit https://gerrit.osmocom.org/1358 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Dec 5 11:48:51 2016 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Mon, 5 Dec 2016 11:48:51 +0000 Subject: [PATCH] openbsc[master]: LLC: Fixup elemnt order in LLC-XID Message-ID: Review at https://gerrit.osmocom.org/1359 LLC: Fixup elemnt order in LLC-XID When the LLC-XID request is constructed the order of the elements in the TLV structure is reversed. This is in theory not a problem, but differs from what we know from our practical experience. This commint fixes the problem. Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 --- M openbsc/src/gprs/gprs_llc.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/59/1359/1 diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index e5a80e5..0215029 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -77,9 +77,9 @@ xid_n201i.data_len = 2; /* Add locally managed XID Fields */ - llist_add(&xid_n201i.list, &xid_fields); - llist_add(&xid_n201u.list, &xid_fields); llist_add(&xid_version.list, &xid_fields); + llist_add(&xid_n201u.list, &xid_fields); + llist_add(&xid_n201i.list, &xid_fields); /* Append layer 3 XID field (if present) */ if (l3_xid_field) { -- To view, visit https://gerrit.osmocom.org/1359 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Mon Dec 5 14:45:10 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 14:45:10 +0000 Subject: openbsc[master]: LLC: Fixup elemnt order in LLC-XID In-Reply-To: References: Message-ID: Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/1359/1//COMMIT_MSG Commit Message: PS1, Line 7: elemnt typo ;) PS1, Line 11: This : commint fixes the problem. Remove this sentence. You could add if you like Put version tlv to the top. -- To view, visit https://gerrit.osmocom.org/1359 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Mon Dec 5 14:57:10 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 14:57:10 +0000 Subject: [PATCH] openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... Message-ID: Review at https://gerrit.osmocom.org/1360 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/src/libbsc/gsm_04_08_utils.c 2 files changed, 16 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/60/1360/1 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/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 98f0790..78d504d 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -75,8 +75,12 @@ { 0x67, 0xff, CHREQ_T_LMU }, { 0x60, 0xf9, CHREQ_T_RESERVED_SDCCH }, { 0x61, 0xfb, CHREQ_T_RESERVED_SDCCH }, - { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, - { 0x7f, 0xff, CHREQ_T_RESERVED_IGNORE }, + { 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, 0xf, CHREQ_T_RESERVED_IGNORE }, }; /* If SYSTEM INFORMATION TYPE 4 NECI bit == 0 */ @@ -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_PBCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_CHREQ_REASON_PBCH, [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: newchange Gerrit-Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Dec 5 14:58:23 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 14:58:23 +0000 Subject: [PATCH] libosmocore[master]: Revert "Revert "gsm0408: add chreq_type for CHREQ_T_PDCH_ONE... Message-ID: Review at https://gerrit.osmocom.org/1361 Revert "Revert "gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASE"" This reverts commit 909cbecbb9d3223b3b372849564600bb9be7fbda. 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/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 767aa3d..c05b62e 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1456,6 +1456,8 @@ CHREQ_T_PAG_R_TCH_F, CHREQ_T_PAG_R_TCH_FH, CHREQ_T_LMU, + CHREQ_T_PDCH_ONE_PHASE, + CHREQ_T_PDCH_TWO_PHASE, CHREQ_T_RESERVED_SDCCH, CHREQ_T_RESERVED_IGNORE, }; -- To view, visit https://gerrit.osmocom.org/1361 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Dec 5 14:59:15 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 14:59:15 +0000 Subject: [PATCH] libosmocore[master]: write_queue: implement overflow handling by dropping the old... Message-ID: Review at https://gerrit.osmocom.org/1362 write_queue: implement overflow handling by dropping the oldest msgb When a new element should be inserted into a full write queue, drop the oldest message in queue. Change-Id: Ica7d0a1f2bd7d9da238c8cac0686db78bcfd48f1 --- M src/write_queue.c 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/1362/1 diff --git a/src/write_queue.c b/src/write_queue.c index 3e488ae..5aa2307 100644 --- a/src/write_queue.c +++ b/src/write_queue.c @@ -104,8 +104,14 @@ */ int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data) { -// if (queue->current_length + 1 >= queue->max_length) -// LOGP(DMSC, LOGL_ERROR, "The queue is full. Dropping not yet implemented.\n"); + if (queue->current_length + 1 >= queue->max_length) { + struct llist_head *first = queue->msg_queue.next; + struct msgb* = container_of(first, struct msgb, list); + llist_del(queue->msg_queue.next); + msgb_free(first); + /* FIXME: this should be a rate limit warnin or error */ + LOGP(DMSC, LOGL_DEBUG, "The queue is full. Dropping last package.\n"); + } ++queue->current_length; msgb_enqueue(&queue->msg_queue, data); -- To view, visit https://gerrit.osmocom.org/1362 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica7d0a1f2bd7d9da238c8cac0686db78bcfd48f1 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:11:44 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:11:44 +0000 Subject: [PATCH] libosmo-abis[master]: Fix log message to match function name Message-ID: Review at https://gerrit.osmocom.org/1363 Fix log message to match function name Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 --- M src/trau/osmo_ortp.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/63/1363/1 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 51829d1..f7adc93 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -173,7 +173,8 @@ if (recv_with_cb(rs)) return 1; - LOGP(DLMIB, LOGL_INFO, "osmo_rtp_poll(%u): ERROR!\n", rs->rx_user_ts); + LOGP(DLMIB, LOGL_INFO, "osmo_rtp_socket_poll(%u): ERROR!\n", + rs->rx_user_ts); return 0; } -- To view, visit https://gerrit.osmocom.org/1363 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:13:48 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 15:13:48 +0000 Subject: [ABANDON] libosmocore[master]: write_queue: implement overflow handling by dropping the old... In-Reply-To: References: Message-ID: lynxis lazus has abandoned this change. Change subject: write_queue: implement overflow handling by dropping the oldest msgb ...................................................................... Abandoned in favor of https://gerrit.osmocom.org/#/c/1243/ -- To view, visit https://gerrit.osmocom.org/1362 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: Ica7d0a1f2bd7d9da238c8cac0686db78bcfd48f1 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:14:34 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:14:34 +0000 Subject: [PATCH] libosmo-abis[master]: Expand network error callback Message-ID: Review at https://gerrit.osmocom.org/1364 Expand network error callback ortp: use extra parameter for network_error callback in log message as it's described in oRTP documentation (error string). Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 --- M src/trau/osmo_ortp.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/64/1364/1 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 51829d1..208b5d1 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -130,7 +130,7 @@ int port = rtp_session_get_local_port(rs); LOGP(DLMIB, LOGL_ERROR, - "osmo-ortp(%d): network_error\n", port); + "osmo-ortp(%d): network_error %s\n", (char *)data); } static void ortp_sig_cb_ts(RtpSession *rs, void *data) -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:22:25 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:22:25 +0000 Subject: openbsc[master]: LLC: Fixup elemnt order in LLC-XID In-Reply-To: References: Message-ID: Patch Set 1: Is order specified in some spec? If so, could add reference to it as comment or to commit message? -- To view, visit https://gerrit.osmocom.org/1359 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Mon Dec 5 15:22:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 15:22:35 +0000 Subject: [PATCH] libosmo-abis[master]: osmo_rtp_socket_poll(): Fix log message to match function name In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1363 to look at the new patch set (#2). osmo_rtp_socket_poll(): Fix log message to match function name Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 --- M src/trau/osmo_ortp.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/63/1363/2 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 51829d1..f7adc93 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -173,7 +173,8 @@ if (recv_with_cb(rs)) return 1; - LOGP(DLMIB, LOGL_INFO, "osmo_rtp_poll(%u): ERROR!\n", rs->rx_user_ts); + LOGP(DLMIB, LOGL_INFO, "osmo_rtp_socket_poll(%u): ERROR!\n", + rs->rx_user_ts); return 0; } -- To view, visit https://gerrit.osmocom.org/1363 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:22:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 15:22:37 +0000 Subject: libosmo-abis[master]: osmo_rtp_socket_poll(): Fix log message to match function name In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1363 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 5 15:26:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:26:21 +0000 Subject: libosmocore[master]: logging: Extend log_target with call-back for un-formatted l... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1355 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:26:30 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:26:30 +0000 Subject: [MERGED] libosmo-abis[master]: osmo_rtp_socket_poll(): Fix log message to match function name In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: osmo_rtp_socket_poll(): Fix log message to match function name ...................................................................... osmo_rtp_socket_poll(): Fix log message to match function name Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 --- M src/trau/osmo_ortp.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 51829d1..f7adc93 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -173,7 +173,8 @@ if (recv_with_cb(rs)) return 1; - LOGP(DLMIB, LOGL_INFO, "osmo_rtp_poll(%u): ERROR!\n", rs->rx_user_ts); + LOGP(DLMIB, LOGL_INFO, "osmo_rtp_socket_poll(%u): ERROR!\n", + rs->rx_user_ts); return 0; } -- To view, visit https://gerrit.osmocom.org/1363 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5c36bbc35e2ba794b5e446f52a0752bcf1367d11 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 5 15:58:42 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:58:42 +0000 Subject: openbsc[master]: channel_mode_from_lchan(): Add missing break statement In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1328 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 15:59:07 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 15:59:07 +0000 Subject: openbsc[master]: cfg_bts_si2quater_neigh_add(): Don't call strerror() on nega... In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1325 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 16:10:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 16:10:20 +0000 Subject: [PATCH] openbsc[master]: cosmetic: chan_alloc: use switch instead of if cascade Message-ID: Review at https://gerrit.osmocom.org/1365 cosmetic: chan_alloc: use switch instead of if cascade Preparing cosmetically for a subsequent commit which will add another pchan kind to be checked, rather use a "switch (pchan) {}". Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc --- M openbsc/src/libbsc/chan_alloc.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/1365/1 diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 0f4d90a..799fbef 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -124,7 +124,8 @@ * to check whether a dynamic timeslot is already in TCH/H mode * and whether one of the two channels is still available. */ - if (pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { + switch (pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: if (ts->dyn.pchan_is != ts->dyn.pchan_want) { /* The TS's mode is being switched. Not * available anymore/yet. */ @@ -149,7 +150,8 @@ } else /* Otherwise this slot is not applicable. */ continue; - } else { + + default: /* Not a dynamic channel, there is only one pchan kind: */ check_subslots = ts_subslots(ts); } -- To view, visit https://gerrit.osmocom.org/1365 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 5 16:10:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 16:10:20 +0000 Subject: [PATCH] openbsc[master]: Fix TCH/F_PDCH: no need to check ts subslots for PDCH Message-ID: Review at https://gerrit.osmocom.org/1366 Fix TCH/F_PDCH: no need to check ts subslots for PDCH For TCH/F_PDCH in PDCH mode, directly return the lchan to use, in order to switch it to TCH/F. To check the pchan type in chan_alloc.c, make ts_pchan() public in gsm_data_shared.h. Commit c3f72f63afde926dfc46827d6880055597515fb6 broke TCH/F_PDCH, as a fallout of setting the GSM_PCHAN_PDCH subslots number to 0. This is sane and correct, but the chan_alloc code failed to see a ts as available if it has no subslots. Explanation: _lc_find_trx() checks each timeslot. TCH/F_TCH/H_PDCH has a special check that directly returns the lchan when in PDCH mode. All other pchan types are handled by determining the amout of logical subslots on the ts and checking that all are free. This worked for TCH/F_PDCH as long as ts_subslots() returned 1 for PDCH: the for-loop at the bottom of _lc_find_trx() checked one subslot, which succeeded on an lchan in PDCH mode, since PDCH lchans are always marked type == NONE and state == NONE. Now we more accurately acknowledge that a PDCH timeslot has zero subslots and that a dynamic timeslot in PDCH mode can always be switched to voice immediately, without checking lchan type or state. So, above mentioned commit set PDCH to zero subslots, and the for-loop to check the (zero) subslots never ran and hence never returned the lchan. This fix adds a special condition for TCH/F_PDCH in PDCH mode, same as TCH/F_TCH/H_PDCH. (Todo: ts_pchan() can probably be used in other places as well to remove some code dup. Leaving that for another patch.) Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 Fixes: OS#1868 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/chan_alloc.c M openbsc/src/libcommon/gsm_data_shared.c 3 files changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/1366/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4ec4f69..9407b82 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -891,6 +891,7 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, int *rc); +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); bool ts_is_tch(struct gsm_bts_trx_ts *ts); diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 799fbef..932d960 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -151,6 +151,13 @@ /* Otherwise this slot is not applicable. */ continue; + case GSM_PCHAN_TCH_F_PDCH: + /* Available for voice when in PDCH mode */ + if (ts_pchan(ts) != GSM_PCHAN_PDCH) + continue; + /* Subslots of a PDCH ts don't need to be checked. */ + return ts->lchan; + default: /* Not a dynamic channel, there is only one pchan kind: */ check_subslots = ts_subslots(ts); diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index df204fe..387af70 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -729,7 +729,7 @@ }; /*! Return the actual pchan type, also heeding dynamic TS. */ -static enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) { switch (ts->pchan) { case GSM_PCHAN_TCH_F_TCH_H_PDCH: -- To view, visit https://gerrit.osmocom.org/1366 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 5 16:19:43 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 16:19:43 +0000 Subject: openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (2 comments) The build fails because it needs a commit in libosmocore: https://gerrit.osmocom.org/1361 Before merging to libosmocore, this patch should have +2 and follow right after, because otherwise the openbsc build would be broken. I'd love to give my +2, but I don't really understand the changes in gsm_04_08_utils.c https://gerrit.osmocom.org/#/c/1360/1/openbsc/src/libbsc/gsm_04_08_utils.c File openbsc/src/libbsc/gsm_04_08_utils.c: Line 78: { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, unrelated cosmetic change ... but small enough I guess Line 99: { 0x63, 0xff, CHREQ_T_RESERVED_SDCCH }, unrelated cosmetic change ... but small enough I guess -- 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: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 5 16:24:33 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 16:24:33 +0000 Subject: libosmo-abis[master]: Expand network error callback In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-2 (1 comment) https://gerrit.osmocom.org/#/c/1364/1/src/trau/osmo_ortp.c File src/trau/osmo_ortp.c: Line 133: "osmo-ortp(%d): network_error %s\n", (char *)data); you dropped the port arg! -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis 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 Dec 5 16:24:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 16:24:37 +0000 Subject: libosmo-abis[master]: Expand network error callback In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis 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 Dec 5 16:40:39 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 5 Dec 2016 16:40:39 +0000 Subject: [PATCH] libosmo-abis[master]: Expand network error callback 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/1364 to look at the new patch set (#2). Expand network error callback ortp: use extra parameter for network_error callback in log message as it's described in oRTP documentation (error string). Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 --- M src/trau/osmo_ortp.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/64/1364/2 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 51829d1..645d366 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -130,7 +130,7 @@ int port = rtp_session_get_local_port(rs); LOGP(DLMIB, LOGL_ERROR, - "osmo-ortp(%d): network_error\n", port); + "osmo-ortp(%d): network_error %s\n", port, (char *)data); } static void ortp_sig_cb_ts(RtpSession *rs, void *data) -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:29:25 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 18:29:25 +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, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1360 to look at the new patch set (#2). 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/2 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..d8a3524 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -45,6 +45,7 @@ GSM_CHREQ_REASON_PAG, GSM_CHREQ_REASON_CALL, GSM_CHREQ_REASON_LOCATION_UPD, + GSM_CHREQ_REASON_PBCH, GSM_CHREQ_REASON_OTHER, }; diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 98f0790..0226b83 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_PBCH, + [CHREQ_T_PDCH_TWO_PHASE] = GSM_CHREQ_REASON_PBCH, [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: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:31:22 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Mon, 5 Dec 2016 18:31:22 +0000 Subject: openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1360/2/openbsc/src/libbsc/gsm_04_08_utils.c File openbsc/src/libbsc/gsm_04_08_utils.c: PS2, Line 143: = GSM_CHREQ_REASON_PBCH, : [CHREQ_T_PDCH_TWO_PHASE] = GSM_CHREQ_REASON_PBCH, should this named PBCH? -- 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: 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: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:45:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:45:43 +0000 Subject: libosmo-abis[master]: Expand network error callback In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 5 18:46:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:46:24 +0000 Subject: openbsc[master]: Fix TCH/F_PDCH: no need to check ts subslots for PDCH In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1366 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 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 Mon Dec 5 18:47:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:47:39 +0000 Subject: openbsc[master]: cosmetic: chan_alloc: use switch instead of if cascade In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1365/1/openbsc/src/libbsc/chan_alloc.c File openbsc/src/libbsc/chan_alloc.c: Line 153: are you sure we don't want a break here? yes, _most_ cases above have a return or continue, but three is the GSM_PCHAN_PDCH case which falls throug below. If that's intended, it is a semantic change compared to the previous 'if' clause, right? -- To view, visit https://gerrit.osmocom.org/1365 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Mon Dec 5 18:48:36 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:48:36 +0000 Subject: [MERGED] libosmocore[master]: logging: Extend log_target with call-back for un-formatted l... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: logging: Extend log_target with call-back for un-formatted log line ...................................................................... logging: Extend log_target with call-back for un-formatted log line Some targets might not want to receive only an opaque, pre-formatted string, but rather the unformatted arguments with metadata like sub-system/level/file/line. We solve this by introducing a log_target->output_raw() function pointer. If a target specifies this function, it takes precedence over the regular log_target->output() function. Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd --- M include/osmocom/core/logging.h M src/logging.c 2 files changed, 21 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/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 3da9d33..581ebce 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -207,13 +207,29 @@ }; /*! \brief call-back function to be called when the logging framework - * wants to log somethnig. + * wants to log a fully formatted string * \param[in] target logging target * \param[in] level log level of currnet message * \param[in] string the string that is to be written to the log */ void (*output) (struct log_target *target, unsigned int level, const char *string); + + /*! \brief alternative call-back function to which the logging + * framework passes the unfortmatted input arguments, + * i.e. bypassing the internal string formatter + * \param[in] target logging target + * \param[in] subsys logging sub-system + * \param[in] level logging level + * \param[in] file soure code file name + * \param[in] line source code file line number + * \param[in] cont continuation of previous statement? + * \param[in] format format string + * \param[in] ap vararg list of printf arguments + */ + void (*raw_output)(struct log_target *target, int subsys, + unsigned int level, const char *file, int line, + int cont, const char *format, va_list ap); }; /* use the above macros */ diff --git a/src/logging.c b/src/logging.c index 9e30d5f..165d822 100644 --- a/src/logging.c +++ b/src/logging.c @@ -385,7 +385,10 @@ * in undefined state. Since _output uses vsnprintf and it may * be called several times, we have to pass a copy of ap. */ va_copy(bp, ap); - _output(tar, subsys, level, file, line, cont, format, bp); + if (tar->raw_output) + tar->raw_output(tar, subsys, level, file, line, cont, format, bp); + else + _output(tar, subsys, level, file, line, cont, format, bp); va_end(bp); } } -- To view, visit https://gerrit.osmocom.org/1355 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:50:11 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:50:11 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 > Just for the record, as discussed today: would be much faster to > send raw string with formatters and data and let wireshark do > string formatting. Although this might open up can of worms with > string format vulnerabilities. yes, but that's not an either-or, but a another variant of a future different GSMTAP sub-type of the logging. The difficulty is to know about the type of the function arguments and encoding them in the GSMTAP message while not paying the same cost as the sprintf format string traversal. -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:51:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:51:48 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 9 Gerrit-Project: openbsc 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 Dec 5 18:52:13 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:52:13 +0000 Subject: openbsc[master]: Use IPA module for vty tests In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1267 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If13ed7fd243ce3aeef505d2e8468e221aa62f79e Gerrit-PatchSet: 9 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 Mon Dec 5 18:53:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:53:30 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 10: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1268/10/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 351: # test as CTRL server, for example using bsc_control.py to issue set/get commands: why are those tests all commented out? -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 10 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 Mon Dec 5 18:54:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:54:39 +0000 Subject: openbsc[master]: bsc_control.py: use ipa.py module In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 8 Gerrit-Project: openbsc 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 Dec 5 18:54:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:54:52 +0000 Subject: openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 7 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 Mon Dec 5 18:55:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:55:06 +0000 Subject: openbsc[master]: bsc_control.py: convert to python3 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1358 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 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 Mon Dec 5 18:55:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:55:40 +0000 Subject: osmo-bts[master]: TRX: prevent segfault upon phy init In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1276 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id979506731ea92401458f1060e87aeb690901539 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:55:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:55:49 +0000 Subject: [MERGED] osmo-bts[master]: TRX: prevent segfault upon phy init In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: TRX: prevent segfault upon phy init ...................................................................... TRX: prevent segfault upon phy init Previously if multiply phy instances were configured but not used osmo-bts-trx would segfault. Terminate with clear error message instead so user can correct configuration. Example configuration which caused problem: ... phy 0 instance 0 instance 1 ... trx 0 phy 0 instance 0 Note the 2nd instance of phy 0 which is not used in trx later on. Change-Id: Id979506731ea92401458f1060e87aeb690901539 --- M src/common/scheduler.c M src/osmo-bts-trx/l1_if.c 2 files changed, 13 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/scheduler.c b/src/common/scheduler.c index db1f977..fd5c584 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -166,6 +166,9 @@ uint8_t tn; unsigned int i; + if (!trx) + return -EINVAL; + l1t->trx = trx; LOGP(DL1C, LOGL_NOTICE, "Init scheduler for trx=%u\n", l1t->trx->nr); diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 3d5f52e..6304c1f 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -71,19 +71,22 @@ return NULL; l1h->phy_inst = pinst; - trx_sched_init(&l1h->l1s, pinst->trx); + rc = trx_sched_init(&l1h->l1s, pinst->trx); + if (rc < 0) { + LOGP(DL1C, LOGL_FATAL, "Cannot initialize scheduler for phy " + "instance %d\n", pinst->num); + return NULL; + } rc = trx_if_open(l1h); if (rc < 0) { - LOGP(DL1C, LOGL_FATAL, "Cannot initialize scheduler\n"); - goto err; + LOGP(DL1C, LOGL_FATAL, "Cannot open TRX interface for phy " + "instance %d\n", pinst->num); + l1if_close(l1h); + return NULL; } return l1h; - -err: - l1if_close(l1h); - return NULL; } void l1if_close(struct trx_l1h *l1h) -- To view, visit https://gerrit.osmocom.org/1276 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id979506731ea92401458f1060e87aeb690901539 Gerrit-PatchSet: 3 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 Dec 5 18:57:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:57:02 +0000 Subject: [PATCH] openbsc[master]: LLC: Fixup element order in LLC-XID In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1359 to look at the new patch set (#2). LLC: Fixup element order in LLC-XID When the LLC-XID request is constructed the order of the elements in the TLV structure is reversed. This is in theory not a problem, but differs from what we know from our practical experience. This commit fixes the problem. Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 --- M openbsc/src/gprs/gprs_llc.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/59/1359/2 diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index e5a80e5..0215029 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -77,9 +77,9 @@ xid_n201i.data_len = 2; /* Add locally managed XID Fields */ - llist_add(&xid_n201i.list, &xid_fields); - llist_add(&xid_n201u.list, &xid_fields); llist_add(&xid_version.list, &xid_fields); + llist_add(&xid_n201u.list, &xid_fields); + llist_add(&xid_n201i.list, &xid_fields); /* Append layer 3 XID field (if present) */ if (l3_xid_field) { -- To view, visit https://gerrit.osmocom.org/1359 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:57:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:57:05 +0000 Subject: openbsc[master]: LLC: Fixup element order in LLC-XID In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1359 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 5 18:57:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 18:57:06 +0000 Subject: [MERGED] openbsc[master]: LLC: Fixup element order in LLC-XID In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: LLC: Fixup element order in LLC-XID ...................................................................... LLC: Fixup element order in LLC-XID When the LLC-XID request is constructed the order of the elements in the TLV structure is reversed. This is in theory not a problem, but differs from what we know from our practical experience. This commit fixes the problem. Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 --- M openbsc/src/gprs/gprs_llc.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index e5a80e5..0215029 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -77,9 +77,9 @@ xid_n201i.data_len = 2; /* Add locally managed XID Fields */ - llist_add(&xid_n201i.list, &xid_fields); - llist_add(&xid_n201u.list, &xid_fields); llist_add(&xid_version.list, &xid_fields); + llist_add(&xid_n201u.list, &xid_fields); + llist_add(&xid_n201i.list, &xid_fields); /* Append layer 3 XID field (if present) */ if (l3_xid_field) { -- To view, visit https://gerrit.osmocom.org/1359 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1d71c947350d3c5a85ff36b71c1b8f036071d162 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Mon Dec 5 19:03:25 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 5 Dec 2016 19:03:25 +0000 Subject: openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1360/2/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 48: GSM_CHREQ_REASON_PBCH, this is a typo, right? Shouldn't it be PDCH? What is a PBCH? -- 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: 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: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 5 22:14:09 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 22:14:09 +0000 Subject: openbsc[master]: cosmetic: chan_alloc: use switch instead of if cascade In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1365/1/openbsc/src/libbsc/chan_alloc.c File openbsc/src/libbsc/chan_alloc.c: Line 153: > are you sure we don't want a break here? yes, _most_ cases above have a ret ah, I missed that one. I was lucky because the fall-through does exactly the same thing and causes no harm, but it's ugly code and not intentional. thanks :) -- To view, visit https://gerrit.osmocom.org/1365 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 5 23:32:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 23:32:37 +0000 Subject: [PATCH] openbsc[master]: cosmetic: chan_alloc: use switch instead of if-cascade 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/1365 to look at the new patch set (#2). cosmetic: chan_alloc: use switch instead of if-cascade Preparing cosmetically for a subsequent commit which will add another pchan kind to be checked, rather use a "switch (pchan) {}". Also reverse one if() branch to "early-exit" style. Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc --- M openbsc/src/libbsc/chan_alloc.c 1 file changed, 12 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/1365/2 diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 0f4d90a..a50b4ee 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -124,7 +124,8 @@ * to check whether a dynamic timeslot is already in TCH/H mode * and whether one of the two channels is still available. */ - if (pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { + switch (pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: if (ts->dyn.pchan_is != ts->dyn.pchan_want) { /* The TS's mode is being switched. Not * available anymore/yet. */ @@ -141,17 +142,19 @@ continue; return ts->lchan; } - if (ts->dyn.pchan_is == dyn_as_pchan) { - /* The requested type matches the dynamic - * timeslot's current mode. A channel may still - * be available (think TCH/H). */ - check_subslots = ts_subslots(ts); - } else - /* Otherwise this slot is not applicable. */ + if (ts->dyn.pchan_is != dyn_as_pchan) + /* not applicable. */ continue; - } else { + /* The requested type matches the dynamic timeslot's + * current mode. A channel may still be available + * (think TCH/H). */ + check_subslots = ts_subslots(ts); + break; + + default: /* Not a dynamic channel, there is only one pchan kind: */ check_subslots = ts_subslots(ts); + break; } /* Is a sub-slot still available? */ -- To view, visit https://gerrit.osmocom.org/1365 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc Gerrit-PatchSet: 2 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 Dec 5 23:32:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 5 Dec 2016 23:32:37 +0000 Subject: [PATCH] openbsc[master]: Fix TCH/F_PDCH: no need to check ts subslots for PDCH 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/1366 to look at the new patch set (#2). Fix TCH/F_PDCH: no need to check ts subslots for PDCH For TCH/F_PDCH in PDCH mode, directly return the lchan to use, in order to switch it to TCH/F. To check the pchan type in chan_alloc.c, make ts_pchan() public in gsm_data_shared.h. Commit c3f72f63afde926dfc46827d6880055597515fb6 broke TCH/F_PDCH, as a fallout of setting the GSM_PCHAN_PDCH subslots number to 0. This is sane and correct, but the chan_alloc code failed to see a ts as available if it has no subslots. Explanation: _lc_find_trx() checks each timeslot. For normal, static TCH timeslots we determine the number of logical subslots contained and check whether one of them is free. For dynamic TS, we can do the same when in TCH mode, but when in PDCH mode, we already know that it is available for immediate switchover for voice and hence can return it right away. TCH/F_TCH/H_PDCH already has a special check for that. TCH/F_PDCH doesn't, but this worked for TCH/F_PDCH as long as ts_subslots() returned 1 for PDCH: the for-loop at the bottom of _lc_find_trx() checked one subslot, which succeeded on an lchan in PDCH mode, since PDCH lchans are always marked type == NONE and state == NONE. Now we more accurately acknowledge that a PDCH timeslot has zero subslots and that a dynamic timeslot in PDCH mode can always be switched to voice immediately, without checking lchan type or state. So, above mentioned commit set PDCH to zero subslots, and the for-loop to check the (zero) subslots never ran and hence never returned the lchan. This fix adds a special condition for TCH/F_PDCH in PDCH mode, same as TCH/F_TCH/H_PDCH. (Todo: ts_pchan() can probably be used in other places as well to remove some code dup. Leaving that for another patch.) Fixes: OS#1868 Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/chan_alloc.c M openbsc/src/libcommon/gsm_data_shared.c 3 files changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/1366/2 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4ec4f69..9407b82 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -891,6 +891,7 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, int *rc); +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); bool ts_is_tch(struct gsm_bts_trx_ts *ts); diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index a50b4ee..33b79a0 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -151,6 +151,13 @@ check_subslots = ts_subslots(ts); break; + case GSM_PCHAN_TCH_F_PDCH: + /* Available for voice when in PDCH mode */ + if (ts_pchan(ts) != GSM_PCHAN_PDCH) + continue; + /* Subslots of a PDCH ts don't need to be checked. */ + return ts->lchan; + default: /* Not a dynamic channel, there is only one pchan kind: */ check_subslots = ts_subslots(ts); diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index df204fe..387af70 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -729,7 +729,7 @@ }; /*! Return the actual pchan type, also heeding dynamic TS. */ -static enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) { switch (ts->pchan) { case GSM_PCHAN_TCH_F_TCH_H_PDCH: -- To view, visit https://gerrit.osmocom.org/1366 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 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 Tue Dec 6 13:37:02 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 6 Dec 2016 13:37:02 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 10: They can't be run in parallel: for example "running as a ctrl client" will require external entity which binds to port used in "running as a server test". This can be worked around by parsing command-line and using corresponding test (and parameters like port etc) but I wanted the code to be as simple as possible. -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 10 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 Dec 7 00:07:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 7 Dec 2016 00:07:41 +0000 Subject: [PATCH] libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs Message-ID: Review at https://gerrit.osmocom.org/1367 contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs Add a first version of a python script that tries to analyze .c source files to draw graphs of osmo_fsm implementations. So far it uses quick-and-dirty regexes. Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 --- A contrib/fsm-to-dot.py 1 file changed, 710 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/67/1367/1 diff --git a/contrib/fsm-to-dot.py b/contrib/fsm-to-dot.py new file mode 100755 index 0000000..3549d1e --- /dev/null +++ b/contrib/fsm-to-dot.py @@ -0,0 +1,710 @@ +#!/usr/bin/env python + +__doc__ = ''' +fsm-to-dot: convert FSM definitons to graph images + +Usage: + ./fsm-to-dot.py ~/openbsc/openbsc/src/libvlr/*.c + for f in *.dot ; do dot -Tpng $f > $f.png; done + # dot comes from 'apt-get install graphviz' + +Looks for osmo_fsm finite state machine definitions and madly parses .c files +to draw graphs of them. This uses wild regexes that rely on coding style etc.. +No proper C parsing is done here (pycparser sucked, unfortunately). +''' + +import sys, re + +def err(msg): + sys.stderr.write(msg + '\n') + +class listdict(object): + def __getattr__(ld, name): + if name == 'add': + return ld.__getattribute__(name) + return ld.__dict__.__getattribute__(name) + + def _have(ld, name): + l = ld.__dict__.get(name) + if not l: + l = [] + ld.__dict__[name] = l + return l + + def add(ld, name, item): + l = ld._have(name) + l.append(item) + return ld + + def add_dict(ld, d): + for k,v in d.items(): + ld.add(k, v) + + def __setitem__(ld, name, val): + return ld.__dict__.__setitem__(name, val) + + def __getitem__(ld, name): + return ld.__dict__.__getitem__(name) + + def __str__(ld): + return ld.__dict__.__str__() + + def __repr__(ld): + return ld.__dict__.__repr__() + + def update(ld, other_ld): + for name, items in other_ld.items(): + ld.extend(name, items) + return ld + + def extend(ld, name, vals): + l = ld._have(name) + l.extend(vals) + return ld + +re_state_start = re.compile(r'\[([A-Z_][A-Z_0-9]*)\]') +re_event = re.compile(r'S\(([A-Z_][A-Z_0-9]*)\)') +re_action = re.compile(r'.action *= *([a-z_][a-z_0-9]*)') + +def state_starts(line): + m = re_state_start.search(line) + if m: + return m.group(1) + return None + +def in_event_starts(line): + return line.find('in_event_mask') >= 0 + +def out_state_starts(line): + return line.find('out_state_mask') >= 0 + +def states_or_events(line): + return re_event.findall(line) + +def parse_action(line): + a = re_action.findall(line) + if a: + return a[0] + return None + +def _common_prefix(a, b): + for l in reversed(range(1,len(a))): + aa = a[:l+1] + if b.startswith(aa): + return aa + return '' + +def common_prefix(strs): + if not strs: + return '' + p = None + for s in strs: + if p is None: + p = s + continue + p = _common_prefix(p, s) + if not p: + return '' + return p + +KIND_STATE = 'KIND_STATE' +KIND_FUNC = 'KIND_FUNC' +KIND_FSM = 'KIND_FSM' +BOX_SHAPES = { + KIND_STATE : None, + KIND_FUNC : 'box', + KIND_FSM : 'box3d', +} + +class Event: + def __init__(event, name): + event.name = name + event.short_name = name + + def __cmp__(event, other): + return cmp(event.name, other.name) + +class Edge: + def __init__(edge, to_state, event_name=None, style=None, action=None): + edge.to_state = to_state + edge.style = style + edge.events = [] + edge.actions = [] + edge.add_event_name(event_name) + edge.add_action(action) + + def add_event_name(edge, event_name): + if not event_name: + return + edge.add_event(Event(event_name)) + + def add_event(edge, event): + if not event: + return + if event in edge.events: + return + edge.events.append(event) + + def add_events(edge, events): + for event in events: + edge.add_event(event) + + def add_action(edge, action): + if not action or action in edge.actions: + return + edge.actions.append(action) + + def add_actions(edge, actions): + for action in actions: + edge.add_action(action) + + def event_names(edge): + return sorted([event.name for event in edge.events]) + + def event_labels(edge): + return sorted([event.short_name for event in edge.events]) + + def action_labels(edge): + return sorted([action + '()' for action in edge.actions]) + + def has_event_name(edge, event_name): + return event_name in edge.event_names() + +class State: + name = None + short_name = None + action = None + label = None + in_event_names = None + out_state_names = None + out_edges = None + kind = None + + def __init__(state): + state.in_event_names = [] + state.out_state_names = [] + state.out_edges = [] + state.kind = KIND_STATE + + def add_out_edge(state, edge): + for out_edge in state.out_edges: + if out_edge.to_state is edge.to_state: + if out_edge.style == edge.style: + out_edge.add_events(edge.events) + out_edge.add_actions(edge.actions) + return + # sanity + if out_edge.to_state.get_label() == edge.to_state.get_label(): + raise Exception('Two distinct states exist with identical labels.') + state.out_edges.append(edge) + + def get_label(state): + if state.label: + return state.label + l = [state.short_name] + if state.action: + if state.short_name == state.action: + l = [] + l.append(state.action + '()') + return r'\n'.join(l) + + def event_names(state): + event_names = [] + for out_edge in state.out_edges: + event_names.extend(out_edge.event_names()) + return event_names + + def shape_str(state): + shape = BOX_SHAPES.get(state.kind, None) + if not shape: + return '' + return ',shape=%s' % shape + + def __repr__(state): + return 'State(name=%r,short_name=%r,out=%d)' % (state.name, state.short_name, len(state.out_edges)) + +class Fsm: + def __init__(fsm, struct_name, states_struct_name, from_file=None): + fsm.states = [] + fsm.struct_name = struct_name + fsm.states_struct_name = states_struct_name + fsm.from_file = from_file + fsm.action_funcs = set() + fsm.event_names = set() + + def parse_states(fsm, src): + state = None + started = None + + IN_EVENTS = 'events' + OUT_STATES = 'states' + + lines = src.splitlines() + + for line in lines: + state_name = state_starts(line) + if state_name: + state = State() + fsm.states.append(state) + started = None + state.name = state_name + + if in_event_starts(line): + started = IN_EVENTS + if out_state_starts(line): + started = OUT_STATES + + if not state or not started: + continue + + tokens = states_or_events(line) + if started == IN_EVENTS: + state.in_event_names.extend(tokens) + elif started == OUT_STATES: + state.out_state_names.extend(tokens) + else: + err('ignoring: %r' % tokens) + + a = parse_action(line) + if a: + state.action = a + + + for state in fsm.states: + if state.action: + fsm.action_funcs.add(state.action) + if state.in_event_names: + fsm.event_names.update(state.in_event_names) + + fsm.make_states_short_names() + fsm.ref_out_states() + + def make_states_short_names(fsm): + p = common_prefix([s.name for s in fsm.states]) + for s in fsm.states: + s.short_name = s.name[len(p):] + return p + + def make_events_short_names(fsm): + p = common_prefix(fsm.event_names) + for state in fsm.states: + for edge in state.out_edges: + for event in edge.events: + event.short_name = event.name[len(p):] + + def ref_out_states(fsm): + for state in fsm.states: + for e in [Edge(fsm.find_state_by_name(n, True)) for n in state.out_state_names]: + state.add_out_edge(e) + + def find_state_by_name(fsm, name, strict=False): + for state in fsm.states: + if state.name == name: + return state + if strict: + raise Exception("State not found: %r" % name); + return None + + def find_state_by_action(fsm, action): + for state in fsm.states: + if state.action == action: + return state + return None + + def add_special_state(fsm, additional_states, name, in_state=None, + out_state=None, event_name=None, kind=KIND_FUNC, + state_action=None, label=None, edge_action=None): + additional_state = None + for s in additional_states: + if s.short_name == name: + additional_state = s + break; + + if not additional_state: + for s in fsm.states: + if s.short_name == name: + additional_state = s + break; + + if kind == KIND_FUNC and not state_action: + state_action = name + + if not additional_state: + additional_state = State() + additional_state.short_name = name + additional_state.action = state_action + additional_state.kind = kind + additional_state.label = label + additional_states.append(additional_state) + + if out_state: + additional_state.out_state_names.append(out_state.name) + additional_state.add_out_edge(Edge(out_state, event_name, 'dotted', + action=edge_action)) + + if in_state: + in_state.out_state_names.append(additional_state.name) + in_state.add_out_edge(Edge(additional_state, event_name, 'dotted', + action=edge_action)) + + + def find_event_edges(fsm, c_files): + # enrich state transitions between the states with event labels + func_to_state_transitions = listdict() + for c_file in c_files: + func_to_state_transitions.update( c_file.find_state_transitions(fsm.event_names) ) + + # edges between explicit states + for state in fsm.states: + transitions = func_to_state_transitions.get(state.action) + if not transitions: + continue + + for to_state_name, event_name in transitions: + if not event_name: + continue + for out_edge in state.out_edges: + if out_edge.to_state.name == to_state_name: + out_edge.add_event_name(event_name) + + additional_states = [] + + + # functions that aren't state actions but still effect state transitions + for func_name, transitions in func_to_state_transitions.items(): + if func_name in fsm.action_funcs: + continue + for to_state_name, event_name in transitions: + to_state = fsm.find_state_by_name(to_state_name) + if not to_state: + continue + fsm.add_special_state(additional_states, func_name, None, to_state, event_name) + + + event_sources = c_files.find_event_sources(fsm.event_names) + + for state in fsm.states: + + for in_event_name in state.in_event_names: + funcs_for_in_event = event_sources.get(in_event_name) + if not funcs_for_in_event: + continue + + found = False + for out_edge in state.out_edges: + if out_edge.has_event_name(in_event_name): + out_edge.action = r'\n'.join([(f + '()') for f in funcs_for_in_event + if f != state.action]) + + # if any functions that don't belong to a state trigger events, add + # them to the graph as well + additional_funcs = [f for f in funcs_for_in_event if f not in fsm.action_funcs] + for af in additional_funcs: + fsm.add_special_state(additional_states, af, None, state, in_event_name) + + fsm.states.extend(additional_states) + + # do any existing action functions by chance call other action functions? + for state in fsm.states: + if not state.action: + continue + callers = c_files.find_callers(state.action) + if not callers: + continue + for other_state in fsm.states: + if other_state.action in callers: + other_state.add_out_edge(Edge(state, None, 'dotted')) + + def add_fsm_alloc(fsm, c_files): + + allocating_funcs = [] + for c_file in c_files: + allocating_funcs.extend(c_file.fsm_allocators.get(fsm.struct_name, [])) + + starting_state = None + if fsm.states: + # assume the first state starts + starting_state = fsm.states[0] + + additional_states = [] + for func_name in allocating_funcs: + fsm.add_special_state(additional_states, func_name, None, starting_state) + + fsm.states.extend(additional_states) + + def add_cross_fsm_links(fsm, fsms, c_files, fsm_meta): + for state in fsm.states: + if not state.action: + continue + if state.kind == KIND_FSM: + continue + callers = c_files.find_callers(state.action) + + if state.kind == KIND_FUNC: + callers.append(state.action) + + if not callers: + continue + + for caller in callers: + for calling_fsm in fsms: + if calling_fsm is fsm: + continue + calling_state = calling_fsm.find_state_by_action(caller) + if not calling_state: + continue + if calling_state.kind == KIND_FSM: + continue + + label = None + if state.kind == KIND_STATE: + label=fsm.struct_name + ': ' + state.short_name + edge_action = caller + if calling_state.action == edge_action: + edge_action = None + calling_fsm.add_special_state(calling_fsm.states, fsm.struct_name, + calling_state, kind=KIND_FSM, edge_action=edge_action, label=label) + + label = None + if calling_state.kind == KIND_STATE: + label=calling_fsm.struct_name + ': ' + calling_state.short_name + edge_action = caller + if state.action == edge_action: + edge_action = None + fsm.add_special_state(fsm.states, calling_fsm.struct_name, None, + state, kind=KIND_FSM, edge_action=edge_action, + label=label) + + # meta overview + meta_called_fsm = fsm_meta.have_state(fsm.struct_name, KIND_FSM) + meta_calling_fsm = fsm_meta.have_state(calling_fsm.struct_name, KIND_FSM) + meta_calling_fsm.add_out_edge(Edge(meta_called_fsm)) + + + def have_state(fsm, name, kind=KIND_STATE): + state = fsm.find_state_by_name(name) + if not state: + state = State() + state.name = name + state.short_name = name + state.kind = kind + fsm.states.append(state) + return state + + def to_dot(fsm): + out = ['digraph G {', 'rankdir=LR;'] + + for state in fsm.states: + out.append('%s [label="%s"%s]' % (state.short_name, state.get_label(), + state.shape_str())) + + for state in fsm.states: + for out_edge in state.out_edges: + attrs = [] + labels = [] + if out_edge.events: + labels.extend(out_edge.event_labels()) + if out_edge.actions: + labels.extend(out_edge.action_labels()) + if labels: + attrs.append('label="%s"' % (r'\n'.join(labels))) + if out_edge.style: + attrs.append('style=%s'% out_edge.style) + attrs_str = '' + if attrs: + attrs_str = ' [%s]' % (','.join(attrs)) + out.append('%s->%s%s' % (state.short_name, out_edge.to_state.short_name, attrs_str)) + + out.append('}\n') + + return '\n'.join(out) + + def write_dot_file(fsm): + dot_path = '%s.dot' % fsm.struct_name + f = open(dot_path, 'w') + f.write(fsm.to_dot()) + f.close() + print(dot_path) + + +re_fsm = re.compile(r'struct osmo_fsm ([a-z_][a-z_0-9]*) =') +re_fsm_states_struct_name = re.compile(r'\bstates = ([a-z_][a-z_0-9]*)\W*,') +re_fsm_states = re.compile(r'struct osmo_fsm_state ([a-z_][a-z_0-9]*)\[\] =') +re_func = re.compile(r'(\b[a-z_][a-z_0-9]*\b)\([^)]*\)\W*^{', re.MULTILINE) +re_state_trigger = re.compile(r'osmo_fsm_inst_state_chg\([^,]+,\W*([A-Z_][A-Z_0-9]*)\W*,', re.M) +re_fsm_alloc = re.compile(r'osmo_fsm_inst_alloc[_child]*\(\W*&([a-z_][a-z_0-9]*),', re.M) +re_fsm_event_dispatch = re.compile(r'osmo_fsm_inst_dispatch\(\W*[^,]+,\W*([A-Z_][A-Z_0-9]*)\W*,', re.M) + +class CFile(): + def __init__(c_file, path): + c_file.path = path + c_file.src = open(path).read() + c_file.funcs = {} + c_file.fsm_allocators = listdict() + + def extract_block(c_file, brace_open, brace_close, start): + pos = 0 + try: + src = c_file.src + block_start = src.find(brace_open, start) + + pos = block_start + level = 1 + while level > 0: + pos += 1 + if src[pos] == brace_open: + level += 1 + elif src[pos] == brace_close: + level -= 1 + + return src[block_start+1:pos] + except: + print("Error while trying to extract a code block from %r char pos %d" % (c_file.path, pos)) + print("Block start at char pos %d" % block_start) + try: + print(src[block_start - 20 : block_start + 20]) + print('...') + print(src[pos - 20 : pos + 20]) + except: + pass + return '' + + + def find_fsms(c_file): + fsms = [] + for m in re_fsm.finditer(c_file.src): + struct_name = m.group(1) + struct_def = c_file.extract_block('{', '}', m.start()) + states_struct_name = re_fsm_states_struct_name.findall(struct_def)[0] + fsm = Fsm(struct_name, states_struct_name, c_file) + fsms.append(fsm) + return fsms + + def find_fsm_states(c_file, fsms): + for m in re_fsm_states.finditer(c_file.src): + states_struct_name = m.group(1) + for fsm in fsms: + if states_struct_name == fsm.states_struct_name: + fsm.parse_states(c_file.extract_block('{', '}', m.start())) + + def parse_functions(c_file): + funcs = {} + for m in re_func.finditer(c_file.src): + name = m.group(1) + func_src = c_file.extract_block('{', '}', m.start()) + funcs[name] = func_src + c_file.funcs = funcs + c_file.find_fsm_allocators() + + def find_callers(c_file, func_name): + func_call = func_name + '(' + callers = [] + for func_name, src in c_file.funcs.items(): + if src.find(func_call) >= 0: + callers.append(func_name) + return callers + + def find_fsm_allocators(c_file): + c_file.fsm_allocators = listdict() + for func_name, src in c_file.funcs.items(): + for m in re_fsm_alloc.finditer(src): + fsm_struct_name = m.group(1) + c_file.fsm_allocators.add(fsm_struct_name, func_name) + + def find_state_transitions(c_file, event_names): + TO_STATE = 'TO_STATE' + EVENT = 'EVENT' + func_to_state_transitions = listdict() + + for func_name, src in c_file.funcs.items(): + found_tokens = [] + + for m in re_state_trigger.finditer(src): + to_state = m.group(1) + found_tokens.append((m.start(), TO_STATE, to_state)) + + for event in event_names: + re_event = re.compile(r'\b(' + event + r')\b') + for m in re_event.finditer(src): + event = m.group(1) + found_tokens.append((m.start(), EVENT, event)) + + found_tokens = sorted(found_tokens) + + last_event = None + for start, kind, name in found_tokens: + if kind == EVENT: + last_event = name + else: + func_to_state_transitions.add(func_name, (name, last_event)) + + return func_to_state_transitions + + + def find_event_sources(c_file, event_names): + c_file.event_sources = listdict() + for func_name, src in c_file.funcs.items(): + for m in re_fsm_event_dispatch.finditer(src): + event_name = m.group(1) + c_file.event_sources.add(event_name, func_name) + +class CFiles(list): + + def find_callers(c_files, func_name): + callers = [] + for c_file in c_files: + callers.extend(c_file.find_callers(func_name)) + return callers + + def find_func_to_state_transitions(c_files): + func_to_state_transitions = listdict() + for c_file in c_files: + func_to_state_transitions.update( c_file.find_state_transitions(fsm.event_names) ) + return func_to_state_transitions + + def find_event_sources(c_files, event_names): + event_sources = listdict() + for c_file in c_files: + for event, sources in c_file.event_sources.items(): + if event in event_names: + event_sources.extend(event, sources) + return event_sources + +c_files = CFiles() +paths_seen = set() +for path in sys.argv[1:]: + if path in paths_seen: + continue + paths_seen.add(path) + c_file = CFile(path) + c_files.append(c_file) + +for c_file in c_files: + c_file.parse_functions() + +fsms = [] +for c_file in c_files: + fsms.extend(c_file.find_fsms()) + +for c_file in c_files: + c_file.find_fsm_states(fsms) + c_file.find_event_sources(fsms) + +for fsm in fsms: + fsm.find_event_edges(c_files) + fsm.add_fsm_alloc(c_files) + +fsm_meta = Fsm("meta", "meta") +for fsm in fsms: + fsm.add_cross_fsm_links(fsms, c_files, fsm_meta) + +for fsm in fsms: + fsm.make_events_short_names() + +for fsm in fsms: + fsm.write_dot_file() + +fsm_meta.write_dot_file() + + +# vim: tabstop=2 shiftwidth=2 expandtab -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 7 10:25:52 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 7 Dec 2016 10:25:52 +0000 Subject: [PATCH] openbsc[master]: Turn some warnings into errors Message-ID: Review at https://gerrit.osmocom.org/1368 Turn some warnings into errors Make warnings related to common memory-related issues into warnings to harden the source and decrease chance of errors. Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 --- M openbsc/src/Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/68/1368/1 diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am index cfad7df..f7ba8ac 100644 --- a/openbsc/src/Makefile.am +++ b/openbsc/src/Makefile.am @@ -6,6 +6,8 @@ AM_CFLAGS = \ -Wall \ + -Werror=implicit -Werror=maybe-uninitialized -Werror=memset-transposed-args -Werror=null-dereference \ + -Werror=sizeof-pointer-memaccess -Werror=sizeof-array-argument \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 7 12:48:54 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 7 Dec 2016 12:48:54 +0000 Subject: [PATCH] osmo-bts[master]: Save RTP metadata in Control Buffer In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1343 to look at the new patch set (#2). Save RTP metadata in Control Buffer Having RTP metadata is useful for debugging - save Sequence Number and Timestamp next to Marker bit from RTP header. Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 --- M include/osmo-bts/msg_utils.h M src/common/l1sap.c 2 files changed, 17 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/43/1343/2 diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 4f9868c..c5cd754 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -16,6 +16,12 @@ /* Access 1st byte of msgb control buffer */ #define rtpmsg_marker_bit(x) ((x)->cb[0]) +/* Access 2nd byte of msgb control buffer */ +#define rtpmsg_seq(x) ((x)->cb[1]) + +/* Access 3rd byte of msgb control buffer */ +#define rtpmsg_ts(x) ((x)->cb[2]) + /** * Classification of OML message. ETSI for plain GSM 12.21 * messages and IPA/Osmo for manufacturer messages. diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 553011f..0274d91 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -662,7 +662,8 @@ struct gsm_time g_time; struct gsm_lchan *lchan; uint8_t chan_nr, marker = 0; - uint32_t fn; + uint16_t seq; + uint32_t fn, timestamp; chan_nr = rts_ind->chan_nr; fn = rts_ind->fn; @@ -695,6 +696,10 @@ } else { /* Obtain RTP header Marker bit from control buffer */ marker = rtpmsg_marker_bit(resp_msg); + /* Obtain RTP header Sequence Number from control buffer */ + seq = rtpmsg_seq(resp_msg); + /* Obtain RTP header Timestamp from control buffer */ + timestamp = rtpmsg_ts(resp_msg); resp_msg->l2h = resp_msg->data; msgb_push(resp_msg, sizeof(*resp_l1sap)); @@ -1075,8 +1080,12 @@ /* Store RTP header Marker bit in control buffer */ rtpmsg_marker_bit(msg) = marker; + /* Store RTP header Sequence Number in control buffer */ + rtpmsg_seq(msg) = seq_number; + /* Store RTP header Timestamp in control buffer */ + rtpmsg_ts(msg) = timestamp; - /* make sure the queue doesn't get too long */ + /* make sure the queue doesn't get too long */ llist_for_each_entry(tmp, &lchan->dl_tch_queue, list) count++; while (count >= 2) { -- To view, visit https://gerrit.osmocom.org/1343 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 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 Wed Dec 7 12:49:44 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 7 Dec 2016 12:49:44 +0000 Subject: osmo-bts[master]: Save RTP metadata in Control Buffer In-Reply-To: References: Message-ID: Patch Set 2: Oops, was sure that it's uint8_t for some reason. Fixed in new version, thanks. -- To view, visit https://gerrit.osmocom.org/1343 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 Gerrit-PatchSet: 2 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 Wed Dec 7 14:33:32 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 7 Dec 2016 14:33:32 +0000 Subject: [PATCH] osmo-iuh[master]: log: fix number format for domain indicator Message-ID: Review at https://gerrit.osmocom.org/1369 log: fix number format for domain indicator CN_DomainIndicator_t is a long, so use %l format. Error was introduced in recent 2b5021fd8d445f0ca4f28e0ea71a19cd52724e57. Fixes: CID#157119 Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f --- M src/hnbgw_rua.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/69/1369/1 diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c index 0ca64d3..47d33f0 100644 --- a/src/hnbgw_rua.c +++ b/src/hnbgw_rua.c @@ -348,7 +348,7 @@ cn = hnb->gw->cnlink_ps; break; default: - LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %u\n", + LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %l\n", ies.cN_DomainIndicator); rc = -1; goto error_free; @@ -394,7 +394,7 @@ cn = hnb->gw->cnlink_ps; break; default: - LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %u\n", + LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %l\n", ies.cN_DomainIndicator); rc = -1; goto error_free; -- To view, visit https://gerrit.osmocom.org/1369 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 7 18:20:44 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 7 Dec 2016 18:20:44 +0000 Subject: [PATCH] openbsc[master]: Replace duplicated code with macro call Message-ID: Review at https://gerrit.osmocom.org/1370 Replace duplicated code with macro call Use already defined GSM48_LEN2PLEN for computing SI length. Change-Id: I2020417119c844b886f89e34dbfd75e716743dc4 --- M openbsc/src/libbsc/system_information.c 1 file changed, 10 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/70/1370/1 diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 3f6d6b9..6c601e4 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -541,7 +541,7 @@ memset(si1, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si1->header.l2_plen = (21 << 2) | 1; + si1->header.l2_plen = GSM48_LEN2PLEN(21); si1->header.rr_protocol_discriminator = GSM48_PDISC_RR; si1->header.skip_indicator = 0; si1->header.system_information = GSM48_MT_RR_SYSINFO_1; @@ -570,7 +570,7 @@ memset(si2, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si2->header.l2_plen = (22 << 2) | 1; + si2->header.l2_plen = GSM48_LEN2PLEN(22); si2->header.rr_protocol_discriminator = GSM48_PDISC_RR; si2->header.skip_indicator = 0; si2->header.system_information = GSM48_MT_RR_SYSINFO_2; @@ -596,7 +596,7 @@ memset(si2b, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si2b->header.l2_plen = (22 << 2) | 1; + si2b->header.l2_plen = GSM48_LEN2PLEN(22); si2b->header.rr_protocol_discriminator = GSM48_PDISC_RR; si2b->header.skip_indicator = 0; si2b->header.system_information = GSM48_MT_RR_SYSINFO_2bis; @@ -630,7 +630,7 @@ memset(si2t, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si2t->header.l2_plen = (22 << 2) | 1; + si2t->header.l2_plen = GSM48_LEN2PLEN(22); si2t->header.rr_protocol_discriminator = GSM48_PDISC_RR; si2t->header.skip_indicator = 0; si2t->header.system_information = GSM48_MT_RR_SYSINFO_2ter; @@ -711,7 +711,7 @@ memset(si3, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si3->header.l2_plen = (18 << 2) | 1; + si3->header.l2_plen = GSM48_LEN2PLEN(18); si3->header.rr_protocol_discriminator = GSM48_PDISC_RR; si3->header.skip_indicator = 0; si3->header.system_information = GSM48_MT_RR_SYSINFO_3; @@ -784,7 +784,7 @@ /* we don't use hopping and thus don't need a CBCH MA */ } - si4->header.l2_plen = (l2_plen << 2) | 1; + si4->header.l2_plen = GSM48_LEN2PLEN(l2_plen); /* SI4 Rest Octets (10.5.2.35), containing Optional Power offset, GPRS Indicator, @@ -805,7 +805,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: @@ -840,7 +840,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: @@ -884,7 +884,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: @@ -921,7 +921,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: -- To view, visit https://gerrit.osmocom.org/1370 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2020417119c844b886f89e34dbfd75e716743dc4 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 7 18:20:45 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 7 Dec 2016 18:20:45 +0000 Subject: [PATCH] openbsc[master]: Use arch-independent type for SI length Message-ID: Review at https://gerrit.osmocom.org/1371 Use arch-independent type for SI length This is a troubleshooting fix in attempt to make hard-to-reproduce crash during UARFCN encoding for SI2q into more predictable one. Change-Id: I6e35d4c5e9822696e4b979e68a89bec6c99fec2f --- M openbsc/src/libbsc/bsc_init.c 1 file changed, 6 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/71/1371/1 diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 9e913d6..077a23d 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -124,10 +124,13 @@ /* set all system information types for a TRX */ int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx) { - int i, rc; + int rc; struct gsm_bts *bts = trx->bts; - uint8_t gen_si[_MAX_SYSINFO_TYPE], n_si = 0, n; - int si_len[_MAX_SYSINFO_TYPE]; + uint8_t gen_si[_MAX_SYSINFO_TYPE], n_si = 0, n, i, + /* SI length might be more than GSM_MACBLOCK_LEN (23 bytes) if we + use SI2quater INDEX & COUNT and store them in-place but this + isn't supported yet */ + si_len[_MAX_SYSINFO_TYPE]; bts->si_common.cell_sel_par.ms_txpwr_max_ccch = ms_pwr_ctl_lvl(bts->band, bts->ms_max_power); -- To view, visit https://gerrit.osmocom.org/1371 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6e35d4c5e9822696e4b979e68a89bec6c99fec2f Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 8 11:24:19 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 11:24:19 +0000 Subject: [PATCH] openbsc[master]: Cosmetic fixes around SI generation Message-ID: Review at https://gerrit.osmocom.org/1372 Cosmetic fixes around SI generation * add missing spaces after comma and minus * make range_enc_arfcns() return void instead of always returning 0 * prevent useless recursion calls Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e --- M openbsc/include/openbsc/arfcn_range_encode.h M openbsc/src/libbsc/arfcn_range_encode.c M openbsc/src/libbsc/bsc_init.c M openbsc/src/libbsc/system_information.c 4 files changed, 11 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/72/1372/1 diff --git a/openbsc/include/openbsc/arfcn_range_encode.h b/openbsc/include/openbsc/arfcn_range_encode.h index bd85d6a..11192d1 100644 --- a/openbsc/include/openbsc/arfcn_range_encode.h +++ b/openbsc/include/openbsc/arfcn_range_encode.h @@ -14,7 +14,7 @@ #define RANGE_ENC_MAX_ARFCNS 29 int range_enc_determine_range(const int *arfcns, int size, int *f0_out); -int range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); +void range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); int range_enc_find_index(const int rng, const int *arfcns, int size); int range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included); diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index e67bf0a..dce864d 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -79,7 +79,7 @@ * \param size The size of the list of ARFCNs * \param out Place to store the W(i) output. */ -int range_enc_arfcns(const int range, +void range_enc_arfcns(const int range, const int *arfcns, int size, int *out, const int index) { @@ -100,11 +100,11 @@ /* Test the two recursion anchors and stop processing */ if (size == 0) - return 0; + return; if (size == 1) { out[index] = 1 + arfcns[0]; - return 0; + return; } /* Now do the processing */ @@ -127,11 +127,12 @@ * Now recurse and we need to make this iterative... but as the * tree is balanced the stack will not be too deep. */ - range_enc_arfcns(range / 2, arfcns_left, l_size, + if (l_size) + range_enc_arfcns(range / 2, arfcns_left, l_size, out, index + greatest_power_of_2_lesser_or_equal_to(index + 1)); - range_enc_arfcns((range -1 ) / 2, arfcns_right, r_size, + if (r_size) + range_enc_arfcns((range - 1) / 2, arfcns_right, r_size, out, index + (2 * greatest_power_of_2_lesser_or_equal_to(index + 1))); - return 0; } /* diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 9e913d6..b17ff79 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -193,7 +193,7 @@ return 0; err_out: - LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>," + LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, " "most likely a problem with neighbor cell list generation\n", get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc)); return rc; diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 3f6d6b9..1b4145c 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -325,7 +325,7 @@ int w[RANGE_ENC_MAX_ARFCNS]; int f0_included = 0; int arfcns_used = 0; - int i, rc, range, f0; + int i, range, f0; /* * Select ARFCNs according to the rules in bitvec2freq_list @@ -354,9 +354,7 @@ f0, &f0_included); memset(w, 0, sizeof(w)); - rc = range_enc_arfcns(range, arfcns, arfcns_used, w, 0); - if (rc != 0) - return -3; + range_enc_arfcns(range, arfcns, arfcns_used, w, 0); /* Select the range and the amount of bits needed */ switch (range) { -- To view, visit https://gerrit.osmocom.org/1372 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 8 11:49:48 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 11:49:48 +0000 Subject: libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Patch Set 1: I think it would be much better to do it other way around and generate .c code (and corresponding documentation) from .dot files. -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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 Dec 8 11:51:01 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Thu, 8 Dec 2016 11:51:01 +0000 Subject: [PATCH] osmo-pcu[master]: Add statistics in the ms and tbf level. 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/1345 to look at the new patch set (#4). Add statistics in the ms and tbf level. Adds DL throughput in show ms imsi . Adds the number of coding schemes counter and rlc nacked counter at TBf level. Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c --- M src/gprs_rlcmac_meas.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp 5 files changed, 128 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/45/1345/4 diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp index 5a2e38e..d6bbc19 100644 --- a/src/gprs_rlcmac_meas.cpp +++ b/src/gprs_rlcmac_meas.cpp @@ -179,6 +179,8 @@ if (elapsed < 128) return 0; + tbf->m_bw.dl_throughput = (tbf->m_bw.dl_bw_octets/elapsed); + LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: " "%d KBits/s\n", tbf->imsi(), tbf->tlli(), tbf->m_bw.dl_bw_octets / elapsed); diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index ca7f7ad..4b4b36d 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -76,6 +76,13 @@ vty_out(vty, " V(A)=%d V(S)=%d nBSN=%d%s", win->v_a(), win->v_s(), win->resend_needed(), win->window_stalled() ? " STALLED" : ""); + vty_out(vty, "%s", VTY_NEWLINE); + vty_out_rate_ctr_group(vty, " ", tbf->m_ctrs); + if(GprsCodingScheme::GPRS == tbf->ms()->mode()) { + vty_out_rate_ctr_group(vty, " ", dl_tbf->m_dl_gprs_ctrs); + } else { + vty_out_rate_ctr_group(vty, " ", dl_tbf->m_dl_egprs_ctrs); + } } vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE); } @@ -176,11 +183,15 @@ ms->ul_tbf()->tfi(), ms->ul_tbf()->state_name(), VTY_NEWLINE); - if (ms->dl_tbf()) + if (ms->dl_tbf()) { vty_out(vty, " Downlink TBF: TFI=%d, state=%s%s", ms->dl_tbf()->tfi(), ms->dl_tbf()->state_name(), VTY_NEWLINE); + vty_out(vty, " Current DL Throughput: %d Kbps %s", + ms->dl_tbf()->m_bw.dl_throughput, + VTY_NEWLINE); + } llist_for_each(i_tbf, &ms->old_tbfs()) vty_out(vty, " Old %-19s TFI=%d, state=%s%s", diff --git a/src/tbf.cpp b/src/tbf.cpp index 25209e4..60fba68 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -33,6 +33,7 @@ extern "C" { #include #include +#include } #include @@ -41,6 +42,53 @@ extern void *tall_pcu_ctx; static void tbf_timer_cb(void *_tbf); + +static const struct rate_ctr_desc tbf_ctr_description[] = { + { "rlc.nacked", "RLC Nacked " }, +}; + +static const struct rate_ctr_desc tbf_dl_gprs_ctr_description[] = { + { "gprs.downlink.cs1", "CS1 " }, + { "gprs.downlink.cs2", "CS2 " }, + { "gprs.downlink.cs3", "CS3 " }, + { "gprs.downlink.cs4", "CS4 " }, +}; + +static const struct rate_ctr_desc tbf_dl_egprs_ctr_description[] = { + { "egprs.downlink.mcs1", "MCS1 " }, + { "egprs.downlink.mcs2", "MCS2 " }, + { "egprs.downlink.mcs3", "MCS3 " }, + { "egprs.downlink.mcs4", "MCS4 " }, + { "egprs.downlink.mcs5", "MCS5 " }, + { "egprs.downlink.mcs6", "MCS6 " }, + { "egprs.downlink.mcs7", "MCS7 " }, + { "egprs.downlink.mcs8", "MCS8 " }, + { "egprs.downlink.mcs9", "MCS9 " }, +}; + +static const struct rate_ctr_group_desc tbf_ctrg_desc = { + "pcu.tbf", + "TBF Statistics", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_ctr_description), + tbf_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = { + "tbf.gprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_dl_gprs_ctr_description), + tbf_dl_gprs_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_dl_egprs_ctrg_desc = { + "tbf.egprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_dl_egprs_ctr_description), + tbf_dl_egprs_ctr_description, +}; gprs_rlcmac_tbf::Meas::Meas() : rssi_sum(0), @@ -78,7 +126,8 @@ m_ms_class(0), m_list(this), m_ms_list(this), - m_egprs_enabled(false) + m_egprs_enabled(false), + m_ctrs(NULL) { /* The classes of these members do not have proper constructors yet. * Just set them to 0 like talloc_zero did */ @@ -325,6 +374,12 @@ if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_ul_aborted(); } else { + gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); + if (tbf->is_egprs_enabled()) { + rate_ctr_group_free(dl_tbf->m_dl_egprs_ctrs); + } else { + rate_ctr_group_free(dl_tbf->m_dl_gprs_ctrs); + } tbf->bts->tbf_dl_freed(); if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_dl_aborted(); @@ -359,6 +414,8 @@ if (tbf->ms()) tbf->set_ms(NULL); + + rate_ctr_group_free(tbf->m_ctrs); LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF ends here **********\n"); talloc_free(tbf); @@ -646,6 +703,8 @@ "Allocated %s: trx = %d, ul_slots = %02x, dl_slots = %02x\n", tbf->name(), tbf->trx->trx_no, tbf->ul_slots(), tbf->dl_slots()); + tbf->m_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0); + return 0; } @@ -732,7 +791,8 @@ gprs_rlcmac_dl_tbf::BandWidth::BandWidth() : dl_bw_octets(0), dl_loss_lost(0), - dl_loss_received(0) + dl_loss_received(0), + dl_throughput(0) { timerclear(&dl_bw_tv); timerclear(&dl_loss_tv); @@ -744,7 +804,9 @@ m_wait_confirm(0), m_dl_ack_requested(false), m_last_dl_poll_fn(0), - m_last_dl_drained_fn(0) + m_last_dl_drained_fn(0), + m_dl_gprs_ctrs(NULL), + m_dl_egprs_ctrs(NULL) { memset(&m_llc_timer, 0, sizeof(m_llc_timer)); } @@ -802,8 +864,12 @@ return NULL; } - if (tbf->is_egprs_enabled()) + if (tbf->is_egprs_enabled()) { tbf->egprs_calc_window_size(); + tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_egprs_ctrg_desc, 0); + } else { + tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_gprs_ctrg_desc, 0); + } llist_add(&tbf->list(), &bts->bts->dl_tbfs()); tbf->bts->tbf_dl_created(); diff --git a/src/tbf.h b/src/tbf.h index 1e98a24..5017d3e 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -79,6 +79,29 @@ GPRS_RLCMAC_UL_TBF }; +enum tbf_counters { + TBF_CTR_RLC_NACKED, +}; + +enum tbf_gprs_counters { + TBF_CTR_GPRS_DL_CS1, + TBF_CTR_GPRS_DL_CS2, + TBF_CTR_GPRS_DL_CS3, + TBF_CTR_GPRS_DL_CS4, +}; + +enum tbf_egprs_counters { + TBF_CTR_EGPRS_DL_MCS1, + TBF_CTR_EGPRS_DL_MCS2, + TBF_CTR_EGPRS_DL_MCS3, + TBF_CTR_EGPRS_DL_MCS4, + TBF_CTR_EGPRS_DL_MCS5, + TBF_CTR_EGPRS_DL_MCS6, + TBF_CTR_EGPRS_DL_MCS7, + TBF_CTR_EGPRS_DL_MCS8, + TBF_CTR_EGPRS_DL_MCS9, +}; + #define GPRS_RLCMAC_FLAG_CCCH 0 /* assignment on CCCH */ #define GPRS_RLCMAC_FLAG_PACCH 1 /* assignment on PACCH */ #define GPRS_RLCMAC_FLAG_UL_DATA 2 /* uplink data received */ @@ -224,6 +247,8 @@ */ uint8_t m_tfi; time_t m_created_ts; + + struct rate_ctr_group *m_ctrs; protected: gprs_rlcmac_bts *bts_data() const; @@ -399,6 +424,7 @@ struct BandWidth { struct timeval dl_bw_tv; /* timestamp for dl bw calculation */ uint32_t dl_bw_octets; /* number of octets since bw_tv */ + uint32_t dl_throughput; /* throughput to be displayed in stats */ struct timeval dl_loss_tv; /* timestamp for loss calculation */ uint16_t dl_loss_lost; /* sum of lost packets */ @@ -407,6 +433,9 @@ BandWidth(); } m_bw; + struct rate_ctr_group *m_dl_gprs_ctrs; + struct rate_ctr_group *m_dl_egprs_ctrs; + protected: struct ana_result { unsigned received_packets; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index c6f3945..2af2ff0 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -949,6 +949,7 @@ ms()->update_error_rate(this, error_rate); m_window.update(bts, rbb, first_bsn, &lost, &received); + rate_ctr_add(&m_ctrs->ctr[TBF_CTR_RLC_NACKED], lost); /* report lost and received packets */ gprs_rlcmac_received_lost(this, received, lost); @@ -1007,6 +1008,7 @@ m_window.update(bts, show_rbb, ssn, &lost, &received); + rate_ctr_add(&m_ctrs->ctr[TBF_CTR_RLC_NACKED], lost); /* report lost and received packets */ gprs_rlcmac_received_lost(this, received, lost); @@ -1342,45 +1344,58 @@ switch (coding_scheme) { case GprsCodingScheme::CS1 : bts->gprs_dl_cs1(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS1]); break; case GprsCodingScheme::CS2 : bts->gprs_dl_cs2(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS2]); break; case GprsCodingScheme::CS3 : bts->gprs_dl_cs3(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS3]); break; case GprsCodingScheme::CS4 : bts->gprs_dl_cs4(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS4]); break; } } else { switch (coding_scheme) { case GprsCodingScheme::MCS1 : bts->egprs_dl_mcs1(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS1]); break; case GprsCodingScheme::MCS2 : bts->egprs_dl_mcs2(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS2]); break; case GprsCodingScheme::MCS3 : bts->egprs_dl_mcs3(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS3]); break; case GprsCodingScheme::MCS4 : bts->egprs_dl_mcs4(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS4]); break; case GprsCodingScheme::MCS5 : bts->egprs_dl_mcs5(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS5]); break; case GprsCodingScheme::MCS6 : bts->egprs_dl_mcs6(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS6]); break; case GprsCodingScheme::MCS7 : bts->egprs_dl_mcs7(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS7]); break; case GprsCodingScheme::MCS8 : bts->egprs_dl_mcs8(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS8]); break; case GprsCodingScheme::MCS9 : bts->egprs_dl_mcs9(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS9]); break; } } -- To view, visit https://gerrit.osmocom.org/1345 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c Gerrit-PatchSet: 4 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 8 12:24:52 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 12:24:52 +0000 Subject: libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Patch Set 1: > I think it would be much better to do it other way around and > generate .c code (and corresponding documentation) from .dot files. To a degree this is possible, i.e. generate the state array definitions, but you will not be able to generate the contents of each state's action functions. Take a closer look at http://kleinekatze.de/quooXai5/ and see that functions like lu_fsm_wait_lu_compl() are featured in the graphs, and transitions to other FSMs are indicated. In http://kleinekatze.de/quooXai5/vlr_lu_fsm.dot.png a whole chain of states is managed by functions that merely happen to exist, not even mentioned in the FSM definition arrays. This code scans the action functions and figures out what other functions send events to it. It shows what the C code actually does, and the C code can decide to do anything in arbitrary complexity. This will simply not work in reverse. -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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 Thu Dec 8 12:29:46 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 12:29:46 +0000 Subject: libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Patch Set 1: Well, yes and no: event generation is external to FSM but states transition isn't. So what you could generate is the code which does FSM state transitions (alongside with all the necessary states etc). That's the plan for OS#1837 which is on my todo list. Feel free to contribute :) -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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 Thu Dec 8 12:44:16 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 12:44:16 +0000 Subject: [PATCH] openbsc[master]: Add test-case which breaks range1024 encoding Message-ID: Review at https://gerrit.osmocom.org/1373 Add test-case which breaks range1024 encoding Change-Id: I99f917d80232b63d1bb518842c24517b3dd18be4 --- M openbsc/tests/gsm0408/gsm0408_test.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/73/1373/1 diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 9e7babb..0b5ca06 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -226,6 +226,7 @@ int arfcns_num; int arfcns[RANGE_ENC_MAX_ARFCNS]; } arfcn_test_ranges[] = { + {ARFCN_RANGE_1024, 2, { 319, 319 }}, {ARFCN_RANGE_512, 12, { 1, 12, 31, 51, 57, 91, 97, 98, 113, 117, 120, 125 }}, {ARFCN_RANGE_512, 17, -- To view, visit https://gerrit.osmocom.org/1373 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I99f917d80232b63d1bb518842c24517b3dd18be4 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 8 13:46:28 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 13:46:28 +0000 Subject: [PATCH] osmo-bts[master]: DTX: add explicit check if DTX enabled Message-ID: Review at https://gerrit.osmocom.org/1374 DTX: add explicit check if DTX enabled Check explicitly if DTX is enabled for AMR before checking if SID frame repetition is optional. Change-Id: I660688d56505798cade1495c30338fd6806a3259 Related: OS#1801 --- M src/common/msg_utils.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/74/1374/1 diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index c5081b4..b844eec 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -257,6 +257,9 @@ */ static inline bool dtx_amr_sid_optional(struct gsm_lchan *lchan, uint32_t fn) { + if (!dtx_dl_amr_enabled(lchan)) + return true; + /* Compute approx. time delta x26 based on Fn duration */ uint32_t dx26 = 120 * (fn - lchan->tch.dtx.fn); -- To view, visit https://gerrit.osmocom.org/1374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I660688d56505798cade1495c30338fd6806a3259 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 8 15:33:27 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 15:33:27 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 2: I don't think we really have to support all the same types sprintf does: 1,2,4,8 byte integers and strings will cover 99% of the use-cases. Those could be sent as TV and TLV and fed to sprintf in wireshark. Shall I make a ticket for that? -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 8 15:37:21 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 15:37:21 +0000 Subject: [PATCH] libosmocore[master]: import oap message parsing / encoding from openbsc.git Message-ID: Review at https://gerrit.osmocom.org/1375 import oap message parsing / encoding from openbsc.git In the process, rename to osmo_* and add API docs, update the copyright. Remove the copyright notice from the .h file as typical in all osmocom headers. Change-Id: If5099e60681a215e798b6675f21813f26769c253 --- M Makefile.am A doc/osmocom-authn-protocol.txt M include/Makefile.am M include/osmocom/core/logging.h A include/osmocom/gsm/oap.h M src/gsm/Makefile.am M src/gsm/libosmogsm.map A src/gsm/oap.c 8 files changed, 492 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/1375/1 diff --git a/Makefile.am b/Makefile.am index 185127e..9c901ea 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 doc/osmocom-authn-protocol.txt if HAVE_DOXYGEN diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..1b6794e --- /dev/null +++ b/doc/osmocom-authn-protocol.txt @@ -0,0 +1,250 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +The Osmocom Authentication Protocol employs mutual authentication to register a +client with a server over an IPA connection. Milenage is used as the +authentication algorithm, where client and server have a shared secret. + +For example, an SGSN, as OAP client, may use its SGSN ID to register with a MAP +proxy, an OAP server. + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 (OAP) + +2. Procedures + +Ideal communication sequence: + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "test setup": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "invalid sequence nr": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Sync Request (AUTS) | + |----------------------------------->| + | | + | Challenge (RAND'+AUTN') | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The client sends a REGISTER_REQ message containing an identifier number. + +2.2. Challenge + +The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes +and a milenage authentication token generated from these random bytes, using a +shared secret, to authenticate itself to the OAP client. The server may omit +this challenge entirely, based on its configuration, and immediately reply with +a Register Result response. If the client cannot be registered (e.g. id is +invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the client has received a Challenge, it may verify the server's +authenticity and validity of the sequence number (included in AUTN), and, if +valid, reply with a CHALLENGE_RES message. This shall contain an XRES +authentication token generated by milenage from the same random bytes received +from the server and the same shared secet. If the client decides to cancel the +registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a +CHALLENGE_ERR message may be sent, but is not mandatory. For example, the +client may directly start with a new REGISTER_REQ message. + +2.4. Sync Request + +When the client has received a Challenge but sees an invalid sequence number +(embedded in AUTN, according to the milenage algorithm), the client may send a +SYNC_REQ message containing an AUTS synchronisation token. + +2.5. Sync Result + +If the server has received a valid Sync Request, it shall answer by directly +sending another Challenge (see 2.2.). If an invalid Sync Request is received, +the server shall reply with a REGISTER_ERR message. + +2.6. Register Result + +The server sends a REGISTER_RES message to indicate that registration has been +successful. If the server cannot register the client (e.g. invalid challenge +response), it shall send a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 Client ID big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 XRES octet string (8) M TLV 10 + +3.2.3. Sync Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 AUTS octet string (16) M TLV 18 + +3.2.4. Sync Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + | 0 0 0 0 1 1 0 0 - Sync Request | + | 0 0 0 0 1 1 0 1 - Sync Error (not used) | + | 0 0 0 0 1 1 1 0 - Sync Result (not used) | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x23 AUTN octet string | + | 0x24 XRES octet string | + | 0x25 AUTS octet string | + | 0x30 Client ID big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. Client ID + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | Client ID IEI | octet 1 + +-----------------------------------------------------+ + | Length of Client ID IE contents (2) | octet 2 + +-----------------------------------------------------+ + | Client ID number, most significant byte | octet 3 + +-----------------------------------------------------+ + | Client ID number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The Client ID number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset ID. + diff --git a/include/Makefile.am b/include/Makefile.am index c125691..0a300a8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -82,6 +82,7 @@ osmocom/gsm/mncc.h \ osmocom/gsm/prim.h \ osmocom/gsm/l1sap.h \ + osmocom/gsm/oap.h \ osmocom/gsm/protocol/gsm_03_40.h \ osmocom/gsm/protocol/gsm_03_41.h \ osmocom/gsm/protocol/gsm_04_08.h \ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..f9c58bb 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -92,7 +92,8 @@ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ #define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ -#define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ +#define DLOAP 12 /*!< Osmocom Authentication Protocol */ +#define OSMO_NUM_DLIB 12 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ struct log_category { diff --git a/include/osmocom/gsm/oap.h b/include/osmocom/gsm/oap.h new file mode 100644 index 0000000..fa3ef16 --- /dev/null +++ b/include/osmocom/gsm/oap.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include + +/*! \brief Information Element Identifiers for OAP IEs. + * They match osmo_gsup_iei (so far). */ +enum osmo_oap_iei { + OAP_CAUSE_IE = 0x02, + OAP_RAND_IE = 0x20, + OAP_AUTN_IE = 0x23, + OAP_XRES_IE = 0x24, + OAP_AUTS_IE = 0x25, + OAP_CLIENT_ID_IE = 0x30, +}; + +/*! \brief OAP message types */ +enum osmo_oap_message_type { + OAP_MSGT_REGISTER_REQUEST = 0b00000100, + OAP_MSGT_REGISTER_ERROR = 0b00000101, + OAP_MSGT_REGISTER_RESULT = 0b00000110, + + OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + OAP_MSGT_CHALLENGE_RESULT = 0b00001010, + + OAP_MSGT_SYNC_REQUEST = 0b00001100, + OAP_MSGT_SYNC_ERROR = 0b00001101, + OAP_MSGT_SYNC_RESULT = 0b00001110, +}; + +/*! \brief Parsed/decoded OAP protocol message */ +struct osmo_oap_message { + enum osmo_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t client_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int xres_present; + uint8_t xres[8]; + int auts_present; + uint8_t auts[16]; +}; + +int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, + size_t data_len); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3877f78..4ea55e1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -22,7 +22,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 + gsup.c gprs_gea.c gsm0503_conv.c oap.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3e7333c..a3d224f 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -356,5 +356,8 @@ osmo_gsup_encode; osmo_gsup_decode; +osmo_oap_encode; +osmo_oap_decode; + local: *; }; diff --git a/src/gsm/oap.c b/src/gsm/oap.c new file mode 100644 index 0000000..979bde6 --- /dev/null +++ b/src/gsm/oap.c @@ -0,0 +1,184 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#include +#include +#include +#include +#include + +#include + +/*! \brief Decode OAP message data. + * \param[out] oap_msg Parsed data is written to this instance. + * \param[in] data Pointer to the data buffer containing the OAP message. + * \param[in] data_len Length of the OAP message data. + * \returns 0 on success, a negative cause value on failure. + */ +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *const_data, size_t data_len) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + + memset(oap_msg, 0, sizeof(*oap_msg)); + + /* message type */ + rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = osmo_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum osmo_oap_iei iei; + + rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case OAP_CLIENT_ID_IE: + if (value_len != 2) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->client_id = osmo_decode_big_endian(value, value_len); + + if (oap_msg->client_id == 0) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d): client ID must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case OAP_XRES_IE: + if (value_len != sizeof(oap_msg->xres)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type XRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->xres, value, value_len); + oap_msg->xres_present = value_len; + break; + + case OAP_AUTS_IE: + if (value_len != sizeof(oap_msg->auts)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTS (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->auts, value, value_len); + oap_msg->auts_present = value_len; + break; + + case OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DLOAP, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +/*! \brief Compose OAP message data. + * \param[out] msg OAP message data is appended to this message buffer. + * \param[in] oap_msg Elements to encode in the message data. + */ +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, (uint8_t)oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->client_id > 0) + msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), + osmo_encode_big_endian(oap_msg->client_id, + sizeof(oap_msg->client_id))); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->auts_present) + msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); + + if (oap_msg->xres_present) + msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); + + msg->l2h = msg->data; +} -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 8 15:38:00 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 15:38:00 +0000 Subject: [PATCH] libosmocore[master]: cosmetic: gsup: remove copyright from header, tweak 'sysmoco... Message-ID: Review at https://gerrit.osmocom.org/1376 cosmetic: gsup: remove copyright from header, tweak 'sysmocom' in .c We typically don't have copyright notices in header files. In gsup.c's copyright notice, 'sysmocom' should be spelled lower case. Notably, the copyright in gsup.h differed from the one in gsup.c: gsup.c names the GNU Affero GPL, gsup.h only the GNU GPL. Keep only the Affero one in gsup.c. Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 2 files changed, 1 insertion(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/1376/1 diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index ed1ef2a..24eeba9 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -1,23 +1,3 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ - -/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck - * (C) 2016 by Harald Welte - * 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, see . - * - */ #pragma once #include diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index c90244a..13fbe20 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,7 +1,7 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ /* - * (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2014 by sysmocom s.f.m.c. GmbH * (C) 2015 by Holger Hans Peter Freyther * (C) 2016 by Harald Welte * All Rights Reserved -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 8 15:38:00 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 15:38:00 +0000 Subject: [PATCH] libosmocore[master]: cosmetic: gsup.c comments: write 'Generic' for the G in GSUP Message-ID: Review at https://gerrit.osmocom.org/1377 cosmetic: gsup.c comments: write 'Generic' for the G in GSUP The G used to mean GPRS, but the scope is larger now. To satisfy the curious reader, give the G a name in gsup files' header comments. BTW, logging.h and gsup_test.c already mentioned "Generic" before this. Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 --- M src/gsm/gsup.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/1377/1 diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index 13fbe20..9697909 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,4 +1,4 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ +/* Osmocom Generic Subscriber Update Protocol message encoder/decoder */ /* * (C) 2014 by sysmocom s.f.m.c. GmbH -- To view, visit https://gerrit.osmocom.org/1377 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 8 15:44:09 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 15:44:09 +0000 Subject: [PATCH] osmo-bts[master]: Save RTP metadata in Control Buffer In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1343 to look at the new patch set (#4). Save RTP metadata in Control Buffer Having RTP metadata is useful for debugging - save Sequence Number and Timestamp next to Marker bit from RTP header. Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 --- M include/osmo-bts/msg_utils.h M src/common/l1sap.c 2 files changed, 18 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/43/1343/4 diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 7321045..55e8475 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -13,9 +13,15 @@ struct msgb; -/* Access 1st byte of msgb control buffer */ +/* Access 1st part of msgb control buffer */ #define rtpmsg_marker_bit(x) ((x)->cb[0]) +/* Access 2nd part of msgb control buffer */ +#define rtpmsg_seq(x) ((x)->cb[1]) + +/* Access 3rd part of msgb control buffer */ +#define rtpmsg_ts(x) ((x)->cb[2]) + /** * Classification of OML message. ETSI for plain GSM 12.21 * messages and IPA/Osmo for manufacturer messages. diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 82aa1ac..cfa02bd 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -661,7 +661,8 @@ struct gsm_time g_time; struct gsm_lchan *lchan; uint8_t chan_nr, marker = 0; - uint32_t fn; + uint16_t seq; + uint32_t fn, timestamp; chan_nr = rts_ind->chan_nr; fn = rts_ind->fn; @@ -694,6 +695,10 @@ } else { /* Obtain RTP header Marker bit from control buffer */ marker = rtpmsg_marker_bit(resp_msg); + /* Obtain RTP header Sequence Number from control buffer */ + seq = rtpmsg_seq(resp_msg); + /* Obtain RTP header Timestamp from control buffer */ + timestamp = rtpmsg_ts(resp_msg); resp_msg->l2h = resp_msg->data; msgb_push(resp_msg, sizeof(*resp_l1sap)); @@ -1074,8 +1079,12 @@ /* Store RTP header Marker bit in control buffer */ rtpmsg_marker_bit(msg) = marker; + /* Store RTP header Sequence Number in control buffer */ + rtpmsg_seq(msg) = seq_number; + /* Store RTP header Timestamp in control buffer */ + rtpmsg_ts(msg) = timestamp; - /* make sure the queue doesn't get too long */ + /* make sure the queue doesn't get too long */ llist_for_each_entry(tmp, &lchan->dl_tch_queue, list) count++; while (count >= 2) { -- To view, visit https://gerrit.osmocom.org/1343 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 Gerrit-PatchSet: 4 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 Dec 8 16:10:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 16:10:26 +0000 Subject: libosmocore[master]: import oap message parsing / encoding from openbsc.git In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 a test will follow -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Thu Dec 8 16:27:44 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 8 Dec 2016 16:27:44 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 2: > I don't think we really have to support all the same types sprintf > does: 1,2,4,8 byte integers and strings will cover 99% of the > use-cases. Those could be sent as TV and TLV and fed to sprintf in > wireshark. Shall I make a ticket for that? YEs, please create a ticket. The problem is not the wire encoding, but the fact that you have to traverse the format-string to detect %s and the like. And that is part of the expensive operation that you'd want to avoid in the first place, right? Or are you sure __typeof() trickery is sufficient? for arbitrary argument lists/ordering? -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 8 16:40:30 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 16:40:30 +0000 Subject: osmo-bts[master]: DTX: add explicit check if DTX enabled In-Reply-To: References: Message-ID: Patch Set 1: Note: this fixes the segfault which I was unable to reproduce locally. -- To view, visit https://gerrit.osmocom.org/1374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I660688d56505798cade1495c30338fd6806a3259 Gerrit-PatchSet: 1 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 Dec 8 16:47:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 8 Dec 2016 16:47:21 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 2: Ticket OS#1872 created. -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 8 16:54:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 16:54:13 +0000 Subject: [PATCH] libosmocore[master]: import oap message parsing / encoding from openbsc.git In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1375 to look at the new patch set (#2). import oap message parsing / encoding from openbsc.git In the process, rename to osmo_* and add API docs, update the copyright. Remove the copyright notice from the .h file as typical in all osmocom headers. A unit test will follow in a subsequent patch, since it needs a minor tweak for decoding of boolean values. Change-Id: If5099e60681a215e798b6675f21813f26769c253 --- M Makefile.am A doc/osmocom-authn-protocol.txt M include/Makefile.am M include/osmocom/core/logging.h A include/osmocom/gsm/oap.h M src/gsm/Makefile.am M src/gsm/libosmogsm.map A src/gsm/oap.c 8 files changed, 492 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/1375/2 diff --git a/Makefile.am b/Makefile.am index 185127e..9c901ea 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 doc/osmocom-authn-protocol.txt if HAVE_DOXYGEN diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..1b6794e --- /dev/null +++ b/doc/osmocom-authn-protocol.txt @@ -0,0 +1,250 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +The Osmocom Authentication Protocol employs mutual authentication to register a +client with a server over an IPA connection. Milenage is used as the +authentication algorithm, where client and server have a shared secret. + +For example, an SGSN, as OAP client, may use its SGSN ID to register with a MAP +proxy, an OAP server. + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 (OAP) + +2. Procedures + +Ideal communication sequence: + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "test setup": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "invalid sequence nr": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Sync Request (AUTS) | + |----------------------------------->| + | | + | Challenge (RAND'+AUTN') | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The client sends a REGISTER_REQ message containing an identifier number. + +2.2. Challenge + +The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes +and a milenage authentication token generated from these random bytes, using a +shared secret, to authenticate itself to the OAP client. The server may omit +this challenge entirely, based on its configuration, and immediately reply with +a Register Result response. If the client cannot be registered (e.g. id is +invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the client has received a Challenge, it may verify the server's +authenticity and validity of the sequence number (included in AUTN), and, if +valid, reply with a CHALLENGE_RES message. This shall contain an XRES +authentication token generated by milenage from the same random bytes received +from the server and the same shared secet. If the client decides to cancel the +registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a +CHALLENGE_ERR message may be sent, but is not mandatory. For example, the +client may directly start with a new REGISTER_REQ message. + +2.4. Sync Request + +When the client has received a Challenge but sees an invalid sequence number +(embedded in AUTN, according to the milenage algorithm), the client may send a +SYNC_REQ message containing an AUTS synchronisation token. + +2.5. Sync Result + +If the server has received a valid Sync Request, it shall answer by directly +sending another Challenge (see 2.2.). If an invalid Sync Request is received, +the server shall reply with a REGISTER_ERR message. + +2.6. Register Result + +The server sends a REGISTER_RES message to indicate that registration has been +successful. If the server cannot register the client (e.g. invalid challenge +response), it shall send a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 Client ID big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 XRES octet string (8) M TLV 10 + +3.2.3. Sync Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 AUTS octet string (16) M TLV 18 + +3.2.4. Sync Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + | 0 0 0 0 1 1 0 0 - Sync Request | + | 0 0 0 0 1 1 0 1 - Sync Error (not used) | + | 0 0 0 0 1 1 1 0 - Sync Result (not used) | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x23 AUTN octet string | + | 0x24 XRES octet string | + | 0x25 AUTS octet string | + | 0x30 Client ID big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. Client ID + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | Client ID IEI | octet 1 + +-----------------------------------------------------+ + | Length of Client ID IE contents (2) | octet 2 + +-----------------------------------------------------+ + | Client ID number, most significant byte | octet 3 + +-----------------------------------------------------+ + | Client ID number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The Client ID number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset ID. + diff --git a/include/Makefile.am b/include/Makefile.am index c125691..0a300a8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -82,6 +82,7 @@ osmocom/gsm/mncc.h \ osmocom/gsm/prim.h \ osmocom/gsm/l1sap.h \ + osmocom/gsm/oap.h \ osmocom/gsm/protocol/gsm_03_40.h \ osmocom/gsm/protocol/gsm_03_41.h \ osmocom/gsm/protocol/gsm_04_08.h \ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..f9c58bb 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -92,7 +92,8 @@ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ #define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ -#define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ +#define DLOAP 12 /*!< Osmocom Authentication Protocol */ +#define OSMO_NUM_DLIB 12 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ struct log_category { diff --git a/include/osmocom/gsm/oap.h b/include/osmocom/gsm/oap.h new file mode 100644 index 0000000..fa3ef16 --- /dev/null +++ b/include/osmocom/gsm/oap.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include + +/*! \brief Information Element Identifiers for OAP IEs. + * They match osmo_gsup_iei (so far). */ +enum osmo_oap_iei { + OAP_CAUSE_IE = 0x02, + OAP_RAND_IE = 0x20, + OAP_AUTN_IE = 0x23, + OAP_XRES_IE = 0x24, + OAP_AUTS_IE = 0x25, + OAP_CLIENT_ID_IE = 0x30, +}; + +/*! \brief OAP message types */ +enum osmo_oap_message_type { + OAP_MSGT_REGISTER_REQUEST = 0b00000100, + OAP_MSGT_REGISTER_ERROR = 0b00000101, + OAP_MSGT_REGISTER_RESULT = 0b00000110, + + OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + OAP_MSGT_CHALLENGE_RESULT = 0b00001010, + + OAP_MSGT_SYNC_REQUEST = 0b00001100, + OAP_MSGT_SYNC_ERROR = 0b00001101, + OAP_MSGT_SYNC_RESULT = 0b00001110, +}; + +/*! \brief Parsed/decoded OAP protocol message */ +struct osmo_oap_message { + enum osmo_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t client_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int xres_present; + uint8_t xres[8]; + int auts_present; + uint8_t auts[16]; +}; + +int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, + size_t data_len); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3877f78..4ea55e1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -22,7 +22,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 + gsup.c gprs_gea.c gsm0503_conv.c oap.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3e7333c..a3d224f 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -356,5 +356,8 @@ osmo_gsup_encode; osmo_gsup_decode; +osmo_oap_encode; +osmo_oap_decode; + local: *; }; diff --git a/src/gsm/oap.c b/src/gsm/oap.c new file mode 100644 index 0000000..979bde6 --- /dev/null +++ b/src/gsm/oap.c @@ -0,0 +1,184 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#include +#include +#include +#include +#include + +#include + +/*! \brief Decode OAP message data. + * \param[out] oap_msg Parsed data is written to this instance. + * \param[in] data Pointer to the data buffer containing the OAP message. + * \param[in] data_len Length of the OAP message data. + * \returns 0 on success, a negative cause value on failure. + */ +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *const_data, size_t data_len) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + + memset(oap_msg, 0, sizeof(*oap_msg)); + + /* message type */ + rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = osmo_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum osmo_oap_iei iei; + + rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case OAP_CLIENT_ID_IE: + if (value_len != 2) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->client_id = osmo_decode_big_endian(value, value_len); + + if (oap_msg->client_id == 0) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d): client ID must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case OAP_XRES_IE: + if (value_len != sizeof(oap_msg->xres)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type XRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->xres, value, value_len); + oap_msg->xres_present = value_len; + break; + + case OAP_AUTS_IE: + if (value_len != sizeof(oap_msg->auts)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTS (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->auts, value, value_len); + oap_msg->auts_present = value_len; + break; + + case OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DLOAP, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +/*! \brief Compose OAP message data. + * \param[out] msg OAP message data is appended to this message buffer. + * \param[in] oap_msg Elements to encode in the message data. + */ +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, (uint8_t)oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->client_id > 0) + msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), + osmo_encode_big_endian(oap_msg->client_id, + sizeof(oap_msg->client_id))); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->auts_present) + msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); + + if (oap_msg->xres_present) + msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); + + msg->l2h = msg->data; +} -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Thu Dec 8 16:54:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 16:54:13 +0000 Subject: [PATCH] libosmocore[master]: gsm/oap: more robust: decode presence as clearly either 1 or 0 Message-ID: Review at https://gerrit.osmocom.org/1378 gsm/oap: more robust: decode presence as clearly either 1 or 0 Prepares for the unit test, which can now simply check for encode/decode identity. Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 --- M src/gsm/oap.c 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/1378/1 diff --git a/src/gsm/oap.c b/src/gsm/oap.c index 979bde6..1494a6a 100644 --- a/src/gsm/oap.c +++ b/src/gsm/oap.c @@ -92,7 +92,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->autn, value, value_len); - oap_msg->autn_present = value_len; + oap_msg->autn_present = value_len ? 1 : 0; break; case OAP_RAND_IE: @@ -103,7 +103,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->rand, value, value_len); - oap_msg->rand_present = value_len; + oap_msg->rand_present = value_len ? 1 : 0; break; case OAP_XRES_IE: @@ -114,7 +114,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->xres, value, value_len); - oap_msg->xres_present = value_len; + oap_msg->xres_present = value_len ? 1 : 0; break; case OAP_AUTS_IE: @@ -125,7 +125,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->auts, value, value_len); - oap_msg->auts_present = value_len; + oap_msg->auts_present = value_len ? 1 : 0; break; case OAP_CAUSE_IE: -- To view, visit https://gerrit.osmocom.org/1378 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 8 16:54:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 16:54:13 +0000 Subject: [PATCH] libosmocore[master]: oap: add encode/decode unit test Message-ID: Review at https://gerrit.osmocom.org/1379 oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 253 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/1379/1 diff --git a/tests/Makefile.am b/tests/Makefile.am index f5d095d..cb037bd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test + tlv/tlv_test gsup/gsup_test fsm/fsm_test oap/oap_test if ENABLE_MSGFILE check_PROGRAMS += msgfile/msgfile_test @@ -133,6 +133,10 @@ fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/libosmocore.la \ + $(top_builddir)/src/gsm/libosmogsm.la + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -168,7 +172,7 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err + fsm/fsm_test.ok fsm/fsm_test.err oap/oap_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..c8fe494 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,181 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2015 by 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { + [DLOAP] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 0, .loglevel = LOGL_DEBUG, + }, +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..4e77c3c --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,22 @@ +Testing OAP messages +- Register Request +ok +- Register Error +ok +- Register Result +ok +- Challenge Request, no rand, no autn +ok +- Challenge Request, with rand, no autn +ok +- Challenge Request, no rand, with autn +ok +- Challenge Request, with rand, with autn +ok +- Challenge Error +ok +- Challenge Result +ok +- Sync Request +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index 77038bc..57da5d0 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -215,3 +215,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 8 16:54:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 16:54:13 +0000 Subject: [PATCH] libosmocore[master]: doc: osmocom-authn-protocol.txt: fix numbering, mark unused ... Message-ID: Review at https://gerrit.osmocom.org/1380 doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a --- M doc/osmocom-authn-protocol.txt 1 file changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/1380/1 diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt index 1b6794e..6d057be 100644 --- a/doc/osmocom-authn-protocol.txt +++ b/doc/osmocom-authn-protocol.txt @@ -142,14 +142,14 @@ 02 Cause GMM cause, M TLV 3 04.08: 10.5.5.14 -3.2.6. Register Result +3.2.3. Register Result Server -> Client IEI Info Element Type Pres. Format Length Message type 4.2.1 M V 1 -3.2.3. Challenge +3.2.4. Challenge Server -> Client @@ -158,7 +158,7 @@ 20 RAND octet string (16) M TLV 18 23 AUTN octet string (16) M TLV 18 -3.2.4. Challenge Error +3.2.5. Challenge Error Client -> Server @@ -167,7 +167,7 @@ 02 Cause GMM cause, M TLV 3 04.08: 10.5.5.14 -3.2.5. Challenge Result +3.2.6. Challenge Result Client -> Server @@ -175,7 +175,7 @@ Message type 4.2.1 M V 1 21 XRES octet string (8) M TLV 10 -3.2.3. Sync Request +3.2.7. Sync Request Client -> Server @@ -183,14 +183,14 @@ Message type 4.2.1 M V 1 20 AUTS octet string (16) M TLV 18 -3.2.4. Sync Error +3.2.8. Sync Error -Server -> Client +Not used. - IEI Info Element Type Pres. Format Length - Message type 4.2.1 M V 1 - 02 Cause GMM cause, M TLV 3 - 04.08: 10.5.5.14 +3.2.9. Sync Result + +Not used. + 4. Information Elements -- To view, visit https://gerrit.osmocom.org/1380 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 8 16:58:55 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 16:58:55 +0000 Subject: [PATCH] libosmocore[master]: oap: add encode/decode unit test In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1379 to look at the new patch set (#2). oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 275 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/1379/2 diff --git a/tests/Makefile.am b/tests/Makefile.am index f5d095d..cb037bd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test + tlv/tlv_test gsup/gsup_test fsm/fsm_test oap/oap_test if ENABLE_MSGFILE check_PROGRAMS += msgfile/msgfile_test @@ -133,6 +133,10 @@ fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/libosmocore.la \ + $(top_builddir)/src/gsm/libosmogsm.la + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -168,7 +172,7 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err + fsm/fsm_test.ok fsm/fsm_test.err oap/oap_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..5a3afc4 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,183 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2015 by 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + printf("encoded message:\n%s\n", + osmo_hexdump((void*)msgb_l2(msgb), msgb_l2len(msgb))); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { + [DLOAP] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 0, .loglevel = LOGL_DEBUG, + }, +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..9260d44 --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,42 @@ +Testing OAP messages +- Register Request +encoded message: +04 30 02 23 42 +ok +- Register Error +encoded message: +05 02 01 6f +ok +- Register Result +encoded message: +06 +ok +- Challenge Request, no rand, no autn +encoded message: +08 +ok +- Challenge Request, with rand, no autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 +ok +- Challenge Request, no rand, with autn +encoded message: +08 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Request, with rand, with autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Error +encoded message: +09 02 01 17 +ok +- Challenge Result +encoded message: +0a 24 08 01 02 03 04 05 06 07 08 +ok +- Sync Request +encoded message: +0c 25 10 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 01 +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index 77038bc..57da5d0 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -215,3 +215,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 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 Dec 8 17:06:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 8 Dec 2016 17:06:35 +0000 Subject: osmo-bts[master]: DTX: add explicit check if DTX enabled In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I660688d56505798cade1495c30338fd6806a3259 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 Dec 8 17:06:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 8 Dec 2016 17:06:43 +0000 Subject: [MERGED] osmo-bts[master]: DTX: add explicit check if DTX enabled In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: DTX: add explicit check if DTX enabled ...................................................................... DTX: add explicit check if DTX enabled Check explicitly if DTX is enabled for AMR before checking if SID frame repetition is optional. Change-Id: I660688d56505798cade1495c30338fd6806a3259 Related: OS#1801 --- M src/common/msg_utils.c 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index c5081b4..b844eec 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -257,6 +257,9 @@ */ static inline bool dtx_amr_sid_optional(struct gsm_lchan *lchan, uint32_t fn) { + if (!dtx_dl_amr_enabled(lchan)) + return true; + /* Compute approx. time delta x26 based on Fn duration */ uint32_t dx26 = 120 * (fn - lchan->tch.dtx.fn); -- To view, visit https://gerrit.osmocom.org/1374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I660688d56505798cade1495c30338fd6806a3259 Gerrit-PatchSet: 1 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 Dec 8 17:08:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 8 Dec 2016 17:08:26 +0000 Subject: libosmocore[master]: doc: osmocom-authn-protocol.txt: fix numbering, mark unused ... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1380 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a 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 Dec 8 18:58:32 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 18:58:32 +0000 Subject: libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Patch Set 1: I still don't see how this is useful beyond generating the struct arrays... Even if you generate the action function with a switch inside, it will be only once-off -- as soon as I've enriched the action function with implementation specific C code, changing the state transitions will generate a new empty switch and I have to migrate the C code? well, I'm sceptical about the usefulness, but let's see what you come up with there :) -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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 Thu Dec 8 19:20:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 8 Dec 2016 19:20:23 +0000 Subject: [PATCH] openbsc[master]: move OAP messages implementations to libosmocore Message-ID: Review at https://gerrit.osmocom.org/1381 move OAP messages implementations to libosmocore Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf --- M openbsc/include/openbsc/Makefile.am D openbsc/include/openbsc/oap_messages.h M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/oap.c D openbsc/src/gprs/oap_messages.c M openbsc/tests/oap/Makefile.am M openbsc/tests/oap/oap_test.c M openbsc/tests/sgsn/Makefile.am 8 files changed, 2 insertions(+), 255 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/81/1381/1 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 2b54c43..3e8bd5f 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -55,7 +55,6 @@ nat_rewrite_trie.h \ network_listen.h \ oap.h \ - oap_messages.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h deleted file mode 100644 index ecb66df..0000000 --- a/openbsc/include/openbsc/oap_messages.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Osmocom Authentication Protocol message encoder/decoder */ - -/* (C) 2015 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 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 -#include - -/* Some numbers are out of sequence because (so far) they match gprs_gsup_iei. - */ -enum oap_iei { - OAP_CAUSE_IE = 0x02, - OAP_RAND_IE = 0x20, - OAP_AUTN_IE = 0x23, - OAP_XRES_IE = 0x24, - OAP_AUTS_IE = 0x25, - OAP_CLIENT_ID_IE = 0x30, -}; - -enum osmo_oap_message_type { - OAP_MSGT_REGISTER_REQUEST = 0b00000100, - OAP_MSGT_REGISTER_ERROR = 0b00000101, - OAP_MSGT_REGISTER_RESULT = 0b00000110, - - OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, - OAP_MSGT_CHALLENGE_ERROR = 0b00001001, - OAP_MSGT_CHALLENGE_RESULT = 0b00001010, - - OAP_MSGT_SYNC_REQUEST = 0b00001100, - OAP_MSGT_SYNC_ERROR = 0b00001101, - OAP_MSGT_SYNC_RESULT = 0b00001110, -}; - -struct osmo_oap_message { - enum osmo_oap_message_type message_type; - enum gsm48_gmm_cause cause; - uint16_t client_id; - int rand_present; - uint8_t rand[16]; - int autn_present; - uint8_t autn[16]; - int xres_present; - uint8_t xres[8]; - int auts_present; - uint8_t auts[16]; -}; - -int osmo_oap_decode(struct osmo_oap_message *oap_msg, - const uint8_t *data, size_t data_len); -void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); - diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index d228b39..fad372f 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -92,7 +92,6 @@ sgsn_ares.c \ slhc.c \ oap.c \ - oap_messages.c \ gprs_llc_xid.c \ v42bis.c \ $(NULL) diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index c7c9777..7efbe81 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -24,10 +24,10 @@ #include #include +#include #include #include -#include int oap_init(struct oap_config *config, struct oap_state *state) { diff --git a/openbsc/src/gprs/oap_messages.c b/openbsc/src/gprs/oap_messages.c deleted file mode 100644 index d81723f..0000000 --- a/openbsc/src/gprs/oap_messages.c +++ /dev/null @@ -1,178 +0,0 @@ -/* Osmocom Authentication Protocol message encoder/decoder */ - -/* (C) 2015 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 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 - - -int osmo_oap_decode(struct osmo_oap_message *oap_msg, - const uint8_t *const_data, size_t data_len) -{ - int rc; - uint8_t tag; - /* the shift/match functions expect non-const pointers, but we'll - * either copy the data or cast pointers back to const before returning - * them - */ - uint8_t *data = (uint8_t *)const_data; - uint8_t *value; - size_t value_len; - - memset(oap_msg, 0, sizeof(*oap_msg)); - - /* message type */ - rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); - if (rc < 0) - return -GMM_CAUSE_INV_MAND_INFO; - oap_msg->message_type = osmo_decode_big_endian(value, 1); - - /* specific parts */ - while (data_len > 0) { - enum oap_iei iei; - - rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); - if (rc < 0) - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - - iei = tag; - - switch (iei) { - case OAP_CLIENT_ID_IE: - if (value_len != 2) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type client ID (%d) should be 2 octets, but has %d\n", - (int)iei, (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - - oap_msg->client_id = osmo_decode_big_endian(value, value_len); - - if (oap_msg->client_id == 0) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type client ID (%d): client ID must be nonzero.\n", - (int)iei); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - break; - - case OAP_AUTN_IE: - if (value_len != sizeof(oap_msg->autn)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type AUTN (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->autn, value, value_len); - oap_msg->autn_present = value_len; - break; - - case OAP_RAND_IE: - if (value_len != sizeof(oap_msg->rand)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type RAND (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->rand, value, value_len); - oap_msg->rand_present = value_len; - break; - - case OAP_XRES_IE: - if (value_len != sizeof(oap_msg->xres)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type XRES (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->xres, value, value_len); - oap_msg->xres_present = value_len; - break; - - case OAP_AUTS_IE: - if (value_len != sizeof(oap_msg->auts)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type AUTS (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->auts, value, value_len); - oap_msg->auts_present = value_len; - break; - - case OAP_CAUSE_IE: - if (value_len > 1) { - LOGP(DGPRS, LOGL_ERROR, - "OAP cause may not exceed one octet, is %d", (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - oap_msg->cause = *value; - break; - - default: - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type %d unknown\n", iei); - continue; - } - } - - return 0; -} - -void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) -{ - uint8_t u8; - - /* generic part */ - OSMO_ASSERT(oap_msg->message_type); - msgb_v_put(msg, (uint8_t)oap_msg->message_type); - - /* specific parts */ - if ((u8 = oap_msg->cause)) - msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); - - if (oap_msg->client_id > 0) - msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), - osmo_encode_big_endian(oap_msg->client_id, - sizeof(oap_msg->client_id))); - - if (oap_msg->rand_present) - msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); - - if (oap_msg->autn_present) - msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); - - if (oap_msg->auts_present) - msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); - - if (oap_msg->xres_present) - msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); - - msg->l2h = msg->data; -} - diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index 06ccf33..bb9ebb2 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -28,7 +28,6 @@ oap_test_LDADD = \ $(top_builddir)/src/gprs/oap.o \ - $(top_builddir)/src/gprs/oap_messages.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index d200ed2..68542fd 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -19,11 +19,10 @@ */ #include +#include #include - #include -#include #include #include diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 9ee5455..b00cb82 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -55,7 +55,6 @@ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ $(top_builddir)/src/gprs/oap.o \ - $(top_builddir)/src/gprs/oap_messages.o \ $(top_builddir)/src/gprs/gprs_llc_xid.o \ $(top_builddir)/src/gprs/gprs_sndcp_xid.o \ $(top_builddir)/src/gprs/slhc.o \ -- To view, visit https://gerrit.osmocom.org/1381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:25 +0000 Subject: [PATCH] openbsc[master]: add gsup_test_client program Message-ID: Review at https://gerrit.osmocom.org/1382 add gsup_test_client program Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 --- M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gprs_gsup_client.c A openbsc/src/gprs/gsup_test_client.c 3 files changed, 319 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/82/1382/1 diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index fad372f..ab2517e 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -37,6 +37,7 @@ $(NULL) bin_PROGRAMS = \ + gsup_test_client \ osmo-gbproxy \ $(NULL) if HAVE_LIBGTP @@ -132,3 +133,16 @@ $(LIBGTP_LIBS) \ -lrt \ $(NULL) + +gsup_test_client_SOURCES = \ + gprs_gsup_client.c \ + gsup_test_client.c \ + oap.c \ + $(NULL) +gsup_test_client_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + -lrt \ + $(NULL) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index a4aca09..deaf156 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -25,6 +25,7 @@ #include #include #include +#include #include diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c new file mode 100644 index 0000000..5f123b8 --- /dev/null +++ b/openbsc/src/gprs/gsup_test_client.c @@ -0,0 +1,304 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +static struct gprs_gsup_client *g_gc; + + +/*********************************************************************** + * IMSI Operation + ***********************************************************************/ +static LLIST_HEAD(g_imsi_ops); + +struct imsi_op_stats { + uint32_t num_alloc; + uint32_t num_released; + uint32_t num_rx_success; + uint32_t num_rx_error; + uint32_t num_timeout; +}; + +enum imsi_op_type { + IMSI_OP_SAI, + IMSI_OP_LU, + IMSI_OP_ISD, + _NUM_IMSI_OP +}; + +static const struct value_string imsi_op_names[] = { + { IMSI_OP_SAI, "SAI" }, + { IMSI_OP_LU, "LU" }, + { IMSI_OP_ISD, "ISD" }, + { 0, NULL } +}; + +static struct imsi_op_stats imsi_op_stats[_NUM_IMSI_OP]; + +struct imsi_op { + struct llist_head list; + char imsi[17]; + enum imsi_op_type type; + struct osmo_timer_list timer; +}; + +static struct imsi_op *imsi_op_find(const char *imsi, + enum imsi_op_type type) +{ + struct imsi_op *io; + + llist_for_each_entry(io, &g_imsi_ops, list) { + if (!strcmp(io->imsi, imsi) && io->type == type) + return io; + } + return NULL; +} + +static void imsi_op_timer_cb(void *data); + +static struct imsi_op *imsi_op_alloc(void *ctx, const char *imsi, + enum imsi_op_type type) +{ + struct imsi_op *io; + + if (imsi_op_find(imsi, type)) + return NULL; + + io = talloc_zero(ctx, struct imsi_op); + strncpy(io->imsi, imsi, sizeof(io->imsi)); + io->imsi[sizeof(io->imsi)-1] = '\0'; + io->type = type; + io->timer.cb = imsi_op_timer_cb; + io->timer.data = io; + llist_add(&io->list, &g_imsi_ops); + imsi_op_stats[type].num_alloc++; + + return io; +} + +static void imsi_op_release(struct imsi_op *io) +{ + osmo_timer_del(&io->timer); + llist_del(&io->list); + imsi_op_stats[io->type].num_released++; + talloc_free(io); +} + +static void imsi_op_timer_cb(void *data) +{ + struct imsi_op *io = data; + printf("%s: Timer expiration\n", io->imsi); + imsi_op_stats[io->type].num_timeout++; + imsi_op_release(io); +} + +/* allocate + generate + send Send-Auth-Info */ +int req_auth_info(const char *imsi) +{ + struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_SAI); + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST; + + osmo_gsup_encode(msg, &gsup); + + return gprs_gsup_client_send(g_gc, msg); +} + +/* allocate + generate + send Send-Auth-Info */ +int req_loc_upd(const char *imsi) +{ + struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_LU); + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST; + + osmo_gsup_encode(msg, &gsup); + + return gprs_gsup_client_send(g_gc, msg); +} + +int resp_isd(struct imsi_op *io) +{ + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_RESULT; + + osmo_gsup_encode(msg, &gsup); + + imsi_op_release(io); + + return gprs_gsup_client_send(g_gc, msg); +} + +/* receive an incoming GSUP message */ +static void imsi_op_rx_gsup(struct imsi_op *io, const struct osmo_gsup_message *gsup) +{ + int is_error = 0; + + if (OSMO_GSUP_IS_MSGT_ERROR(gsup->message_type)) { + imsi_op_stats[io->type].num_rx_error++; + is_error = 1; + } else + imsi_op_stats[io->type].num_rx_success++; + + switch (io->type) { + case IMSI_OP_SAI: + printf("%s; SAI Response%s\n", io->imsi, is_error ? ": ERROR" : ""); + /* now that we have auth tuples, request LU */ + req_loc_upd(io->imsi); + imsi_op_release(io); + break; + case IMSI_OP_LU: + printf("%s; LU Response%s\n", io->imsi, is_error ? ": ERROR" : ""); + imsi_op_release(io); + break; + case IMSI_OP_ISD: + printf("%s; ISD Request%s\n", io->imsi, is_error ? ": ERROR" : ""); + resp_isd(io); + break; + default: + printf("%s: Unknown\n", io->imsi); + imsi_op_release(io); + break; + } +} + +static int op_type_by_gsup_msgt(enum osmo_gsup_message_type msg_type) +{ + switch (msg_type) { + case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT: + case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR: + return IMSI_OP_SAI; + case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT: + case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR: + return IMSI_OP_LU; + case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST: + return IMSI_OP_ISD; + default: + printf("Unknown GSUP msg_type %u\n", msg_type); + return -1; + } +} + +static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +{ + struct osmo_gsup_message gsup_msg = {0}; + struct imsi_op *io; + int rc; + + DEBUGP(DGPRS, "Rx GSUP %s\n", osmo_hexdump(msgb_l2(msg), msgb_l2len(msg))); + + rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup_msg); + if (rc < 0) + return rc; + + if (!gsup_msg.imsi[0]) + return -1; + + rc = op_type_by_gsup_msgt(gsup_msg.message_type); + if (rc < 0) + return rc; + + switch (rc) { + case IMSI_OP_SAI: + case IMSI_OP_LU: + io = imsi_op_find(gsup_msg.imsi, rc); + if (!io) + return -1; + break; + case IMSI_OP_ISD: + /* ISD is an inbound transaction */ + io = imsi_op_alloc(g_gc, gsup_msg.imsi, IMSI_OP_ISD); + break; + } + + imsi_op_rx_gsup(io, &gsup_msg); + msgb_free(msg); + + return 0; +} + +static void print_report(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(imsi_op_stats); i++) { + struct imsi_op_stats *st = &imsi_op_stats[i]; + const char *name = get_value_string(imsi_op_names, i); + printf("%s: %u alloc, %u released, %u success, %u error , %u tout\n", + name, st->num_alloc, st->num_released, st->num_rx_success, + st->num_rx_error, st->num_timeout); + } +} + +static void sig_cb(int sig) +{ + switch (sig) { + case SIGINT: + print_report(); + exit(0); + break; + } +} + +void *tall_bsc_ctx = NULL; + +/* default categories */ +static struct log_info_cat gprs_categories[] = { + [DGPRS] = { + .name = "DGPRS", + .description = "GPRS Packet Service", + .enabled = 1, .loglevel = LOGL_INFO, + }, +}; + +static const struct log_info gprs_log_info = { + .cat = gprs_categories, + .num_cat = ARRAY_SIZE(gprs_categories), +}; + +int main(int argc, char **argv) +{ + unsigned long long i; + char *server_host = "127.0.0.1"; + uint16_t server_port = 2222; + + osmo_init_logging(&gprs_log_info); + + g_gc = gprs_gsup_client_create(server_host, server_port, + gsupc_read_cb, NULL); + + + signal(SIGINT, sig_cb); + + for (i = 0; i < 10000; i++) { + unsigned long long imsi = 901790000000000 + i; + char imsi_buf[17]; + snprintf(imsi_buf, sizeof(imsi_buf), "%015llu", imsi); + req_auth_info(imsi_buf); + osmo_select_main(0); + } + + while (1) { + osmo_select_main(0); + } + + print_report(); + exit(0); +} -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:25 +0000 Subject: [PATCH] openbsc[master]: comments: gsup client: rename to Generic, adjust copyright a... Message-ID: Review at https://gerrit.osmocom.org/1383 comments: gsup client: rename to Generic, adjust copyright and authors Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 --- M openbsc/src/gprs/gprs_gsup_client.c 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/83/1383/1 diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index deaf156..41b88ad 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -1,9 +1,10 @@ -/* GPRS Subscriber Update Protocol client */ +/* Generic Subscriber Update Protocol client */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH +/* (C) 2014-2016 by Sysmocom s.f.m.c. GmbH * All Rights Reserved * * Author: Jacob Erlbeck + * 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 -- To view, visit https://gerrit.osmocom.org/1383 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:25 +0000 Subject: [PATCH] openbsc[master]: grps_gsup_*: rename public API to osmo_gsup_ Message-ID: Review at https://gerrit.osmocom.org/1384 grps_gsup_*: rename public API to osmo_gsup_ Also rename static functions to gsupc_* This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. libvlr and osmo-sgsn will use the same GSUP client code. Clarify naming by removing the gprs_ prefix everywhere. A number of patches will follow up on this, also doing the same move and renaming for the OAP client. Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 --- M openbsc/include/openbsc/gprs_gsup_client.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/gprs/gsup_test_client.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c 7 files changed, 93 insertions(+), 88 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/84/1384/1 diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gprs_gsup_client.h index ccfa388..398b64f 100644 --- a/openbsc/include/openbsc/gprs_gsup_client.h +++ b/openbsc/include/openbsc/gprs_gsup_client.h @@ -25,35 +25,37 @@ #include -#define GPRS_GSUP_RECONNECT_INTERVAL 10 -#define GPRS_GSUP_PING_INTERVAL 20 +#define OSMO_GSUP_CLIENT_RECONNECT_INTERVAL 10 +#define OSMO_GSUP_CLIENT_PING_INTERVAL 20 struct msgb; struct ipa_client_conn; -struct gprs_gsup_client; +struct osmo_gsup_client; /* Expects message in msg->l2h */ -typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg); +typedef int (*osmo_gsup_client_read_cb_t)(struct osmo_gsup_client *gsupc, + struct msgb *msg); -struct gprs_gsup_client { - struct ipa_client_conn *link; - gprs_gsup_read_cb_t read_cb; - void *data; +struct osmo_gsup_client { + struct ipa_client_conn *link; + osmo_gsup_client_read_cb_t read_cb; + void *data; struct oap_state oap_state; - struct osmo_timer_list ping_timer; - struct osmo_timer_list connect_timer; - int is_connected; - int got_ipa_pong; + struct osmo_timer_list ping_timer; + struct osmo_timer_list connect_timer; + int is_connected; + int got_ipa_pong; }; -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb, - struct oap_config *oap_config); +struct osmo_gsup_client * +osmo_gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + osmo_gsup_client_read_cb_t read_cb, + struct oap_config *oap_config); -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc); -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -struct msgb *gprs_gsup_msgb_alloc(void); +void osmo_gsup_client_destroy(struct osmo_gsup_client *gsupc); +int osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg); +struct msgb *osmo_gsup_client_msgb_alloc(void); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 786e2b2..9051738 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -123,7 +123,7 @@ /* GSN instance for libgtp */ struct gsn_t *gsn; /* Subscriber */ - struct gprs_gsup_client *gsup_client; + struct osmo_gsup_client *gsup_client; /* LLME inactivity timer */ struct osmo_timer_list llme_timer; diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 41b88ad..456b28d 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -35,11 +35,11 @@ extern void *tall_bsc_ctx; -static void start_test_procedure(struct gprs_gsup_client *gsupc); +static void start_test_procedure(struct osmo_gsup_client *gsupc); -static void gsup_client_send_ping(struct gprs_gsup_client *gsupc) +static void gsupc_send_ping(struct osmo_gsup_client *gsupc) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = osmo_gsup_client_msgb_alloc(); msg->l2h = msgb_put(msg, 1); msg->l2h[0] = IPAC_MSGT_PING; @@ -47,7 +47,7 @@ ipa_client_conn_send(gsupc->link, msg); } -static int gsup_client_connect(struct gprs_gsup_client *gsupc) +static int gsupc_connect(struct osmo_gsup_client *gsupc) { int rc; @@ -84,7 +84,8 @@ rc == -EINVAL) return rc; - osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); + osmo_timer_schedule(&gsupc->connect_timer, + OSMO_GSUP_CLIENT_RECONNECT_INTERVAL, 0); LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); @@ -92,17 +93,17 @@ return 0; } -static void connect_timer_cb(void *gsupc_) +static void gsupc_connect_timer_cb(void *gsupc_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct osmo_gsup_client *gsupc = gsupc_; if (gsupc->is_connected) return; - gsup_client_connect(gsupc); + gsupc_connect(gsupc); } -static void gsup_client_send(struct gprs_gsup_client *gsupc, int proto_ext, struct msgb *msg_tx) +static void gsupc_send(struct osmo_gsup_client *gsupc, int proto_ext, struct msgb *msg_tx) { ipa_prepend_header_ext(msg_tx, proto_ext); ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO); @@ -110,7 +111,7 @@ /* msg_tx is now queued and will be freed. */ } -static void gsup_client_oap_register(struct gprs_gsup_client *gsupc) +static void gsupc_oap_register(struct osmo_gsup_client *gsupc) { struct msgb *msg_tx; int rc; @@ -121,12 +122,12 @@ return; } - gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); + gsupc_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); } -static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) +static void gsupc_updown_cb(struct ipa_client_conn *link, int up) { - struct gprs_gsup_client *gsupc = link->data; + struct osmo_gsup_client *gsupc = link->data; LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); @@ -137,18 +138,18 @@ start_test_procedure(gsupc); if (gsupc->oap_state.state == OAP_INITIALIZED) - gsup_client_oap_register(gsupc); + gsupc_oap_register(gsupc); osmo_timer_del(&gsupc->connect_timer); } else { osmo_timer_del(&gsupc->ping_timer); osmo_timer_schedule(&gsupc->connect_timer, - GPRS_GSUP_RECONNECT_INTERVAL, 0); + OSMO_GSUP_CLIENT_RECONNECT_INTERVAL, 0); } } -static int gsup_client_oap_handle(struct gprs_gsup_client *gsupc, struct msgb *msg_rx) +static int gsupc_oap_handle(struct osmo_gsup_client *gsupc, struct msgb *msg_rx) { int rc; struct msgb *msg_tx; @@ -159,16 +160,16 @@ return rc; if (msg_tx) - gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); + gsupc_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); return 0; } -static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) +static int gsupc_read_cb(struct ipa_client_conn *link, struct msgb *msg) { struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); - struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data; + struct osmo_gsup_client *gsupc = (struct osmo_gsup_client *)link->data; int rc; static struct ipaccess_unit ipa_dev = { .unit_name = "SGSN" @@ -213,8 +214,8 @@ gsupc->read_cb(gsupc, msg); /* expecting read_cb() to free msg */ } else if (he->proto == IPAC_PROTO_EXT_OAP) { - return gsup_client_oap_handle(gsupc, msg); - /* gsup_client_oap_handle frees msg */ + return gsupc_oap_handle(gsupc, msg); + /* gsupc_oap_handle frees msg */ } else goto invalid; @@ -231,7 +232,7 @@ static void ping_timer_cb(void *gsupc_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct osmo_gsup_client *gsupc = gsupc_; LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", @@ -246,29 +247,31 @@ ipa_client_conn_close(gsupc->link); gsupc->is_connected = 0; - gsup_client_connect(gsupc); + gsupc_connect(gsupc); } -static void start_test_procedure(struct gprs_gsup_client *gsupc) +static void start_test_procedure(struct osmo_gsup_client *gsupc) { gsupc->ping_timer.data = gsupc; gsupc->ping_timer.cb = &ping_timer_cb; gsupc->got_ipa_pong = 0; - osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0); + osmo_timer_schedule(&gsupc->ping_timer, OSMO_GSUP_CLIENT_PING_INTERVAL, + 0); LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); - gsup_client_send_ping(gsupc); + gsupc_send_ping(gsupc); } -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb, - struct oap_config *oap_config) +struct osmo_gsup_client * +osmo_gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + osmo_gsup_client_read_cb_t read_cb, + struct oap_config *oap_config) { - struct gprs_gsup_client *gsupc; + struct osmo_gsup_client *gsupc; int rc; - gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + gsupc = talloc_zero(tall_bsc_ctx, struct osmo_gsup_client); OSMO_ASSERT(gsupc); rc = oap_init(oap_config, &gsupc->oap_state); @@ -279,17 +282,17 @@ /* no e1inp */ NULL, 0, ip_addr, tcp_port, - gsup_client_updown_cb, - gsup_client_read_cb, + gsupc_updown_cb, + gsupc_read_cb, /* default write_cb */ NULL, gsupc); if (!gsupc->link) goto failed; gsupc->connect_timer.data = gsupc; - gsupc->connect_timer.cb = &connect_timer_cb; + gsupc->connect_timer.cb = &gsupc_connect_timer_cb; - rc = gsup_client_connect(gsupc); + rc = gsupc_connect(gsupc); if (rc < 0) goto failed; @@ -299,11 +302,11 @@ return gsupc; failed: - gprs_gsup_client_destroy(gsupc); + osmo_gsup_client_destroy(gsupc); return NULL; } -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc) +void osmo_gsup_client_destroy(struct osmo_gsup_client *gsupc) { osmo_timer_del(&gsupc->connect_timer); osmo_timer_del(&gsupc->ping_timer); @@ -316,7 +319,7 @@ talloc_free(gsupc); } -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg) { if (!gsupc) { msgb_free(msg); @@ -328,12 +331,12 @@ return -EAGAIN; } - gsup_client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); + gsupc_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); return 0; } -struct msgb *gprs_gsup_msgb_alloc(void) +struct msgb *osmo_gsup_client_msgb_alloc(void) { return msgb_alloc_headroom(4000, 64, __func__); } diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 658ce04..f9572de 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -45,7 +45,7 @@ extern void *tall_bsc_ctx; -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg); +static int gsup_read_cb(struct osmo_gsup_client *gsupc, struct msgb *msg); /* TODO: Some functions are specific to the SGSN, but this file is more general * (it has gprs_* name). Either move these functions elsewhere, split them and @@ -62,7 +62,7 @@ addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr); - sgi->gsup_client = gprs_gsup_client_create( + sgi->gsup_client = osmo_gsup_client_create( addr_str, sgi->cfg.gsup_server_port, &gsup_read_cb, &sgi->cfg.oap); @@ -73,7 +73,7 @@ return 1; } -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +static int gsup_read_cb(struct osmo_gsup_client *gsupc, struct msgb *msg) { int rc; @@ -161,7 +161,7 @@ static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr, struct osmo_gsup_message *gsup_msg) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = osmo_gsup_client_msgb_alloc(); if (strlen(gsup_msg->imsi) == 0 && subscr) strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1); @@ -176,7 +176,7 @@ return -ENOTSUP; } - return gprs_gsup_client_send(sgsn->gsup_client, msg); + return osmo_gsup_client_send(sgsn->gsup_client, msg); } static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr, diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index 5f123b8..d981346 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -12,7 +12,7 @@ #include #include -static struct gprs_gsup_client *g_gc; +static struct osmo_gsup_client *g_gc; /*********************************************************************** @@ -113,7 +113,7 @@ osmo_gsup_encode(msg, &gsup); - return gprs_gsup_client_send(g_gc, msg); + return osmo_gsup_client_send(g_gc, msg); } /* allocate + generate + send Send-Auth-Info */ @@ -128,7 +128,7 @@ osmo_gsup_encode(msg, &gsup); - return gprs_gsup_client_send(g_gc, msg); + return osmo_gsup_client_send(g_gc, msg); } int resp_isd(struct imsi_op *io) @@ -143,7 +143,7 @@ imsi_op_release(io); - return gprs_gsup_client_send(g_gc, msg); + return osmo_gsup_client_send(g_gc, msg); } /* receive an incoming GSUP message */ @@ -196,7 +196,7 @@ } } -static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +static int gsupc_read_cb(struct osmo_gsup_client *gsupc, struct msgb *msg) { struct osmo_gsup_message gsup_msg = {0}; struct imsi_op *io; @@ -281,8 +281,8 @@ osmo_init_logging(&gprs_log_info); - g_gc = gprs_gsup_client_create(server_host, server_port, - gsupc_read_cb, NULL); + g_gc = osmo_gsup_client_create(server_host, server_port, gsupc_read_cb, + NULL); signal(SIGINT, sig_cb); diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index b00cb82..aa54144 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -36,7 +36,7 @@ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ - -Wl,--wrap=gprs_gsup_client_send \ + -Wl,--wrap=osmo_gsup_client_send \ $(NULL) sgsn_test_LDADD = \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 789817c..35dd85c 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -146,14 +146,14 @@ return (*subscr_request_auth_info_cb)(mmctx); }; -/* override, requires '-Wl,--wrap=gprs_gsup_client_send' */ -int __real_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -int (*gprs_gsup_client_send_cb)(struct gprs_gsup_client *gsupc, struct msgb *msg) = - &__real_gprs_gsup_client_send; +/* override, requires '-Wl,--wrap=osmo_gsup_client_send' */ +int __real_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg); +int (*osmo_gsup_client_send_cb)(struct osmo_gsup_client *gsupc, struct msgb *msg) = + &__real_osmo_gsup_client_send; -int __wrap_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int __wrap_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg) { - return (*gprs_gsup_client_send_cb)(gsupc, msg); + return (*osmo_gsup_client_send_cb)(gsupc, msg); }; static int count(struct llist_head *head) @@ -714,7 +714,7 @@ cleanup_test(); } -int my_gprs_gsup_client_send_dummy(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_osmo_gsup_client_send_dummy(struct osmo_gsup_client *gsupc, struct msgb *msg) { msgb_free(msg); return 0; @@ -1281,7 +1281,7 @@ cleanup_test(); } -int my_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg) { struct osmo_gsup_message to_peer = {0}; struct osmo_gsup_message from_peer = {0}; @@ -1323,7 +1323,7 @@ return 0; } - reply_msg = gprs_gsup_msgb_alloc(); + reply_msg = osmo_gsup_client_msgb_alloc(); reply_msg->l2h = reply_msg->data; osmo_gsup_encode(reply_msg, &from_peer); gprs_subscr_rx_gsup_message(reply_msg); @@ -1338,9 +1338,9 @@ struct gsm_subscriber *subscr; sgsn_inst.cfg.auth_policy = SGSN_AUTH_POLICY_REMOTE; - gprs_gsup_client_send_cb = my_gprs_gsup_client_send; + osmo_gsup_client_send_cb = my_osmo_gsup_client_send; - sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct osmo_gsup_client); if (retry) { upd_loc_skip = 3; @@ -1355,7 +1355,7 @@ assert_no_subscrs(); sgsn->cfg.auth_policy = saved_auth_policy; - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + osmo_gsup_client_send_cb = __real_osmo_gsup_client_send; upd_loc_skip = 0; auth_info_skip = 0; talloc_free(sgsn->gsup_client); @@ -2239,7 +2239,7 @@ printf("Testing GGSN selection\n"); - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + osmo_gsup_client_send_cb = my_osmo_gsup_client_send_dummy; /* Check for emptiness */ OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); @@ -2358,7 +2358,7 @@ sgsn_ggsn_ctx_free(ggcs[1]); sgsn_ggsn_ctx_free(ggcs[2]); - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + osmo_gsup_client_send_cb = __real_osmo_gsup_client_send; cleanup_test(); } -- To view, visit https://gerrit.osmocom.org/1384 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:25 +0000 Subject: [PATCH] openbsc[master]: rename gprs_gsup_client.h to gsup_client.h Message-ID: Review at https://gerrit.osmocom.org/1385 rename gprs_gsup_client.h to gsup_client.h This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c --- M openbsc/include/openbsc/Makefile.am R openbsc/include/openbsc/gsup_client.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/gprs/gsup_test_client.c M openbsc/src/gprs/sgsn_vty.c M openbsc/tests/sgsn/sgsn_test.c 7 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/1385/1 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 3e8bd5f..8ea95e0 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -23,7 +23,6 @@ gb_proxy.h \ gprs_gb_parse.h \ gprs_gmm.h \ - gprs_gsup_client.h \ gprs_llc.h \ gprs_llc_xid.h \ gprs_sgsn.h \ @@ -39,6 +38,7 @@ gsm_data.h \ gsm_data_shared.h \ gsm_subscriber.h \ + gsup_client.h \ gtphub.h \ handover.h \ handover_decision.h \ diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gsup_client.h similarity index 100% rename from openbsc/include/openbsc/gprs_gsup_client.h rename to openbsc/include/openbsc/gsup_client.h diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 456b28d..bd1a16b 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -21,7 +21,7 @@ * */ -#include +#include #include #include diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index f9572de..3f41cfa 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index d981346..843e108 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include static struct osmo_gsup_client *g_gc; diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 1b477e5..21c865b 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 35dd85c..bc87f8b 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1385 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category Message-ID: Review at https://gerrit.osmocom.org/1386 gsup client, gsup_test_client: move logging to DLGSUP category Since recently, libosmocore offers the DLGSUP logging category. Use it for GSUP. Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee --- M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gsup_test_client.c 2 files changed, 22 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/1386/1 diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index bd1a16b..c8e7abd 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -55,29 +55,29 @@ return 0; if (osmo_timer_pending(&gsupc->connect_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: connect timer already running\n"); osmo_timer_del(&gsupc->connect_timer); } if (osmo_timer_pending(&gsupc->ping_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: ping timer already running\n"); osmo_timer_del(&gsupc->ping_timer); } if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); rc = ipa_client_conn_open(gsupc->link); if (rc >= 0) { - LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP connecting to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; } - LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", gsupc->link->addr, gsupc->link->port, strerror(-rc)); if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || @@ -87,7 +87,7 @@ osmo_timer_schedule(&gsupc->connect_timer, OSMO_GSUP_CLIENT_RECONNECT_INTERVAL, 0); - LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; @@ -118,7 +118,7 @@ rc = oap_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { - LOGP(DGPRS, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); + LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); return; } @@ -129,7 +129,7 @@ { struct osmo_gsup_client *gsupc = link->data; - LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); gsupc->is_connected = up; @@ -180,7 +180,7 @@ rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); if (rc < 0) { - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA/CCM message from %s:%d\n", link->addr, link->port); /* Link has been closed */ @@ -193,7 +193,7 @@ uint8_t msg_type = *(msg->l2h); /* CCM message */ if (msg_type == IPAC_MSGT_PONG) { - LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP receiving PONG\n"); gsupc->got_ipa_pong = 1; } @@ -222,7 +222,7 @@ return 0; invalid: - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA message from %s:%d, size = %d\n", link->addr, link->port, msgb_length(msg)); @@ -234,7 +234,7 @@ { struct osmo_gsup_client *gsupc = gsupc_; - LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", gsupc->got_ipa_pong ? "got" : "didn't get"); @@ -243,7 +243,7 @@ return; } - LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); + LOGP(DLGSUP, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); ipa_client_conn_close(gsupc->link); gsupc->is_connected = 0; @@ -258,7 +258,7 @@ gsupc->got_ipa_pong = 0; osmo_timer_schedule(&gsupc->ping_timer, OSMO_GSUP_CLIENT_PING_INTERVAL, 0); - LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP sending PING\n"); gsupc_send_ping(gsupc); } diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index 843e108..e817185 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -260,17 +260,17 @@ void *tall_bsc_ctx = NULL; /* default categories */ -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", +static struct log_info_cat default_categories[] = { + [DLGSUP] = { + .name = "DLGSUP", + .description = "Generic Subscriber Update Protocol", .enabled = 1, .loglevel = LOGL_INFO, }, }; -static const struct log_info gprs_log_info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), +static const struct log_info gsup_test_client_log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), }; int main(int argc, char **argv) @@ -279,7 +279,7 @@ char *server_host = "127.0.0.1"; uint16_t server_port = 2222; - osmo_init_logging(&gprs_log_info); + osmo_init_logging(&gsup_test_client_log_info); g_gc = osmo_gsup_client_create(server_host, server_port, gsupc_read_cb, NULL); -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: oap: rename public API from oap_ to osmo_oap_client_ Message-ID: Review at https://gerrit.osmocom.org/1387 oap: rename public API from oap_ to osmo_oap_client_ This is in preparation for moving the oap client to libcommon, which is in turn preparation for libvlr. Add the osmo_ prefix, as all public Osmocom API should have. We also have OAP messages code in libosmocore, so clarify by naming this osmo_oap_client, and by also renaming the oap_test to oap_client_test. This reshuffling will allow an easy move of OAP to libosmocore if we should want to do that. A number of patches will follow up on this. Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 --- M openbsc/include/openbsc/gsup_client.h M openbsc/include/openbsc/oap.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/oap.c M openbsc/tests/oap/oap_test.c 6 files changed, 63 insertions(+), 57 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/87/1387/1 diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index 398b64f..b07cc51 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -41,7 +41,7 @@ osmo_gsup_client_read_cb_t read_cb; void *data; - struct oap_state oap_state; + struct osmo_oap_client_state oap_state; struct osmo_timer_list ping_timer; struct osmo_timer_list connect_timer; @@ -53,7 +53,7 @@ osmo_gsup_client_create(const char *ip_addr, unsigned int tcp_port, osmo_gsup_client_read_cb_t read_cb, - struct oap_config *oap_config); + struct osmo_oap_client_config *oap_config); void osmo_gsup_client_destroy(struct osmo_gsup_client *gsupc); int osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg); diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap.h index 2206184..19e11ed 100644 --- a/openbsc/include/openbsc/oap.h +++ b/openbsc/include/openbsc/oap.h @@ -27,9 +27,10 @@ struct msgb; struct osmo_oap_message; -/* This is the config part for vty. It is essentially copied in oap_state, - * where values are copied over once the config is considered valid. */ -struct oap_config { +/* This is the config part for vty. It is essentially copied in + * osmo_oap_client_state, where values are copied over once the config is + * considered valid. */ +struct osmo_oap_client_config { uint16_t client_id; int secret_k_present; uint8_t secret_k[16]; @@ -38,9 +39,10 @@ }; /* The runtime state of the OAP client. client_id and the secrets are in fact - * duplicated from oap_config, so that a separate validation of the config data - * is possible, and so that only a struct oap_state* is passed around. */ -struct oap_state { + * duplicated from osmo_oap_client_config, so that a separate validation of the + * config data is possible, and so that only a struct osmo_oap_client_state* is + * passed around. */ +struct osmo_oap_client_state { enum { OAP_UNINITIALIZED = 0, /* just allocated. */ OAP_DISABLED, /* disabled by config. */ @@ -56,23 +58,26 @@ }; /* From config, initialize state. Return 0 on success. */ -int oap_init(struct oap_config *config, struct oap_state *state); +int osmo_oap_client_init(struct osmo_oap_client_config *config, + struct osmo_oap_client_state *state); /* Construct an OAP registration message and return in *msg_tx. Use * state->client_id and update state->state. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_register(struct oap_state *state, struct msgb **msg_tx); +int osmo_oap_client_register(struct osmo_oap_client_state *state, + struct msgb **msg_tx); /* Decode and act on a received OAP message msg_rx. Update state->state. If a * non-NULL pointer is returned in *msg_tx, that msgb should be sent to the OAP * server (and freed) by the caller. The received msg_rx is not freed. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx); +int osmo_oap_client_handle(struct osmo_oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx); -/* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on - * error. (Like oap_encode(), but also allocates a msgb.) - * About the name: the idea is do_something(oap_encoded(my_struct)) */ -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg); - +/* Allocate a msgb and in it, return the encoded osmo_oap_client_msg. Return + * NULL on error. (Like osmo_oap_client_encode(), but also allocates a msgb.) + * About the name: the idea is do_something(osmo_oap_client_encoded(my_struct)) + */ +struct msgb *osmo_oap_client_encoded(const struct osmo_oap_message *osmo_oap_client_msg); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 9051738..5b3b7ef 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -92,7 +92,7 @@ int dynamic_lookup; - struct oap_config oap; + struct osmo_oap_client_config oap; /* RFC1144 TCP/IP header compression */ struct { diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index c8e7abd..5b05a95 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -115,7 +115,7 @@ { struct msgb *msg_tx; int rc; - rc = oap_register(&gsupc->oap_state, &msg_tx); + rc = osmo_oap_client_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); @@ -154,7 +154,7 @@ int rc; struct msgb *msg_tx; - rc = oap_handle(&gsupc->oap_state, msg_rx, &msg_tx); + rc = osmo_oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) return rc; @@ -266,7 +266,7 @@ osmo_gsup_client_create(const char *ip_addr, unsigned int tcp_port, osmo_gsup_client_read_cb_t read_cb, - struct oap_config *oap_config) + struct osmo_oap_client_config *oap_config) { struct osmo_gsup_client *gsupc; int rc; @@ -274,7 +274,7 @@ gsupc = talloc_zero(tall_bsc_ctx, struct osmo_gsup_client); OSMO_ASSERT(gsupc); - rc = oap_init(oap_config, &gsupc->oap_state); + rc = osmo_oap_client_init(oap_config, &gsupc->oap_state); if (rc != 0) goto failed; diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index 7efbe81..60a114e 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -29,7 +29,7 @@ #include #include -int oap_init(struct oap_config *config, struct oap_state *state) +int osmo_oap_client_init(struct osmo_oap_client_config *config, struct osmo_oap_client_state *state) { OSMO_ASSERT(state->state == OAP_UNINITIALIZED); @@ -66,7 +66,7 @@ * response message and update the state. * Return 0 on success; -1 if OAP is disabled; -2 if rx_random and rx_autn fail * the authentication check; -3 for any other errors. */ -static int oap_evaluate_challenge(const struct oap_state *state, +static int oap_evaluate_challenge(const struct osmo_oap_client_state *state, const uint8_t *rx_random, const uint8_t *rx_autn, uint8_t *tx_xres) @@ -119,7 +119,7 @@ return 0; } -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +struct msgb *osmo_oap_client_encoded(const struct osmo_oap_message *oap_msg) { struct msgb *msg = msgb_alloc_headroom(1000, 64, __func__); OSMO_ASSERT(msg); @@ -140,10 +140,10 @@ oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; oap_msg.client_id = client_id; - return oap_encoded(&oap_msg); + return osmo_oap_client_encoded(&oap_msg); } -int oap_register(struct oap_state *state, struct msgb **msg_tx) +int osmo_oap_client_register(struct osmo_oap_client_state *state, struct msgb **msg_tx) { *msg_tx = oap_msg_register(state->client_id); if (!(*msg_tx)) @@ -163,10 +163,10 @@ oap_reply.message_type = OAP_MSGT_CHALLENGE_RESULT; memcpy(oap_reply.xres, xres, sizeof(oap_reply.xres)); oap_reply.xres_present = 1; - return oap_encoded(&oap_reply); + return osmo_oap_client_encoded(&oap_reply); } -static int handle_challenge(struct oap_state *state, +static int handle_challenge(struct osmo_oap_client_state *state, struct osmo_oap_message *oap_rx, struct msgb **msg_tx) { @@ -203,7 +203,8 @@ return rc; } -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx) +int osmo_oap_client_handle(struct osmo_oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx) { uint8_t *data = msgb_l2(msg_rx); size_t data_len = msgb_l2len(msg_rx); @@ -237,7 +238,7 @@ state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { state->registration_failures ++; - return oap_register(state, msg_tx); + return osmo_oap_client_register(state, msg_tx); } return -11; diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index 68542fd..5c1a24f 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -31,11 +31,11 @@ { printf("Testing OAP API\n - Config parsing\n"); - struct oap_config _config; - struct oap_config *config = &_config; + struct osmo_oap_client_config _config; + struct osmo_oap_client_config *config = &_config; - struct oap_state _state; - struct oap_state *state = &_state; + struct osmo_oap_client_state _state; + struct osmo_oap_client_state *state = &_state; memset(config, 0, sizeof(*config)); memset(state, 0, sizeof(*state)); @@ -50,7 +50,7 @@ config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); /* reset state */ @@ -60,7 +60,7 @@ config->client_id = 0; config->secret_k_present = 1; config->secret_opc_present = 1; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -69,7 +69,7 @@ config->client_id = 12345; config->secret_k_present = 0; config->secret_opc_present = 1; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -78,7 +78,7 @@ config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 0; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -89,7 +89,7 @@ config->secret_k_present = 1; config->secret_opc_present = 1; /*config->secret_* buffers are still set from the top */ - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); printf(" - AUTN failures\n"); @@ -105,8 +105,8 @@ oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST; oap_rx.rand_present = 0; oap_rx.autn_present = 0; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = osmo_oap_client_encoded(&oap_rx); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -114,8 +114,8 @@ osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); oap_rx.rand_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = osmo_oap_client_encoded(&oap_rx); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -124,8 +124,8 @@ osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); oap_rx.autn_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = osmo_oap_client_encoded(&oap_rx); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -136,25 +136,25 @@ oap_rx.autn, 16); oap_rx.rand_present = 1; oap_rx.autn_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = osmo_oap_client_encoded(&oap_rx); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); /* all data correct */ osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); - msg_rx = oap_encoded(&oap_rx); + msg_rx = osmo_oap_client_encoded(&oap_rx); /* but refuse to evaluate in uninitialized state */ OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -1); OSMO_ASSERT(!msg_tx); state->state = OAP_DISABLED; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -1); OSMO_ASSERT(!msg_tx); state->state = OAP_INITIALIZED; @@ -162,7 +162,7 @@ /* now everything is correct */ printf(" - AUTN success\n"); /* a successful return value here indicates correct autn */ - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0); msgb_free(msg_rx); /* Expect the challenge response in msg_tx */ @@ -176,18 +176,18 @@ msgb_free(msg_tx); msg_tx = 0; - struct oap_state saved_state = _state; + struct osmo_oap_client_state saved_state = _state; printf(" - Registration failure\n"); memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; - msg_rx = oap_encoded(&oap_rx); + msg_rx = osmo_oap_client_encoded(&oap_rx); /* Receive registration error for the first time. */ OSMO_ASSERT(state->registration_failures == 0); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(state->registration_failures == 1); OSMO_ASSERT(msg_tx); OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0); @@ -198,7 +198,7 @@ /* Receive registration error for the Nth time. */ state->registration_failures = 999; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -11); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -11); OSMO_ASSERT(!msg_tx); OSMO_ASSERT(state->state == OAP_INITIALIZED); msgb_free(msg_tx); @@ -211,8 +211,8 @@ _state = saved_state; memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_RESULT; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + msg_rx = osmo_oap_client_encoded(&oap_rx); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(!msg_tx); OSMO_ASSERT(state->state == OAP_REGISTERED); msgb_free(msg_rx); -- To view, visit https://gerrit.osmocom.org/1387 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: rename oap.h to oap_client.h Message-ID: Review at https://gerrit.osmocom.org/1388 rename oap.h to oap_client.h Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec --- M openbsc/include/openbsc/Makefile.am M openbsc/include/openbsc/gsup_client.h R openbsc/include/openbsc/oap_client.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/oap.c M openbsc/tests/oap/oap_test.c 6 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/88/1388/1 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 8ea95e0..2466ce8 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -54,7 +54,7 @@ mncc_int.h \ nat_rewrite_trie.h \ network_listen.h \ - oap.h \ + oap_client.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index b07cc51..0962bdb 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -23,7 +23,7 @@ #include -#include +#include #define OSMO_GSUP_CLIENT_RECONNECT_INTERVAL 10 #define OSMO_GSUP_CLIENT_PING_INTERVAL 20 diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap_client.h similarity index 100% rename from openbsc/include/openbsc/oap.h rename to openbsc/include/openbsc/oap_client.h diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 5b3b7ef..4299f5b 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index 60a114e..d6a7043 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include int osmo_oap_client_init(struct osmo_oap_client_config *config, struct osmo_oap_client_state *state) diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index 5c1a24f..50aeeec 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1388 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: move gprs/oap.c to libcommon/oap_client.c Message-ID: Review at https://gerrit.osmocom.org/1389 move gprs/oap.c to libcommon/oap_client.c This is in preparation for libvlr. Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 --- M openbsc/src/gprs/Makefile.am M openbsc/src/libcommon/Makefile.am R openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/Makefile.am M openbsc/tests/sgsn/Makefile.am 5 files changed, 2 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/89/1389/1 diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index ab2517e..d059aee 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -92,7 +92,6 @@ sgsn_cdr.c \ sgsn_ares.c \ slhc.c \ - oap.c \ gprs_llc_xid.c \ v42bis.c \ $(NULL) @@ -137,9 +136,9 @@ gsup_test_client_SOURCES = \ gprs_gsup_client.c \ gsup_test_client.c \ - oap.c \ $(NULL) gsup_test_client_LDADD = \ + $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6cfebc2..6582d1e 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,6 +23,7 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ + oap_client.c \ socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/libcommon/oap_client.c similarity index 100% rename from openbsc/src/gprs/oap.c rename to openbsc/src/libcommon/oap_client.c diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index bb9ebb2..c17abb5 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -27,7 +27,6 @@ $(NULL) oap_test_LDADD = \ - $(top_builddir)/src/gprs/oap.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index aa54144..86f596d 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -54,7 +54,6 @@ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ - $(top_builddir)/src/gprs/oap.o \ $(top_builddir)/src/gprs/gprs_llc_xid.o \ $(top_builddir)/src/gprs/gprs_sndcp_xid.o \ $(top_builddir)/src/gprs/slhc.o \ -- To view, visit https://gerrit.osmocom.org/1389 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: move grps_gsup_client.c to libcommon/gsup_client.c Message-ID: Review at https://gerrit.osmocom.org/1390 move grps_gsup_client.c to libcommon/gsup_client.c This is in preparation for libvlr. Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce --- M openbsc/src/gprs/Makefile.am M openbsc/src/libcommon/Makefile.am R openbsc/src/libcommon/gsup_client.c R openbsc/src/libcommon/gsup_test_client.c M openbsc/tests/sgsn/Makefile.am 5 files changed, 17 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/90/1390/1 diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index d059aee..cff17dd 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -37,7 +37,6 @@ $(NULL) bin_PROGRAMS = \ - gsup_test_client \ osmo-gbproxy \ $(NULL) if HAVE_LIBGTP @@ -88,7 +87,6 @@ sgsn_auth.c \ gprs_subscriber.c \ gprs_utils.c \ - gprs_gsup_client.c \ sgsn_cdr.c \ sgsn_ares.c \ slhc.c \ @@ -130,18 +128,5 @@ $(LIBOSMOVTY_LIBS) \ $(LIBCARES_LIBS) \ $(LIBGTP_LIBS) \ - -lrt \ - $(NULL) - -gsup_test_client_SOURCES = \ - gprs_gsup_client.c \ - gsup_test_client.c \ - $(NULL) -gsup_test_client_LDADD = \ - $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBOSMOCORE_LIBS) \ - $(LIBOSMOGSM_LIBS) \ - $(LIBOSMOVTY_LIBS) \ - $(LIBOSMOABIS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6582d1e..0b258c0 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,8 +23,25 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ + gsup_client.c \ oap_client.c \ socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ $(NULL) + +noinst_PROGRAMS = \ + gsup_test_client \ + $(NULL) + +gsup_test_client_SOURCES = \ + gsup_test_client.c \ + $(NULL) +gsup_test_client_LDADD = \ + libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + -lrt \ + $(NULL) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/libcommon/gsup_client.c similarity index 100% rename from openbsc/src/gprs/gprs_gsup_client.c rename to openbsc/src/libcommon/gsup_client.c diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/libcommon/gsup_test_client.c similarity index 100% rename from openbsc/src/gprs/gsup_test_client.c rename to openbsc/src/libcommon/gsup_test_client.c diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 86f596d..77419d7 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -50,7 +50,6 @@ $(top_builddir)/src/gprs/sgsn_libgtp.o \ $(top_builddir)/src/gprs/sgsn_auth.o \ $(top_builddir)/src/gprs/sgsn_ares.o \ - $(top_builddir)/src/gprs/gprs_gsup_client.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ -- To view, visit https://gerrit.osmocom.org/1390 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: oap_test.c: rename to avoid clash with libosmocore oap_test.c Message-ID: Review at https://gerrit.osmocom.org/1391 oap_test.c: rename to avoid clash with libosmocore oap_test.c Rename to oap_client_test.c, which is also a more accurate name. Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f --- M openbsc/tests/oap/Makefile.am R openbsc/tests/oap/oap_client_test.c R openbsc/tests/oap/oap_client_test.ok M openbsc/tests/testsuite.at 4 files changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/91/1391/1 diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index c17abb5..df0a43f 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -11,22 +11,22 @@ $(NULL) EXTRA_DIST = \ - oap_test.ok \ + oap_client_test.ok \ $(NULL) if HAVE_LIBGTP if HAVE_LIBCARES noinst_PROGRAMS = \ - oap_test \ + oap_client_test \ $(NULL) endif endif -oap_test_SOURCES = \ - oap_test.c \ +oap_client_test_SOURCES = \ + oap_client_test.c \ $(NULL) -oap_test_LDADD = \ +oap_client_test_LDADD = \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_client_test.c similarity index 100% rename from openbsc/tests/oap/oap_test.c rename to openbsc/tests/oap/oap_client_test.c diff --git a/openbsc/tests/oap/oap_test.ok b/openbsc/tests/oap/oap_client_test.ok similarity index 100% rename from openbsc/tests/oap/oap_test.ok rename to openbsc/tests/oap/oap_client_test.ok diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index b44d595..0765c76 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -107,8 +107,8 @@ AT_SETUP([oap]) AT_KEYWORDS([oap]) AT_CHECK([test "$enable_oap_test" != no || exit 77]) -cat $abs_srcdir/oap/oap_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [], [expout], [ignore]) +cat $abs_srcdir/oap/oap_client_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [ignore]) AT_CLEANUP AT_SETUP([gtphub]) -- To view, visit https://gerrit.osmocom.org/1391 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:26 +0000 Subject: [PATCH] openbsc[master]: oap_client_test: print test descr to stderr, check stderr Message-ID: Review at https://gerrit.osmocom.org/1392 oap_client_test: print test descr to stderr, check stderr Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 --- M openbsc/tests/oap/Makefile.am M openbsc/tests/oap/oap_client_test.c A openbsc/tests/oap/oap_client_test.err M openbsc/tests/oap/oap_client_test.ok M openbsc/tests/testsuite.at 5 files changed, 56 insertions(+), 30 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/92/1392/1 diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index df0a43f..1bb672d 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -12,6 +12,7 @@ EXTRA_DIST = \ oap_client_test.ok \ + oap_client_test.err \ $(NULL) if HAVE_LIBGTP diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 50aeeec..b966c41 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -29,7 +29,7 @@ static void test_oap_api(void) { - printf("Testing OAP API\n - Config parsing\n"); + printf("Testing OAP API\n"); struct osmo_oap_client_config _config; struct osmo_oap_client_config *config = &_config; @@ -43,20 +43,20 @@ OSMO_ASSERT(osmo_hexparse("0102030405060708090a0b0c0d0e0f10", config->secret_k, 16) == 16); OSMO_ASSERT(osmo_hexparse("1112131415161718191a1b1c1d1e1f20", config->secret_opc, 16) == 16); - /* make sure filling with zeros means uninitialized */ + fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); - /* invalid client_id and shared secret */ + fprintf(stderr, "- invalid client_id and shared secret\n"); config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); - /* reset state */ + fprintf(stderr, "- reset state\n"); memset(state, 0, sizeof(*state)); - /* only client_id is invalid */ + fprintf(stderr, "- only client_id is invalid\n"); config->client_id = 0; config->secret_k_present = 1; config->secret_opc_present = 1; @@ -65,7 +65,7 @@ memset(state, 0, sizeof(*state)); - /* valid id, but omitted shared_secret (1/2) */ + fprintf(stderr, "- valid id, but omitted shared_secret (1/2)\n"); config->client_id = 12345; config->secret_k_present = 0; config->secret_opc_present = 1; @@ -74,7 +74,7 @@ memset(state, 0, sizeof(*state)); - /* valid id, but omitted shared_secret (2/2) */ + fprintf(stderr, "- valid id, but omitted shared_secret (2/2)\n"); config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 0; @@ -84,7 +84,7 @@ memset(state, 0, sizeof(*state)); - /* mint configuration */ + fprintf(stderr, "- mint configuration\n"); config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 1; @@ -92,16 +92,13 @@ OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); - printf(" - AUTN failures\n"); - struct osmo_oap_message oap_rx; struct osmo_oap_message oap_tx; struct msgb *msg_rx; struct msgb *msg_tx; + fprintf(stderr, "- Missing challenge data\n"); memset(&oap_rx, 0, sizeof(oap_rx)); - - /* Missing challenge data */ oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST; oap_rx.rand_present = 0; oap_rx.autn_present = 0; @@ -110,7 +107,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* AUTN missing */ + fprintf(stderr, "- AUTN missing\n"); osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); oap_rx.rand_present = 1; @@ -119,7 +116,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* RAND missing */ + fprintf(stderr, "- RAND missing\n"); oap_rx.rand_present = 0; osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); @@ -129,7 +126,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* wrong autn (by one bit) */ + fprintf(stderr, "- wrong autn (by one bit)\n"); osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); osmo_hexparse("dec4e3848a33000086781158ca40f136", @@ -141,12 +138,12 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* all data correct */ + fprintf(stderr, "- all data correct\n"); osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); msg_rx = osmo_oap_client_encoded(&oap_rx); - /* but refuse to evaluate in uninitialized state */ + fprintf(stderr, "- but refuse to evaluate in uninitialized state\n"); OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; @@ -159,13 +156,12 @@ state->state = OAP_INITIALIZED; - /* now everything is correct */ - printf(" - AUTN success\n"); + fprintf(stderr, "- now everything is correct\n"); /* a successful return value here indicates correct autn */ OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0); msgb_free(msg_rx); - /* Expect the challenge response in msg_tx */ + fprintf(stderr, "- Expect the challenge response in msg_tx\n"); OSMO_ASSERT(msg_tx); OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0); OSMO_ASSERT(oap_tx.message_type == OAP_MSGT_CHALLENGE_RESULT); @@ -178,14 +174,13 @@ struct osmo_oap_client_state saved_state = _state; - printf(" - Registration failure\n"); + fprintf(stderr, "- Receive registration error for the first time.\n"); memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; msg_rx = osmo_oap_client_encoded(&oap_rx); - /* Receive registration error for the first time. */ OSMO_ASSERT(state->registration_failures == 0); OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(state->registration_failures == 1); @@ -196,7 +191,7 @@ msgb_free(msg_tx); msg_tx = 0; - /* Receive registration error for the Nth time. */ + fprintf(stderr, "- Receive registration error for the Nth time.\n"); state->registration_failures = 999; OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -11); OSMO_ASSERT(!msg_tx); @@ -206,7 +201,7 @@ msgb_free(msg_rx); - printf(" - Registration success\n"); + fprintf(stderr, "- Registration success\n"); _state = saved_state; memset(&oap_rx, 0, sizeof(oap_rx)); @@ -236,6 +231,12 @@ msgb_talloc_ctx_init(NULL, 0); osmo_init_logging(&info); + OSMO_ASSERT(osmo_stderr_target); + osmo_stderr_target->use_color = 0; + osmo_stderr_target->print_timestamp = 0; + osmo_stderr_target->print_filename = 0; + osmo_stderr_target->print_category = 1; + test_oap_api(); printf("Done\n"); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err new file mode 100644 index 0000000..3272237 --- /dev/null +++ b/openbsc/tests/oap/oap_client_test.err @@ -0,0 +1,28 @@ +- make sure filling with zeros means uninitialized +- invalid client_id and shared secret +- reset state +- only client_id is invalid +- valid id, but omitted shared_secret (1/2) +DGPRS OAP: client ID set, but secret K missing. +- valid id, but omitted shared_secret (2/2) +DGPRS OAP: client ID set, but secret OPC missing. +- mint configuration +- Missing challenge data +DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +- AUTN missing +DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +- RAND missing +DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +- wrong autn (by one bit) +DGPRS OAP: AUTN mismatch! +DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 +DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +- all data correct +- but refuse to evaluate in uninitialized state +- now everything is correct +- Expect the challenge response in msg_tx +- Receive registration error for the first time. +DGPRS OAP registration failed +- Receive registration error for the Nth time. +DGPRS OAP registration failed +- Registration success diff --git a/openbsc/tests/oap/oap_client_test.ok b/openbsc/tests/oap/oap_client_test.ok index 2e9ecf0..59108a7 100644 --- a/openbsc/tests/oap/oap_client_test.ok +++ b/openbsc/tests/oap/oap_client_test.ok @@ -1,7 +1,2 @@ Testing OAP API - - Config parsing - - AUTN failures - - AUTN success - - Registration failure - - Registration success Done diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index 0765c76..01737a3 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -108,7 +108,8 @@ AT_KEYWORDS([oap]) AT_CHECK([test "$enable_oap_test" != no || exit 77]) cat $abs_srcdir/oap/oap_client_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [ignore]) +cat $abs_srcdir/oap/oap_client_test.err > experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [experr]) AT_CLEANUP AT_SETUP([gtphub]) -- To view, visit https://gerrit.osmocom.org/1392 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:27 +0000 Subject: [PATCH] openbsc[master]: oap_client: move logging to DLOAP logging category Message-ID: Review at https://gerrit.osmocom.org/1393 oap_client: move logging to DLOAP logging category libosmocore since recently offers the DLOAP logging category for OAP. Use it. Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a --- M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 3 files changed, 28 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/93/1393/1 diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index d6a7043..db09630 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -37,12 +37,12 @@ goto disable; if (config->secret_k_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); goto disable; } if (config->secret_opc_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); goto disable; } @@ -100,16 +100,16 @@ osmo_auth_gen_vec(&vec, &auth, rx_random); if (vec.res_len != 8) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", vec.res_len); return -3; } if (osmo_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) { - LOGP(DGPRS, LOGL_ERROR, "OAP: AUTN mismatch!\n"); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN from server: %s\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: AUTN mismatch!\n"); + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN from server: %s\n", osmo_hexdump_nospc(rx_autn, sizeof(vec.autn))); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN expected: %s\n", + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN expected: %s\n", osmo_hexdump_nospc(vec.autn, sizeof(vec.autn))); return -2; } @@ -134,7 +134,7 @@ struct osmo_oap_message oap_msg = {0}; if (client_id < 1) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); + LOGP(DLOAP, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); return NULL; } @@ -174,7 +174,7 @@ uint8_t xres[8]; if (!(oap_rx->rand_present && oap_rx->autn_present)) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n", oap_rx->rand_present, oap_rx->autn_present); rc = -2; @@ -217,7 +217,7 @@ rc = osmo_oap_decode(&oap_msg, data, data_len); if (rc < 0) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Decoding OAP message failed with error '%s' (%d)\n", get_value_string(gsm48_gmm_cause_names, -rc), -rc); return -10; @@ -233,7 +233,7 @@ break; case OAP_MSGT_REGISTER_ERROR: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP registration failed\n"); state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { @@ -244,13 +244,13 @@ case OAP_MSGT_REGISTER_REQUEST: case OAP_MSGT_CHALLENGE_RESULT: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Received invalid OAP message type for OAP client side: %d\n", (int)oap_msg.message_type); return -12; default: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Unknown OAP message type: %d\n", (int)oap_msg.message_type); return -13; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index b966c41..8ae92bb 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -213,17 +213,17 @@ msgb_free(msg_rx); } -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", +static struct log_info_cat oap_client_test_categories[] = { + [DLOAP] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", .enabled = 1, .loglevel = LOGL_DEBUG, }, }; static struct log_info info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), + .cat = oap_client_test_categories, + .num_cat = ARRAY_SIZE(oap_client_test_categories), }; int main(int argc, char **argv) diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 3272237..248808e 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -3,26 +3,26 @@ - reset state - only client_id is invalid - valid id, but omitted shared_secret (1/2) -DGPRS OAP: client ID set, but secret K missing. +DLOAP OAP: client ID set, but secret K missing. - valid id, but omitted shared_secret (2/2) -DGPRS OAP: client ID set, but secret OPC missing. +DLOAP OAP: client ID set, but secret OPC missing. - mint configuration - Missing challenge data -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 0) - AUTN missing -DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 1, autn_present: 0) - RAND missing -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 1) - wrong autn (by one bit) -DGPRS OAP: AUTN mismatch! -DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 -DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN mismatch! +DLOAP OAP: AUTN from server: dec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN expected: cec4e3848a33000086781158ca40f136 - all data correct - but refuse to evaluate in uninitialized state - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Receive registration error for the Nth time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Registration success -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:27 +0000 Subject: [PATCH] openbsc[master]: oap_client_test: show bug: disabled state does not reject me... Message-ID: Review at https://gerrit.osmocom.org/1394 oap_client_test: show bug: disabled state does not reject message There is a hole in OAP where a disabled OAP still accepts at least a Registration Reject message, after which it will do things it shouldn't. Show this by expecting the bugs, to be adjusted with the upcoming fix. Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 --- M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 2 files changed, 41 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/94/1394/1 diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 8ae92bb..d847f15 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -37,6 +37,12 @@ struct osmo_oap_client_state _state; struct osmo_oap_client_state *state = &_state; + struct osmo_oap_message oap_rx; + struct msgb *msg_rx; + + struct osmo_oap_message oap_tx; + struct msgb *msg_tx; + memset(config, 0, sizeof(*config)); memset(state, 0, sizeof(*state)); @@ -46,7 +52,38 @@ fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); + fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n"); + memset(&oap_rx, 0, sizeof(oap_rx)); + state->client_id = 1; + oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; + msg_rx = osmo_oap_client_encoded(&oap_rx); + /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP + * happily accepts this message and breaks the uninitialized state. The + * expected rc, state and msg_tx will be fixed along with the fix. */ + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); + OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */); + msgb_free(msg_rx); + OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); + msgb_free(msg_tx); + + fprintf(stderr, "- reject messages in disabled state\n"); + memset(state, 0, sizeof(*state)); + memset(&oap_rx, 0, sizeof(oap_rx)); + state->state = OAP_DISABLED; + state->client_id = 1; + oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; + msg_rx = osmo_oap_client_encoded(&oap_rx); + /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP + * happily accepts this message and breaks the uninitialized state. The + * expected rc, state and msg_tx will be fixed along with the fix. */ + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); + OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */); + msgb_free(msg_rx); + OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); + msgb_free(msg_tx); + fprintf(stderr, "- invalid client_id and shared secret\n"); + memset(state, 0, sizeof(*state)); config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; @@ -92,10 +129,6 @@ OSMO_ASSERT( osmo_oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); - struct osmo_oap_message oap_rx; - struct osmo_oap_message oap_tx; - struct msgb *msg_rx; - struct msgb *msg_tx; fprintf(stderr, "- Missing challenge data\n"); memset(&oap_rx, 0, sizeof(oap_rx)); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 248808e..9e52357 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,4 +1,8 @@ - make sure filling with zeros means uninitialized +- reject messages in uninitialized state EXPECTING BUGS +DLOAP OAP registration failed +- reject messages in disabled state +DLOAP OAP registration failed - invalid client_id and shared secret - reset state - only client_id is invalid -- To view, visit https://gerrit.osmocom.org/1394 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:27 +0000 Subject: [PATCH] openbsc[master]: oap_client: reject all messages in disabled/uninitialized state Message-ID: Review at https://gerrit.osmocom.org/1395 oap_client: reject all messages in disabled/uninitialized state Fixes the bug indicated in oap_client_test.c: adjust to actually expect the proper behavior. Also adjust for modified return value for message rejection. Instead of -1, just expect < 0. Adjust experr for new error messages. Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 --- M openbsc/src/libcommon/gsup_client.c M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 4 files changed, 31 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/95/1395/1 diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c index 5b05a95..398bfa8 100644 --- a/openbsc/src/libcommon/gsup_client.c +++ b/openbsc/src/libcommon/gsup_client.c @@ -154,6 +154,7 @@ int rc; struct msgb *msg_tx; + /* If the oap_state is disabled, this will reject the messages. */ rc = osmo_oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index db09630..d9688b5 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -223,6 +224,21 @@ return -10; } + switch (state->state) { + case OAP_UNINITIALIZED: + LOGP(DLOAP, LOGL_ERROR, + "Received OAP message %d, but the OAP client is" + " not initialized\n", oap_msg.message_type); + return -ENOTCONN; + case OAP_DISABLED: + LOGP(DLOAP, LOGL_ERROR, + "Received OAP message %d, but the OAP client is" + " disabled\n", oap_msg.message_type); + return -ENOTCONN; + default: + break; + } + switch (oap_msg.message_type) { case OAP_MSGT_CHALLENGE_REQUEST: return handle_challenge(state, &oap_msg, msg_tx); diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index d847f15..d83e6f8 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -52,19 +52,15 @@ fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); - fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n"); + fprintf(stderr, "- reject messages in uninitialized state\n"); memset(&oap_rx, 0, sizeof(oap_rx)); state->client_id = 1; oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; msg_rx = osmo_oap_client_encoded(&oap_rx); - /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP - * happily accepts this message and breaks the uninitialized state. The - * expected rc, state and msg_tx will be fixed along with the fix. */ - OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); - OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) < 0); + OSMO_ASSERT(state->state == OAP_UNINITIALIZED); msgb_free(msg_rx); - OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); - msgb_free(msg_tx); + OSMO_ASSERT(!msg_tx); fprintf(stderr, "- reject messages in disabled state\n"); memset(state, 0, sizeof(*state)); @@ -73,14 +69,10 @@ state->client_id = 1; oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; msg_rx = osmo_oap_client_encoded(&oap_rx); - /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP - * happily accepts this message and breaks the uninitialized state. The - * expected rc, state and msg_tx will be fixed along with the fix. */ - OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); - OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) < 0); + OSMO_ASSERT(state->state == OAP_DISABLED); msgb_free(msg_rx); - OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); - msgb_free(msg_tx); + OSMO_ASSERT(!msg_tx); fprintf(stderr, "- invalid client_id and shared secret\n"); memset(state, 0, sizeof(*state)); @@ -180,11 +172,11 @@ OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; - OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) < 0); OSMO_ASSERT(!msg_tx); state->state = OAP_DISABLED; - OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(osmo_oap_client_handle(state, msg_rx, &msg_tx) < 0); OSMO_ASSERT(!msg_tx); state->state = OAP_INITIALIZED; diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 9e52357..8c538dc 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,8 +1,8 @@ - make sure filling with zeros means uninitialized -- reject messages in uninitialized state EXPECTING BUGS -DLOAP OAP registration failed +- reject messages in uninitialized state +DLOAP Received OAP message 5, but the OAP client is not initialized - reject messages in disabled state -DLOAP OAP registration failed +DLOAP Received OAP message 5, but the OAP client is disabled - invalid client_id and shared secret - reset state - only client_id is invalid @@ -23,6 +23,8 @@ DLOAP OAP: AUTN expected: cec4e3848a33000086781158ca40f136 - all data correct - but refuse to evaluate in uninitialized state +DLOAP Received OAP message 8, but the OAP client is not initialized +DLOAP Received OAP message 8, but the OAP client is disabled - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -- To view, visit https://gerrit.osmocom.org/1395 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 00:38:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 00:38:27 +0000 Subject: [PATCH] openbsc[master]: oap_client: make use of OAP optional: disable for NULL config Message-ID: Review at https://gerrit.osmocom.org/1396 oap_client: make use of OAP optional: disable for NULL config When passing a NULL config to osmo_oap_client_init(), set OAP to disabled state. Along with the previous fix that ensures message rejection in the disabled state, this makes use of OAP in the GSUP client optional. oap_client_test: expect null config to set state to disabled. Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 --- M openbsc/src/libcommon/gsup_client.c M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 4 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/96/1396/1 diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c index 398bfa8..d25ecf3 100644 --- a/openbsc/src/libcommon/gsup_client.c +++ b/openbsc/src/libcommon/gsup_client.c @@ -275,6 +275,7 @@ gsupc = talloc_zero(tall_bsc_ctx, struct osmo_gsup_client); OSMO_ASSERT(gsupc); + /* a NULL oap_config will mark oap_state disabled. */ rc = osmo_oap_client_init(oap_config, &gsupc->oap_state); if (rc != 0) goto failed; diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index d9688b5..a050ccb 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -34,6 +34,9 @@ { OSMO_ASSERT(state->state == OAP_UNINITIALIZED); + if (!config) + goto disable; + if (config->client_id == 0) goto disable; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index d83e6f8..f65721e 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -62,6 +62,10 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); + fprintf(stderr, "- NULL config should disable\n"); + OSMO_ASSERT( osmo_oap_client_init(NULL, state) == 0 ); + OSMO_ASSERT(state->state == OAP_DISABLED); + fprintf(stderr, "- reject messages in disabled state\n"); memset(state, 0, sizeof(*state)); memset(&oap_rx, 0, sizeof(oap_rx)); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 8c538dc..62ddc9e 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,6 +1,7 @@ - make sure filling with zeros means uninitialized - reject messages in uninitialized state DLOAP Received OAP message 5, but the OAP client is not initialized +- NULL config should disable - reject messages in disabled state DLOAP Received OAP message 5, but the OAP client is disabled - invalid client_id and shared secret -- To view, visit https://gerrit.osmocom.org/1396 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 01:07:44 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 01:07:44 +0000 Subject: openbsc[master]: move OAP messages implementations to libosmocore In-Reply-To: References: Message-ID: Patch Set 1: build failure: this needs https://gerrit.osmocom.org/1375 in libosmocore -- To view, visit https://gerrit.osmocom.org/1381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf 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 Dec 9 01:42:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 01:42:41 +0000 Subject: [PATCH] openbsc[master]: lchan release in error state: SACCH deact only for SACCH pchans Message-ID: Review at https://gerrit.osmocom.org/1397 lchan release in error state: SACCH deact only for SACCH pchans Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libcommon/gsm_data_shared.c 3 files changed, 17 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/97/1397/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4ec4f69..9407b82 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -891,6 +891,7 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, int *rc); +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); bool ts_is_tch(struct gsm_bts_trx_ts *ts); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index b7f7a75..2c016a6 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -898,9 +898,23 @@ */ static int rsl_rf_chan_release_err(struct gsm_lchan *lchan) { + enum sacch_deact sacch_deact; if (lchan->state != LCHAN_S_ACTIVE) return 0; - return rsl_rf_chan_release(lchan, 1, SACCH_DEACTIVATE); + switch (ts_pchan(lchan->ts)) { + case GSM_PCHAN_TCH_F: + case GSM_PCHAN_TCH_H: + case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: + case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: + sacch_deact = SACCH_DEACTIVATE; + break; + default: + sacch_deact = SACCH_NONE; + break; + } + return rsl_rf_chan_release(lchan, 1, sacch_deact); } static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan) diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index df204fe..387af70 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -729,7 +729,7 @@ }; /*! Return the actual pchan type, also heeding dynamic TS. */ -static enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) { switch (ts->pchan) { case GSM_PCHAN_TCH_F_TCH_H_PDCH: -- To view, visit https://gerrit.osmocom.org/1397 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 01:43:56 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 01:43:56 +0000 Subject: openbsc[master]: lchan release in error state: SACCH deact only for SACCH pchans In-Reply-To: References: Message-ID: Patch Set 1: Just found this old patch in my git. I dimly remember that it makes sense. Does it? -- To view, visit https://gerrit.osmocom.org/1397 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 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 Dec 9 07:20:32 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Fri, 9 Dec 2016 07:20:32 +0000 Subject: [PATCH] openbsc[master]: Support Deactivate PDP Context Request from network 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/1262 to look at the new patch set (#4). Support Deactivate PDP Context Request from network Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 180 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/62/1262/4 diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 24e286c..b3f250d 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,6 +369,8 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); +void drop_gmm_ctx_for_ms(const char *imsi); + char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..f66d6cc 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,6 +667,44 @@ } } +/* + * High-level function to be called for PDP deactivation initiated from SGSN VTY. + * When there are PDP contexts present for a MM context, PDP context will be + * deactivated along with GMM Detach(MM context deletion). + * If there are no PDP present, MM context will be deleted to avoid further + * PDP context activation for that MS. + */ +void drop_gmm_ctx_for_ms(const char *imsi) +{ + OSMO_ASSERT(imsi != NULL); + struct sgsn_mm_ctx *mm; + struct sgsn_pdp_ctx *pdp; + + LOGP(DGPRS, LOGL_INFO, "SGSN intiated Deactivate PDP for IMSI: %s\n", + imsi); + /* Search the MM context subscriber */ + mm = sgsn_mm_ctx_by_imsi(imsi); + if (mm) { + /* Search the PDP for this subscriber */ + if (llist_empty(&mm->pdp_list)) { + /* + * Deleting mm context for the subscriber when no PDP + * context is present. + */ + gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); + LOGP(DGPRS, LOGL_NOTICE, "No pdp context for this IMSI: %s\n", + imsi); + } else { + llist_for_each_entry(pdp, &mm->pdp_list, list) { + gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); + LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " + "Successful\n"); + } + } + } else + LOGP(DGPRS, LOGL_NOTICE, "No MM context for this IMSI: %s\n", imsi); +} + /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 789817c..51deb2e 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,14 +38,17 @@ #include #include +#include void *tall_bsc_ctx; +struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, + .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2363,6 +2366,138 @@ cleanup_test(); } +static void test_pdp_deactivation_with_pdp_ctx(void) +{ + struct apn_ctx *actxs[4]; + struct sgsn_ggsn_ctx *ggc, *ggcs[3]; + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + enum gsm48_gsm_cause gsm_cause; + struct tlv_parsed tp; + uint8_t apn_enc[GSM_APN_LENGTH + 10]; + struct sgsn_subscriber_pdp_data *pdp_data; + char apn_str[GSM_APN_LENGTH]; + + printf("Testing Pdp deactivation for MS with pdp ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + struct sgsn_pdp_ctx *pdp; + + tp.lv[GSM48_IE_GSM_APN].len = 0; + tp.lv[GSM48_IE_GSM_APN].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; + tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; + + ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); + + actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); + actxs[0]->ggsn = ggcs[0]; + + pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); + pdp_data->context_id = 1; + pdp_data->pdp_type = 0x0121; + strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); + + /* Resolve GGSNs */ + tp.lv[GSM48_IE_GSM_APN].len = + gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); + + ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); + + OSMO_ASSERT(ggc != NULL); + OSMO_ASSERT(ggc->id == 0); + + ggc = sgsn_ggsn_ctx_alloc(ggc->id); + /* Create a pdp context */ + pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + gsm48_tx_gsm_deact_pdp_acc(pdp); + gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); + + /* Cleanup */ + + subscr_put(s1); + + sgsn_apn_ctx_free(actxs[0]); + sgsn_ggsn_ctx_free(ggcs[0]); + sgsn_ggsn_ctx_free(ggc); + talloc_free(pdp); + + cleanup_test(); +} + +static void test_pdp_deactivation_with_only_mm_ctx(void) +{ + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + + printf("Testing Pdp deactivation for MS with only MM ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation_without_mm_ctx(void) +{ + const char *imsi1 = "1234567890"; + + printf("Testing Pdp deactivation for MS without MM ctx\n"); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation(void) +{ + printf("Testing pdp deactivation\n"); + + test_pdp_deactivation_with_pdp_ctx(); + test_pdp_deactivation_without_mm_ctx(); + test_pdp_deactivation_with_only_mm_ctx(); +} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2454,6 +2589,7 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); + test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c7a53b9..c36b643 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,4 +34,8 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection +Testing pdp deactivation +Testing Pdp deactivation for MS with pdp ctx +Testing Pdp deactivation for MS without MM ctx +Testing Pdp deactivation for MS with only MM ctx Done -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 07:29:03 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Fri, 9 Dec 2016 07:29:03 +0000 Subject: [PATCH] openbsc[master]: Trigger Deactivate PDP context Request from SGSN VTY 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/1263 to look at the new patch set (#2). Trigger Deactivate PDP context Request from SGSN VTY In SGSN for acl based authorization IMSI values of all registered MS are maintained. Through imsi_acl_del Deactivate PDP context Request from network can be triggered. Hence, It will remove all PDP context related to that MS. Change-Id: Ide0cd4af828b753d24d2e507967d1c2e652ee05e --- M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/sgsn_vty.c 2 files changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/63/1263/2 diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 363b457..77f94f8 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -2535,6 +2535,8 @@ break; case GSM48_MT_GSM_DEACT_PDP_ACK: rc = gsm48_rx_gsm_deact_pdp_ack(mmctx, msg); + if (sgsn_auth_state(mmctx) != SGSN_AUTH_ACCEPTED) + gsm0408_gprs_access_cancelled(mmctx, GMM_CAUSE_GPRS_NOTALLOWED); break; case GSM48_MT_GSM_STATUS: rc = gsm48_rx_gsm_status(mmctx, msg); diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 1b477e5..e58d9bc 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -573,9 +573,11 @@ if (!strcmp(op, "add")) rc = sgsn_acl_add(imsi, g_cfg); - else + else { + vty_out(vty, "%% Network initiated PDP deactivate%s", VTY_NEWLINE); + drop_gmm_ctx_for_ms(imsi); rc = sgsn_acl_del(imsi, g_cfg); - + } if (rc < 0) { vty_out(vty, "%% unable to %s ACL%s", op, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/1263 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ide0cd4af828b753d24d2e507967d1c2e652ee05e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:27:14 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 9 Dec 2016 10:27:14 +0000 Subject: libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Patch Set 1: See my comment to OS#1837. -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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 Fri Dec 9 10:43:42 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 9 Dec 2016 10:43:42 +0000 Subject: [PATCH] osmo-pcu[master]: Sanitizer build fix for TbfTest Message-ID: Review at https://gerrit.osmocom.org/1398 Sanitizer build fix for TbfTest Change-Id: Ia6993fd6f89c9d9ed00ec6cb4b27953e72fa1f52 --- M tests/tbf/TbfTest.cpp 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/98/1398/1 diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 213bd12..bebb6ef 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -2124,6 +2124,8 @@ gprs_rlc_v_b *prlcmvb; gprs_rlc_dl_window *prlcdlwindow; + memset(&ul_control_block, 0, sizeof(RlcMacUplink_t)); + printf("=== start %s ===\n", __func__); bts = the_bts.bts_data(); -- To view, visit https://gerrit.osmocom.org/1398 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia6993fd6f89c9d9ed00ec6cb4b27953e72fa1f52 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:48:10 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 9 Dec 2016 10:48:10 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Verified+1 -- To view, visit https://gerrit.osmocom.org/1398 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia6993fd6f89c9d9ed00ec6cb4b27953e72fa1f52 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:49:41 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 9 Dec 2016 10:49:41 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 (2 comments) https://gerrit.osmocom.org/#/c/1398/1/tests/tbf/TbfTest.cpp File tests/tbf/TbfTest.cpp: Line 2123: RlcMacUplink_t ul_control_block; = { 0, }; could work above as well. PS1, Line 2127: _ I would prefer to use sizeof(ul_control_block) to protect against changes of the type. -- To view, visit https://gerrit.osmocom.org/1398 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia6993fd6f89c9d9ed00ec6cb4b27953e72fa1f52 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:50:15 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 9 Dec 2016 10:50:15 +0000 Subject: [MERGED] osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: arvind.sirsikar has submitted this change and it was merged. Change subject: Sanitizer build fix for TbfTest ...................................................................... Sanitizer build fix for TbfTest Change-Id: Ia6993fd6f89c9d9ed00ec6cb4b27953e72fa1f52 --- M tests/tbf/TbfTest.cpp 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: arvind.sirsikar: Looks good to me, but someone else must approve; Verified Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 213bd12..bebb6ef 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -2124,6 +2124,8 @@ gprs_rlc_v_b *prlcmvb; gprs_rlc_dl_window *prlcdlwindow; + memset(&ul_control_block, 0, sizeof(RlcMacUplink_t)); + printf("=== start %s ===\n", __func__); bts = the_bts.bts_data(); -- To view, visit https://gerrit.osmocom.org/1398 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia6993fd6f89c9d9ed00ec6cb4b27953e72fa1f52 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:58:27 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 9 Dec 2016 10:58:27 +0000 Subject: libosmocore[master]: cosmetic: gsup: remove copyright from header, tweak 'sysmoco... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (2 comments) * We can try to claim copyright for the header file but most likely it is void any way. * The AGPL for libgsm is an issue. @laforge: Shall this be relicensed? I assume sysmocom is willing to change it to GPL and you will relicense your contribution as well? https://gerrit.osmocom.org/#/c/1376/1/include/osmocom/gsm/gsup.h File include/osmocom/gsm/gsup.h: Line 1 I find these short summaries useful when reading code. Line 3 As copyright is transferred it is a way to give credit. -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:58:46 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 9 Dec 2016 10:58:46 +0000 Subject: libosmocore[master]: cosmetic: gsup.c comments: write 'Generic' for the G in GSUP In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1377 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 10:59:45 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 9 Dec 2016 10:59:45 +0000 Subject: [PATCH] libosmocore[master]: wqueue: Reject messges if queue is considered full 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/1243 to look at the new patch set (#2). wqueue: Reject messges if queue is considered full The write queue was always meant to not queue more than the max_length messages but the implementation never rejected a message. Begin to log and enforce the queue size limit, add a testcase to verify the code and initialize except_cb as part of a fix for that new test case. Real applications might now run into the queue limit and drop messages where they just queued them before. It is unfortunate but I still think it is good to implement the routine as it was intended. We need to review osmo_wqueue_enqueue once more to see that no msgb is leaked. Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae --- M .gitignore M src/write_queue.c M tests/Makefile.am M tests/testsuite.at A tests/write_queue/wqueue_test.c A tests/write_queue/wqueue_test.ok 6 files changed, 103 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/43/1243/2 diff --git a/.gitignore b/.gitignore index 90c8c85..50209b0 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,7 @@ tests/gsup/gsup_test tests/tlv/tlv_test tests/fsm/fsm_test +tests/write_queue/wqueue_test utils/osmo-arfcn utils/osmo-auc-gen diff --git a/src/write_queue.c b/src/write_queue.c index 3e488ae..c7a4320 100644 --- a/src/write_queue.c +++ b/src/write_queue.c @@ -1,6 +1,6 @@ /* Generic write queue implementation */ /* - * (C) 2010 by Holger Hans Peter Freyther + * (C) 2010-2016 by Holger Hans Peter Freyther * (C) 2010 by On-Waves * * All Rights Reserved @@ -23,6 +23,7 @@ #include #include +#include /*! \addtogroup write_queue * @{ @@ -93,6 +94,7 @@ queue->current_length = 0; queue->read_cb = NULL; queue->write_cb = NULL; + queue->except_cb = NULL; queue->bfd.cb = osmo_wqueue_bfd_cb; INIT_LLIST_HEAD(&queue->msg_queue); } @@ -104,8 +106,11 @@ */ int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data) { -// if (queue->current_length + 1 >= queue->max_length) -// LOGP(DMSC, LOGL_ERROR, "The queue is full. Dropping not yet implemented.\n"); + if (queue->current_length >= queue->max_length) { + LOGP(DLGLOBAL, LOGL_ERROR, + "wqueue(%p) is full. Rejecting msgb\n", queue); + return -ENOSPC; + } ++queue->current_length; msgb_enqueue(&queue->msg_queue, data); diff --git a/tests/Makefile.am b/tests/Makefile.am index f5d095d..1aad2e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,8 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test + tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + write_queue/wqueue_test if ENABLE_MSGFILE check_PROGRAMS += msgfile/msgfile_test @@ -133,6 +134,9 @@ fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la +write_queue_wqueue_test_SOURCES = write_queue/wqueue_test.c +write_queue_wqueue_test_LDADD = $(top_builddir)/src/libosmocore.la + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -168,7 +172,7 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err + fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/testsuite.at b/tests/testsuite.at index 77038bc..c01f4af 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -177,6 +177,12 @@ AT_CHECK([$abs_top_builddir/tests/stats/stats_test], [0], [expout], [ignore]) AT_CLEANUP +AT_SETUP([write_queue]) +AT_KEYWORDS([write_queue]) +cat $abs_srcdir/write_queue/wqueue_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/write_queue/wqueue_test], [0], [expout], [ignore]) +AT_CLEANUP + AT_SETUP([bssgp-fc]) AT_KEYWORDS([bssgp-fc]) cat $abs_srcdir/gb/bssgp_fc_tests.ok > expout diff --git a/tests/write_queue/wqueue_test.c b/tests/write_queue/wqueue_test.c new file mode 100644 index 0000000..827e4e8 --- /dev/null +++ b/tests/write_queue/wqueue_test.c @@ -0,0 +1,81 @@ +#include +#include +#include + +static const struct log_info_cat default_categories[] = { +}; + +static const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +static void test_wqueue_limit(void) +{ + struct msgb *msg; + struct osmo_wqueue wqueue; + int rc; + + osmo_wqueue_init(&wqueue, 0); + OSMO_ASSERT(wqueue.max_length == 0); + OSMO_ASSERT(wqueue.current_length == 0); + OSMO_ASSERT(wqueue.read_cb == NULL); + OSMO_ASSERT(wqueue.write_cb == NULL); + OSMO_ASSERT(wqueue.except_cb == NULL); + + /* try to add and fail */ + msg = msgb_alloc(4096, "msg1"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc < 0); + + /* add one and fail on the second */ + wqueue.max_length = 1; + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 1); + msg = msgb_alloc(4096, "msg2"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc < 0); + + /* add one more */ + wqueue.max_length = 2; + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 2); + + /* release everything */ + osmo_wqueue_clear(&wqueue); + OSMO_ASSERT(wqueue.current_length == 0); + OSMO_ASSERT(wqueue.max_length == 2); + + /* Add two, fail on the third, free it and the queue */ + msg = msgb_alloc(4096, "msg3"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 1); + msg = msgb_alloc(4096, "msg4"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 2); + msg = msgb_alloc(4096, "msg5"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc < 0); + OSMO_ASSERT(wqueue.current_length == 2); + msgb_free(msg); + osmo_wqueue_clear(&wqueue); +} + +int main(int argc, char **argv) +{ + struct log_target *stderr_target; + + log_init(&log_info, NULL); + stderr_target = log_target_create_stderr(); + log_add_target(stderr_target); + log_set_print_filename(stderr_target, 0); + + test_wqueue_limit(); + + printf("Done\n"); + return 0; +} diff --git a/tests/write_queue/wqueue_test.ok b/tests/write_queue/wqueue_test.ok new file mode 100644 index 0000000..a965a70 --- /dev/null +++ b/tests/write_queue/wqueue_test.ok @@ -0,0 +1 @@ +Done -- To view, visit https://gerrit.osmocom.org/1243 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:23:29 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:23:29 +0000 Subject: libosmocore[master]: cosmetic: gsup: remove copyright from header, tweak 'sysmoco... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) > (2 comments) > > * We can try to claim copyright for the header file but most likely > it is void any way. > * The AGPL for libgsm is an issue. > > @laforge: Shall this be relicensed? I assume sysmocom is willing to > change it to GPL and you will relicense your contribution as well? Yes, I have no issue with the AGPLv3 -> GPLv2-or-later re-licensing of this header file and the gsup.c code, both as managing director of sysmocom and for my personal contributions. https://gerrit.osmocom.org/#/c/1376/1/include/osmocom/gsm/gsup.h File include/osmocom/gsm/gsup.h: Line 1 > I find these short summaries useful when reading code. I too. I think I generally put this first line in every file in the OpenBSC project. Always as separate line to the copright/license comment. -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:26:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:26:32 +0000 Subject: libosmocore[master]: wqueue: Reject messges if queue is considered full In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1243 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther 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 Fri Dec 9 11:26:38 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:26:38 +0000 Subject: [MERGED] libosmocore[master]: wqueue: Reject messges if queue is considered full In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: wqueue: Reject messges if queue is considered full ...................................................................... wqueue: Reject messges if queue is considered full The write queue was always meant to not queue more than the max_length messages but the implementation never rejected a message. Begin to log and enforce the queue size limit, add a testcase to verify the code and initialize except_cb as part of a fix for that new test case. Real applications might now run into the queue limit and drop messages where they just queued them before. It is unfortunate but I still think it is good to implement the routine as it was intended. We need to review osmo_wqueue_enqueue once more to see that no msgb is leaked. Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae --- M .gitignore M src/write_queue.c M tests/Makefile.am M tests/testsuite.at A tests/write_queue/wqueue_test.c A tests/write_queue/wqueue_test.ok 6 files changed, 103 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitignore b/.gitignore index 90c8c85..50209b0 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,7 @@ tests/gsup/gsup_test tests/tlv/tlv_test tests/fsm/fsm_test +tests/write_queue/wqueue_test utils/osmo-arfcn utils/osmo-auc-gen diff --git a/src/write_queue.c b/src/write_queue.c index 3e488ae..c7a4320 100644 --- a/src/write_queue.c +++ b/src/write_queue.c @@ -1,6 +1,6 @@ /* Generic write queue implementation */ /* - * (C) 2010 by Holger Hans Peter Freyther + * (C) 2010-2016 by Holger Hans Peter Freyther * (C) 2010 by On-Waves * * All Rights Reserved @@ -23,6 +23,7 @@ #include #include +#include /*! \addtogroup write_queue * @{ @@ -93,6 +94,7 @@ queue->current_length = 0; queue->read_cb = NULL; queue->write_cb = NULL; + queue->except_cb = NULL; queue->bfd.cb = osmo_wqueue_bfd_cb; INIT_LLIST_HEAD(&queue->msg_queue); } @@ -104,8 +106,11 @@ */ int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data) { -// if (queue->current_length + 1 >= queue->max_length) -// LOGP(DMSC, LOGL_ERROR, "The queue is full. Dropping not yet implemented.\n"); + if (queue->current_length >= queue->max_length) { + LOGP(DLGLOBAL, LOGL_ERROR, + "wqueue(%p) is full. Rejecting msgb\n", queue); + return -ENOSPC; + } ++queue->current_length; msgb_enqueue(&queue->msg_queue, data); diff --git a/tests/Makefile.am b/tests/Makefile.am index f5d095d..1aad2e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,8 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test + tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + write_queue/wqueue_test if ENABLE_MSGFILE check_PROGRAMS += msgfile/msgfile_test @@ -133,6 +134,9 @@ fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la +write_queue_wqueue_test_SOURCES = write_queue/wqueue_test.c +write_queue_wqueue_test_LDADD = $(top_builddir)/src/libosmocore.la + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -168,7 +172,7 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err + fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/testsuite.at b/tests/testsuite.at index 77038bc..c01f4af 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -177,6 +177,12 @@ AT_CHECK([$abs_top_builddir/tests/stats/stats_test], [0], [expout], [ignore]) AT_CLEANUP +AT_SETUP([write_queue]) +AT_KEYWORDS([write_queue]) +cat $abs_srcdir/write_queue/wqueue_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/write_queue/wqueue_test], [0], [expout], [ignore]) +AT_CLEANUP + AT_SETUP([bssgp-fc]) AT_KEYWORDS([bssgp-fc]) cat $abs_srcdir/gb/bssgp_fc_tests.ok > expout diff --git a/tests/write_queue/wqueue_test.c b/tests/write_queue/wqueue_test.c new file mode 100644 index 0000000..827e4e8 --- /dev/null +++ b/tests/write_queue/wqueue_test.c @@ -0,0 +1,81 @@ +#include +#include +#include + +static const struct log_info_cat default_categories[] = { +}; + +static const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +static void test_wqueue_limit(void) +{ + struct msgb *msg; + struct osmo_wqueue wqueue; + int rc; + + osmo_wqueue_init(&wqueue, 0); + OSMO_ASSERT(wqueue.max_length == 0); + OSMO_ASSERT(wqueue.current_length == 0); + OSMO_ASSERT(wqueue.read_cb == NULL); + OSMO_ASSERT(wqueue.write_cb == NULL); + OSMO_ASSERT(wqueue.except_cb == NULL); + + /* try to add and fail */ + msg = msgb_alloc(4096, "msg1"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc < 0); + + /* add one and fail on the second */ + wqueue.max_length = 1; + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 1); + msg = msgb_alloc(4096, "msg2"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc < 0); + + /* add one more */ + wqueue.max_length = 2; + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 2); + + /* release everything */ + osmo_wqueue_clear(&wqueue); + OSMO_ASSERT(wqueue.current_length == 0); + OSMO_ASSERT(wqueue.max_length == 2); + + /* Add two, fail on the third, free it and the queue */ + msg = msgb_alloc(4096, "msg3"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 1); + msg = msgb_alloc(4096, "msg4"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc == 0); + OSMO_ASSERT(wqueue.current_length == 2); + msg = msgb_alloc(4096, "msg5"); + rc = osmo_wqueue_enqueue(&wqueue, msg); + OSMO_ASSERT(rc < 0); + OSMO_ASSERT(wqueue.current_length == 2); + msgb_free(msg); + osmo_wqueue_clear(&wqueue); +} + +int main(int argc, char **argv) +{ + struct log_target *stderr_target; + + log_init(&log_info, NULL); + stderr_target = log_target_create_stderr(); + log_add_target(stderr_target); + log_set_print_filename(stderr_target, 0); + + test_wqueue_limit(); + + printf("Done\n"); + return 0; +} diff --git a/tests/write_queue/wqueue_test.ok b/tests/write_queue/wqueue_test.ok new file mode 100644 index 0000000..a965a70 --- /dev/null +++ b/tests/write_queue/wqueue_test.ok @@ -0,0 +1 @@ +Done -- To view, visit https://gerrit.osmocom.org/1243 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Holger Freyther Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:29:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:29:04 +0000 Subject: libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:29:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:29:07 +0000 Subject: [MERGED] libosmocore[master]: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs ...................................................................... contrib: add fsm-to-dot.py to draw osmo_fsm dotty graphs Add a first version of a python script that tries to analyze .c source files to draw graphs of osmo_fsm implementations. So far it uses quick-and-dirty regexes. Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 --- A contrib/fsm-to-dot.py 1 file changed, 710 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/contrib/fsm-to-dot.py b/contrib/fsm-to-dot.py new file mode 100755 index 0000000..3549d1e --- /dev/null +++ b/contrib/fsm-to-dot.py @@ -0,0 +1,710 @@ +#!/usr/bin/env python + +__doc__ = ''' +fsm-to-dot: convert FSM definitons to graph images + +Usage: + ./fsm-to-dot.py ~/openbsc/openbsc/src/libvlr/*.c + for f in *.dot ; do dot -Tpng $f > $f.png; done + # dot comes from 'apt-get install graphviz' + +Looks for osmo_fsm finite state machine definitions and madly parses .c files +to draw graphs of them. This uses wild regexes that rely on coding style etc.. +No proper C parsing is done here (pycparser sucked, unfortunately). +''' + +import sys, re + +def err(msg): + sys.stderr.write(msg + '\n') + +class listdict(object): + def __getattr__(ld, name): + if name == 'add': + return ld.__getattribute__(name) + return ld.__dict__.__getattribute__(name) + + def _have(ld, name): + l = ld.__dict__.get(name) + if not l: + l = [] + ld.__dict__[name] = l + return l + + def add(ld, name, item): + l = ld._have(name) + l.append(item) + return ld + + def add_dict(ld, d): + for k,v in d.items(): + ld.add(k, v) + + def __setitem__(ld, name, val): + return ld.__dict__.__setitem__(name, val) + + def __getitem__(ld, name): + return ld.__dict__.__getitem__(name) + + def __str__(ld): + return ld.__dict__.__str__() + + def __repr__(ld): + return ld.__dict__.__repr__() + + def update(ld, other_ld): + for name, items in other_ld.items(): + ld.extend(name, items) + return ld + + def extend(ld, name, vals): + l = ld._have(name) + l.extend(vals) + return ld + +re_state_start = re.compile(r'\[([A-Z_][A-Z_0-9]*)\]') +re_event = re.compile(r'S\(([A-Z_][A-Z_0-9]*)\)') +re_action = re.compile(r'.action *= *([a-z_][a-z_0-9]*)') + +def state_starts(line): + m = re_state_start.search(line) + if m: + return m.group(1) + return None + +def in_event_starts(line): + return line.find('in_event_mask') >= 0 + +def out_state_starts(line): + return line.find('out_state_mask') >= 0 + +def states_or_events(line): + return re_event.findall(line) + +def parse_action(line): + a = re_action.findall(line) + if a: + return a[0] + return None + +def _common_prefix(a, b): + for l in reversed(range(1,len(a))): + aa = a[:l+1] + if b.startswith(aa): + return aa + return '' + +def common_prefix(strs): + if not strs: + return '' + p = None + for s in strs: + if p is None: + p = s + continue + p = _common_prefix(p, s) + if not p: + return '' + return p + +KIND_STATE = 'KIND_STATE' +KIND_FUNC = 'KIND_FUNC' +KIND_FSM = 'KIND_FSM' +BOX_SHAPES = { + KIND_STATE : None, + KIND_FUNC : 'box', + KIND_FSM : 'box3d', +} + +class Event: + def __init__(event, name): + event.name = name + event.short_name = name + + def __cmp__(event, other): + return cmp(event.name, other.name) + +class Edge: + def __init__(edge, to_state, event_name=None, style=None, action=None): + edge.to_state = to_state + edge.style = style + edge.events = [] + edge.actions = [] + edge.add_event_name(event_name) + edge.add_action(action) + + def add_event_name(edge, event_name): + if not event_name: + return + edge.add_event(Event(event_name)) + + def add_event(edge, event): + if not event: + return + if event in edge.events: + return + edge.events.append(event) + + def add_events(edge, events): + for event in events: + edge.add_event(event) + + def add_action(edge, action): + if not action or action in edge.actions: + return + edge.actions.append(action) + + def add_actions(edge, actions): + for action in actions: + edge.add_action(action) + + def event_names(edge): + return sorted([event.name for event in edge.events]) + + def event_labels(edge): + return sorted([event.short_name for event in edge.events]) + + def action_labels(edge): + return sorted([action + '()' for action in edge.actions]) + + def has_event_name(edge, event_name): + return event_name in edge.event_names() + +class State: + name = None + short_name = None + action = None + label = None + in_event_names = None + out_state_names = None + out_edges = None + kind = None + + def __init__(state): + state.in_event_names = [] + state.out_state_names = [] + state.out_edges = [] + state.kind = KIND_STATE + + def add_out_edge(state, edge): + for out_edge in state.out_edges: + if out_edge.to_state is edge.to_state: + if out_edge.style == edge.style: + out_edge.add_events(edge.events) + out_edge.add_actions(edge.actions) + return + # sanity + if out_edge.to_state.get_label() == edge.to_state.get_label(): + raise Exception('Two distinct states exist with identical labels.') + state.out_edges.append(edge) + + def get_label(state): + if state.label: + return state.label + l = [state.short_name] + if state.action: + if state.short_name == state.action: + l = [] + l.append(state.action + '()') + return r'\n'.join(l) + + def event_names(state): + event_names = [] + for out_edge in state.out_edges: + event_names.extend(out_edge.event_names()) + return event_names + + def shape_str(state): + shape = BOX_SHAPES.get(state.kind, None) + if not shape: + return '' + return ',shape=%s' % shape + + def __repr__(state): + return 'State(name=%r,short_name=%r,out=%d)' % (state.name, state.short_name, len(state.out_edges)) + +class Fsm: + def __init__(fsm, struct_name, states_struct_name, from_file=None): + fsm.states = [] + fsm.struct_name = struct_name + fsm.states_struct_name = states_struct_name + fsm.from_file = from_file + fsm.action_funcs = set() + fsm.event_names = set() + + def parse_states(fsm, src): + state = None + started = None + + IN_EVENTS = 'events' + OUT_STATES = 'states' + + lines = src.splitlines() + + for line in lines: + state_name = state_starts(line) + if state_name: + state = State() + fsm.states.append(state) + started = None + state.name = state_name + + if in_event_starts(line): + started = IN_EVENTS + if out_state_starts(line): + started = OUT_STATES + + if not state or not started: + continue + + tokens = states_or_events(line) + if started == IN_EVENTS: + state.in_event_names.extend(tokens) + elif started == OUT_STATES: + state.out_state_names.extend(tokens) + else: + err('ignoring: %r' % tokens) + + a = parse_action(line) + if a: + state.action = a + + + for state in fsm.states: + if state.action: + fsm.action_funcs.add(state.action) + if state.in_event_names: + fsm.event_names.update(state.in_event_names) + + fsm.make_states_short_names() + fsm.ref_out_states() + + def make_states_short_names(fsm): + p = common_prefix([s.name for s in fsm.states]) + for s in fsm.states: + s.short_name = s.name[len(p):] + return p + + def make_events_short_names(fsm): + p = common_prefix(fsm.event_names) + for state in fsm.states: + for edge in state.out_edges: + for event in edge.events: + event.short_name = event.name[len(p):] + + def ref_out_states(fsm): + for state in fsm.states: + for e in [Edge(fsm.find_state_by_name(n, True)) for n in state.out_state_names]: + state.add_out_edge(e) + + def find_state_by_name(fsm, name, strict=False): + for state in fsm.states: + if state.name == name: + return state + if strict: + raise Exception("State not found: %r" % name); + return None + + def find_state_by_action(fsm, action): + for state in fsm.states: + if state.action == action: + return state + return None + + def add_special_state(fsm, additional_states, name, in_state=None, + out_state=None, event_name=None, kind=KIND_FUNC, + state_action=None, label=None, edge_action=None): + additional_state = None + for s in additional_states: + if s.short_name == name: + additional_state = s + break; + + if not additional_state: + for s in fsm.states: + if s.short_name == name: + additional_state = s + break; + + if kind == KIND_FUNC and not state_action: + state_action = name + + if not additional_state: + additional_state = State() + additional_state.short_name = name + additional_state.action = state_action + additional_state.kind = kind + additional_state.label = label + additional_states.append(additional_state) + + if out_state: + additional_state.out_state_names.append(out_state.name) + additional_state.add_out_edge(Edge(out_state, event_name, 'dotted', + action=edge_action)) + + if in_state: + in_state.out_state_names.append(additional_state.name) + in_state.add_out_edge(Edge(additional_state, event_name, 'dotted', + action=edge_action)) + + + def find_event_edges(fsm, c_files): + # enrich state transitions between the states with event labels + func_to_state_transitions = listdict() + for c_file in c_files: + func_to_state_transitions.update( c_file.find_state_transitions(fsm.event_names) ) + + # edges between explicit states + for state in fsm.states: + transitions = func_to_state_transitions.get(state.action) + if not transitions: + continue + + for to_state_name, event_name in transitions: + if not event_name: + continue + for out_edge in state.out_edges: + if out_edge.to_state.name == to_state_name: + out_edge.add_event_name(event_name) + + additional_states = [] + + + # functions that aren't state actions but still effect state transitions + for func_name, transitions in func_to_state_transitions.items(): + if func_name in fsm.action_funcs: + continue + for to_state_name, event_name in transitions: + to_state = fsm.find_state_by_name(to_state_name) + if not to_state: + continue + fsm.add_special_state(additional_states, func_name, None, to_state, event_name) + + + event_sources = c_files.find_event_sources(fsm.event_names) + + for state in fsm.states: + + for in_event_name in state.in_event_names: + funcs_for_in_event = event_sources.get(in_event_name) + if not funcs_for_in_event: + continue + + found = False + for out_edge in state.out_edges: + if out_edge.has_event_name(in_event_name): + out_edge.action = r'\n'.join([(f + '()') for f in funcs_for_in_event + if f != state.action]) + + # if any functions that don't belong to a state trigger events, add + # them to the graph as well + additional_funcs = [f for f in funcs_for_in_event if f not in fsm.action_funcs] + for af in additional_funcs: + fsm.add_special_state(additional_states, af, None, state, in_event_name) + + fsm.states.extend(additional_states) + + # do any existing action functions by chance call other action functions? + for state in fsm.states: + if not state.action: + continue + callers = c_files.find_callers(state.action) + if not callers: + continue + for other_state in fsm.states: + if other_state.action in callers: + other_state.add_out_edge(Edge(state, None, 'dotted')) + + def add_fsm_alloc(fsm, c_files): + + allocating_funcs = [] + for c_file in c_files: + allocating_funcs.extend(c_file.fsm_allocators.get(fsm.struct_name, [])) + + starting_state = None + if fsm.states: + # assume the first state starts + starting_state = fsm.states[0] + + additional_states = [] + for func_name in allocating_funcs: + fsm.add_special_state(additional_states, func_name, None, starting_state) + + fsm.states.extend(additional_states) + + def add_cross_fsm_links(fsm, fsms, c_files, fsm_meta): + for state in fsm.states: + if not state.action: + continue + if state.kind == KIND_FSM: + continue + callers = c_files.find_callers(state.action) + + if state.kind == KIND_FUNC: + callers.append(state.action) + + if not callers: + continue + + for caller in callers: + for calling_fsm in fsms: + if calling_fsm is fsm: + continue + calling_state = calling_fsm.find_state_by_action(caller) + if not calling_state: + continue + if calling_state.kind == KIND_FSM: + continue + + label = None + if state.kind == KIND_STATE: + label=fsm.struct_name + ': ' + state.short_name + edge_action = caller + if calling_state.action == edge_action: + edge_action = None + calling_fsm.add_special_state(calling_fsm.states, fsm.struct_name, + calling_state, kind=KIND_FSM, edge_action=edge_action, label=label) + + label = None + if calling_state.kind == KIND_STATE: + label=calling_fsm.struct_name + ': ' + calling_state.short_name + edge_action = caller + if state.action == edge_action: + edge_action = None + fsm.add_special_state(fsm.states, calling_fsm.struct_name, None, + state, kind=KIND_FSM, edge_action=edge_action, + label=label) + + # meta overview + meta_called_fsm = fsm_meta.have_state(fsm.struct_name, KIND_FSM) + meta_calling_fsm = fsm_meta.have_state(calling_fsm.struct_name, KIND_FSM) + meta_calling_fsm.add_out_edge(Edge(meta_called_fsm)) + + + def have_state(fsm, name, kind=KIND_STATE): + state = fsm.find_state_by_name(name) + if not state: + state = State() + state.name = name + state.short_name = name + state.kind = kind + fsm.states.append(state) + return state + + def to_dot(fsm): + out = ['digraph G {', 'rankdir=LR;'] + + for state in fsm.states: + out.append('%s [label="%s"%s]' % (state.short_name, state.get_label(), + state.shape_str())) + + for state in fsm.states: + for out_edge in state.out_edges: + attrs = [] + labels = [] + if out_edge.events: + labels.extend(out_edge.event_labels()) + if out_edge.actions: + labels.extend(out_edge.action_labels()) + if labels: + attrs.append('label="%s"' % (r'\n'.join(labels))) + if out_edge.style: + attrs.append('style=%s'% out_edge.style) + attrs_str = '' + if attrs: + attrs_str = ' [%s]' % (','.join(attrs)) + out.append('%s->%s%s' % (state.short_name, out_edge.to_state.short_name, attrs_str)) + + out.append('}\n') + + return '\n'.join(out) + + def write_dot_file(fsm): + dot_path = '%s.dot' % fsm.struct_name + f = open(dot_path, 'w') + f.write(fsm.to_dot()) + f.close() + print(dot_path) + + +re_fsm = re.compile(r'struct osmo_fsm ([a-z_][a-z_0-9]*) =') +re_fsm_states_struct_name = re.compile(r'\bstates = ([a-z_][a-z_0-9]*)\W*,') +re_fsm_states = re.compile(r'struct osmo_fsm_state ([a-z_][a-z_0-9]*)\[\] =') +re_func = re.compile(r'(\b[a-z_][a-z_0-9]*\b)\([^)]*\)\W*^{', re.MULTILINE) +re_state_trigger = re.compile(r'osmo_fsm_inst_state_chg\([^,]+,\W*([A-Z_][A-Z_0-9]*)\W*,', re.M) +re_fsm_alloc = re.compile(r'osmo_fsm_inst_alloc[_child]*\(\W*&([a-z_][a-z_0-9]*),', re.M) +re_fsm_event_dispatch = re.compile(r'osmo_fsm_inst_dispatch\(\W*[^,]+,\W*([A-Z_][A-Z_0-9]*)\W*,', re.M) + +class CFile(): + def __init__(c_file, path): + c_file.path = path + c_file.src = open(path).read() + c_file.funcs = {} + c_file.fsm_allocators = listdict() + + def extract_block(c_file, brace_open, brace_close, start): + pos = 0 + try: + src = c_file.src + block_start = src.find(brace_open, start) + + pos = block_start + level = 1 + while level > 0: + pos += 1 + if src[pos] == brace_open: + level += 1 + elif src[pos] == brace_close: + level -= 1 + + return src[block_start+1:pos] + except: + print("Error while trying to extract a code block from %r char pos %d" % (c_file.path, pos)) + print("Block start at char pos %d" % block_start) + try: + print(src[block_start - 20 : block_start + 20]) + print('...') + print(src[pos - 20 : pos + 20]) + except: + pass + return '' + + + def find_fsms(c_file): + fsms = [] + for m in re_fsm.finditer(c_file.src): + struct_name = m.group(1) + struct_def = c_file.extract_block('{', '}', m.start()) + states_struct_name = re_fsm_states_struct_name.findall(struct_def)[0] + fsm = Fsm(struct_name, states_struct_name, c_file) + fsms.append(fsm) + return fsms + + def find_fsm_states(c_file, fsms): + for m in re_fsm_states.finditer(c_file.src): + states_struct_name = m.group(1) + for fsm in fsms: + if states_struct_name == fsm.states_struct_name: + fsm.parse_states(c_file.extract_block('{', '}', m.start())) + + def parse_functions(c_file): + funcs = {} + for m in re_func.finditer(c_file.src): + name = m.group(1) + func_src = c_file.extract_block('{', '}', m.start()) + funcs[name] = func_src + c_file.funcs = funcs + c_file.find_fsm_allocators() + + def find_callers(c_file, func_name): + func_call = func_name + '(' + callers = [] + for func_name, src in c_file.funcs.items(): + if src.find(func_call) >= 0: + callers.append(func_name) + return callers + + def find_fsm_allocators(c_file): + c_file.fsm_allocators = listdict() + for func_name, src in c_file.funcs.items(): + for m in re_fsm_alloc.finditer(src): + fsm_struct_name = m.group(1) + c_file.fsm_allocators.add(fsm_struct_name, func_name) + + def find_state_transitions(c_file, event_names): + TO_STATE = 'TO_STATE' + EVENT = 'EVENT' + func_to_state_transitions = listdict() + + for func_name, src in c_file.funcs.items(): + found_tokens = [] + + for m in re_state_trigger.finditer(src): + to_state = m.group(1) + found_tokens.append((m.start(), TO_STATE, to_state)) + + for event in event_names: + re_event = re.compile(r'\b(' + event + r')\b') + for m in re_event.finditer(src): + event = m.group(1) + found_tokens.append((m.start(), EVENT, event)) + + found_tokens = sorted(found_tokens) + + last_event = None + for start, kind, name in found_tokens: + if kind == EVENT: + last_event = name + else: + func_to_state_transitions.add(func_name, (name, last_event)) + + return func_to_state_transitions + + + def find_event_sources(c_file, event_names): + c_file.event_sources = listdict() + for func_name, src in c_file.funcs.items(): + for m in re_fsm_event_dispatch.finditer(src): + event_name = m.group(1) + c_file.event_sources.add(event_name, func_name) + +class CFiles(list): + + def find_callers(c_files, func_name): + callers = [] + for c_file in c_files: + callers.extend(c_file.find_callers(func_name)) + return callers + + def find_func_to_state_transitions(c_files): + func_to_state_transitions = listdict() + for c_file in c_files: + func_to_state_transitions.update( c_file.find_state_transitions(fsm.event_names) ) + return func_to_state_transitions + + def find_event_sources(c_files, event_names): + event_sources = listdict() + for c_file in c_files: + for event, sources in c_file.event_sources.items(): + if event in event_names: + event_sources.extend(event, sources) + return event_sources + +c_files = CFiles() +paths_seen = set() +for path in sys.argv[1:]: + if path in paths_seen: + continue + paths_seen.add(path) + c_file = CFile(path) + c_files.append(c_file) + +for c_file in c_files: + c_file.parse_functions() + +fsms = [] +for c_file in c_files: + fsms.extend(c_file.find_fsms()) + +for c_file in c_files: + c_file.find_fsm_states(fsms) + c_file.find_event_sources(fsms) + +for fsm in fsms: + fsm.find_event_edges(c_files) + fsm.add_fsm_alloc(c_files) + +fsm_meta = Fsm("meta", "meta") +for fsm in fsms: + fsm.add_cross_fsm_links(fsms, c_files, fsm_meta) + +for fsm in fsms: + fsm.make_events_short_names() + +for fsm in fsms: + fsm.write_dot_file() + +fsm_meta.write_dot_file() + + +# vim: tabstop=2 shiftwidth=2 expandtab -- To view, visit https://gerrit.osmocom.org/1367 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I155f57a608d600f59aedfd27ef66eb9772c124e7 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-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:29:42 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:29:42 +0000 Subject: openbsc[master]: Trigger Deactivate PDP context Request from SGSN VTY In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1263 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ide0cd4af828b753d24d2e507967d1c2e652ee05e Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:33:54 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:33:54 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 4: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1262/4/openbsc/src/gprs/gprs_sgsn.c File openbsc/src/gprs/gprs_sgsn.c: Line 695: LOGP(DGPRS, LOGL_NOTICE, "No pdp context for this IMSI: %s\n", We have LOGMMCTXP for printing the mm context identity in a unique fashion and to exactly prevent everyone re-inventing their "%s", imsi style printing. It should be used in all code where you have a sgsn_mm_ctx. Actually, it is even safe against mm == NULL. -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:35:50 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:35:50 +0000 Subject: [PATCH] openbsc[master]: lchan release in error state: SACCH deact only for SACCH pchans In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1397 to look at the new patch set (#2). lchan release in error state: SACCH deact only for SACCH pchans This is useful particularly in case where we deactivate PDCHs which don't have a SACCH associated. The existin code would always attempt to deactivate a SACCH even in those cases, leading to the BTS responsding with related error messages. Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libcommon/gsm_data_shared.c 3 files changed, 17 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/97/1397/2 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4ec4f69..9407b82 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -891,6 +891,7 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, int *rc); +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); bool ts_is_tch(struct gsm_bts_trx_ts *ts); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index b7f7a75..2c016a6 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -898,9 +898,23 @@ */ static int rsl_rf_chan_release_err(struct gsm_lchan *lchan) { + enum sacch_deact sacch_deact; if (lchan->state != LCHAN_S_ACTIVE) return 0; - return rsl_rf_chan_release(lchan, 1, SACCH_DEACTIVATE); + switch (ts_pchan(lchan->ts)) { + case GSM_PCHAN_TCH_F: + case GSM_PCHAN_TCH_H: + case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: + case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: + sacch_deact = SACCH_DEACTIVATE; + break; + default: + sacch_deact = SACCH_NONE; + break; + } + return rsl_rf_chan_release(lchan, 1, sacch_deact); } static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan) diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index df204fe..387af70 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -729,7 +729,7 @@ }; /*! Return the actual pchan type, also heeding dynamic TS. */ -static enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) { switch (ts->pchan) { case GSM_PCHAN_TCH_F_TCH_H_PDCH: -- To view, visit https://gerrit.osmocom.org/1397 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 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 Dec 9 11:35:54 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:35:54 +0000 Subject: openbsc[master]: lchan release in error state: SACCH deact only for SACCH pchans In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1397 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 Gerrit-PatchSet: 2 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 Fri Dec 9 11:35:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:35:56 +0000 Subject: [MERGED] openbsc[master]: lchan release in error state: SACCH deact only for SACCH pchans In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: lchan release in error state: SACCH deact only for SACCH pchans ...................................................................... lchan release in error state: SACCH deact only for SACCH pchans This is useful particularly in case where we deactivate PDCHs which don't have a SACCH associated. The existin code would always attempt to deactivate a SACCH even in those cases, leading to the BTS responsding with related error messages. Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libcommon/gsm_data_shared.c 3 files changed, 17 insertions(+), 2 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 4ec4f69..9407b82 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -891,6 +891,7 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, int *rc); +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); bool ts_is_tch(struct gsm_bts_trx_ts *ts); diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index b7f7a75..2c016a6 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -898,9 +898,23 @@ */ static int rsl_rf_chan_release_err(struct gsm_lchan *lchan) { + enum sacch_deact sacch_deact; if (lchan->state != LCHAN_S_ACTIVE) return 0; - return rsl_rf_chan_release(lchan, 1, SACCH_DEACTIVATE); + switch (ts_pchan(lchan->ts)) { + case GSM_PCHAN_TCH_F: + case GSM_PCHAN_TCH_H: + case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: + case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: + sacch_deact = SACCH_DEACTIVATE; + break; + default: + sacch_deact = SACCH_NONE; + break; + } + return rsl_rf_chan_release(lchan, 1, sacch_deact); } static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan) diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index df204fe..387af70 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -729,7 +729,7 @@ }; /*! Return the actual pchan type, also heeding dynamic TS. */ -static enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) +enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts) { switch (ts->pchan) { case GSM_PCHAN_TCH_F_TCH_H_PDCH: -- To view, visit https://gerrit.osmocom.org/1397 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734 Gerrit-PatchSet: 2 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 Dec 9 11:37:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:37:08 +0000 Subject: openbsc[master]: move OAP messages implementations to libosmocore In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1381/1//COMMIT_MSG Commit Message: Line 8: please always state the exact Change-Id of libosmocore that is required for builds from this point on. -- To view, visit https://gerrit.osmocom.org/1381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:37:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:37:31 +0000 Subject: openbsc[master]: add gsup_test_client program In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 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 Fri Dec 9 11:37:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:37:48 +0000 Subject: openbsc[master]: comments: gsup client: rename to Generic, adjust copyright a... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1383 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 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 Fri Dec 9 11:40:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:40:28 +0000 Subject: openbsc[master]: grps_gsup_*: rename public API to osmo_gsup_ In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1384/1//COMMIT_MSG Commit Message: PS1, Line 7: o I think at last osmodevcon we indicated clearly that osmo_* naming should only be present in libosmo* code. This means that when private code like gsup_* is moved from the openbsc.git to libosmcore.git, we rename it to osmo_gsup_*. This way we don't ever introduce new cases where a symbol with the same name was first provided by an executable and then by a library. So if the intention is to keep this in openbsc.git (which I agree) then please don't rename it (or introdcue other new code) that uses the osmo_ prefix. -- To view, visit https://gerrit.osmocom.org/1384 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Fri Dec 9 11:40:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:40:49 +0000 Subject: openbsc[master]: rename gprs_gsup_client.h to gsup_client.h In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1385 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c 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 Fri Dec 9 11:41:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:41:30 +0000 Subject: openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1386/1//COMMIT_MSG Commit Message: PS1, Line 9: , which commit exactly? should we thus bump the libosmocore library version requirement in configure.ac? -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Fri Dec 9 11:42:44 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:42:44 +0000 Subject: openbsc[master]: oap: rename public API from oap_ to osmo_oap_client_ In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1387/1//COMMIT_MSG Commit Message: Line 7: oap: rename public API from oap_ to osmo_oap_client_ see my comment about the osmo_ prefix being reserved for libosmo*.git repositories :/ depending on how generic the OAP client code is, we might move it there. But if it isn't, the osmo_ prefix shouldn't be used. -- To view, visit https://gerrit.osmocom.org/1387 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Fri Dec 9 11:43:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:43:06 +0000 Subject: openbsc[master]: rename oap.h to oap_client.h In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1388 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec 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 Fri Dec 9 11:43:13 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:43:13 +0000 Subject: openbsc[master]: move gprs/oap.c to libcommon/oap_client.c In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1389 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 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 Fri Dec 9 11:43:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:43:19 +0000 Subject: openbsc[master]: move grps_gsup_client.c to libcommon/gsup_client.c In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1390 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce 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 Fri Dec 9 11:43:27 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:43:27 +0000 Subject: openbsc[master]: oap_test.c: rename to avoid clash with libosmocore oap_test.c In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1391 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f 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 Fri Dec 9 11:43:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:43:40 +0000 Subject: openbsc[master]: oap_client_test: print test descr to stderr, check stderr In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1392 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 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 Fri Dec 9 11:44:50 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:44:50 +0000 Subject: openbsc[master]: oap_client: move logging to DLOAP logging category In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1393/1//COMMIT_MSG Commit Message: Line 7: oap_client: move logging to DLOAP logging category we do this in some cases, but I'm not entirely sure how much I like it. The category is prefixed by intention with 'L' to indicate library code. However, the oap_client code is inside the application (at least as per this commit). Not sure what others think about this. -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a Gerrit-PatchSet: 1 Gerrit-Project: openbsc 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 Fri Dec 9 11:45:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:45:08 +0000 Subject: openbsc[master]: oap_client_test: show bug: disabled state does not reject me... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1394 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 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 Fri Dec 9 11:46:00 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:46:00 +0000 Subject: openbsc[master]: oap_client: reject all messages in disabled/uninitialized state In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1395 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 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 Fri Dec 9 11:46:17 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:46:17 +0000 Subject: openbsc[master]: oap_client: make use of OAP optional: disable for NULL config In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1396 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 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 Fri Dec 9 11:52:23 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:52:23 +0000 Subject: libosmocore[master]: import oap message parsing / encoding from openbsc.git In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1375/2//COMMIT_MSG Commit Message: Line 7: import oap message parsing / encoding from openbsc.git might be worth noticing the acknowledgement of the license chance AGPLv3 to GPLv2-or-later by sysmocom in the commit. -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:52:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:52:40 +0000 Subject: libosmocore[master]: gsm/oap: more robust: decode presence as clearly either 1 or 0 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1378 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 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 Fri Dec 9 11:53:16 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:53:16 +0000 Subject: libosmocore[master]: oap: add encode/decode unit test In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1379/2/tests/oap/oap_test.c File tests/oap/oap_test.c: Line 14: * GNU Affero General Public License for more details. we shouldn't introduce AGPLv3 (or any AGPL) code into libosmo*. -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 Gerrit-PatchSet: 2 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 Fri Dec 9 11:54:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:54:31 +0000 Subject: osmo-bts[master]: Save RTP metadata in Control Buffer In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1343 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 11:54:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:54:39 +0000 Subject: [MERGED] osmo-bts[master]: Save RTP metadata in Control Buffer In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Save RTP metadata in Control Buffer ...................................................................... Save RTP metadata in Control Buffer Having RTP metadata is useful for debugging - save Sequence Number and Timestamp next to Marker bit from RTP header. Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 --- M include/osmo-bts/msg_utils.h M src/common/l1sap.c 2 files changed, 18 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 7321045..55e8475 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -13,9 +13,15 @@ struct msgb; -/* Access 1st byte of msgb control buffer */ +/* Access 1st part of msgb control buffer */ #define rtpmsg_marker_bit(x) ((x)->cb[0]) +/* Access 2nd part of msgb control buffer */ +#define rtpmsg_seq(x) ((x)->cb[1]) + +/* Access 3rd part of msgb control buffer */ +#define rtpmsg_ts(x) ((x)->cb[2]) + /** * Classification of OML message. ETSI for plain GSM 12.21 * messages and IPA/Osmo for manufacturer messages. diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 82aa1ac..cfa02bd 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -661,7 +661,8 @@ struct gsm_time g_time; struct gsm_lchan *lchan; uint8_t chan_nr, marker = 0; - uint32_t fn; + uint16_t seq; + uint32_t fn, timestamp; chan_nr = rts_ind->chan_nr; fn = rts_ind->fn; @@ -694,6 +695,10 @@ } else { /* Obtain RTP header Marker bit from control buffer */ marker = rtpmsg_marker_bit(resp_msg); + /* Obtain RTP header Sequence Number from control buffer */ + seq = rtpmsg_seq(resp_msg); + /* Obtain RTP header Timestamp from control buffer */ + timestamp = rtpmsg_ts(resp_msg); resp_msg->l2h = resp_msg->data; msgb_push(resp_msg, sizeof(*resp_l1sap)); @@ -1074,8 +1079,12 @@ /* Store RTP header Marker bit in control buffer */ rtpmsg_marker_bit(msg) = marker; + /* Store RTP header Sequence Number in control buffer */ + rtpmsg_seq(msg) = seq_number; + /* Store RTP header Timestamp in control buffer */ + rtpmsg_ts(msg) = timestamp; - /* make sure the queue doesn't get too long */ + /* make sure the queue doesn't get too long */ llist_for_each_entry(tmp, &lchan->dl_tch_queue, list) count++; while (count >= 2) { -- To view, visit https://gerrit.osmocom.org/1343 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997 Gerrit-PatchSet: 5 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 Fri Dec 9 11:56:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 11:56:39 +0000 Subject: openbsc[master]: Add test-case which breaks range1024 encoding In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1373 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I99f917d80232b63d1bb518842c24517b3dd18be4 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 Fri Dec 9 12:05:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:05:35 +0000 Subject: osmo-pcu[master]: Add statistics in the ms and tbf level. In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1345 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c Gerrit-PatchSet: 4 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 12:05:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:05:43 +0000 Subject: [MERGED] osmo-pcu[master]: Add statistics in the ms and tbf level. In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add statistics in the ms and tbf level. ...................................................................... Add statistics in the ms and tbf level. Adds DL throughput in show ms imsi . Adds the number of coding schemes counter and rlc nacked counter at TBf level. Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c --- M src/gprs_rlcmac_meas.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp 5 files changed, 128 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp index 5a2e38e..d6bbc19 100644 --- a/src/gprs_rlcmac_meas.cpp +++ b/src/gprs_rlcmac_meas.cpp @@ -179,6 +179,8 @@ if (elapsed < 128) return 0; + tbf->m_bw.dl_throughput = (tbf->m_bw.dl_bw_octets/elapsed); + LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: " "%d KBits/s\n", tbf->imsi(), tbf->tlli(), tbf->m_bw.dl_bw_octets / elapsed); diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index ca7f7ad..4b4b36d 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -76,6 +76,13 @@ vty_out(vty, " V(A)=%d V(S)=%d nBSN=%d%s", win->v_a(), win->v_s(), win->resend_needed(), win->window_stalled() ? " STALLED" : ""); + vty_out(vty, "%s", VTY_NEWLINE); + vty_out_rate_ctr_group(vty, " ", tbf->m_ctrs); + if(GprsCodingScheme::GPRS == tbf->ms()->mode()) { + vty_out_rate_ctr_group(vty, " ", dl_tbf->m_dl_gprs_ctrs); + } else { + vty_out_rate_ctr_group(vty, " ", dl_tbf->m_dl_egprs_ctrs); + } } vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE); } @@ -176,11 +183,15 @@ ms->ul_tbf()->tfi(), ms->ul_tbf()->state_name(), VTY_NEWLINE); - if (ms->dl_tbf()) + if (ms->dl_tbf()) { vty_out(vty, " Downlink TBF: TFI=%d, state=%s%s", ms->dl_tbf()->tfi(), ms->dl_tbf()->state_name(), VTY_NEWLINE); + vty_out(vty, " Current DL Throughput: %d Kbps %s", + ms->dl_tbf()->m_bw.dl_throughput, + VTY_NEWLINE); + } llist_for_each(i_tbf, &ms->old_tbfs()) vty_out(vty, " Old %-19s TFI=%d, state=%s%s", diff --git a/src/tbf.cpp b/src/tbf.cpp index 25209e4..60fba68 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -33,6 +33,7 @@ extern "C" { #include #include +#include } #include @@ -41,6 +42,53 @@ extern void *tall_pcu_ctx; static void tbf_timer_cb(void *_tbf); + +static const struct rate_ctr_desc tbf_ctr_description[] = { + { "rlc.nacked", "RLC Nacked " }, +}; + +static const struct rate_ctr_desc tbf_dl_gprs_ctr_description[] = { + { "gprs.downlink.cs1", "CS1 " }, + { "gprs.downlink.cs2", "CS2 " }, + { "gprs.downlink.cs3", "CS3 " }, + { "gprs.downlink.cs4", "CS4 " }, +}; + +static const struct rate_ctr_desc tbf_dl_egprs_ctr_description[] = { + { "egprs.downlink.mcs1", "MCS1 " }, + { "egprs.downlink.mcs2", "MCS2 " }, + { "egprs.downlink.mcs3", "MCS3 " }, + { "egprs.downlink.mcs4", "MCS4 " }, + { "egprs.downlink.mcs5", "MCS5 " }, + { "egprs.downlink.mcs6", "MCS6 " }, + { "egprs.downlink.mcs7", "MCS7 " }, + { "egprs.downlink.mcs8", "MCS8 " }, + { "egprs.downlink.mcs9", "MCS9 " }, +}; + +static const struct rate_ctr_group_desc tbf_ctrg_desc = { + "pcu.tbf", + "TBF Statistics", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_ctr_description), + tbf_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = { + "tbf.gprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_dl_gprs_ctr_description), + tbf_dl_gprs_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_dl_egprs_ctrg_desc = { + "tbf.egprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_dl_egprs_ctr_description), + tbf_dl_egprs_ctr_description, +}; gprs_rlcmac_tbf::Meas::Meas() : rssi_sum(0), @@ -78,7 +126,8 @@ m_ms_class(0), m_list(this), m_ms_list(this), - m_egprs_enabled(false) + m_egprs_enabled(false), + m_ctrs(NULL) { /* The classes of these members do not have proper constructors yet. * Just set them to 0 like talloc_zero did */ @@ -325,6 +374,12 @@ if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_ul_aborted(); } else { + gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); + if (tbf->is_egprs_enabled()) { + rate_ctr_group_free(dl_tbf->m_dl_egprs_ctrs); + } else { + rate_ctr_group_free(dl_tbf->m_dl_gprs_ctrs); + } tbf->bts->tbf_dl_freed(); if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_dl_aborted(); @@ -359,6 +414,8 @@ if (tbf->ms()) tbf->set_ms(NULL); + + rate_ctr_group_free(tbf->m_ctrs); LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF ends here **********\n"); talloc_free(tbf); @@ -646,6 +703,8 @@ "Allocated %s: trx = %d, ul_slots = %02x, dl_slots = %02x\n", tbf->name(), tbf->trx->trx_no, tbf->ul_slots(), tbf->dl_slots()); + tbf->m_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0); + return 0; } @@ -732,7 +791,8 @@ gprs_rlcmac_dl_tbf::BandWidth::BandWidth() : dl_bw_octets(0), dl_loss_lost(0), - dl_loss_received(0) + dl_loss_received(0), + dl_throughput(0) { timerclear(&dl_bw_tv); timerclear(&dl_loss_tv); @@ -744,7 +804,9 @@ m_wait_confirm(0), m_dl_ack_requested(false), m_last_dl_poll_fn(0), - m_last_dl_drained_fn(0) + m_last_dl_drained_fn(0), + m_dl_gprs_ctrs(NULL), + m_dl_egprs_ctrs(NULL) { memset(&m_llc_timer, 0, sizeof(m_llc_timer)); } @@ -802,8 +864,12 @@ return NULL; } - if (tbf->is_egprs_enabled()) + if (tbf->is_egprs_enabled()) { tbf->egprs_calc_window_size(); + tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_egprs_ctrg_desc, 0); + } else { + tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_gprs_ctrg_desc, 0); + } llist_add(&tbf->list(), &bts->bts->dl_tbfs()); tbf->bts->tbf_dl_created(); diff --git a/src/tbf.h b/src/tbf.h index 1e98a24..5017d3e 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -79,6 +79,29 @@ GPRS_RLCMAC_UL_TBF }; +enum tbf_counters { + TBF_CTR_RLC_NACKED, +}; + +enum tbf_gprs_counters { + TBF_CTR_GPRS_DL_CS1, + TBF_CTR_GPRS_DL_CS2, + TBF_CTR_GPRS_DL_CS3, + TBF_CTR_GPRS_DL_CS4, +}; + +enum tbf_egprs_counters { + TBF_CTR_EGPRS_DL_MCS1, + TBF_CTR_EGPRS_DL_MCS2, + TBF_CTR_EGPRS_DL_MCS3, + TBF_CTR_EGPRS_DL_MCS4, + TBF_CTR_EGPRS_DL_MCS5, + TBF_CTR_EGPRS_DL_MCS6, + TBF_CTR_EGPRS_DL_MCS7, + TBF_CTR_EGPRS_DL_MCS8, + TBF_CTR_EGPRS_DL_MCS9, +}; + #define GPRS_RLCMAC_FLAG_CCCH 0 /* assignment on CCCH */ #define GPRS_RLCMAC_FLAG_PACCH 1 /* assignment on PACCH */ #define GPRS_RLCMAC_FLAG_UL_DATA 2 /* uplink data received */ @@ -224,6 +247,8 @@ */ uint8_t m_tfi; time_t m_created_ts; + + struct rate_ctr_group *m_ctrs; protected: gprs_rlcmac_bts *bts_data() const; @@ -399,6 +424,7 @@ struct BandWidth { struct timeval dl_bw_tv; /* timestamp for dl bw calculation */ uint32_t dl_bw_octets; /* number of octets since bw_tv */ + uint32_t dl_throughput; /* throughput to be displayed in stats */ struct timeval dl_loss_tv; /* timestamp for loss calculation */ uint16_t dl_loss_lost; /* sum of lost packets */ @@ -407,6 +433,9 @@ BandWidth(); } m_bw; + struct rate_ctr_group *m_dl_gprs_ctrs; + struct rate_ctr_group *m_dl_egprs_ctrs; + protected: struct ana_result { unsigned received_packets; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index c6f3945..2af2ff0 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -949,6 +949,7 @@ ms()->update_error_rate(this, error_rate); m_window.update(bts, rbb, first_bsn, &lost, &received); + rate_ctr_add(&m_ctrs->ctr[TBF_CTR_RLC_NACKED], lost); /* report lost and received packets */ gprs_rlcmac_received_lost(this, received, lost); @@ -1007,6 +1008,7 @@ m_window.update(bts, show_rbb, ssn, &lost, &received); + rate_ctr_add(&m_ctrs->ctr[TBF_CTR_RLC_NACKED], lost); /* report lost and received packets */ gprs_rlcmac_received_lost(this, received, lost); @@ -1342,45 +1344,58 @@ switch (coding_scheme) { case GprsCodingScheme::CS1 : bts->gprs_dl_cs1(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS1]); break; case GprsCodingScheme::CS2 : bts->gprs_dl_cs2(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS2]); break; case GprsCodingScheme::CS3 : bts->gprs_dl_cs3(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS3]); break; case GprsCodingScheme::CS4 : bts->gprs_dl_cs4(); + rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS4]); break; } } else { switch (coding_scheme) { case GprsCodingScheme::MCS1 : bts->egprs_dl_mcs1(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS1]); break; case GprsCodingScheme::MCS2 : bts->egprs_dl_mcs2(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS2]); break; case GprsCodingScheme::MCS3 : bts->egprs_dl_mcs3(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS3]); break; case GprsCodingScheme::MCS4 : bts->egprs_dl_mcs4(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS4]); break; case GprsCodingScheme::MCS5 : bts->egprs_dl_mcs5(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS5]); break; case GprsCodingScheme::MCS6 : bts->egprs_dl_mcs6(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS6]); break; case GprsCodingScheme::MCS7 : bts->egprs_dl_mcs7(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS7]); break; case GprsCodingScheme::MCS8 : bts->egprs_dl_mcs8(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS8]); break; case GprsCodingScheme::MCS9 : bts->egprs_dl_mcs9(); + rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS9]); break; } } -- To view, visit https://gerrit.osmocom.org/1345 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c Gerrit-PatchSet: 5 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 12:06:20 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:06:20 +0000 Subject: openbsc[master]: Replace duplicated code with macro call In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1370 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2020417119c844b886f89e34dbfd75e716743dc4 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 Fri Dec 9 12:06:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:06:28 +0000 Subject: [MERGED] openbsc[master]: Replace duplicated code with macro call In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Replace duplicated code with macro call ...................................................................... Replace duplicated code with macro call Use already defined GSM48_LEN2PLEN for computing SI length. Change-Id: I2020417119c844b886f89e34dbfd75e716743dc4 --- M openbsc/src/libbsc/system_information.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/system_information.c b/openbsc/src/libbsc/system_information.c index 3f6d6b9..6c601e4 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -541,7 +541,7 @@ memset(si1, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si1->header.l2_plen = (21 << 2) | 1; + si1->header.l2_plen = GSM48_LEN2PLEN(21); si1->header.rr_protocol_discriminator = GSM48_PDISC_RR; si1->header.skip_indicator = 0; si1->header.system_information = GSM48_MT_RR_SYSINFO_1; @@ -570,7 +570,7 @@ memset(si2, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si2->header.l2_plen = (22 << 2) | 1; + si2->header.l2_plen = GSM48_LEN2PLEN(22); si2->header.rr_protocol_discriminator = GSM48_PDISC_RR; si2->header.skip_indicator = 0; si2->header.system_information = GSM48_MT_RR_SYSINFO_2; @@ -596,7 +596,7 @@ memset(si2b, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si2b->header.l2_plen = (22 << 2) | 1; + si2b->header.l2_plen = GSM48_LEN2PLEN(22); si2b->header.rr_protocol_discriminator = GSM48_PDISC_RR; si2b->header.skip_indicator = 0; si2b->header.system_information = GSM48_MT_RR_SYSINFO_2bis; @@ -630,7 +630,7 @@ memset(si2t, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si2t->header.l2_plen = (22 << 2) | 1; + si2t->header.l2_plen = GSM48_LEN2PLEN(22); si2t->header.rr_protocol_discriminator = GSM48_PDISC_RR; si2t->header.skip_indicator = 0; si2t->header.system_information = GSM48_MT_RR_SYSINFO_2ter; @@ -711,7 +711,7 @@ memset(si3, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); - si3->header.l2_plen = (18 << 2) | 1; + si3->header.l2_plen = GSM48_LEN2PLEN(18); si3->header.rr_protocol_discriminator = GSM48_PDISC_RR; si3->header.skip_indicator = 0; si3->header.system_information = GSM48_MT_RR_SYSINFO_3; @@ -784,7 +784,7 @@ /* we don't use hopping and thus don't need a CBCH MA */ } - si4->header.l2_plen = (l2_plen << 2) | 1; + si4->header.l2_plen = GSM48_LEN2PLEN(l2_plen); /* SI4 Rest Octets (10.5.2.35), containing Optional Power offset, GPRS Indicator, @@ -805,7 +805,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: @@ -840,7 +840,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: @@ -884,7 +884,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: @@ -921,7 +921,7 @@ switch (bts->type) { case GSM_BTS_TYPE_NANOBTS: case GSM_BTS_TYPE_OSMO_SYSMO: - *output++ = (l2_plen << 2) | 1; + *output++ = GSM48_LEN2PLEN(l2_plen); l2_plen++; break; default: -- To view, visit https://gerrit.osmocom.org/1370 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2020417119c844b886f89e34dbfd75e716743dc4 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 Fri Dec 9 12:08:25 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:08:25 +0000 Subject: openbsc[master]: Cosmetic fixes around SI generation In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1372/1/openbsc/src/libbsc/arfcn_range_encode.c File openbsc/src/libbsc/arfcn_range_encode.c: Line 132: out, index + greatest_power_of_2_lesser_or_equal_to(index + 1)); we normally indent wrapped function arguments to the column of the first argument in the line above. -- To view, visit https://gerrit.osmocom.org/1372 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e 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 Fri Dec 9 12:08:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:08:56 +0000 Subject: openbsc[master]: Use arch-independent type for SI length In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 not really sure this makes the code any cleaner. Guess this was just a temporary thing during testing, but without need to be merged. -- To view, visit https://gerrit.osmocom.org/1371 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6e35d4c5e9822696e4b979e68a89bec6c99fec2f 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 Fri Dec 9 12:10:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:10:19 +0000 Subject: osmo-iuh[master]: log: fix number format for domain indicator In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1369 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f 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 Fri Dec 9 12:10:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:10:32 +0000 Subject: [MERGED] osmo-iuh[master]: log: fix number format for domain indicator In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: log: fix number format for domain indicator ...................................................................... log: fix number format for domain indicator CN_DomainIndicator_t is a long, so use %l format. Error was introduced in recent 2b5021fd8d445f0ca4f28e0ea71a19cd52724e57. Fixes: CID#157119 Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f --- M src/hnbgw_rua.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c index 0ca64d3..47d33f0 100644 --- a/src/hnbgw_rua.c +++ b/src/hnbgw_rua.c @@ -348,7 +348,7 @@ cn = hnb->gw->cnlink_ps; break; default: - LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %u\n", + LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %l\n", ies.cN_DomainIndicator); rc = -1; goto error_free; @@ -394,7 +394,7 @@ cn = hnb->gw->cnlink_ps; break; default: - LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %u\n", + LOGP(DRUA, LOGL_ERROR, "Invalid CN_DomainIndicator: %l\n", ies.cN_DomainIndicator); rc = -1; goto error_free; -- To view, visit https://gerrit.osmocom.org/1369 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 12:12:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:12:05 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 I think it's a good idea. But let's hear some other opinions. If we go ahead with this, please also submit similar changes to all the other projects (osmo-bts,osmo-pcu,libosmo*, ...) -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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 Fri Dec 9 12:12:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:12:49 +0000 Subject: openbsc[master]: cosmetic: chan_alloc: use switch instead of if-cascade In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1365 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc Gerrit-PatchSet: 2 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 Fri Dec 9 12:12:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:12:56 +0000 Subject: openbsc[master]: Fix TCH/F_PDCH: no need to check ts subslots for PDCH In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1366 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 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 Fri Dec 9 12:13:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:13:03 +0000 Subject: [MERGED] openbsc[master]: Fix TCH/F_PDCH: no need to check ts subslots for PDCH In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix TCH/F_PDCH: no need to check ts subslots for PDCH ...................................................................... Fix TCH/F_PDCH: no need to check ts subslots for PDCH For TCH/F_PDCH in PDCH mode, directly return the lchan to use, in order to switch it to TCH/F. To check the pchan type in chan_alloc.c, make ts_pchan() public in gsm_data_shared.h. Commit c3f72f63afde926dfc46827d6880055597515fb6 broke TCH/F_PDCH, as a fallout of setting the GSM_PCHAN_PDCH subslots number to 0. This is sane and correct, but the chan_alloc code failed to see a ts as available if it has no subslots. Explanation: _lc_find_trx() checks each timeslot. For normal, static TCH timeslots we determine the number of logical subslots contained and check whether one of them is free. For dynamic TS, we can do the same when in TCH mode, but when in PDCH mode, we already know that it is available for immediate switchover for voice and hence can return it right away. TCH/F_TCH/H_PDCH already has a special check for that. TCH/F_PDCH doesn't, but this worked for TCH/F_PDCH as long as ts_subslots() returned 1 for PDCH: the for-loop at the bottom of _lc_find_trx() checked one subslot, which succeeded on an lchan in PDCH mode, since PDCH lchans are always marked type == NONE and state == NONE. Now we more accurately acknowledge that a PDCH timeslot has zero subslots and that a dynamic timeslot in PDCH mode can always be switched to voice immediately, without checking lchan type or state. So, above mentioned commit set PDCH to zero subslots, and the for-loop to check the (zero) subslots never ran and hence never returned the lchan. This fix adds a special condition for TCH/F_PDCH in PDCH mode, same as TCH/F_TCH/H_PDCH. (Todo: ts_pchan() can probably be used in other places as well to remove some code dup. Leaving that for another patch.) Fixes: OS#1868 Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 --- M openbsc/src/libbsc/chan_alloc.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/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index a50b4ee..33b79a0 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -151,6 +151,13 @@ check_subslots = ts_subslots(ts); break; + case GSM_PCHAN_TCH_F_PDCH: + /* Available for voice when in PDCH mode */ + if (ts_pchan(ts) != GSM_PCHAN_PDCH) + continue; + /* Subslots of a PDCH ts don't need to be checked. */ + return ts->lchan; + default: /* Not a dynamic channel, there is only one pchan kind: */ check_subslots = ts_subslots(ts); -- To view, visit https://gerrit.osmocom.org/1366 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0 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 Fri Dec 9 12:13:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:13:03 +0000 Subject: [MERGED] openbsc[master]: cosmetic: chan_alloc: use switch instead of if-cascade In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: cosmetic: chan_alloc: use switch instead of if-cascade ...................................................................... cosmetic: chan_alloc: use switch instead of if-cascade Preparing cosmetically for a subsequent commit which will add another pchan kind to be checked, rather use a "switch (pchan) {}". Also reverse one if() branch to "early-exit" style. Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc --- M openbsc/src/libbsc/chan_alloc.c 1 file changed, 12 insertions(+), 9 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 0f4d90a..a50b4ee 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -124,7 +124,8 @@ * to check whether a dynamic timeslot is already in TCH/H mode * and whether one of the two channels is still available. */ - if (pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { + switch (pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: if (ts->dyn.pchan_is != ts->dyn.pchan_want) { /* The TS's mode is being switched. Not * available anymore/yet. */ @@ -141,17 +142,19 @@ continue; return ts->lchan; } - if (ts->dyn.pchan_is == dyn_as_pchan) { - /* The requested type matches the dynamic - * timeslot's current mode. A channel may still - * be available (think TCH/H). */ - check_subslots = ts_subslots(ts); - } else - /* Otherwise this slot is not applicable. */ + if (ts->dyn.pchan_is != dyn_as_pchan) + /* not applicable. */ continue; - } else { + /* The requested type matches the dynamic timeslot's + * current mode. A channel may still be available + * (think TCH/H). */ + check_subslots = ts_subslots(ts); + break; + + default: /* Not a dynamic channel, there is only one pchan kind: */ check_subslots = ts_subslots(ts); + break; } /* Is a sub-slot still available? */ -- To view, visit https://gerrit.osmocom.org/1365 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc 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 Dec 9 12:14:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 12:14:40 +0000 Subject: libosmocore[master]: Revert "Revert "gsm0408: add chreq_type for CHREQ_T_PDCH_ONE... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1361/1//COMMIT_MSG Commit Message: Line 6: what this is missing is _why_ the patch is reverted. -- 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: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: lynxis lazus Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 12:51:41 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Fri, 9 Dec 2016 12:51:41 +0000 Subject: [PATCH] openbsc[master]: Support Deactivate PDP Context Request from network 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/1262 to look at the new patch set (#5). Support Deactivate PDP Context Request from network Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 178 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/62/1262/5 diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 24e286c..b3f250d 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,6 +369,8 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); +void drop_gmm_ctx_for_ms(const char *imsi); + char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..1d7148e 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,6 +667,42 @@ } } +/* + * High-level function to be called for PDP deactivation initiated from SGSN VTY. + * When there are PDP contexts present for a MM context, PDP context will be + * deactivated along with GMM Detach(MM context deletion). + * If there are no PDP present, MM context will be deleted to avoid further + * PDP context activation for that MS. + */ +void drop_gmm_ctx_for_ms(const char *imsi) +{ + OSMO_ASSERT(imsi != NULL); + struct sgsn_mm_ctx *mm; + struct sgsn_pdp_ctx *pdp; + + /* Search the MM context subscriber */ + mm = sgsn_mm_ctx_by_imsi(imsi); + LOGMMCTXP(LOGL_INFO, mm, "SGSN intiated Deactivate PDP request\n"); + if (mm) { + /* Search the PDP for this subscriber */ + if (llist_empty(&mm->pdp_list)) { + /* + * Deleting mm context for the subscriber when no PDP + * context is present. + */ + gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); + LOGMMCTXP(LOGL_NOTICE, mm, "No PDP context to deactivate\n"); + } else { + llist_for_each_entry(pdp, &mm->pdp_list, list) { + gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); + LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " + "Successful\n"); + } + } + } else + LOGMMCTXP(LOGL_NOTICE, mm, "No MM context to deactivate\n"); +} + /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 789817c..51deb2e 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,14 +38,17 @@ #include #include +#include void *tall_bsc_ctx; +struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, + .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2363,6 +2366,138 @@ cleanup_test(); } +static void test_pdp_deactivation_with_pdp_ctx(void) +{ + struct apn_ctx *actxs[4]; + struct sgsn_ggsn_ctx *ggc, *ggcs[3]; + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + enum gsm48_gsm_cause gsm_cause; + struct tlv_parsed tp; + uint8_t apn_enc[GSM_APN_LENGTH + 10]; + struct sgsn_subscriber_pdp_data *pdp_data; + char apn_str[GSM_APN_LENGTH]; + + printf("Testing Pdp deactivation for MS with pdp ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + struct sgsn_pdp_ctx *pdp; + + tp.lv[GSM48_IE_GSM_APN].len = 0; + tp.lv[GSM48_IE_GSM_APN].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; + tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; + + ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); + + actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); + actxs[0]->ggsn = ggcs[0]; + + pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); + pdp_data->context_id = 1; + pdp_data->pdp_type = 0x0121; + strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); + + /* Resolve GGSNs */ + tp.lv[GSM48_IE_GSM_APN].len = + gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); + + ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); + + OSMO_ASSERT(ggc != NULL); + OSMO_ASSERT(ggc->id == 0); + + ggc = sgsn_ggsn_ctx_alloc(ggc->id); + /* Create a pdp context */ + pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + gsm48_tx_gsm_deact_pdp_acc(pdp); + gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); + + /* Cleanup */ + + subscr_put(s1); + + sgsn_apn_ctx_free(actxs[0]); + sgsn_ggsn_ctx_free(ggcs[0]); + sgsn_ggsn_ctx_free(ggc); + talloc_free(pdp); + + cleanup_test(); +} + +static void test_pdp_deactivation_with_only_mm_ctx(void) +{ + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + + printf("Testing Pdp deactivation for MS with only MM ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation_without_mm_ctx(void) +{ + const char *imsi1 = "1234567890"; + + printf("Testing Pdp deactivation for MS without MM ctx\n"); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation(void) +{ + printf("Testing pdp deactivation\n"); + + test_pdp_deactivation_with_pdp_ctx(); + test_pdp_deactivation_without_mm_ctx(); + test_pdp_deactivation_with_only_mm_ctx(); +} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2454,6 +2589,7 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); + test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c7a53b9..c36b643 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,4 +34,8 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection +Testing pdp deactivation +Testing Pdp deactivation for MS with pdp ctx +Testing Pdp deactivation for MS without MM ctx +Testing Pdp deactivation for MS with only MM ctx Done -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 13:05:27 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 9 Dec 2016 13:05:27 +0000 Subject: openbsc[master]: sgsn_test: Fix missing = in == type check In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1322 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I696a7d25d2f4d19922e05a7e83c4aeec5c44fb07 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 13:16:29 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 9 Dec 2016 13:16:29 +0000 Subject: [PATCH] osmo-bts[master]: DTX: fix TS adjustment for ONSET Message-ID: Review at https://gerrit.osmocom.org/1399 DTX: fix TS adjustment for ONSET Previously timestamp was always adjusted according to FN difference. In case of ONSET event this causes unnecessary TS gap with subsequent speech packet. Fix this by checking Marker bit before performing adjustment. Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Related: OS#1801 --- M src/common/l1sap.c 1 file changed, 11 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/99/1399/1 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index cfa02bd..a223729 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -71,16 +71,23 @@ static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); -static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn) +static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan) { + uint32_t samples_passed, r; + + /* do not adjust duration for ONSET RTP packet to avoid timestamp gap + with subsequent SPEECH RTP packet*/ + if (lchan->rtp_tx_marker) + return GSM_RTP_DURATION; + if (last_fn != LCHAN_FN_DUMMY) { /* 12/13 frames usable for audio in TCH, 160 samples per RTP packet, 1 RTP packet per 4 frames */ - uint32_t samples_passed = (fn - last_fn) * 12 * 160 / (13 * 4); + samples_passed = (fn - lchan->tch.last_fn) * 12 * 160 / (13 * 4); /* round number of samples to the nearest multiple of GSM_RTP_DURATION */ - uint32_t r = samples_passed + GSM_RTP_DURATION / 2; + r = samples_passed + GSM_RTP_DURATION / 2; r -= r % GSM_RTP_DURATION; return r; } @@ -912,7 +919,7 @@ /* hand msg to RTP code for transmission */ if (lchan->abis_ip.rtp_socket) osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket, - msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker); + msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker); /* if loopback is enabled, also queue received RTP data */ if (lchan->loopback) { -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 9 14:03:49 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 14:03:49 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/1368/1//COMMIT_MSG Commit Message: Line 9: Make warnings related to common memory-related issues into warnings to "into errors" :) -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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 Fri Dec 9 14:30:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 14:30:13 +0000 Subject: openbsc[master]: oap_client: move logging to DLOAP logging category In-Reply-To: References: Message-ID: Patch Set 1: I certainly don't want to log OAP as DGPRS as before this patch. We could add a DOAP logging category to openbsc, but before you indicated that we shouldn't proliferate logging category explosion. Another way would be to add a logging category arg to the API and pass in DVLR or DGPRS depending on which subsystem uses the GSUP+OAP client; and clearly add to the logging messages that it is GSUP or OAP related. Using DLGSUP and DLOAP is the simplest way for now to get "GSUP"/"OAP" into the logs instead of "GPRS". -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a Gerrit-PatchSet: 1 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 Fri Dec 9 14:51:19 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 9 Dec 2016 14:51:19 +0000 Subject: [PATCH] osmo-bts[master]: DTX: fix TS adjustment for ONSET In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1399 to look at the new patch set (#2). DTX: fix TS adjustment for ONSET Previously timestamp was always adjusted according to FN difference. In case of ONSET event this causes unnecessary TS gap with subsequent speech packet. Fix this by checking Marker bit before performing adjustment. Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Related: OS#1801 --- M src/common/l1sap.c 1 file changed, 12 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/99/1399/2 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index cfa02bd..2bce3b3 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -71,16 +71,23 @@ static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); -static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn) +static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan) { - if (last_fn != LCHAN_FN_DUMMY) { + uint32_t samples_passed, r; + + /* do not adjust duration for ONSET RTP packet to avoid timestamp gap + with subsequent SPEECH RTP packet*/ + if (lchan->rtp_tx_marker) + return GSM_RTP_DURATION; + + if (lchan->tch.last_fn != LCHAN_FN_DUMMY) { /* 12/13 frames usable for audio in TCH, 160 samples per RTP packet, 1 RTP packet per 4 frames */ - uint32_t samples_passed = (fn - last_fn) * 12 * 160 / (13 * 4); + samples_passed = (fn - lchan->tch.last_fn) * 12 * 160 / (13 * 4); /* round number of samples to the nearest multiple of GSM_RTP_DURATION */ - uint32_t r = samples_passed + GSM_RTP_DURATION / 2; + r = samples_passed + GSM_RTP_DURATION / 2; r -= r % GSM_RTP_DURATION; return r; } @@ -912,7 +919,7 @@ /* hand msg to RTP code for transmission */ if (lchan->abis_ip.rtp_socket) osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket, - msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker); + msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker); /* if loopback is enabled, also queue received RTP data */ if (lchan->loopback) { -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c 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 Fri Dec 9 15:11:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 15:11:13 +0000 Subject: [PATCH] libosmocore[master]: doc: fsm timer_cb: explain return value Message-ID: Review at https://gerrit.osmocom.org/1400 doc: fsm timer_cb: explain return value Change-Id: Ic6fbe95737862ed8b8de78058989c8b2ae330006 --- M include/osmocom/core/fsm.h 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/1400/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 9b6072d..fba5497 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -64,7 +64,8 @@ void (*allstate_action)(struct osmo_fsm_inst *fi, uint32_t event, void *data); /*! \breif clean-up function, called during termination */ void (*cleanup)(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause); - /*! \brief timer call-back for states with time-out */ + /*! \brief timer call-back for states with time-out. + * \returns 1 to request termination, 0 to keep running. */ int (*timer_cb)(struct osmo_fsm_inst *fi); /*! \brief logging sub-system for this FSM */ int log_subsys; -- To view, visit https://gerrit.osmocom.org/1400 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic6fbe95737862ed8b8de78058989c8b2ae330006 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:22:06 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 15:22:06 +0000 Subject: libosmocore[master]: cosmetic: gsup: remove copyright from header, tweak 'sysmoco... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1376/1/include/osmocom/gsm/gsup.h File include/osmocom/gsm/gsup.h: Line 3 > As copyright is transferred it is a way to give credit. Are you saying I should keep this copyright notice? -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore 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: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:28:49 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 15:28:49 +0000 Subject: [PATCH] libosmocore[master]: license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmo... 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/1376 to look at the new patch set (#2). license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmocom' In gsup.c/h's copyright notice, 'sysmocom' should be spelled lower case. Notably, the copyright in gsup.h differed from the one in gsup.c: gsup.c names the GNU Affero GPL, gsup.h only the GNU GPL. Change both to GPL. Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 2 files changed, 8 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/1376/2 diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index ed1ef2a..636a112 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -1,6 +1,6 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck +/* (C) 2014 by sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck * (C) 2016 by Harald Welte * All Rights Reserved * diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index c90244a..9208ad6 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,7 +1,7 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ /* - * (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2014 by sysmocom s.f.m.c. GmbH * (C) 2015 by Holger Hans Peter Freyther * (C) 2016 by Harald Welte * All Rights Reserved @@ -9,17 +9,18 @@ * Author: Jacob Erlbeck * * 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 + * 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 Affero General Public License for more details. + * 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 . + * 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. * */ -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore 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 Fri Dec 9 15:28:49 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 15:28:49 +0000 Subject: [PATCH] libosmocore[master]: cosmetic: gsup comments: write 'Generic' for the G in GSUP In-Reply-To: References: Message-ID: Hello Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1377 to look at the new patch set (#2). cosmetic: gsup comments: write 'Generic' for the G in GSUP The G used to mean GPRS, but the scope is larger now. To satisfy the curious reader, give the G a name in gsup files' header comments. BTW, logging.h and gsup_test.c already mentioned "Generic" before this. Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/1377/2 diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index 636a112..e2912a6 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -1,4 +1,4 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ +/* Osmocom Generic Subscriber Update Protocol message encoder/decoder */ /* (C) 2014 by sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck * (C) 2016 by Harald Welte diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index 9208ad6..10398e4 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,4 +1,4 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ +/* Osmocom Generic Subscriber Update Protocol message encoder/decoder */ /* * (C) 2014 by sysmocom s.f.m.c. GmbH -- To view, visit https://gerrit.osmocom.org/1377 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:33:20 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:33:20 +0000 Subject: osmo-bts[master]: DTX: fix TS adjustment for ONSET In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c 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 Fri Dec 9 15:34:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:34:33 +0000 Subject: libosmocore[master]: license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmo... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore 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 Fri Dec 9 15:34:44 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:34:44 +0000 Subject: libosmocore[master]: cosmetic: gsup comments: write 'Generic' for the G in GSUP In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1377 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:35:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:05 +0000 Subject: libosmocore[master]: doc: fsm timer_cb: explain return value In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1400 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic6fbe95737862ed8b8de78058989c8b2ae330006 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 Fri Dec 9 15:35:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:08 +0000 Subject: [MERGED] libosmocore[master]: doc: fsm timer_cb: explain return value In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: doc: fsm timer_cb: explain return value ...................................................................... doc: fsm timer_cb: explain return value Change-Id: Ic6fbe95737862ed8b8de78058989c8b2ae330006 --- M include/osmocom/core/fsm.h 1 file changed, 2 insertions(+), 1 deletion(-) 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 9b6072d..fba5497 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -64,7 +64,8 @@ void (*allstate_action)(struct osmo_fsm_inst *fi, uint32_t event, void *data); /*! \breif clean-up function, called during termination */ void (*cleanup)(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause); - /*! \brief timer call-back for states with time-out */ + /*! \brief timer call-back for states with time-out. + * \returns 1 to request termination, 0 to keep running. */ int (*timer_cb)(struct osmo_fsm_inst *fi); /*! \brief logging sub-system for this FSM */ int log_subsys; -- To view, visit https://gerrit.osmocom.org/1400 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic6fbe95737862ed8b8de78058989c8b2ae330006 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 Fri Dec 9 15:35:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:31 +0000 Subject: [MERGED] openbsc[master]: sgsn_test: Fix missing = in == type check In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: sgsn_test: Fix missing = in == type check ...................................................................... sgsn_test: Fix missing = in == type check Change-Id: I696a7d25d2f4d19922e05a7e83c4aeec5c44fb07 Fixes: Coverity CID 135156 --- M openbsc/tests/sgsn/sgsn_test.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Max: Looks good to me, but someone else must approve Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 789817c..e7b7458 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -627,7 +627,7 @@ /* Inject InsertSubscrData GSUP message */ last_updated_subscr = NULL; rc = rx_gsup_message(insert_data_req, sizeof(insert_data_req)); - OSMO_ASSERT(rc = -ENOTSUP); /* not connected */ + OSMO_ASSERT(rc == -ENOTSUP); /* not connected */ OSMO_ASSERT(last_updated_subscr == s1); /* Inject DeleteSubscrData GSUP message */ -- To view, visit https://gerrit.osmocom.org/1322 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I696a7d25d2f4d19922e05a7e83c4aeec5c44fb07 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:35:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:31 +0000 Subject: [MERGED] openbsc[master]: cfg_bts_si2quater_neigh_add(): Don't call strerror() on nega... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: cfg_bts_si2quater_neigh_add(): Don't call strerror() on negative value ...................................................................... cfg_bts_si2quater_neigh_add(): Don't call strerror() on negative value Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Fixes: Coverity CID 135185 --- M openbsc/src/libbsc/bsc_vty.c 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/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index b9519b4..e3ec8d9 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -2745,7 +2745,7 @@ r = osmo_earfcn_add(e, arfcn, meas); if (r < 0) { - vty_out(vty, "Unable to add arfcn %u: %s%s", arfcn, strerror(r), + vty_out(vty, "Unable to add arfcn %u: %s%s", arfcn, strerror(-r), VTY_NEWLINE); return CMD_WARNING; } -- To view, visit https://gerrit.osmocom.org/1325 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:35:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:32 +0000 Subject: [MERGED] openbsc[master]: mgcp_protocol: Ensure we don't call strtok_r with NULL data In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: mgcp_protocol: Ensure we don't call strtok_r with NULL data ...................................................................... mgcp_protocol: Ensure we don't call strtok_r with NULL data Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Fixes: Coverity CID 135181 --- M openbsc/src/libmgcp/mgcp_protocol.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 2e728cb..18398fc 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -447,6 +447,7 @@ int i = 0; char *elem, *save = NULL; + OSMO_ASSERT(data); pdata->trans = "000000"; for (elem = strtok_r(data, " ", &save); elem; -- To view, visit https://gerrit.osmocom.org/1324 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1dce4df6a49fe95db592b0598194e3a8b8b1b994 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:35:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:32 +0000 Subject: [MERGED] openbsc[master]: bsc_ctrl: Ensure we don't pass NULL string into strtok_r() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bsc_ctrl: Ensure we don't pass NULL string into strtok_r() ...................................................................... bsc_ctrl: Ensure we don't pass NULL string into strtok_r() Change-Id: I03bea132377c0136b55b6fdad99a5d92da12e692 Fixes: Coverity CID 135180 --- M openbsc/src/osmo-bsc/osmo_bsc_ctrl.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index f10a74a..5352bf2 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -605,6 +605,7 @@ char *saveptr = NULL; char *inp, *cic, *alert, *text; + OSMO_ASSERT(cmd); inp = talloc_strdup(cmd, value); cic = strtok_r(inp, ",", &saveptr); -- To view, visit https://gerrit.osmocom.org/1323 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I03bea132377c0136b55b6fdad99a5d92da12e692 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:35:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 15:35:32 +0000 Subject: [MERGED] openbsc[master]: abisip-find: check bsc_fd_register() result In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: abisip-find: check bsc_fd_register() result ...................................................................... abisip-find: check bsc_fd_register() result Change-Id: I72d713725d287d32ec90506099751aeb9b15ef15 Fixes: Coverity CID 70462 --- M openbsc/src/ipaccess/abisip-find.c 1 file changed, 5 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/ipaccess/abisip-find.c b/openbsc/src/ipaccess/abisip-find.c index 9fe7df6..5b36272 100644 --- a/openbsc/src/ipaccess/abisip-find.c +++ b/openbsc/src/ipaccess/abisip-find.c @@ -194,7 +194,11 @@ exit(1); } - osmo_fd_register(&bfd); + rc = osmo_fd_register(&bfd); + if (rc < 0) { + fprintf(stderr, "Cannot register FD\n"); + exit(1); + } timer.cb = timer_cb; timer.data = &bfd; -- To view, visit https://gerrit.osmocom.org/1321 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I72d713725d287d32ec90506099751aeb9b15ef15 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 15:46:52 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 15:46:52 +0000 Subject: [PATCH] libosmocore[master]: license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmo... 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/1376 to look at the new patch set (#3). license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmocom' The copyright in gsup.h differed from the one in gsup.c: gsup.c names the GNU Affero GPL, gsup.h only the GNU GPL. Change both to GPL-v2-or-later. In gsup.c/h's copyright notice, 'sysmocom' should be spelled lower case. Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 2 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/1376/3 diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index ed1ef2a..636a112 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -1,6 +1,6 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck +/* (C) 2014 by sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck * (C) 2016 by Harald Welte * All Rights Reserved * diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index c90244a..b213e30 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,7 +1,7 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ /* - * (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2014 by sysmocom s.f.m.c. GmbH * (C) 2015 by Holger Hans Peter Freyther * (C) 2016 by Harald Welte * All Rights Reserved @@ -9,16 +9,16 @@ * Author: Jacob Erlbeck * * 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 + * 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 Affero General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore 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 Fri Dec 9 15:48:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 15:48:35 +0000 Subject: libosmocore[master]: license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmo... In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 tweaked the GPL text to use the URL instead of the street address and rebased. Thus reinstating the +2. -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 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: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 16:01:32 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 16:01:32 +0000 Subject: openbsc[master]: grps_gsup_*: rename public API to osmo_gsup_ In-Reply-To: References: Message-ID: Patch Set 1: shucks, that's right, how could I forget... -- To view, visit https://gerrit.osmocom.org/1384 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 Gerrit-PatchSet: 1 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 Fri Dec 9 16:14:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 16:14:20 +0000 Subject: [MERGED] libosmocore[master]: cosmetic: gsup comments: write 'Generic' for the G in GSUP In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: cosmetic: gsup comments: write 'Generic' for the G in GSUP ...................................................................... cosmetic: gsup comments: write 'Generic' for the G in GSUP The G used to mean GPRS, but the scope is larger now. To satisfy the curious reader, give the G a name in gsup files' header comments. BTW, logging.h and gsup_test.c already mentioned "Generic" before this. Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index 636a112..e2912a6 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -1,4 +1,4 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ +/* Osmocom Generic Subscriber Update Protocol message encoder/decoder */ /* (C) 2014 by sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck * (C) 2016 by Harald Welte diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index b213e30..22f57ab 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,4 +1,4 @@ -/* Osmocom Subscriber Update Protocol message encoder/decoder */ +/* Osmocom Generic Subscriber Update Protocol message encoder/decoder */ /* * (C) 2014 by sysmocom s.f.m.c. GmbH -- To view, visit https://gerrit.osmocom.org/1377 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6ac5cf94c215e156ceff6a58da3d9e520ca942d9 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: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 16:14:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 16:14:20 +0000 Subject: [MERGED] libosmocore[master]: license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmo... In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmocom' ...................................................................... license: gsup: libosmogsm requires GPL, not AGPL; say 'sysmocom' The copyright in gsup.h differed from the one in gsup.c: gsup.c names the GNU Affero GPL, gsup.h only the GNU GPL. Change both to GPL-v2-or-later. In gsup.c/h's copyright notice, 'sysmocom' should be spelled lower case. Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 2 files changed, 6 insertions(+), 6 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index ed1ef2a..636a112 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -1,6 +1,6 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck +/* (C) 2014 by sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck * (C) 2016 by Harald Welte * All Rights Reserved * diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index c90244a..b213e30 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -1,7 +1,7 @@ /* Osmocom Subscriber Update Protocol message encoder/decoder */ /* - * (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2014 by sysmocom s.f.m.c. GmbH * (C) 2015 by Holger Hans Peter Freyther * (C) 2016 by Harald Welte * All Rights Reserved @@ -9,16 +9,16 @@ * Author: Jacob Erlbeck * * 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 + * 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 Affero General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ -- To view, visit https://gerrit.osmocom.org/1376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia5748c275501889b9086aef7d20ccb5c9edb8031 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: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 9 16:15:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 16:15:13 +0000 Subject: [PATCH] libosmocore[master]: oap: add encode/decode unit test 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/1379 to look at the new patch set (#3). oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 278 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/1379/3 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1aad2e9..8fd591b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test if ENABLE_MSGFILE @@ -131,6 +131,9 @@ gsup_gsup_test_SOURCES = gsup/gsup_test.c gsup_gsup_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la + fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la @@ -172,7 +175,8 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok + oap_oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ + write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..b14e245 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,186 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2016 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + printf("encoded message:\n%s\n", + osmo_hexdump((void*)msgb_l2(msgb), msgb_l2len(msgb))); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { + [DLOAP] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 0, .loglevel = LOGL_DEBUG, + }, +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..9260d44 --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,42 @@ +Testing OAP messages +- Register Request +encoded message: +04 30 02 23 42 +ok +- Register Error +encoded message: +05 02 01 6f +ok +- Register Result +encoded message: +06 +ok +- Challenge Request, no rand, no autn +encoded message: +08 +ok +- Challenge Request, with rand, no autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 +ok +- Challenge Request, no rand, with autn +encoded message: +08 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Request, with rand, with autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Error +encoded message: +09 02 01 17 +ok +- Challenge Result +encoded message: +0a 24 08 01 02 03 04 05 06 07 08 +ok +- Sync Request +encoded message: +0c 25 10 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 01 +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index c01f4af..426c74c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -221,3 +221,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 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 Fri Dec 9 16:15:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 16:15:13 +0000 Subject: [PATCH] libosmocore[master]: import oap message parsing / encoding from openbsc.git, unde... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1375 to look at the new patch set (#3). import oap message parsing / encoding from openbsc.git, under GPL Change the license from AGPLv3 to GPLv2-or-later, correct spelling of 'sysmocom' to lowercase, add '2016' to the copyright. In the process, rename to osmo_* and add API docs, update the copyright. Remove the copyright notice from the .h file as typical in all osmocom headers. A unit test will follow in a subsequent patch, since it needs a minor tweak for decoding of boolean values. The related openbsc change-id is I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf. Tweaked-by: Neels Hofmeyr Change-Id: If5099e60681a215e798b6675f21813f26769c253 --- M Makefile.am A doc/osmocom-authn-protocol.txt M include/Makefile.am M include/osmocom/core/logging.h A include/osmocom/gsm/oap.h M src/gsm/Makefile.am M src/gsm/libosmogsm.map A src/gsm/oap.c 8 files changed, 514 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/1375/3 diff --git a/Makefile.am b/Makefile.am index 185127e..9c901ea 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 doc/osmocom-authn-protocol.txt if HAVE_DOXYGEN diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..1b6794e --- /dev/null +++ b/doc/osmocom-authn-protocol.txt @@ -0,0 +1,250 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +The Osmocom Authentication Protocol employs mutual authentication to register a +client with a server over an IPA connection. Milenage is used as the +authentication algorithm, where client and server have a shared secret. + +For example, an SGSN, as OAP client, may use its SGSN ID to register with a MAP +proxy, an OAP server. + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 (OAP) + +2. Procedures + +Ideal communication sequence: + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "test setup": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "invalid sequence nr": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Sync Request (AUTS) | + |----------------------------------->| + | | + | Challenge (RAND'+AUTN') | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The client sends a REGISTER_REQ message containing an identifier number. + +2.2. Challenge + +The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes +and a milenage authentication token generated from these random bytes, using a +shared secret, to authenticate itself to the OAP client. The server may omit +this challenge entirely, based on its configuration, and immediately reply with +a Register Result response. If the client cannot be registered (e.g. id is +invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the client has received a Challenge, it may verify the server's +authenticity and validity of the sequence number (included in AUTN), and, if +valid, reply with a CHALLENGE_RES message. This shall contain an XRES +authentication token generated by milenage from the same random bytes received +from the server and the same shared secet. If the client decides to cancel the +registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a +CHALLENGE_ERR message may be sent, but is not mandatory. For example, the +client may directly start with a new REGISTER_REQ message. + +2.4. Sync Request + +When the client has received a Challenge but sees an invalid sequence number +(embedded in AUTN, according to the milenage algorithm), the client may send a +SYNC_REQ message containing an AUTS synchronisation token. + +2.5. Sync Result + +If the server has received a valid Sync Request, it shall answer by directly +sending another Challenge (see 2.2.). If an invalid Sync Request is received, +the server shall reply with a REGISTER_ERR message. + +2.6. Register Result + +The server sends a REGISTER_RES message to indicate that registration has been +successful. If the server cannot register the client (e.g. invalid challenge +response), it shall send a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 Client ID big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 XRES octet string (8) M TLV 10 + +3.2.3. Sync Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 AUTS octet string (16) M TLV 18 + +3.2.4. Sync Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + | 0 0 0 0 1 1 0 0 - Sync Request | + | 0 0 0 0 1 1 0 1 - Sync Error (not used) | + | 0 0 0 0 1 1 1 0 - Sync Result (not used) | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x23 AUTN octet string | + | 0x24 XRES octet string | + | 0x25 AUTS octet string | + | 0x30 Client ID big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. Client ID + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | Client ID IEI | octet 1 + +-----------------------------------------------------+ + | Length of Client ID IE contents (2) | octet 2 + +-----------------------------------------------------+ + | Client ID number, most significant byte | octet 3 + +-----------------------------------------------------+ + | Client ID number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The Client ID number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset ID. + diff --git a/include/Makefile.am b/include/Makefile.am index c125691..0a300a8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -82,6 +82,7 @@ osmocom/gsm/mncc.h \ osmocom/gsm/prim.h \ osmocom/gsm/l1sap.h \ + osmocom/gsm/oap.h \ osmocom/gsm/protocol/gsm_03_40.h \ osmocom/gsm/protocol/gsm_03_41.h \ osmocom/gsm/protocol/gsm_04_08.h \ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..f9c58bb 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -92,7 +92,8 @@ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ #define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ -#define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ +#define DLOAP 12 /*!< Osmocom Authentication Protocol */ +#define OSMO_NUM_DLIB 12 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ struct log_category { diff --git a/include/osmocom/gsm/oap.h b/include/osmocom/gsm/oap.h new file mode 100644 index 0000000..d973013 --- /dev/null +++ b/include/osmocom/gsm/oap.h @@ -0,0 +1,72 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#pragma once + +#include +#include +#include + +/*! \brief Information Element Identifiers for OAP IEs. + * They match osmo_gsup_iei (so far). */ +enum osmo_oap_iei { + OAP_CAUSE_IE = 0x02, + OAP_RAND_IE = 0x20, + OAP_AUTN_IE = 0x23, + OAP_XRES_IE = 0x24, + OAP_AUTS_IE = 0x25, + OAP_CLIENT_ID_IE = 0x30, +}; + +/*! \brief OAP message types */ +enum osmo_oap_message_type { + OAP_MSGT_REGISTER_REQUEST = 0b00000100, + OAP_MSGT_REGISTER_ERROR = 0b00000101, + OAP_MSGT_REGISTER_RESULT = 0b00000110, + + OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + OAP_MSGT_CHALLENGE_RESULT = 0b00001010, + + OAP_MSGT_SYNC_REQUEST = 0b00001100, + OAP_MSGT_SYNC_ERROR = 0b00001101, + OAP_MSGT_SYNC_RESULT = 0b00001110, +}; + +/*! \brief Parsed/decoded OAP protocol message */ +struct osmo_oap_message { + enum osmo_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t client_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int xres_present; + uint8_t xres[8]; + int auts_present; + uint8_t auts[16]; +}; + +int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, + size_t data_len); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3877f78..4ea55e1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -22,7 +22,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 + gsup.c gprs_gea.c gsm0503_conv.c oap.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3e7333c..a3d224f 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -356,5 +356,8 @@ osmo_gsup_encode; osmo_gsup_decode; +osmo_oap_encode; +osmo_oap_decode; + local: *; }; diff --git a/src/gsm/oap.c b/src/gsm/oap.c new file mode 100644 index 0000000..979bde6 --- /dev/null +++ b/src/gsm/oap.c @@ -0,0 +1,184 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#include +#include +#include +#include +#include + +#include + +/*! \brief Decode OAP message data. + * \param[out] oap_msg Parsed data is written to this instance. + * \param[in] data Pointer to the data buffer containing the OAP message. + * \param[in] data_len Length of the OAP message data. + * \returns 0 on success, a negative cause value on failure. + */ +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *const_data, size_t data_len) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + + memset(oap_msg, 0, sizeof(*oap_msg)); + + /* message type */ + rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = osmo_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum osmo_oap_iei iei; + + rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case OAP_CLIENT_ID_IE: + if (value_len != 2) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->client_id = osmo_decode_big_endian(value, value_len); + + if (oap_msg->client_id == 0) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d): client ID must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case OAP_XRES_IE: + if (value_len != sizeof(oap_msg->xres)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type XRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->xres, value, value_len); + oap_msg->xres_present = value_len; + break; + + case OAP_AUTS_IE: + if (value_len != sizeof(oap_msg->auts)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTS (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->auts, value, value_len); + oap_msg->auts_present = value_len; + break; + + case OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DLOAP, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +/*! \brief Compose OAP message data. + * \param[out] msg OAP message data is appended to this message buffer. + * \param[in] oap_msg Elements to encode in the message data. + */ +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, (uint8_t)oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->client_id > 0) + msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), + osmo_encode_big_endian(oap_msg->client_id, + sizeof(oap_msg->client_id))); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->auts_present) + msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); + + if (oap_msg->xres_present) + msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); + + msg->l2h = msg->data; +} -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Fri Dec 9 16:26:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 16:26:09 +0000 Subject: [MERGED] openbsc[master]: gsm0408_test.c: Don't pass negative value to strerror() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm0408_test.c: Don't pass negative value to strerror() ...................................................................... gsm0408_test.c: Don't pass negative value to strerror() Change-Id: I4fcf24ec1bc974a3189486d2372b9713d7fdab70 Fixes: Coverity CID 135192 --- M openbsc/tests/gsm0408/gsm0408_test.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 9e7babb..ae8cbdd 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -89,7 +89,7 @@ { int r = osmo_earfcn_add(e, earfcn, bw); if (r) - printf("failed to add EARFCN %u: %s\n", earfcn, strerror(r)); + printf("failed to add EARFCN %u: %s\n", earfcn, strerror(-r)); else printf("added EARFCN %u - ", earfcn); } -- To view, visit https://gerrit.osmocom.org/1327 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4fcf24ec1bc974a3189486d2372b9713d7fdab70 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 9 16:26:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 16:26:24 +0000 Subject: [MERGED] openbsc[master]: channel_mode_from_lchan(): Add missing break statement In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: channel_mode_from_lchan(): Add missing break statement ...................................................................... channel_mode_from_lchan(): Add missing break statement GSM48_CMODE_DATA_6k0 was not properly terminated and thus resulted in a bug. Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Fixes: Coverity CID 148207 --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 1 insertion(+), 0 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/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 2c016a6..8a6b111 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -453,6 +453,7 @@ lchan->csd_mode); return -EINVAL; } + break; default: LOGP(DRSL, LOGL_ERROR, "unsupported lchan->tch_mode %u\n", -- To view, visit https://gerrit.osmocom.org/1328 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 9 17:00:15 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 17:00:15 +0000 Subject: [PATCH] libosmocore[master]: Fix msgb_test on 64 bit architectures Message-ID: Review at https://gerrit.osmocom.org/1401 Fix msgb_test on 64 bit architectures truncating the unsigned long pointer msg->data to 'int' and then passin git into msgb_resize_area() is unsafe as depending on the 32rd address bit it will be eiether negative or positive. That will in turn change the expected "Sub area is not fully contained in the msg data\n" error message into "Negative sizes are not allowed\n" which is not what the autotest case expects. Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa --- M tests/msgb/msgb_test.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/01/1401/1 diff --git a/tests/msgb/msgb_test.c b/tests/msgb/msgb_test.c index a726ef4..ac10382 100644 --- a/tests/msgb/msgb_test.c +++ b/tests/msgb/msgb_test.c @@ -195,7 +195,7 @@ OSMO_ASSERT(e != 0); if (OSMO_PANIC_TRY(&e)) - msgb_resize_area(msg, NULL, (int)msg->data, 0); + msgb_resize_area(msg, NULL, 0, 0); OSMO_ASSERT(e != 0); if (OSMO_PANIC_TRY(&e)) -- To view, visit https://gerrit.osmocom.org/1401 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 9 17:06:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 17:06:19 +0000 Subject: libosmocore[master]: Fix msgb_test on 64 bit architectures In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1401 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa 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 Dec 9 17:06:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 17:06:39 +0000 Subject: [MERGED] libosmocore[master]: Fix msgb_test on 64 bit architectures In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix msgb_test on 64 bit architectures ...................................................................... Fix msgb_test on 64 bit architectures truncating the unsigned long pointer msg->data to 'int' and then passin git into msgb_resize_area() is unsafe as depending on the 32rd address bit it will be eiether negative or positive. That will in turn change the expected "Sub area is not fully contained in the msg data\n" error message into "Negative sizes are not allowed\n" which is not what the autotest case expects. Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa --- M tests/msgb/msgb_test.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/msgb/msgb_test.c b/tests/msgb/msgb_test.c index a726ef4..ac10382 100644 --- a/tests/msgb/msgb_test.c +++ b/tests/msgb/msgb_test.c @@ -195,7 +195,7 @@ OSMO_ASSERT(e != 0); if (OSMO_PANIC_TRY(&e)) - msgb_resize_area(msg, NULL, (int)msg->data, 0); + msgb_resize_area(msg, NULL, 0, 0); OSMO_ASSERT(e != 0); if (OSMO_PANIC_TRY(&e)) -- To view, visit https://gerrit.osmocom.org/1401 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa 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 Dec 9 17:06:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 17:06:39 +0000 Subject: [MERGED] libosmocore[master]: gsmtap: Add defintions for GSMTAP based remote logging In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsmtap: Add defintions for GSMTAP based remote logging ...................................................................... gsmtap: Add defintions for GSMTAP based remote logging Often it is useful to have log statements from the osmocom programs synchronized with protocol traces. So rather than having to open the pcap file with GSMTAP or other protocol data side-by-side with the textual log of one or more network elements, we simply pass the log lines around as GSMTAP messages, which can then be displayed in-order and interspersed with the protocol messages inside wireshark. Change-Id: I33ab530e10ef0311b6f80b731e61894f20b4b3e7 --- M include/osmocom/core/gsmtap.h 1 file changed, 19 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/gsmtap.h b/include/osmocom/core/gsmtap.h index c35582e..bcfc7bd 100644 --- a/include/osmocom/core/gsmtap.h +++ b/include/osmocom/core/gsmtap.h @@ -45,6 +45,7 @@ #define GSMTAP_TYPE_LTE_RRC 0x0d /* LTE interface */ #define GSMTAP_TYPE_LTE_MAC 0x0e /* LTE MAC interface */ #define GSMTAP_TYPE_LTE_MAC_FRAMED 0x0f /* LTE MAC with context hdr */ +#define GSMTAP_TYPE_OSMOCORE_LOG 0x10 /* libosmocore logging */ /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ @@ -255,3 +256,21 @@ uint8_t res; /*!< reserved for future use (RFU) */ } __attribute__((packed)); + +/*! \brief Structure of the GTMTAP libosmocore logging header */ +struct gsmtap_osmocore_log_hdr { + struct { + uint32_t sec; + uint32_t usec; + } ts; + char proc_name[16]; /*!< name of process */ + uint32_t pid; /*!< process ID */ + uint8_t level; /*!< logging level */ + uint8_t _pad[3]; + /* TODO: color */ + char subsys[16]; /*!< logging sub-system */ + struct { + char name[32]; /*!< source file name */ + uint32_t line_nr;/*!< line number */ + } src_file; +} __attribute__((packed)); -- To view, visit https://gerrit.osmocom.org/1356 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I33ab530e10ef0311b6f80b731e61894f20b4b3e7 Gerrit-PatchSet: 3 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 Dec 9 17:08:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 17:08:30 +0000 Subject: [MERGED] libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Implement GSMTAP log target ...................................................................... Implement GSMTAP log target This target wraps the to-be-logged string (With metadata) into a GSMTAP packet and sends it to the configured destination address. Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 --- M TODO-RELEASE M include/osmocom/core/logging.h M src/Makefile.am M src/logging.c A src/logging_gsmtap.c M src/vty/logging_vty.c 6 files changed, 184 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/TODO-RELEASE b/TODO-RELEASE index 648b6a6..17f6521 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -4,3 +4,4 @@ libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker +libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..ad775b9 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -9,6 +9,7 @@ #include #include #include +#include #include /*! \brief Maximum number of logging contexts */ @@ -122,6 +123,7 @@ struct log_info; struct vty; +struct gsmtap_inst; typedef void log_print_filters(struct vty *vty, const struct log_info *info, @@ -156,6 +158,7 @@ LOG_TGT_TYPE_FILE, /*!< \brief text file logging */ LOG_TGT_TYPE_STDERR, /*!< \brief stderr logging */ LOG_TGT_TYPE_STRRB, /*!< \brief osmo_strrb-backed logging */ + LOG_TGT_TYPE_GSMTAP, /*!< \brief GSMTAP network logging */ }; /*! \brief structure representing a logging target */ @@ -204,6 +207,12 @@ struct { void *rb; } tgt_rb; + + struct { + struct gsmtap_inst *gsmtap_inst; + const char *ident; + const char *hostname; + } tgt_gsmtap; }; /*! \brief call-back function to be called when the logging framework @@ -254,6 +263,7 @@ void log_set_print_category(struct log_target *target, int); void log_set_log_level(struct log_target *target, int log_level); void log_parse_category_mask(struct log_target *target, const char* mask); +const char* log_category_name(int subsys); int log_parse_level(const char *lvl); const char *log_level_str(unsigned int lvl); int log_parse_category(const char *category); @@ -267,6 +277,10 @@ struct log_target *log_target_create_file(const char *fname); struct log_target *log_target_create_syslog(const char *ident, int option, int facility); +struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, + const char *ident, + bool ofd_wq_mode, + bool add_sink); int log_target_file_reopen(struct log_target *tgt); int log_targets_reopen(void); diff --git a/src/Makefile.am b/src/Makefile.am index 74bdb21..6a9c675 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ libosmocore_la_SOURCES = timer.c timer_gettimeofday.c select.c signal.c msgb.c bits.c \ bitvec.c bitcomp.c statistics.c fsm.c \ write_queue.c utils.c socket.c \ - logging.c logging_syslog.c rate_ctr.c \ + logging.c logging_syslog.c logging_gsmtap.c rate_ctr.c \ gsmtap_util.c crc16.c panic.c backtrace.c \ conv.c application.c rbtree.c strrb.c \ loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \ diff --git a/src/logging.c b/src/logging.c index 165d822..1516a7d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -240,7 +240,7 @@ return NULL; } -static const char* category_name(int subsys) +const char* log_category_name(int subsys) { if (subsys < osmo_log_info->num_cat) return osmo_log_info->cat[subsys].name; @@ -290,7 +290,7 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } if (target->print_category) { - ret = snprintf(buf + offset, rem, "%s ", category_name(subsys)); + ret = snprintf(buf + offset, rem, "%s ", log_category_name(subsys)); if (ret < 0) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); diff --git a/src/logging_gsmtap.c b/src/logging_gsmtap.c new file mode 100644 index 0000000..85f8c28 --- /dev/null +++ b/src/logging_gsmtap.c @@ -0,0 +1,134 @@ +/* GSMTAP network logging support code */ + +/* (C) 2016 by Harald Welte + * 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. + * + */ + +/*! \addtogroup logging + * @{ + */ + +/*! \file logging_gsmtap.c */ + +#include "../config.h" + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STRINGS_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +#define GSMTAP_LOG_MAX_SIZE 4096 + +static void _gsmtap_raw_output(struct log_target *target, int subsys, + unsigned int level, const char *file, + int line, int cont, const char *format, + va_list ap) +{ + struct msgb *msg; + struct gsmtap_hdr *gh; + struct gsmtap_osmocore_log_hdr *golh; + const char *subsys_name = log_category_name(subsys); + struct timeval tv; + int rc; + + /* get timestamp ASAP */ + osmo_gettimeofday(&tv, NULL); + + msg = msgb_alloc(sizeof(*gh)+sizeof(*golh)+GSMTAP_LOG_MAX_SIZE, + "GSMTAP logging"); + + /* GSMTAP header */ + gh = (struct gsmtap_hdr *) msgb_put(msg, sizeof(*gh)); + memset(gh, 0, sizeof(*gh)); + gh->version = GSMTAP_VERSION; + gh->hdr_len = sizeof(*gh)/4; + gh->type = GSMTAP_TYPE_OSMOCORE_LOG; + + /* Logging header */ + golh = (struct gsmtap_osmocore_log_hdr *) msgb_put(msg, sizeof(*golh)); + osmo_strlcpy(golh->proc_name, target->tgt_gsmtap.ident, + sizeof(golh->proc_name)); + if (subsys_name) + osmo_strlcpy(golh->subsys, subsys_name+1, sizeof(golh->subsys)); + else + golh->subsys[0] = '\0'; + osmo_strlcpy(golh->src_file.name, file, sizeof(golh->src_file.name)); + golh->src_file.line_nr = htonl(line); + golh->level = level; + /* we always store the timestamp in the message, irrespective + * of hat prrint_[ext_]timestamp say */ + golh->ts.sec = htonl(tv.tv_sec); + golh->ts.usec = htonl(tv.tv_usec); + + rc = vsnprintf((char *) msg->tail, msgb_tailroom(msg), format, ap); + if (rc < 0) + return; + msgb_put(msg, rc); + + gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg); +} + +/*! \brief Create a new logging target for GSMTAP logging + * \param[in] ident string identifier + * \returns Log target in case of success, NULL in case of error + */ +struct log_target *log_target_create_gsmtap(const char *host, uint16_t port, + const char *ident, + bool ofd_wq_mode, + bool add_sink) +{ + struct log_target *target; + struct gsmtap_inst *gti; + + target = log_target_create(); + if (!target) + return NULL; + + gti = gsmtap_source_init(host, port, ofd_wq_mode); + if (!gti) { + log_target_destroy(target); + return NULL; + } + + if (add_sink) + gsmtap_source_add_sink(gti); + + target->tgt_gsmtap.gsmtap_inst = gti; + target->tgt_gsmtap.ident = talloc_strdup(target, ident); + target->tgt_gsmtap.hostname = talloc_strdup(target, host); + + target->type = LOG_TGT_TYPE_GSMTAP; + target->raw_output = _gsmtap_raw_output; + + return target; +} + +/* @} */ diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index d2fca81..cf3ec21 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -498,6 +499,32 @@ } #endif /* HAVE_SYSLOG_H */ +DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd, + "log gsmtap [HOSTNAME]", + LOG_STR "Logging via GSMTAP\n") +{ + const char *hostname = argv[0]; + struct log_target *tgt; + + tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); + if (!tgt) { + tgt = log_target_create_gsmtap(hostname, GSMTAP_UDP_PORT, + host.app_info->name, false, + true); + if (!tgt) { + vty_out(vty, "%% Unable to create GSMTAP log%s", + VTY_NEWLINE); + return CMD_WARNING; + } + log_add_target(tgt); + } + + vty->index = tgt; + vty->node = CFG_LOG_NODE; + + return CMD_SUCCESS; +} + DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, "log stderr", LOG_STR "Logging via STDERR of the process\n") @@ -652,6 +679,10 @@ vty_out(vty, "log alarms %zu%s", log_target_rb_avail_size(tgt), VTY_NEWLINE); break; + case LOG_TGT_TYPE_GSMTAP: + vty_out(vty, "log gsmtap %s%s", + tgt->tgt_gsmtap.hostname, VTY_NEWLINE); + break; } vty_out(vty, " logging filter all %u%s", @@ -744,4 +775,5 @@ install_element(CONFIG_NODE, &cfg_log_syslog_local_cmd); install_element(CONFIG_NODE, &cfg_no_log_syslog_cmd); #endif + install_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); } -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 9 17:15:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 9 Dec 2016 17:15:33 +0000 Subject: libosmocore[master]: Implement GSMTAP log target In-Reply-To: References: Message-ID: Patch Set 4: for the record, the wireshark patch has been submitted at https://code.wireshark.org/review/#/c/19183/ and has change-id I0de723445e5b5ce0199a4081808111240a9ed047 in their gerrit. -- To view, visit https://gerrit.osmocom.org/1357 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 9 19:30:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 19:30:23 +0000 Subject: [PATCH] libosmocore[master]: gsm/oap: more robust: decode presence as clearly either 1 or 0 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/1378 to look at the new patch set (#3). gsm/oap: more robust: decode presence as clearly either 1 or 0 Prepares for the unit test, which can now simply check for encode/decode identity. Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 --- M src/gsm/oap.c 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/1378/3 diff --git a/src/gsm/oap.c b/src/gsm/oap.c index 979bde6..1494a6a 100644 --- a/src/gsm/oap.c +++ b/src/gsm/oap.c @@ -92,7 +92,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->autn, value, value_len); - oap_msg->autn_present = value_len; + oap_msg->autn_present = value_len ? 1 : 0; break; case OAP_RAND_IE: @@ -103,7 +103,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->rand, value, value_len); - oap_msg->rand_present = value_len; + oap_msg->rand_present = value_len ? 1 : 0; break; case OAP_XRES_IE: @@ -114,7 +114,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->xres, value, value_len); - oap_msg->xres_present = value_len; + oap_msg->xres_present = value_len ? 1 : 0; break; case OAP_AUTS_IE: @@ -125,7 +125,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->auts, value, value_len); - oap_msg->auts_present = value_len; + oap_msg->auts_present = value_len ? 1 : 0; break; case OAP_CAUSE_IE: -- To view, visit https://gerrit.osmocom.org/1378 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 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 Fri Dec 9 19:30:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 19:30:23 +0000 Subject: [PATCH] libosmocore[master]: oap: add encode/decode unit test 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/1379 to look at the new patch set (#4). oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 278 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/1379/4 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1aad2e9..8fd591b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test if ENABLE_MSGFILE @@ -131,6 +131,9 @@ gsup_gsup_test_SOURCES = gsup/gsup_test.c gsup_gsup_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la + fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la @@ -172,7 +175,8 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok + oap_oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ + write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..b14e245 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,186 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2016 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + printf("encoded message:\n%s\n", + osmo_hexdump((void*)msgb_l2(msgb), msgb_l2len(msgb))); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { + [DLOAP] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 0, .loglevel = LOGL_DEBUG, + }, +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..9260d44 --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,42 @@ +Testing OAP messages +- Register Request +encoded message: +04 30 02 23 42 +ok +- Register Error +encoded message: +05 02 01 6f +ok +- Register Result +encoded message: +06 +ok +- Challenge Request, no rand, no autn +encoded message: +08 +ok +- Challenge Request, with rand, no autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 +ok +- Challenge Request, no rand, with autn +encoded message: +08 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Request, with rand, with autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Error +encoded message: +09 02 01 17 +ok +- Challenge Result +encoded message: +0a 24 08 01 02 03 04 05 06 07 08 +ok +- Sync Request +encoded message: +0c 25 10 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 01 +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index c01f4af..426c74c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -221,3 +221,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 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 Fri Dec 9 19:30:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 19:30:23 +0000 Subject: [PATCH] libosmocore[master]: doc: osmocom-authn-protocol.txt: fix numbering, mark unused ... 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/1380 to look at the new patch set (#4). doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a --- M doc/osmocom-authn-protocol.txt 1 file changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/1380/4 diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt index 1b6794e..6d057be 100644 --- a/doc/osmocom-authn-protocol.txt +++ b/doc/osmocom-authn-protocol.txt @@ -142,14 +142,14 @@ 02 Cause GMM cause, M TLV 3 04.08: 10.5.5.14 -3.2.6. Register Result +3.2.3. Register Result Server -> Client IEI Info Element Type Pres. Format Length Message type 4.2.1 M V 1 -3.2.3. Challenge +3.2.4. Challenge Server -> Client @@ -158,7 +158,7 @@ 20 RAND octet string (16) M TLV 18 23 AUTN octet string (16) M TLV 18 -3.2.4. Challenge Error +3.2.5. Challenge Error Client -> Server @@ -167,7 +167,7 @@ 02 Cause GMM cause, M TLV 3 04.08: 10.5.5.14 -3.2.5. Challenge Result +3.2.6. Challenge Result Client -> Server @@ -175,7 +175,7 @@ Message type 4.2.1 M V 1 21 XRES octet string (8) M TLV 10 -3.2.3. Sync Request +3.2.7. Sync Request Client -> Server @@ -183,14 +183,14 @@ Message type 4.2.1 M V 1 20 AUTS octet string (16) M TLV 18 -3.2.4. Sync Error +3.2.8. Sync Error -Server -> Client +Not used. - IEI Info Element Type Pres. Format Length - Message type 4.2.1 M V 1 - 02 Cause GMM cause, M TLV 3 - 04.08: 10.5.5.14 +3.2.9. Sync Result + +Not used. + 4. Information Elements -- To view, visit https://gerrit.osmocom.org/1380 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a 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 Fri Dec 9 19:30:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 19:30:23 +0000 Subject: [PATCH] libosmocore[master]: import oap message parsing / encoding from openbsc.git; AGPL... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1375 to look at the new patch set (#4). import oap message parsing / encoding from openbsc.git; AGPL->GPL Change the license from AGPLv3 to GPLv2-or-later, correct spelling of 'sysmocom' to lowercase, add '2016' to the copyright. In the process, rename to osmo_* and add API docs, update the copyright. A unit test will follow in a subsequent patch, since it needs a minor tweak for decoding of boolean values. The related openbsc change-id is I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf. Tweaked-by: Neels Hofmeyr Change-Id: If5099e60681a215e798b6675f21813f26769c253 --- M Makefile.am A doc/osmocom-authn-protocol.txt M include/Makefile.am M include/osmocom/core/logging.h A include/osmocom/gsm/oap.h M src/gsm/Makefile.am M src/gsm/libosmogsm.map A src/gsm/oap.c 8 files changed, 514 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/1375/4 diff --git a/Makefile.am b/Makefile.am index 185127e..9c901ea 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 doc/osmocom-authn-protocol.txt if HAVE_DOXYGEN diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..1b6794e --- /dev/null +++ b/doc/osmocom-authn-protocol.txt @@ -0,0 +1,250 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +The Osmocom Authentication Protocol employs mutual authentication to register a +client with a server over an IPA connection. Milenage is used as the +authentication algorithm, where client and server have a shared secret. + +For example, an SGSN, as OAP client, may use its SGSN ID to register with a MAP +proxy, an OAP server. + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 (OAP) + +2. Procedures + +Ideal communication sequence: + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "test setup": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "invalid sequence nr": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Sync Request (AUTS) | + |----------------------------------->| + | | + | Challenge (RAND'+AUTN') | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The client sends a REGISTER_REQ message containing an identifier number. + +2.2. Challenge + +The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes +and a milenage authentication token generated from these random bytes, using a +shared secret, to authenticate itself to the OAP client. The server may omit +this challenge entirely, based on its configuration, and immediately reply with +a Register Result response. If the client cannot be registered (e.g. id is +invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the client has received a Challenge, it may verify the server's +authenticity and validity of the sequence number (included in AUTN), and, if +valid, reply with a CHALLENGE_RES message. This shall contain an XRES +authentication token generated by milenage from the same random bytes received +from the server and the same shared secet. If the client decides to cancel the +registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a +CHALLENGE_ERR message may be sent, but is not mandatory. For example, the +client may directly start with a new REGISTER_REQ message. + +2.4. Sync Request + +When the client has received a Challenge but sees an invalid sequence number +(embedded in AUTN, according to the milenage algorithm), the client may send a +SYNC_REQ message containing an AUTS synchronisation token. + +2.5. Sync Result + +If the server has received a valid Sync Request, it shall answer by directly +sending another Challenge (see 2.2.). If an invalid Sync Request is received, +the server shall reply with a REGISTER_ERR message. + +2.6. Register Result + +The server sends a REGISTER_RES message to indicate that registration has been +successful. If the server cannot register the client (e.g. invalid challenge +response), it shall send a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 Client ID big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 XRES octet string (8) M TLV 10 + +3.2.3. Sync Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 AUTS octet string (16) M TLV 18 + +3.2.4. Sync Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + | 0 0 0 0 1 1 0 0 - Sync Request | + | 0 0 0 0 1 1 0 1 - Sync Error (not used) | + | 0 0 0 0 1 1 1 0 - Sync Result (not used) | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x23 AUTN octet string | + | 0x24 XRES octet string | + | 0x25 AUTS octet string | + | 0x30 Client ID big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. Client ID + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | Client ID IEI | octet 1 + +-----------------------------------------------------+ + | Length of Client ID IE contents (2) | octet 2 + +-----------------------------------------------------+ + | Client ID number, most significant byte | octet 3 + +-----------------------------------------------------+ + | Client ID number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The Client ID number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset ID. + diff --git a/include/Makefile.am b/include/Makefile.am index c125691..0a300a8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -82,6 +82,7 @@ osmocom/gsm/mncc.h \ osmocom/gsm/prim.h \ osmocom/gsm/l1sap.h \ + osmocom/gsm/oap.h \ osmocom/gsm/protocol/gsm_03_40.h \ osmocom/gsm/protocol/gsm_03_41.h \ osmocom/gsm/protocol/gsm_04_08.h \ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 581ebce..f9c58bb 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -92,7 +92,8 @@ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ #define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ -#define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ +#define DLOAP 12 /*!< Osmocom Authentication Protocol */ +#define OSMO_NUM_DLIB 12 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ struct log_category { diff --git a/include/osmocom/gsm/oap.h b/include/osmocom/gsm/oap.h new file mode 100644 index 0000000..d973013 --- /dev/null +++ b/include/osmocom/gsm/oap.h @@ -0,0 +1,72 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#pragma once + +#include +#include +#include + +/*! \brief Information Element Identifiers for OAP IEs. + * They match osmo_gsup_iei (so far). */ +enum osmo_oap_iei { + OAP_CAUSE_IE = 0x02, + OAP_RAND_IE = 0x20, + OAP_AUTN_IE = 0x23, + OAP_XRES_IE = 0x24, + OAP_AUTS_IE = 0x25, + OAP_CLIENT_ID_IE = 0x30, +}; + +/*! \brief OAP message types */ +enum osmo_oap_message_type { + OAP_MSGT_REGISTER_REQUEST = 0b00000100, + OAP_MSGT_REGISTER_ERROR = 0b00000101, + OAP_MSGT_REGISTER_RESULT = 0b00000110, + + OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + OAP_MSGT_CHALLENGE_RESULT = 0b00001010, + + OAP_MSGT_SYNC_REQUEST = 0b00001100, + OAP_MSGT_SYNC_ERROR = 0b00001101, + OAP_MSGT_SYNC_RESULT = 0b00001110, +}; + +/*! \brief Parsed/decoded OAP protocol message */ +struct osmo_oap_message { + enum osmo_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t client_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int xres_present; + uint8_t xres[8]; + int auts_present; + uint8_t auts[16]; +}; + +int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, + size_t data_len); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3877f78..4ea55e1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -22,7 +22,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 + gsup.c gprs_gea.c gsm0503_conv.c oap.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3e7333c..a3d224f 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -356,5 +356,8 @@ osmo_gsup_encode; osmo_gsup_decode; +osmo_oap_encode; +osmo_oap_decode; + local: *; }; diff --git a/src/gsm/oap.c b/src/gsm/oap.c new file mode 100644 index 0000000..979bde6 --- /dev/null +++ b/src/gsm/oap.c @@ -0,0 +1,184 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#include +#include +#include +#include +#include + +#include + +/*! \brief Decode OAP message data. + * \param[out] oap_msg Parsed data is written to this instance. + * \param[in] data Pointer to the data buffer containing the OAP message. + * \param[in] data_len Length of the OAP message data. + * \returns 0 on success, a negative cause value on failure. + */ +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *const_data, size_t data_len) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + + memset(oap_msg, 0, sizeof(*oap_msg)); + + /* message type */ + rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = osmo_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum osmo_oap_iei iei; + + rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case OAP_CLIENT_ID_IE: + if (value_len != 2) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->client_id = osmo_decode_big_endian(value, value_len); + + if (oap_msg->client_id == 0) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d): client ID must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case OAP_XRES_IE: + if (value_len != sizeof(oap_msg->xres)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type XRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->xres, value, value_len); + oap_msg->xres_present = value_len; + break; + + case OAP_AUTS_IE: + if (value_len != sizeof(oap_msg->auts)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTS (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->auts, value, value_len); + oap_msg->auts_present = value_len; + break; + + case OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DLOAP, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +/*! \brief Compose OAP message data. + * \param[out] msg OAP message data is appended to this message buffer. + * \param[in] oap_msg Elements to encode in the message data. + */ +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, (uint8_t)oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->client_id > 0) + msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), + osmo_encode_big_endian(oap_msg->client_id, + sizeof(oap_msg->client_id))); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->auts_present) + msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); + + if (oap_msg->xres_present) + msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); + + msg->l2h = msg->data; +} -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Fri Dec 9 19:45:03 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 9 Dec 2016 19:45:03 +0000 Subject: [PATCH] libosmocore[master]: oap: add encode/decode unit test 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/1379 to look at the new patch set (#6). oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 278 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/1379/6 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1aad2e9..b9eb8f2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test if ENABLE_MSGFILE @@ -131,6 +131,9 @@ gsup_gsup_test_SOURCES = gsup/gsup_test.c gsup_gsup_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la + fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la @@ -172,7 +175,8 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok + oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ + write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..b14e245 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,186 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2016 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + printf("encoded message:\n%s\n", + osmo_hexdump((void*)msgb_l2(msgb), msgb_l2len(msgb))); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { + [DLOAP] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 0, .loglevel = LOGL_DEBUG, + }, +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..9260d44 --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,42 @@ +Testing OAP messages +- Register Request +encoded message: +04 30 02 23 42 +ok +- Register Error +encoded message: +05 02 01 6f +ok +- Register Result +encoded message: +06 +ok +- Challenge Request, no rand, no autn +encoded message: +08 +ok +- Challenge Request, with rand, no autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 +ok +- Challenge Request, no rand, with autn +encoded message: +08 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Request, with rand, with autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Error +encoded message: +09 02 01 17 +ok +- Challenge Result +encoded message: +0a 24 08 01 02 03 04 05 06 07 08 +ok +- Sync Request +encoded message: +0c 25 10 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 01 +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index c01f4af..426c74c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -221,3 +221,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 Gerrit-PatchSet: 6 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 Sat Dec 10 14:45:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 14:45:12 +0000 Subject: [PATCH] openbsc[master]: add gsup_test_client program 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/1382 to look at the new patch set (#2). add gsup_test_client program Related: OS#1592 Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 --- M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gprs_gsup_client.c A openbsc/src/gprs/gsup_test_client.c 3 files changed, 319 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/82/1382/2 diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index d228b39..a827b77 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -37,6 +37,7 @@ $(NULL) bin_PROGRAMS = \ + gsup_test_client \ osmo-gbproxy \ $(NULL) if HAVE_LIBGTP @@ -133,3 +134,16 @@ $(LIBGTP_LIBS) \ -lrt \ $(NULL) + +gsup_test_client_SOURCES = \ + gprs_gsup_client.c \ + gsup_test_client.c \ + oap.c \ + $(NULL) +gsup_test_client_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + -lrt \ + $(NULL) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index a4aca09..deaf156 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -25,6 +25,7 @@ #include #include #include +#include #include diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c new file mode 100644 index 0000000..5f123b8 --- /dev/null +++ b/openbsc/src/gprs/gsup_test_client.c @@ -0,0 +1,304 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +static struct gprs_gsup_client *g_gc; + + +/*********************************************************************** + * IMSI Operation + ***********************************************************************/ +static LLIST_HEAD(g_imsi_ops); + +struct imsi_op_stats { + uint32_t num_alloc; + uint32_t num_released; + uint32_t num_rx_success; + uint32_t num_rx_error; + uint32_t num_timeout; +}; + +enum imsi_op_type { + IMSI_OP_SAI, + IMSI_OP_LU, + IMSI_OP_ISD, + _NUM_IMSI_OP +}; + +static const struct value_string imsi_op_names[] = { + { IMSI_OP_SAI, "SAI" }, + { IMSI_OP_LU, "LU" }, + { IMSI_OP_ISD, "ISD" }, + { 0, NULL } +}; + +static struct imsi_op_stats imsi_op_stats[_NUM_IMSI_OP]; + +struct imsi_op { + struct llist_head list; + char imsi[17]; + enum imsi_op_type type; + struct osmo_timer_list timer; +}; + +static struct imsi_op *imsi_op_find(const char *imsi, + enum imsi_op_type type) +{ + struct imsi_op *io; + + llist_for_each_entry(io, &g_imsi_ops, list) { + if (!strcmp(io->imsi, imsi) && io->type == type) + return io; + } + return NULL; +} + +static void imsi_op_timer_cb(void *data); + +static struct imsi_op *imsi_op_alloc(void *ctx, const char *imsi, + enum imsi_op_type type) +{ + struct imsi_op *io; + + if (imsi_op_find(imsi, type)) + return NULL; + + io = talloc_zero(ctx, struct imsi_op); + strncpy(io->imsi, imsi, sizeof(io->imsi)); + io->imsi[sizeof(io->imsi)-1] = '\0'; + io->type = type; + io->timer.cb = imsi_op_timer_cb; + io->timer.data = io; + llist_add(&io->list, &g_imsi_ops); + imsi_op_stats[type].num_alloc++; + + return io; +} + +static void imsi_op_release(struct imsi_op *io) +{ + osmo_timer_del(&io->timer); + llist_del(&io->list); + imsi_op_stats[io->type].num_released++; + talloc_free(io); +} + +static void imsi_op_timer_cb(void *data) +{ + struct imsi_op *io = data; + printf("%s: Timer expiration\n", io->imsi); + imsi_op_stats[io->type].num_timeout++; + imsi_op_release(io); +} + +/* allocate + generate + send Send-Auth-Info */ +int req_auth_info(const char *imsi) +{ + struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_SAI); + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST; + + osmo_gsup_encode(msg, &gsup); + + return gprs_gsup_client_send(g_gc, msg); +} + +/* allocate + generate + send Send-Auth-Info */ +int req_loc_upd(const char *imsi) +{ + struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_LU); + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST; + + osmo_gsup_encode(msg, &gsup); + + return gprs_gsup_client_send(g_gc, msg); +} + +int resp_isd(struct imsi_op *io) +{ + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_RESULT; + + osmo_gsup_encode(msg, &gsup); + + imsi_op_release(io); + + return gprs_gsup_client_send(g_gc, msg); +} + +/* receive an incoming GSUP message */ +static void imsi_op_rx_gsup(struct imsi_op *io, const struct osmo_gsup_message *gsup) +{ + int is_error = 0; + + if (OSMO_GSUP_IS_MSGT_ERROR(gsup->message_type)) { + imsi_op_stats[io->type].num_rx_error++; + is_error = 1; + } else + imsi_op_stats[io->type].num_rx_success++; + + switch (io->type) { + case IMSI_OP_SAI: + printf("%s; SAI Response%s\n", io->imsi, is_error ? ": ERROR" : ""); + /* now that we have auth tuples, request LU */ + req_loc_upd(io->imsi); + imsi_op_release(io); + break; + case IMSI_OP_LU: + printf("%s; LU Response%s\n", io->imsi, is_error ? ": ERROR" : ""); + imsi_op_release(io); + break; + case IMSI_OP_ISD: + printf("%s; ISD Request%s\n", io->imsi, is_error ? ": ERROR" : ""); + resp_isd(io); + break; + default: + printf("%s: Unknown\n", io->imsi); + imsi_op_release(io); + break; + } +} + +static int op_type_by_gsup_msgt(enum osmo_gsup_message_type msg_type) +{ + switch (msg_type) { + case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT: + case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR: + return IMSI_OP_SAI; + case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT: + case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR: + return IMSI_OP_LU; + case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST: + return IMSI_OP_ISD; + default: + printf("Unknown GSUP msg_type %u\n", msg_type); + return -1; + } +} + +static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +{ + struct osmo_gsup_message gsup_msg = {0}; + struct imsi_op *io; + int rc; + + DEBUGP(DGPRS, "Rx GSUP %s\n", osmo_hexdump(msgb_l2(msg), msgb_l2len(msg))); + + rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup_msg); + if (rc < 0) + return rc; + + if (!gsup_msg.imsi[0]) + return -1; + + rc = op_type_by_gsup_msgt(gsup_msg.message_type); + if (rc < 0) + return rc; + + switch (rc) { + case IMSI_OP_SAI: + case IMSI_OP_LU: + io = imsi_op_find(gsup_msg.imsi, rc); + if (!io) + return -1; + break; + case IMSI_OP_ISD: + /* ISD is an inbound transaction */ + io = imsi_op_alloc(g_gc, gsup_msg.imsi, IMSI_OP_ISD); + break; + } + + imsi_op_rx_gsup(io, &gsup_msg); + msgb_free(msg); + + return 0; +} + +static void print_report(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(imsi_op_stats); i++) { + struct imsi_op_stats *st = &imsi_op_stats[i]; + const char *name = get_value_string(imsi_op_names, i); + printf("%s: %u alloc, %u released, %u success, %u error , %u tout\n", + name, st->num_alloc, st->num_released, st->num_rx_success, + st->num_rx_error, st->num_timeout); + } +} + +static void sig_cb(int sig) +{ + switch (sig) { + case SIGINT: + print_report(); + exit(0); + break; + } +} + +void *tall_bsc_ctx = NULL; + +/* default categories */ +static struct log_info_cat gprs_categories[] = { + [DGPRS] = { + .name = "DGPRS", + .description = "GPRS Packet Service", + .enabled = 1, .loglevel = LOGL_INFO, + }, +}; + +static const struct log_info gprs_log_info = { + .cat = gprs_categories, + .num_cat = ARRAY_SIZE(gprs_categories), +}; + +int main(int argc, char **argv) +{ + unsigned long long i; + char *server_host = "127.0.0.1"; + uint16_t server_port = 2222; + + osmo_init_logging(&gprs_log_info); + + g_gc = gprs_gsup_client_create(server_host, server_port, + gsupc_read_cb, NULL); + + + signal(SIGINT, sig_cb); + + for (i = 0; i < 10000; i++) { + unsigned long long imsi = 901790000000000 + i; + char imsi_buf[17]; + snprintf(imsi_buf, sizeof(imsi_buf), "%015llu", imsi); + req_auth_info(imsi_buf); + osmo_select_main(0); + } + + while (1) { + osmo_select_main(0); + } + + print_report(); + exit(0); +} -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 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 Sat Dec 10 14:45:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 14:45:12 +0000 Subject: [PATCH] openbsc[master]: comments: gsup client: rename to Generic, adjust copyright 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/1383 to look at the new patch set (#2). comments: gsup client: rename to Generic, adjust copyright and authors Related: OS#1592 Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 --- M openbsc/src/gprs/gprs_gsup_client.c 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/83/1383/2 diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index deaf156..41b88ad 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -1,9 +1,10 @@ -/* GPRS Subscriber Update Protocol client */ +/* Generic Subscriber Update Protocol client */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH +/* (C) 2014-2016 by Sysmocom s.f.m.c. GmbH * All Rights Reserved * * Author: Jacob Erlbeck + * 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 -- To view, visit https://gerrit.osmocom.org/1383 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 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 Sat Dec 10 14:45:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 14:45:12 +0000 Subject: [PATCH] openbsc[master]: gprs_gsup_client*: remove the gprs_ prefix 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/1384 to look at the new patch set (#2). gprs_gsup_client*: remove the gprs_ prefix Make sure everything is named gsup_client_ / GSUP_CLIENT_. Rename static gsup_client_send() to client_send() to avoid clash with public gprs_gsup_client_send() being renamed to gsup_client_send(). This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. libvlr and osmo-sgsn will use the same GSUP client code. A number of patches will follow up on this, also for the the OAP client. Related: OS#1592 Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 --- M openbsc/include/openbsc/gprs_gsup_client.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/gprs/gsup_test_client.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c 7 files changed, 79 insertions(+), 76 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/84/1384/2 diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gprs_gsup_client.h index ccfa388..551f76d 100644 --- a/openbsc/include/openbsc/gprs_gsup_client.h +++ b/openbsc/include/openbsc/gprs_gsup_client.h @@ -25,35 +25,36 @@ #include -#define GPRS_GSUP_RECONNECT_INTERVAL 10 -#define GPRS_GSUP_PING_INTERVAL 20 +#define GSUP_CLIENT_RECONNECT_INTERVAL 10 +#define GSUP_CLIENT_PING_INTERVAL 20 struct msgb; struct ipa_client_conn; -struct gprs_gsup_client; +struct gsup_client; /* Expects message in msg->l2h */ -typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg); +typedef int (*gsup_client_read_cb_t)(struct gsup_client *gsupc, + struct msgb *msg); -struct gprs_gsup_client { - struct ipa_client_conn *link; - gprs_gsup_read_cb_t read_cb; - void *data; +struct gsup_client { + struct ipa_client_conn *link; + gsup_client_read_cb_t read_cb; + void *data; - struct oap_state oap_state; + struct oap_state oap_state; - struct osmo_timer_list ping_timer; - struct osmo_timer_list connect_timer; - int is_connected; - int got_ipa_pong; + struct osmo_timer_list ping_timer; + struct osmo_timer_list connect_timer; + int is_connected; + int got_ipa_pong; }; -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb, - struct oap_config *oap_config); +struct gsup_client *gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + gsup_client_read_cb_t read_cb, + struct oap_config *oap_config); -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc); -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -struct msgb *gprs_gsup_msgb_alloc(void); +void gsup_client_destroy(struct gsup_client *gsupc); +int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); +struct msgb *gsup_client_msgb_alloc(void); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 786e2b2..0045fae 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -123,7 +123,7 @@ /* GSN instance for libgtp */ struct gsn_t *gsn; /* Subscriber */ - struct gprs_gsup_client *gsup_client; + struct gsup_client *gsup_client; /* LLME inactivity timer */ struct osmo_timer_list llme_timer; diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 41b88ad..cd94a8a 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -35,11 +35,11 @@ extern void *tall_bsc_ctx; -static void start_test_procedure(struct gprs_gsup_client *gsupc); +static void start_test_procedure(struct gsup_client *gsupc); -static void gsup_client_send_ping(struct gprs_gsup_client *gsupc) +static void gsup_client_send_ping(struct gsup_client *gsupc) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = gsup_client_msgb_alloc(); msg->l2h = msgb_put(msg, 1); msg->l2h[0] = IPAC_MSGT_PING; @@ -47,7 +47,7 @@ ipa_client_conn_send(gsupc->link, msg); } -static int gsup_client_connect(struct gprs_gsup_client *gsupc) +static int gsup_client_connect(struct gsup_client *gsupc) { int rc; @@ -84,7 +84,8 @@ rc == -EINVAL) return rc; - osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); + osmo_timer_schedule(&gsupc->connect_timer, + GSUP_CLIENT_RECONNECT_INTERVAL, 0); LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); @@ -94,7 +95,7 @@ static void connect_timer_cb(void *gsupc_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct gsup_client *gsupc = gsupc_; if (gsupc->is_connected) return; @@ -102,7 +103,8 @@ gsup_client_connect(gsupc); } -static void gsup_client_send(struct gprs_gsup_client *gsupc, int proto_ext, struct msgb *msg_tx) +static void client_send(struct gsup_client *gsupc, int proto_ext, + struct msgb *msg_tx) { ipa_prepend_header_ext(msg_tx, proto_ext); ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO); @@ -110,7 +112,7 @@ /* msg_tx is now queued and will be freed. */ } -static void gsup_client_oap_register(struct gprs_gsup_client *gsupc) +static void gsup_client_oap_register(struct gsup_client *gsupc) { struct msgb *msg_tx; int rc; @@ -121,12 +123,12 @@ return; } - gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); + client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); } static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) { - struct gprs_gsup_client *gsupc = link->data; + struct gsup_client *gsupc = link->data; LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); @@ -144,11 +146,11 @@ osmo_timer_del(&gsupc->ping_timer); osmo_timer_schedule(&gsupc->connect_timer, - GPRS_GSUP_RECONNECT_INTERVAL, 0); + GSUP_CLIENT_RECONNECT_INTERVAL, 0); } } -static int gsup_client_oap_handle(struct gprs_gsup_client *gsupc, struct msgb *msg_rx) +static int gsup_client_oap_handle(struct gsup_client *gsupc, struct msgb *msg_rx) { int rc; struct msgb *msg_tx; @@ -159,7 +161,7 @@ return rc; if (msg_tx) - gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); + client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); return 0; } @@ -168,7 +170,7 @@ { struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); - struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data; + struct gsup_client *gsupc = (struct gsup_client *)link->data; int rc; static struct ipaccess_unit ipa_dev = { .unit_name = "SGSN" @@ -231,7 +233,7 @@ static void ping_timer_cb(void *gsupc_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct gsup_client *gsupc = gsupc_; LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", @@ -249,26 +251,26 @@ gsup_client_connect(gsupc); } -static void start_test_procedure(struct gprs_gsup_client *gsupc) +static void start_test_procedure(struct gsup_client *gsupc) { gsupc->ping_timer.data = gsupc; gsupc->ping_timer.cb = &ping_timer_cb; gsupc->got_ipa_pong = 0; - osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0); + osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0); LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); gsup_client_send_ping(gsupc); } -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb, - struct oap_config *oap_config) +struct gsup_client *gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + gsup_client_read_cb_t read_cb, + struct oap_config *oap_config) { - struct gprs_gsup_client *gsupc; + struct gsup_client *gsupc; int rc; - gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client); OSMO_ASSERT(gsupc); rc = oap_init(oap_config, &gsupc->oap_state); @@ -299,11 +301,11 @@ return gsupc; failed: - gprs_gsup_client_destroy(gsupc); + gsup_client_destroy(gsupc); return NULL; } -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc) +void gsup_client_destroy(struct gsup_client *gsupc) { osmo_timer_del(&gsupc->connect_timer); osmo_timer_del(&gsupc->ping_timer); @@ -316,7 +318,7 @@ talloc_free(gsupc); } -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) { if (!gsupc) { msgb_free(msg); @@ -328,12 +330,12 @@ return -EAGAIN; } - gsup_client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); + client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); return 0; } -struct msgb *gprs_gsup_msgb_alloc(void) +struct msgb *gsup_client_msgb_alloc(void) { return msgb_alloc_headroom(4000, 64, __func__); } diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 658ce04..100fd91 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -45,7 +45,7 @@ extern void *tall_bsc_ctx; -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg); +static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg); /* TODO: Some functions are specific to the SGSN, but this file is more general * (it has gprs_* name). Either move these functions elsewhere, split them and @@ -62,7 +62,7 @@ addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr); - sgi->gsup_client = gprs_gsup_client_create( + sgi->gsup_client = gsup_client_create( addr_str, sgi->cfg.gsup_server_port, &gsup_read_cb, &sgi->cfg.oap); @@ -73,7 +73,7 @@ return 1; } -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg) { int rc; @@ -161,7 +161,7 @@ static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr, struct osmo_gsup_message *gsup_msg) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = gsup_client_msgb_alloc(); if (strlen(gsup_msg->imsi) == 0 && subscr) strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1); @@ -176,7 +176,7 @@ return -ENOTSUP; } - return gprs_gsup_client_send(sgsn->gsup_client, msg); + return gsup_client_send(sgsn->gsup_client, msg); } static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr, diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index 5f123b8..901b870 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -12,7 +12,7 @@ #include #include -static struct gprs_gsup_client *g_gc; +static struct gsup_client *g_gc; /*********************************************************************** @@ -113,7 +113,7 @@ osmo_gsup_encode(msg, &gsup); - return gprs_gsup_client_send(g_gc, msg); + return gsup_client_send(g_gc, msg); } /* allocate + generate + send Send-Auth-Info */ @@ -128,7 +128,7 @@ osmo_gsup_encode(msg, &gsup); - return gprs_gsup_client_send(g_gc, msg); + return gsup_client_send(g_gc, msg); } int resp_isd(struct imsi_op *io) @@ -143,7 +143,7 @@ imsi_op_release(io); - return gprs_gsup_client_send(g_gc, msg); + return gsup_client_send(g_gc, msg); } /* receive an incoming GSUP message */ @@ -196,7 +196,7 @@ } } -static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +static int gsupc_read_cb(struct gsup_client *gsupc, struct msgb *msg) { struct osmo_gsup_message gsup_msg = {0}; struct imsi_op *io; @@ -281,8 +281,8 @@ osmo_init_logging(&gprs_log_info); - g_gc = gprs_gsup_client_create(server_host, server_port, - gsupc_read_cb, NULL); + g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb, + NULL); signal(SIGINT, sig_cb); diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 9ee5455..c5d90f6 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -36,7 +36,7 @@ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ - -Wl,--wrap=gprs_gsup_client_send \ + -Wl,--wrap=gsup_client_send \ $(NULL) sgsn_test_LDADD = \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index e7b7458..16eb6c9 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -146,14 +146,14 @@ return (*subscr_request_auth_info_cb)(mmctx); }; -/* override, requires '-Wl,--wrap=gprs_gsup_client_send' */ -int __real_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -int (*gprs_gsup_client_send_cb)(struct gprs_gsup_client *gsupc, struct msgb *msg) = - &__real_gprs_gsup_client_send; +/* override, requires '-Wl,--wrap=gsup_client_send' */ +int __real_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); +int (*gsup_client_send_cb)(struct gsup_client *gsupc, struct msgb *msg) = + &__real_gsup_client_send; -int __wrap_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int __wrap_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) { - return (*gprs_gsup_client_send_cb)(gsupc, msg); + return (*gsup_client_send_cb)(gsupc, msg); }; static int count(struct llist_head *head) @@ -714,7 +714,7 @@ cleanup_test(); } -int my_gprs_gsup_client_send_dummy(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_gsup_client_send_dummy(struct gsup_client *gsupc, struct msgb *msg) { msgb_free(msg); return 0; @@ -1281,7 +1281,7 @@ cleanup_test(); } -int my_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) { struct osmo_gsup_message to_peer = {0}; struct osmo_gsup_message from_peer = {0}; @@ -1323,7 +1323,7 @@ return 0; } - reply_msg = gprs_gsup_msgb_alloc(); + reply_msg = gsup_client_msgb_alloc(); reply_msg->l2h = reply_msg->data; osmo_gsup_encode(reply_msg, &from_peer); gprs_subscr_rx_gsup_message(reply_msg); @@ -1338,9 +1338,9 @@ struct gsm_subscriber *subscr; sgsn_inst.cfg.auth_policy = SGSN_AUTH_POLICY_REMOTE; - gprs_gsup_client_send_cb = my_gprs_gsup_client_send; + gsup_client_send_cb = my_gsup_client_send; - sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gsup_client); if (retry) { upd_loc_skip = 3; @@ -1355,7 +1355,7 @@ assert_no_subscrs(); sgsn->cfg.auth_policy = saved_auth_policy; - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + gsup_client_send_cb = __real_gsup_client_send; upd_loc_skip = 0; auth_info_skip = 0; talloc_free(sgsn->gsup_client); @@ -2239,7 +2239,7 @@ printf("Testing GGSN selection\n"); - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + gsup_client_send_cb = my_gsup_client_send_dummy; /* Check for emptiness */ OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); @@ -2358,7 +2358,7 @@ sgsn_ggsn_ctx_free(ggcs[1]); sgsn_ggsn_ctx_free(ggcs[2]); - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + gsup_client_send_cb = __real_gsup_client_send; cleanup_test(); } -- To view, visit https://gerrit.osmocom.org/1384 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 Gerrit-PatchSet: 2 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 Sat Dec 10 14:45:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 14:45:12 +0000 Subject: [PATCH] openbsc[master]: rename gprs_gsup_client.h to gsup_client.h 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/1385 to look at the new patch set (#2). rename gprs_gsup_client.h to gsup_client.h This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. Related: OS#1592 Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c --- M openbsc/include/openbsc/Makefile.am R openbsc/include/openbsc/gsup_client.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/gprs/gsup_test_client.c M openbsc/src/gprs/sgsn_vty.c M openbsc/tests/sgsn/sgsn_test.c 7 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/1385/2 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 2b54c43..9f574e6 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -23,7 +23,6 @@ gb_proxy.h \ gprs_gb_parse.h \ gprs_gmm.h \ - gprs_gsup_client.h \ gprs_llc.h \ gprs_llc_xid.h \ gprs_sgsn.h \ @@ -39,6 +38,7 @@ gsm_data.h \ gsm_data_shared.h \ gsm_subscriber.h \ + gsup_client.h \ gtphub.h \ handover.h \ handover_decision.h \ diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gsup_client.h similarity index 100% rename from openbsc/include/openbsc/gprs_gsup_client.h rename to openbsc/include/openbsc/gsup_client.h diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index cd94a8a..6195fa6 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -21,7 +21,7 @@ * */ -#include +#include #include #include diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 100fd91..23dbdd4 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index 901b870..c8ed03d 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include static struct gsup_client *g_gc; diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 1b477e5..21c865b 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 16eb6c9..b4bcaf6 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1385 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c 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 Sat Dec 10 14:45:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 14:45:12 +0000 Subject: [PATCH] openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category 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/1386 to look at the new patch set (#2). gsup client, gsup_test_client: move logging to DLGSUP category Since libosmocore 0.9.4, the DLGSUP logging category is available. Use it for GSUP. Bump the required version of libosmocore to 0.9.4 (for core/logging.h) and also bump libosmogsm to 0.9.4 to make up for the missing bump when GSUP was moved to libosmocore. Todo: we're using a "Library" logging category, which is not really what the library category was intended for. Instead, the GSUP client should probably be given a logging category like DVLR or DGPRS in its initialization API. Related: OS#1592 Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee --- M openbsc/configure.ac M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gsup_test_client.c 3 files changed, 24 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/1386/2 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 093d42f..123048f 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -30,10 +30,10 @@ AC_SUBST(LIBRARY_DL) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.4) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 6195fa6..b991563 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -55,29 +55,29 @@ return 0; if (osmo_timer_pending(&gsupc->connect_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: connect timer already running\n"); osmo_timer_del(&gsupc->connect_timer); } if (osmo_timer_pending(&gsupc->ping_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: ping timer already running\n"); osmo_timer_del(&gsupc->ping_timer); } if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); rc = ipa_client_conn_open(gsupc->link); if (rc >= 0) { - LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP connecting to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; } - LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", gsupc->link->addr, gsupc->link->port, strerror(-rc)); if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || @@ -87,7 +87,7 @@ osmo_timer_schedule(&gsupc->connect_timer, GSUP_CLIENT_RECONNECT_INTERVAL, 0); - LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; @@ -119,7 +119,7 @@ rc = oap_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { - LOGP(DGPRS, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); + LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); return; } @@ -130,7 +130,7 @@ { struct gsup_client *gsupc = link->data; - LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); gsupc->is_connected = up; @@ -181,7 +181,7 @@ rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); if (rc < 0) { - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA/CCM message from %s:%d\n", link->addr, link->port); /* Link has been closed */ @@ -194,7 +194,7 @@ uint8_t msg_type = *(msg->l2h); /* CCM message */ if (msg_type == IPAC_MSGT_PONG) { - LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP receiving PONG\n"); gsupc->got_ipa_pong = 1; } @@ -223,7 +223,7 @@ return 0; invalid: - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA message from %s:%d, size = %d\n", link->addr, link->port, msgb_length(msg)); @@ -235,7 +235,7 @@ { struct gsup_client *gsupc = gsupc_; - LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", gsupc->got_ipa_pong ? "got" : "didn't get"); @@ -244,7 +244,7 @@ return; } - LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); + LOGP(DLGSUP, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); ipa_client_conn_close(gsupc->link); gsupc->is_connected = 0; @@ -258,7 +258,7 @@ gsupc->got_ipa_pong = 0; osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0); - LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP sending PING\n"); gsup_client_send_ping(gsupc); } diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index c8ed03d..09970b1 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -260,17 +260,17 @@ void *tall_bsc_ctx = NULL; /* default categories */ -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", +static struct log_info_cat default_categories[] = { + [DLGSUP] = { + .name = "DLGSUP", + .description = "Generic Subscriber Update Protocol", .enabled = 1, .loglevel = LOGL_INFO, }, }; -static const struct log_info gprs_log_info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), +static const struct log_info gsup_test_client_log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), }; int main(int argc, char **argv) @@ -279,7 +279,7 @@ char *server_host = "127.0.0.1"; uint16_t server_port = 2222; - osmo_init_logging(&gprs_log_info); + osmo_init_logging(&gsup_test_client_log_info); g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb, NULL); -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee 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 Sat Dec 10 15:44:11 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 15:44:11 +0000 Subject: openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 There's still a problem with DLGSUP as in libosmocore. All DL* categories are typically negative, but DLGSUP isn't, and it's also not in libosmocore's internal_cat array. This means that a program has to include DLGSUP in its own logging cat array, which means for osmo-nitb that DLGSUP (11) replaces DMGCP (also 11). Todo: Fix this: make DLGSUP -11 and include in internal_cat in libosmocore -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee Gerrit-PatchSet: 2 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 Sat Dec 10 16:17:36 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 16:17:36 +0000 Subject: libosmocore[master]: import oap message parsing / encoding from openbsc.git; AGPL... In-Reply-To: References: Message-ID: Patch Set 5: Code-Review-1 There's still a problem with DLOAP. All DL* categories are typically negative, but in this patch DLOAP isn't, and it's also not in libosmocore's internal_cat array. This means that a program has to include DLOAP in its own logging cat array, which means for osmo-nitb that DLOAP will replace another normal logging category. -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Sat Dec 10 16:19:04 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 16:19:04 +0000 Subject: [PATCH] libosmocore[master]: fix: DLGSUP logging category "unusable" Message-ID: Review at https://gerrit.osmocom.org/1402 fix: DLGSUP logging category "unusable" All DL* categories are typically negative, but DLGSUP isn't, and it's also not in libosmocore's internal_cat array. See: 3b6fb0880c3ab1e23a3d7d738d073b00c2a794c2 This means that a program using DLGSUP has to include DLGSUP in its own logging cat array (typically not needed for DL* categories), which means for osmo-nitb that DLGSUP (11) replaces DMGCP (also 11), and DMGCP becomes unusable. Fix this: make DLGSUP -11 and include in internal_cat. In gsup_test.c, no longer add DLGSUP to the logging categories array. External follow-ups are otherwise needed only in osmo-hlr.git and some pending patches for openbsc (Id3938267fa062e1a997d3704cd678874306f86ee). Change-Id: Id974c7be158e4d60421a98110f5c807aefd31119 --- M include/osmocom/core/logging.h M src/logging.c M tests/gsup/gsup_test.c 3 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/1402/1 diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index ad775b9..cc3919b 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -92,7 +92,7 @@ #define DLCTRL -8 /*!< Control Interface */ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ -#define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ +#define DLGSUP -11 /*!< Generic Subscriber Update Protocol */ #define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ diff --git a/src/logging.c b/src/logging.c index 1516a7d..30d0b8d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -123,6 +123,11 @@ .description = "Statistics messages and logging", .enabled = 1, .loglevel = LOGL_NOTICE, }, + [INT2IDX(DLGSUP)] = { + .name = "DLGSUP", + .description = "Generic Subscriber Update Protocol", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, }; /*! \brief descriptive string for each log level */ diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index 2b0a293..7af16b7 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -241,11 +241,6 @@ } const struct log_info_cat default_categories[] = { - [DLGSUP] = { - .name = "DLGSUP", - .description = "Generic Subscriber Update Protocol", - .enabled = 0, .loglevel = LOGL_DEBUG, - }, }; static struct log_info info = { -- To view, visit https://gerrit.osmocom.org/1402 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id974c7be158e4d60421a98110f5c807aefd31119 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sat Dec 10 16:19:13 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 16:19:13 +0000 Subject: [PATCH] libosmocore[master]: import oap message parsing / encoding from openbsc.git; AGPL... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1375 to look at the new patch set (#6). import oap message parsing / encoding from openbsc.git; AGPL->GPL In the process, also: * Change the license from AGPLv3 to GPLv2-or-later; * correct spelling of 'sysmocom' to lowercase; * add '2016' to the copyright; * rename to osmo_*; * add API docs; * add logging category DLOAP: define id and add to internal_cat; * redirect all oap.c logging to DLOAP. A unit test will follow in a subsequent patch, since it needs a minor tweak for decoding of boolean values. The related openbsc change-id is I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf. Tweaked-by: Neels Hofmeyr Change-Id: If5099e60681a215e798b6675f21813f26769c253 --- M Makefile.am A doc/osmocom-authn-protocol.txt M include/Makefile.am M include/osmocom/core/logging.h A include/osmocom/gsm/oap.h M src/gsm/Makefile.am M src/gsm/libosmogsm.map A src/gsm/oap.c M src/logging.c 9 files changed, 519 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/1375/6 diff --git a/Makefile.am b/Makefile.am index 185127e..9c901ea 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 doc/osmocom-authn-protocol.txt if HAVE_DOXYGEN diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..1b6794e --- /dev/null +++ b/doc/osmocom-authn-protocol.txt @@ -0,0 +1,250 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +The Osmocom Authentication Protocol employs mutual authentication to register a +client with a server over an IPA connection. Milenage is used as the +authentication algorithm, where client and server have a shared secret. + +For example, an SGSN, as OAP client, may use its SGSN ID to register with a MAP +proxy, an OAP server. + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 (OAP) + +2. Procedures + +Ideal communication sequence: + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "test setup": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "invalid sequence nr": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Sync Request (AUTS) | + |----------------------------------->| + | | + | Challenge (RAND'+AUTN') | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The client sends a REGISTER_REQ message containing an identifier number. + +2.2. Challenge + +The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes +and a milenage authentication token generated from these random bytes, using a +shared secret, to authenticate itself to the OAP client. The server may omit +this challenge entirely, based on its configuration, and immediately reply with +a Register Result response. If the client cannot be registered (e.g. id is +invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the client has received a Challenge, it may verify the server's +authenticity and validity of the sequence number (included in AUTN), and, if +valid, reply with a CHALLENGE_RES message. This shall contain an XRES +authentication token generated by milenage from the same random bytes received +from the server and the same shared secet. If the client decides to cancel the +registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a +CHALLENGE_ERR message may be sent, but is not mandatory. For example, the +client may directly start with a new REGISTER_REQ message. + +2.4. Sync Request + +When the client has received a Challenge but sees an invalid sequence number +(embedded in AUTN, according to the milenage algorithm), the client may send a +SYNC_REQ message containing an AUTS synchronisation token. + +2.5. Sync Result + +If the server has received a valid Sync Request, it shall answer by directly +sending another Challenge (see 2.2.). If an invalid Sync Request is received, +the server shall reply with a REGISTER_ERR message. + +2.6. Register Result + +The server sends a REGISTER_RES message to indicate that registration has been +successful. If the server cannot register the client (e.g. invalid challenge +response), it shall send a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 Client ID big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 XRES octet string (8) M TLV 10 + +3.2.3. Sync Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 AUTS octet string (16) M TLV 18 + +3.2.4. Sync Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + | 0 0 0 0 1 1 0 0 - Sync Request | + | 0 0 0 0 1 1 0 1 - Sync Error (not used) | + | 0 0 0 0 1 1 1 0 - Sync Result (not used) | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x23 AUTN octet string | + | 0x24 XRES octet string | + | 0x25 AUTS octet string | + | 0x30 Client ID big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. Client ID + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | Client ID IEI | octet 1 + +-----------------------------------------------------+ + | Length of Client ID IE contents (2) | octet 2 + +-----------------------------------------------------+ + | Client ID number, most significant byte | octet 3 + +-----------------------------------------------------+ + | Client ID number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The Client ID number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset ID. + diff --git a/include/Makefile.am b/include/Makefile.am index c125691..0a300a8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -82,6 +82,7 @@ osmocom/gsm/mncc.h \ osmocom/gsm/prim.h \ osmocom/gsm/l1sap.h \ + osmocom/gsm/oap.h \ osmocom/gsm/protocol/gsm_03_40.h \ osmocom/gsm/protocol/gsm_03_41.h \ osmocom/gsm/protocol/gsm_04_08.h \ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index cc3919b..1ca348a 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -93,7 +93,8 @@ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ #define DLGSUP -11 /*!< Generic Subscriber Update Protocol */ -#define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ +#define DLOAP -12 /*!< Osmocom Authentication Protocol */ +#define OSMO_NUM_DLIB 12 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ struct log_category { diff --git a/include/osmocom/gsm/oap.h b/include/osmocom/gsm/oap.h new file mode 100644 index 0000000..d973013 --- /dev/null +++ b/include/osmocom/gsm/oap.h @@ -0,0 +1,72 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#pragma once + +#include +#include +#include + +/*! \brief Information Element Identifiers for OAP IEs. + * They match osmo_gsup_iei (so far). */ +enum osmo_oap_iei { + OAP_CAUSE_IE = 0x02, + OAP_RAND_IE = 0x20, + OAP_AUTN_IE = 0x23, + OAP_XRES_IE = 0x24, + OAP_AUTS_IE = 0x25, + OAP_CLIENT_ID_IE = 0x30, +}; + +/*! \brief OAP message types */ +enum osmo_oap_message_type { + OAP_MSGT_REGISTER_REQUEST = 0b00000100, + OAP_MSGT_REGISTER_ERROR = 0b00000101, + OAP_MSGT_REGISTER_RESULT = 0b00000110, + + OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + OAP_MSGT_CHALLENGE_RESULT = 0b00001010, + + OAP_MSGT_SYNC_REQUEST = 0b00001100, + OAP_MSGT_SYNC_ERROR = 0b00001101, + OAP_MSGT_SYNC_RESULT = 0b00001110, +}; + +/*! \brief Parsed/decoded OAP protocol message */ +struct osmo_oap_message { + enum osmo_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t client_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int xres_present; + uint8_t xres[8]; + int auts_present; + uint8_t auts[16]; +}; + +int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, + size_t data_len); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3877f78..4ea55e1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -22,7 +22,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 + gsup.c gprs_gea.c gsm0503_conv.c oap.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3e7333c..a3d224f 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -356,5 +356,8 @@ osmo_gsup_encode; osmo_gsup_decode; +osmo_oap_encode; +osmo_oap_decode; + local: *; }; diff --git a/src/gsm/oap.c b/src/gsm/oap.c new file mode 100644 index 0000000..979bde6 --- /dev/null +++ b/src/gsm/oap.c @@ -0,0 +1,184 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#include +#include +#include +#include +#include + +#include + +/*! \brief Decode OAP message data. + * \param[out] oap_msg Parsed data is written to this instance. + * \param[in] data Pointer to the data buffer containing the OAP message. + * \param[in] data_len Length of the OAP message data. + * \returns 0 on success, a negative cause value on failure. + */ +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *const_data, size_t data_len) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + + memset(oap_msg, 0, sizeof(*oap_msg)); + + /* message type */ + rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = osmo_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum osmo_oap_iei iei; + + rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case OAP_CLIENT_ID_IE: + if (value_len != 2) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->client_id = osmo_decode_big_endian(value, value_len); + + if (oap_msg->client_id == 0) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d): client ID must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case OAP_XRES_IE: + if (value_len != sizeof(oap_msg->xres)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type XRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->xres, value, value_len); + oap_msg->xres_present = value_len; + break; + + case OAP_AUTS_IE: + if (value_len != sizeof(oap_msg->auts)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTS (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->auts, value, value_len); + oap_msg->auts_present = value_len; + break; + + case OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DLOAP, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +/*! \brief Compose OAP message data. + * \param[out] msg OAP message data is appended to this message buffer. + * \param[in] oap_msg Elements to encode in the message data. + */ +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, (uint8_t)oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->client_id > 0) + msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), + osmo_encode_big_endian(oap_msg->client_id, + sizeof(oap_msg->client_id))); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->auts_present) + msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); + + if (oap_msg->xres_present) + msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); + + msg->l2h = msg->data; +} diff --git a/src/logging.c b/src/logging.c index 30d0b8d..92852c9 100644 --- a/src/logging.c +++ b/src/logging.c @@ -128,6 +128,11 @@ .description = "Generic Subscriber Update Protocol", .enabled = 1, .loglevel = LOGL_NOTICE, }, + [INT2IDX(DLOAP)] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, }; /*! \brief descriptive string for each log level */ -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Sat Dec 10 16:30:46 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 10 Dec 2016 16:30:46 +0000 Subject: [PATCH] osmo-hlr[master]: fix DLGSUP logging cat after change in libosmocore Message-ID: Review at https://gerrit.osmocom.org/1403 fix DLGSUP logging cat after change in libosmocore Following change-id Id974c7be158e4d60421a98110f5c807aefd31119 in libosmocore, DLGSUP must no longer be added to applications' logging category arrays. (Since osmo-hlr has no configure.ac yet, I can't bump the required libosmocore revision. It would have been 0.9.5.) Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d --- M src/logging.c 1 file changed, 0 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/03/1403/1 diff --git a/src/logging.c b/src/logging.c index 54c8900..9b8de45 100644 --- a/src/logging.c +++ b/src/logging.c @@ -13,12 +13,6 @@ .color = "\033[1;31m", .enabled = 1, .loglevel = LOGL_DEBUG, }, - [DLGSUP] = { - .name = "DLGSUP", - .description = "GSUP Protocol", - .color = "\033[1;32m", - .enabled = 1, .loglevel = LOGL_INFO, - }, [DAUC] = { .name = "DAUC", .description = "Authentication Center", -- To view, visit https://gerrit.osmocom.org/1403 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:08:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:08:41 +0000 Subject: [PATCH] osmo-hlr[master]: build with autoconf/automake, add jenkins.sh script Message-ID: Review at https://gerrit.osmocom.org/1404 build with autoconf/automake, add jenkins.sh script Add configure.ac and Makefile.ams to build with autoreconf && ./configure && make like most other Osmocom projects. Add jenkins.sh for a gerrit build job to verify patches. Change-Id: I6b4419dd519f3d0a75235d0c22bf899f075347a3 --- M .gitignore A Makefile.am A configure.ac A contrib/jenkins.sh A git-version-gen A sql/Makefile.am D src/Makefile A src/Makefile.am 8 files changed, 335 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/04/1404/1 diff --git a/.gitignore b/.gitignore index 3224f97..d06928b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,24 @@ *.o *.db -src/hlr +.*.sw? +.version +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +compile +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +libtool +ltmain.sh +m4 +missing +.deps + +src/osmo-hlr src/db_test diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..40dad90 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,16 @@ +AUTOMAKE_OPTIONS = foreign dist-bzip2 + +SUBDIRS = \ + src \ + sql \ + $(NULL) + +EXTRA_DIST = \ + .version \ + $(NULL) + +BUILT_SOURCES = $(top_srcdir)/.version +$(top_srcdir)/.version: + echo $(VERSION) > $@-t && mv $@-t $@ +dist-hook: + echo $(VERSION) > $(distdir)/.tarball-version diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..189a53a --- /dev/null +++ b/configure.ac @@ -0,0 +1,50 @@ +AC_INIT([osmo-hlr], + m4_esyscmd([./git-version-gen .tarball-version]), + [openbsc at lists.osmocom.org]) + +dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ +AC_CONFIG_AUX_DIR([.]) + +dnl libtool init +LT_INIT + +AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9]) + +dnl kernel style compile messages +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +dnl checks for programs +AC_PROG_MAKE_SET +AC_PROG_MKDIR_P +AC_PROG_CC +AC_PROG_INSTALL + +dnl check for pkg-config (explained in detail in libosmocore/configure.ac) +AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) +if test "x$PKG_CONFIG_INSTALLED" = "xno"; then + AC_MSG_WARN([You need to install pkg-config]) +fi +PKG_PROG_PKG_CONFIG([0.20]) + +PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) + +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) + +found_sqlite3=yes +PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) +AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) +AC_SUBST(found_sqlite3) + +AC_CONFIG_MACRO_DIR([m4]) + +dnl checks for header files +AC_HEADER_STDC + +AC_OUTPUT( + Makefile + src/Makefile + sql/Makefile + ) diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh new file mode 100755 index 0000000..c9cab3b --- /dev/null +++ b/contrib/jenkins.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -ex + +base="$PWD" +deps="$base/deps" +inst="$deps/install" +export deps inst + +mkdir "$deps" || true +rm -rf "$inst" + +export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" +export LD_LIBRARY_PATH="$inst/lib" + +osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false +osmo-build-dep.sh libosmo-abis + +set +x +echo +echo +echo +echo " =============================== osmo-hlr ===============================" +echo +set -x + +cd "$base" +autoreconf --install --force +./configure +$MAKE $PARALLEL_MAKE +$MAKE check || cat-testlogs.sh +$MAKE distcheck || cat-testlogs.sh diff --git a/git-version-gen b/git-version-gen new file mode 100755 index 0000000..42cf3d2 --- /dev/null +++ b/git-version-gen @@ -0,0 +1,151 @@ +#!/bin/sh +# Print a version string. +scriptversion=2010-01-28.01 + +# Copyright (C) 2007-2010 Free Software Foundation, Inc. +# +# 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, see . + +# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# It is probably wise to add these two files to .gitignore, so that you +# don't accidentally commit either generated file. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project at example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .tarball-version will +# exist in distribution tarballs. +# +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; +esac + +tarball_version_file=$1 +nl=' +' + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +elif + v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ + || git describe --abbrev=4 HEAD 2>/dev/null` \ + && case $v in + [0-9]*) ;; + v[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + case $v in + *-*-*) : git describe is okay three part flavor ;; + *-*) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + numcommits=`git rev-list "$vtag"..HEAD | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + ;; + esac + + # Change the first '-' to a '.', so version-comparing tools work properly. + # Remove the "g" in git describe's output string, to save a byte. + v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; +else + v=UNKNOWN +fi + +v=`echo "$v" |sed 's/^v//'` + +# Don't declare a version "dirty" merely because a time stamp has changed. +git status > /dev/null 2>&1 + +dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= +case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; +esac + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d '\012' + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/sql/Makefile.am b/sql/Makefile.am new file mode 100644 index 0000000..059a571 --- /dev/null +++ b/sql/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = \ + hlr_data.sql \ + hlr.sql \ + $(NULL) diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index d2536b5..0000000 --- a/src/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -LDFLAGS += -losmocore -losmogsm -losmoabis -lsqlite3 -ltalloc -CFLAGS += -g -Wall - -OBJS = auc.o db.o db_auc.o db_hlr.o logging.o - -all: db_test hlr - -db_test: db_test.o rand_fake.o $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) - -hlr: hlr.o gsup_server.o gsup_router.o rand_urandom.o $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) - -%.o: %.c - $(CC) $(CFLAGS) -o $@ -c $^ - -clean: - rm -f *.o db_test diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..3286560 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,61 @@ +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(SQLITE3_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + populate_hlr_db.pl \ + $(NULL) + +noinst_HEADERS = \ + auc.h \ + db.h \ + gsup_router.h \ + gsup_server.h \ + logging.h \ + rand.h \ + $(NULL) + +bin_PROGRAMS = \ + osmo-hlr \ + db_test \ + $(NULL) + +osmo_hlr_SOURCES = \ + auc.c \ + db.c \ + db_auc.c \ + db_hlr.c \ + gsup_router.c \ + gsup_server.c \ + hlr.c \ + logging.c \ + rand_urandom.c \ + $(NULL) + +osmo_hlr_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(SQLITE3_LIBS) \ + $(NULL) + +db_test_SOURCES = \ + auc.c \ + db.c \ + db_auc.c \ + db_test.c \ + logging.c \ + rand_fake.c \ + $(NULL) + +db_test_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(SQLITE3_LIBS) \ + $(NULL) -- To view, visit https://gerrit.osmocom.org/1404 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6b4419dd519f3d0a75235d0c22bf899f075347a3 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:11:53 +0000 Subject: osmo-hlr[master]: build with autoconf/automake, add jenkins.sh script In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1404 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6b4419dd519f3d0a75235d0c22bf899f075347a3 Gerrit-PatchSet: 1 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 Sun Dec 11 00:11:56 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:11:56 +0000 Subject: [MERGED] osmo-hlr[master]: build with autoconf/automake, add jenkins.sh script In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: build with autoconf/automake, add jenkins.sh script ...................................................................... build with autoconf/automake, add jenkins.sh script Add configure.ac and Makefile.ams to build with autoreconf && ./configure && make like most other Osmocom projects. Add jenkins.sh for a gerrit build job to verify patches. Change-Id: I6b4419dd519f3d0a75235d0c22bf899f075347a3 --- M .gitignore A Makefile.am A configure.ac A contrib/jenkins.sh A git-version-gen A sql/Makefile.am D src/Makefile A src/Makefile.am 8 files changed, 335 insertions(+), 19 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitignore b/.gitignore index 3224f97..d06928b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,24 @@ *.o *.db -src/hlr +.*.sw? +.version +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +compile +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +libtool +ltmain.sh +m4 +missing +.deps + +src/osmo-hlr src/db_test diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..40dad90 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,16 @@ +AUTOMAKE_OPTIONS = foreign dist-bzip2 + +SUBDIRS = \ + src \ + sql \ + $(NULL) + +EXTRA_DIST = \ + .version \ + $(NULL) + +BUILT_SOURCES = $(top_srcdir)/.version +$(top_srcdir)/.version: + echo $(VERSION) > $@-t && mv $@-t $@ +dist-hook: + echo $(VERSION) > $(distdir)/.tarball-version diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..189a53a --- /dev/null +++ b/configure.ac @@ -0,0 +1,50 @@ +AC_INIT([osmo-hlr], + m4_esyscmd([./git-version-gen .tarball-version]), + [openbsc at lists.osmocom.org]) + +dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ +AC_CONFIG_AUX_DIR([.]) + +dnl libtool init +LT_INIT + +AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9]) + +dnl kernel style compile messages +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +dnl checks for programs +AC_PROG_MAKE_SET +AC_PROG_MKDIR_P +AC_PROG_CC +AC_PROG_INSTALL + +dnl check for pkg-config (explained in detail in libosmocore/configure.ac) +AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) +if test "x$PKG_CONFIG_INSTALLED" = "xno"; then + AC_MSG_WARN([You need to install pkg-config]) +fi +PKG_PROG_PKG_CONFIG([0.20]) + +PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) + +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) +PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) + +found_sqlite3=yes +PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) +AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) +AC_SUBST(found_sqlite3) + +AC_CONFIG_MACRO_DIR([m4]) + +dnl checks for header files +AC_HEADER_STDC + +AC_OUTPUT( + Makefile + src/Makefile + sql/Makefile + ) diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh new file mode 100755 index 0000000..c9cab3b --- /dev/null +++ b/contrib/jenkins.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -ex + +base="$PWD" +deps="$base/deps" +inst="$deps/install" +export deps inst + +mkdir "$deps" || true +rm -rf "$inst" + +export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" +export LD_LIBRARY_PATH="$inst/lib" + +osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false +osmo-build-dep.sh libosmo-abis + +set +x +echo +echo +echo +echo " =============================== osmo-hlr ===============================" +echo +set -x + +cd "$base" +autoreconf --install --force +./configure +$MAKE $PARALLEL_MAKE +$MAKE check || cat-testlogs.sh +$MAKE distcheck || cat-testlogs.sh diff --git a/git-version-gen b/git-version-gen new file mode 100755 index 0000000..42cf3d2 --- /dev/null +++ b/git-version-gen @@ -0,0 +1,151 @@ +#!/bin/sh +# Print a version string. +scriptversion=2010-01-28.01 + +# Copyright (C) 2007-2010 Free Software Foundation, Inc. +# +# 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, see . + +# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# It is probably wise to add these two files to .gitignore, so that you +# don't accidentally commit either generated file. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project at example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .tarball-version will +# exist in distribution tarballs. +# +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; +esac + +tarball_version_file=$1 +nl=' +' + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +elif + v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ + || git describe --abbrev=4 HEAD 2>/dev/null` \ + && case $v in + [0-9]*) ;; + v[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + case $v in + *-*-*) : git describe is okay three part flavor ;; + *-*) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + numcommits=`git rev-list "$vtag"..HEAD | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + ;; + esac + + # Change the first '-' to a '.', so version-comparing tools work properly. + # Remove the "g" in git describe's output string, to save a byte. + v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; +else + v=UNKNOWN +fi + +v=`echo "$v" |sed 's/^v//'` + +# Don't declare a version "dirty" merely because a time stamp has changed. +git status > /dev/null 2>&1 + +dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= +case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; +esac + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d '\012' + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/sql/Makefile.am b/sql/Makefile.am new file mode 100644 index 0000000..059a571 --- /dev/null +++ b/sql/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = \ + hlr_data.sql \ + hlr.sql \ + $(NULL) diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index d2536b5..0000000 --- a/src/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -LDFLAGS += -losmocore -losmogsm -losmoabis -lsqlite3 -ltalloc -CFLAGS += -g -Wall - -OBJS = auc.o db.o db_auc.o db_hlr.o logging.o - -all: db_test hlr - -db_test: db_test.o rand_fake.o $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) - -hlr: hlr.o gsup_server.o gsup_router.o rand_urandom.o $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) - -%.o: %.c - $(CC) $(CFLAGS) -o $@ -c $^ - -clean: - rm -f *.o db_test diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..3286560 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,61 @@ +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(SQLITE3_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + populate_hlr_db.pl \ + $(NULL) + +noinst_HEADERS = \ + auc.h \ + db.h \ + gsup_router.h \ + gsup_server.h \ + logging.h \ + rand.h \ + $(NULL) + +bin_PROGRAMS = \ + osmo-hlr \ + db_test \ + $(NULL) + +osmo_hlr_SOURCES = \ + auc.c \ + db.c \ + db_auc.c \ + db_hlr.c \ + gsup_router.c \ + gsup_server.c \ + hlr.c \ + logging.c \ + rand_urandom.c \ + $(NULL) + +osmo_hlr_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(SQLITE3_LIBS) \ + $(NULL) + +db_test_SOURCES = \ + auc.c \ + db.c \ + db_auc.c \ + db_test.c \ + logging.c \ + rand_fake.c \ + $(NULL) + +db_test_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(SQLITE3_LIBS) \ + $(NULL) -- To view, visit https://gerrit.osmocom.org/1404 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6b4419dd519f3d0a75235d0c22bf899f075347a3 Gerrit-PatchSet: 1 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 Sun Dec 11 00:23:04 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:23:04 +0000 Subject: [PATCH] osmo-hlr[master]: fix build on FreeBSD: eliminate implicitly declared functions Message-ID: Review at https://gerrit.osmocom.org/1405 fix build on FreeBSD: eliminate implicitly declared functions Change-Id: I4f7222f19e4d7129a5cef828a28dd12a40824a59 --- M src/gsup_server.c M src/gsup_server.h M src/hlr.c 3 files changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/05/1405/1 diff --git a/src/gsup_server.c b/src/gsup_server.c index 7d4c07d..f95d56c 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -26,6 +26,7 @@ #include #include "gsup_server.h" +#include "gsup_router.h" static void osmo_gsup_server_send(struct osmo_gsup_conn *conn, int proto_ext, struct msgb *msg_tx) diff --git a/src/gsup_server.h b/src/gsup_server.h index bf1a570..484a0d7 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -32,6 +32,8 @@ int osmo_gsup_conn_send(struct osmo_gsup_conn *conn, struct msgb *msg); +int osmo_gsup_conn_ccm_get(const struct osmo_gsup_conn *clnt, uint8_t **addr, + uint8_t tag); struct osmo_gsup_server *osmo_gsup_server_create(void *ctx, const char *ip_addr, diff --git a/src/hlr.c b/src/hlr.c index e87ebb6..86c5dcc 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -116,6 +116,8 @@ uint8_t *peer; }; +void lu_op_tx_insert_subscr_data(struct lu_operation *luop); + void lu_op_statechg(struct lu_operation *luop, enum lu_state new_state) { enum lu_state old_state = luop->state; -- To view, visit https://gerrit.osmocom.org/1405 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4f7222f19e4d7129a5cef828a28dd12a40824a59 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:25:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:25:24 +0000 Subject: [PATCH] osmo-hlr[master]: fix various compiler warnings Message-ID: Review at https://gerrit.osmocom.org/1406 fix various compiler warnings Change-Id: I3bf3b351535843bde9c0c1d955315615bb7c30b2 --- M src/db_auc.c M src/gsup_server.c M src/hlr.c 3 files changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/06/1406/1 diff --git a/src/db_auc.c b/src/db_auc.c index 9196922..b37d9db 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -125,7 +125,7 @@ goto end_2g; } #endif - osmo_hexparse(ki, &aud2g->u.gsm.ki, sizeof(aud2g->u.gsm.ki)); + osmo_hexparse((void*)ki, (void*)&aud2g->u.gsm.ki, sizeof(aud2g->u.gsm.ki)); aud2g->type = OSMO_AUTH_TYPE_GSM; } else LOGAUC(imsi, LOGL_DEBUG, "No 2G Auth Data\n"); @@ -140,7 +140,7 @@ LOGAUC(imsi, LOGL_ERROR, "Error reading K: %d\n", rc); goto out; } - osmo_hexparse(k, &aud3g->u.umts.k, sizeof(aud3g->u.umts.k)); + osmo_hexparse((void*)k, (void*)&aud3g->u.umts.k, sizeof(aud3g->u.umts.k)); /* UMTS Subscribers can have either OP or OPC */ op = sqlite3_column_text(stmt, 5); if (!op) { @@ -149,11 +149,11 @@ LOGAUC(imsi, LOGL_ERROR, "Error reading OPC: %d\n", rc); goto out; } - osmo_hexparse(opc, &aud3g->u.umts.opc, + osmo_hexparse((void*)opc, (void*)&aud3g->u.umts.opc, sizeof(aud3g->u.umts.opc)); aud3g->u.umts.opc_is_op = 0; } else { - osmo_hexparse(op, &aud3g->u.umts.opc, + osmo_hexparse((void*)op, (void*)&aud3g->u.umts.opc, sizeof(aud3g->u.umts.opc)); aud3g->u.umts.opc_is_op = 1; } diff --git a/src/gsup_server.c b/src/gsup_server.c index f95d56c..ea51f7d 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -51,9 +51,9 @@ static int osmo_gsup_conn_oap_handle(struct osmo_gsup_conn *conn, struct msgb *msg_rx) { +#if 0 int rc; struct msgb *msg_tx; -#if 0 rc = oap_handle(&conn->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) @@ -174,7 +174,7 @@ struct ipaccess_unit *unit) { struct osmo_gsup_conn *clnt = (struct osmo_gsup_conn *)conn->data; - uint8_t *addr; + uint8_t *addr = NULL; size_t addr_len; LOGP(DLGSUP, LOGL_INFO, "CCM Callback\n"); diff --git a/src/hlr.c b/src/hlr.c index 86c5dcc..d7d97b1 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -182,7 +182,7 @@ memset(&gsup, 0, sizeof(gsup)); gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR; - strncpy(&gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)); + strncpy((char*)&gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)); gsup.imsi[sizeof(gsup.imsi)-1] = '\0'; gsup.cause = cause; -- To view, visit https://gerrit.osmocom.org/1406 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3bf3b351535843bde9c0c1d955315615bb7c30b2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:25:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:25:41 +0000 Subject: [PATCH] osmo-hlr[master]: fix DLGSUP logging cat after change in libosmocore In-Reply-To: References: Message-ID: fix DLGSUP logging cat after change in libosmocore DLGSUP must no longer be added to applications' logging category arrays after change-id Id974c7be158e4d60421a98110f5c807aefd31119 in libosmocore. Todo: once above change is merged to libosmocore, bump the required libosmocore version in configure.ac. Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d --- M src/logging.c 1 file changed, 0 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/03/1403/2 diff --git a/src/logging.c b/src/logging.c index 54c8900..9b8de45 100644 --- a/src/logging.c +++ b/src/logging.c @@ -13,12 +13,6 @@ .color = "\033[1;31m", .enabled = 1, .loglevel = LOGL_DEBUG, }, - [DLGSUP] = { - .name = "DLGSUP", - .description = "GSUP Protocol", - .color = "\033[1;32m", - .enabled = 1, .loglevel = LOGL_INFO, - }, [DAUC] = { .name = "DAUC", .description = "Authentication Center", -- To view, visit https://gerrit.osmocom.org/1403 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:25:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:25:41 +0000 Subject: [PATCH] osmo-hlr[master]: bump required libosmocore version to 0.9.5 Message-ID: Review at https://gerrit.osmocom.org/1407 bump required libosmocore version to 0.9.5 0.9.5 tags the version from which on DLGSUP is properly handled in libosmocore's internal logging. This bump follows up on previous osmo-hlr change I74ab1a031d1ed144468b016294d2965eba5e7d1d. Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd --- M configure.ac 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/07/1407/1 diff --git a/configure.ac b/configure.ac index 189a53a..2cb178c 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.0) +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(LIBOSMOABIS, libosmoabis >= 0.3.2) -- To view, visit https://gerrit.osmocom.org/1407 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:26:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:26:35 +0000 Subject: osmo-hlr[master]: fix build on FreeBSD: eliminate implicitly declared functions In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1405 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4f7222f19e4d7129a5cef828a28dd12a40824a59 Gerrit-PatchSet: 1 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 Sun Dec 11 00:26:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:26:37 +0000 Subject: [MERGED] osmo-hlr[master]: fix build on FreeBSD: eliminate implicitly declared functions In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix build on FreeBSD: eliminate implicitly declared functions ...................................................................... fix build on FreeBSD: eliminate implicitly declared functions Change-Id: I4f7222f19e4d7129a5cef828a28dd12a40824a59 --- M src/gsup_server.c M src/gsup_server.h M src/hlr.c 3 files changed, 5 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsup_server.c b/src/gsup_server.c index 7d4c07d..f95d56c 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -26,6 +26,7 @@ #include #include "gsup_server.h" +#include "gsup_router.h" static void osmo_gsup_server_send(struct osmo_gsup_conn *conn, int proto_ext, struct msgb *msg_tx) diff --git a/src/gsup_server.h b/src/gsup_server.h index bf1a570..484a0d7 100644 --- a/src/gsup_server.h +++ b/src/gsup_server.h @@ -32,6 +32,8 @@ int osmo_gsup_conn_send(struct osmo_gsup_conn *conn, struct msgb *msg); +int osmo_gsup_conn_ccm_get(const struct osmo_gsup_conn *clnt, uint8_t **addr, + uint8_t tag); struct osmo_gsup_server *osmo_gsup_server_create(void *ctx, const char *ip_addr, diff --git a/src/hlr.c b/src/hlr.c index e87ebb6..86c5dcc 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -116,6 +116,8 @@ uint8_t *peer; }; +void lu_op_tx_insert_subscr_data(struct lu_operation *luop); + void lu_op_statechg(struct lu_operation *luop, enum lu_state new_state) { enum lu_state old_state = luop->state; -- To view, visit https://gerrit.osmocom.org/1405 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4f7222f19e4d7129a5cef828a28dd12a40824a59 Gerrit-PatchSet: 1 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 Sun Dec 11 00:27:01 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:27:01 +0000 Subject: osmo-hlr[master]: fix various compiler warnings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1406 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3bf3b351535843bde9c0c1d955315615bb7c30b2 Gerrit-PatchSet: 1 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 Sun Dec 11 00:27:03 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:27:03 +0000 Subject: [MERGED] osmo-hlr[master]: fix various compiler warnings In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix various compiler warnings ...................................................................... fix various compiler warnings Change-Id: I3bf3b351535843bde9c0c1d955315615bb7c30b2 --- M src/db_auc.c M src/gsup_server.c M src/hlr.c 3 files changed, 7 insertions(+), 7 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/db_auc.c b/src/db_auc.c index 9196922..b37d9db 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -125,7 +125,7 @@ goto end_2g; } #endif - osmo_hexparse(ki, &aud2g->u.gsm.ki, sizeof(aud2g->u.gsm.ki)); + osmo_hexparse((void*)ki, (void*)&aud2g->u.gsm.ki, sizeof(aud2g->u.gsm.ki)); aud2g->type = OSMO_AUTH_TYPE_GSM; } else LOGAUC(imsi, LOGL_DEBUG, "No 2G Auth Data\n"); @@ -140,7 +140,7 @@ LOGAUC(imsi, LOGL_ERROR, "Error reading K: %d\n", rc); goto out; } - osmo_hexparse(k, &aud3g->u.umts.k, sizeof(aud3g->u.umts.k)); + osmo_hexparse((void*)k, (void*)&aud3g->u.umts.k, sizeof(aud3g->u.umts.k)); /* UMTS Subscribers can have either OP or OPC */ op = sqlite3_column_text(stmt, 5); if (!op) { @@ -149,11 +149,11 @@ LOGAUC(imsi, LOGL_ERROR, "Error reading OPC: %d\n", rc); goto out; } - osmo_hexparse(opc, &aud3g->u.umts.opc, + osmo_hexparse((void*)opc, (void*)&aud3g->u.umts.opc, sizeof(aud3g->u.umts.opc)); aud3g->u.umts.opc_is_op = 0; } else { - osmo_hexparse(op, &aud3g->u.umts.opc, + osmo_hexparse((void*)op, (void*)&aud3g->u.umts.opc, sizeof(aud3g->u.umts.opc)); aud3g->u.umts.opc_is_op = 1; } diff --git a/src/gsup_server.c b/src/gsup_server.c index f95d56c..ea51f7d 100644 --- a/src/gsup_server.c +++ b/src/gsup_server.c @@ -51,9 +51,9 @@ static int osmo_gsup_conn_oap_handle(struct osmo_gsup_conn *conn, struct msgb *msg_rx) { +#if 0 int rc; struct msgb *msg_tx; -#if 0 rc = oap_handle(&conn->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) @@ -174,7 +174,7 @@ struct ipaccess_unit *unit) { struct osmo_gsup_conn *clnt = (struct osmo_gsup_conn *)conn->data; - uint8_t *addr; + uint8_t *addr = NULL; size_t addr_len; LOGP(DLGSUP, LOGL_INFO, "CCM Callback\n"); diff --git a/src/hlr.c b/src/hlr.c index 86c5dcc..d7d97b1 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -182,7 +182,7 @@ memset(&gsup, 0, sizeof(gsup)); gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR; - strncpy(&gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)); + strncpy((char*)&gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)); gsup.imsi[sizeof(gsup.imsi)-1] = '\0'; gsup.cause = cause; -- To view, visit https://gerrit.osmocom.org/1406 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3bf3b351535843bde9c0c1d955315615bb7c30b2 Gerrit-PatchSet: 1 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 Sun Dec 11 00:51:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:51:37 +0000 Subject: [PATCH] libosmocore[master]: Fix VTY: add missing doc for 'log gsmtap [HOSTNAME]' Message-ID: Review at https://gerrit.osmocom.org/1408 Fix VTY: add missing doc for 'log gsmtap [HOSTNAME]' Add missing doc string for the HOSTNAME arg. Added in commit aa00f99be2e4cc64ede20d8c9548b83054696581, this breaks the VTY tests for openbsc and hence breaks our jenkins build jobs. Change-Id: I734b22c950242541322e902887bf779c14ba10fd --- M src/vty/logging_vty.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/08/1408/1 diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index cf3ec21..6004c47 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -501,7 +501,8 @@ DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd, "log gsmtap [HOSTNAME]", - LOG_STR "Logging via GSMTAP\n") + LOG_STR "Logging via GSMTAP\n" + "Host name to send the GSMTAP logging to (UDP port 4729)\n") { const char *hostname = argv[0]; struct log_target *tgt; -- To view, visit https://gerrit.osmocom.org/1408 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I734b22c950242541322e902887bf779c14ba10fd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 00:53:49 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:53:49 +0000 Subject: libosmocore[master]: Fix VTY: add missing doc for 'log gsmtap [HOSTNAME]' In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 fast tracking to fix the openbsc build -- To view, visit https://gerrit.osmocom.org/1408 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I734b22c950242541322e902887bf779c14ba10fd 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 Sun Dec 11 00:53:55 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 00:53:55 +0000 Subject: [MERGED] libosmocore[master]: Fix VTY: add missing doc for 'log gsmtap [HOSTNAME]' In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: Fix VTY: add missing doc for 'log gsmtap [HOSTNAME]' ...................................................................... Fix VTY: add missing doc for 'log gsmtap [HOSTNAME]' Add missing doc string for the HOSTNAME arg. Added in commit aa00f99be2e4cc64ede20d8c9548b83054696581, this breaks the VTY tests for openbsc and hence breaks our jenkins build jobs. Change-Id: I734b22c950242541322e902887bf779c14ba10fd --- M src/vty/logging_vty.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index cf3ec21..6004c47 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -501,7 +501,8 @@ DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd, "log gsmtap [HOSTNAME]", - LOG_STR "Logging via GSMTAP\n") + LOG_STR "Logging via GSMTAP\n" + "Host name to send the GSMTAP logging to (UDP port 4729)\n") { const char *hostname = argv[0]; struct log_target *tgt; -- To view, visit https://gerrit.osmocom.org/1408 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I734b22c950242541322e902887bf779c14ba10fd Gerrit-PatchSet: 1 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 Sun Dec 11 01:26:01 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 01:26:01 +0000 Subject: osmo-hlr[master]: bump required libosmocore version to 0.9.5 In-Reply-To: References: Message-ID: Patch Set 1: the build will work only when 0.9.5 has actually been tagged, planning to do so on libosmcore Id974c7be158e4d60421a98110f5c807aefd31119 (mentioned in commit log of previous patch) -- To view, visit https://gerrit.osmocom.org/1407 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd Gerrit-PatchSet: 1 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 Sun Dec 11 02:43:50 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 02:43:50 +0000 Subject: [PATCH] libosmocore[master]: oap: add encode/decode unit test 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/1379 to look at the new patch set (#8). oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 273 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/1379/8 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1aad2e9..b9eb8f2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test if ENABLE_MSGFILE @@ -131,6 +131,9 @@ gsup_gsup_test_SOURCES = gsup/gsup_test.c gsup_gsup_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la + fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la @@ -172,7 +175,8 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok + oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ + write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..f7fe0b7 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,181 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2016 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + printf("encoded message:\n%s\n", + osmo_hexdump((void*)msgb_l2(msgb), msgb_l2len(msgb))); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..9260d44 --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,42 @@ +Testing OAP messages +- Register Request +encoded message: +04 30 02 23 42 +ok +- Register Error +encoded message: +05 02 01 6f +ok +- Register Result +encoded message: +06 +ok +- Challenge Request, no rand, no autn +encoded message: +08 +ok +- Challenge Request, with rand, no autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 +ok +- Challenge Request, no rand, with autn +encoded message: +08 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Request, with rand, with autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Error +encoded message: +09 02 01 17 +ok +- Challenge Result +encoded message: +0a 24 08 01 02 03 04 05 06 07 08 +ok +- Sync Request +encoded message: +0c 25 10 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 01 +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index c01f4af..426c74c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -221,3 +221,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 Gerrit-PatchSet: 8 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 Sun Dec 11 20:18:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 20:18:20 +0000 Subject: [PATCH] libosmo-sccp[master]: fix NULL deref: sua_accept_cb: missing error-return Message-ID: Review at https://gerrit.osmocom.org/1409 fix NULL deref: sua_accept_cb: missing error-return When server creation failed, besides closing the fd also return an error, instead of continuing to use the NULL srv. Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577 Fixes: coverity CID#57684 --- M src/sua.c 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/09/1409/1 diff --git a/src/sua.c b/src/sua.c index 799d270..442b2a0 100644 --- a/src/sua.c +++ b/src/sua.c @@ -1261,8 +1261,10 @@ srv = osmo_stream_srv_create(user, link, fd, sua_srv_conn_cb, sua_srv_conn_closed_cb, NULL); - if (!srv) + if (!srv) { close(fd); + return -1; + } /* create new SUA link and connect both data structures */ sual = sua_link_new(user, 1); -- To view, visit https://gerrit.osmocom.org/1409 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 20:25:08 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 20:25:08 +0000 Subject: [PATCH] libosmo-sccp[master]: NULL safety: sccp_create_sccp_addr: copy only non-NULL sock-... Message-ID: Review at https://gerrit.osmocom.org/1410 NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti presumably, sock->gti_len is always zero when sock->gti is NULL, but ensure with a check and make coverity scan happy. Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428 Fixes: coverity CID#57683 --- M src/sccp.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/10/1410/1 diff --git a/src/sccp.c b/src/sccp.c index e6c538d..6c77cc4 100644 --- a/src/sccp.c +++ b/src/sccp.c @@ -510,8 +510,10 @@ msgb_v_put(msg, sock->sccp_ssn); /* copy the gti if it is present */ - gti = msgb_put(msg, sock->gti_len); - memcpy(gti, sock->gti, sock->gti_len); + if (sock->gti) { + gti = msgb_put(msg, sock->gti_len); + memcpy(gti, sock->gti, sock->gti_len); + } /* update the length now */ len[0] = msg->tail - len - 1; -- To view, visit https://gerrit.osmocom.org/1410 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 11 20:40:32 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 20:40:32 +0000 Subject: openbsc[master]: bsc_control.py: use ipa.py module In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 (3 comments) if you like, fix the cosmetics and bump me on IM to renew the +2; but not that important either. Disclaimer: I don't understand in depth what this patch does, but looks good according to the function names. Also this has been up for review for long enough now, time to unblock. https://gerrit.osmocom.org/#/c/1266/8/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 27: do_set_get(sck, var, val) from below: a, _, _ = do_set_get(... return a (and yes, you don't need to put braces around 'a, _, _') Line 70: (a, _, _) = do_set_get(sock, args[0], ' '.join(args[1:])) looks like set_var() should include this to return the set val, and use set_var() here? Line 77: print "Got message:", a because it is reused -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 8 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 Sun Dec 11 20:42:19 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 20:42:19 +0000 Subject: openbsc[master]: bsc_control.py: style corrections In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/1269/7/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 2: # -*- mode: python-mode; py-indent-tabs-mode: nil -*- next time you could also add # vim: expandtab :) -- To view, visit https://gerrit.osmocom.org/1269 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib79fd4317d40ee4fd87b090b9faf8ebaf4bfca64 Gerrit-PatchSet: 7 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 Sun Dec 11 20:56:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 20:56:53 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 10: (7 comments) I'm confused, what does this code actually *do*?? https://gerrit.osmocom.org/#/c/1268/10/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 33: Generic IPA protocol handler: include some routines for simpler subprotocols end sentence with a '.', can't rely on line break in API docs Line 46: """ I'm not sure that this comment is helpful at all. Also I would put it on a single line like def foo(): 'single line comment' code same below Line 48: print('OSMO MGCP received %s' % data) rather have one def dbg(*args): if not self.factory.debug: return print(' '.join(*args)) or similar, then only use self.dbg(msg) all over this file. Line 92: def handle_RSL(self, d, pr, ex): what are d, pr, ex? let's not have these cryptic names without a doc Line 97: print('IPA RSL received message with attribute %s' % ex) hmm, here 'ex' is called 'attribute'? looks like a naming choice problem. same below. Line 104: pass hmm really? if i pick the wrong class, CCM messages are blown in the wind without anyone noticing? Wait a minute, none of these functions actually *do* anything? Could this API be designed better in the first place? Line 332: Only necessayr for as debugging aid - if we can somehow set parent's class noisy attribute than we can omit this method "necessary", same typo seen around elswhere. Also it's "then" when talking about time -- "than" is for comparison -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 10 Gerrit-Project: openbsc 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 Dec 11 21:09:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 21:09:35 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 9: Code-Review-1 (7 comments) I do uphold most of my comments which you seem to disagree with. Sorry that I commented on PS3 instead of the last PS, but the comments are still valid AFAICT https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 27: class IPA(object): > I think it's better to stick to the same names as in libosmocore. which names? #defines? because all our function prefixes also avoid all-caps. Line 35: PROTO = dict(RSL = 0x00, CCM = 0xFE, SCCP = 0xFD, OML = 0xFF, OSMO = 0xEE, MGCP_OLD = 0xFC) > This would decrease readability without providing any obvious benefits. Not at all. In all python code I've seen, kwargs have no spaces. If you write with spaces, it looks like assignments to me: confusing. Line 45: CTRL_TRAP = 'TRAP' > I think it's better to use the same style for docstrings regardless of how lol "how many LIES" :) Come on, this is code bloat that outweighs the function body. Line 48: """ > This would make dispatcher code which uses it unnecessary hard without prov The benefit is hugely obvious. If you ever compare the return value, you can introduce typos without noticing. The None construct exists for exactly these cases. Line 50: """ > that's python syntax for private functions. double underscores are typically for python language constructs like __doc__ or __name__. Please use single underscore instead. Line 113: if not len(data): > Calling code is expected to work with tag_* functions. Sorry, I don't follow. Why do you not want to define constants in a central place? Line 163: def tag_ip(self, data): > why? it's easier to read when spaces are there. see above, kwargs convention -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 9 Gerrit-Project: openbsc 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 Dec 11 21:13:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 11 Dec 2016 21:13:20 +0000 Subject: openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Patch Set 7: Code-Review-1 (1 comment) could you also briefly comment: unused by whom? what was it intended for which turned out to be obsolete why? only if there's anything to say... https://gerrit.osmocom.org/#/c/1270/7/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 32: if __name__ == '__main__': removing the random seed but no mention nor explanation in the log message. I've commented on this before IIRC -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 7 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 Mon Dec 12 07:38:28 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Mon, 12 Dec 2016 07:38:28 +0000 Subject: [PATCH] osmo-pcu[master]: Sanitizer build fix for TbfTest Message-ID: Review at https://gerrit.osmocom.org/1411 Sanitizer build fix for TbfTest Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 --- M src/tbf_dl.cpp 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/1411/1 diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 2af2ff0..dfbacb2 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -627,7 +627,8 @@ GprsCodingScheme cs; int bsns[ARRAY_SIZE(rlc.block_info)]; unsigned num_bsns; - enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)]; + enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)] = + {EGPRS_PS_INVALID}; bool need_padding = false; enum egprs_rlcmac_dl_spb spb = EGPRS_RLCMAC_DL_NO_RETX; unsigned int spb_status = get_egprs_dl_spb_status(index); -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Mon Dec 12 09:40:25 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 09:40:25 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (6 comments) Did I got it right that the only disagreement right now is of purely aesthetically nature? In the absence of Osmocom coding style guide for python I don't think it warrants -1 review. https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 27: class IPA(object): > which names? #defines? because all our function prefixes also avoid all-cap Yes, defines. Line 35: PROTO = dict(RSL = 0x00, CCM = 0xFE, SCCP = 0xFD, OML = 0xFF, OSMO = 0xEE, MGCP_OLD = 0xFC) > Not at all. In all python code I've seen, kwargs have no spaces. If you wri It looks like assignment because it is assignment. I don't get what's the confusion about? Line 45: """ > lol "how many LIES" :) Lol indeed, perfect typo when it comes to documentation :) Nevertheless, if documentation for a function looks "bloated" compared to function body I don't consider it a bad thing: we're not hard-pressed to squeeze SLOC to an absolute minimum - certainly not at the cost of readability. Line 48: return 'UNKNOWN' > The benefit is hugely obvious. If you ever compare the return value, you ca So it's "potential errors due to typos" vs "potential errors due to unnecessary complex dispatch code". My heart goes for the latter: typos seems to be easier to catch. Line 50: def __tag(self, t, v): > double underscores are typically for python language constructs like __doc_ No, the convention is _ means "don't use unless you know what you're doing", while __ means "private, never use directly". In this case the semantic is the latter, changing underscores would send the wrong message the the users of this class. Line 113: return self.__tag(self.IDTAG['SERNR'], data) > Sorry, I don't follow. Why do you not want to define constants in a central I don't get the question: they are defined in a central place - it's right on top of this file. Could you elaborate? -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Mon Dec 12 09:40:40 2016 From: gerrit-no-reply at lists.osmocom.org (pierre.baudry) Date: Mon, 12 Dec 2016 09:40:40 +0000 Subject: osmo-bts[master]: Remove duplicated code In-Reply-To: References: Message-ID: Patch Set 8: (1 comment) https://gerrit.osmocom.org/#/c/1046/8/src/osmo-bts-trx/l1_if.c File src/osmo-bts-trx/l1_if.c: Line 666: bts_model_lchan_deactivate_sacch(lchan); I think something is wrong here, I see a lot of new errors in the osmo-bts-trx log. A quick debug print line show that chan_nr != lchan->nr. -- To view, visit https://gerrit.osmocom.org/1046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: pierre.baudry Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 12 09:46:31 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Mon, 12 Dec 2016 09:46:31 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Verified+1 -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 09:48:37 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 09:48:37 +0000 Subject: openbsc[master]: bsc_control.py: use ipa.py module In-Reply-To: References: Message-ID: Patch Set 8: (1 comment) https://gerrit.osmocom.org/#/c/1266/8/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 27: do_set_get(sck, var, val) > from below: Erm, pardon but I don't get this at all. Could you please elaborate using more words and longer sentences: - what exactly you think is noteworthy about this change? - if it requires some alterations, than what kind of changes you think are necessary and why? -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 8 Gerrit-Project: openbsc 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 Mon Dec 12 10:17:53 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 10:17:53 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 10: (2 comments) The rest will be fixed in follow-up patch. https://gerrit.osmocom.org/#/c/1268/10/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 46: """ > I'm not sure that this comment is helpful at all. How can I make it more helpful? Line 104: pass > hmm really? if i pick the wrong class, CCM messages are blown in the wind w Well, yes - if you use wrong handler for the messages than result would be wrong indeed: garbage in - garbage out. How would you suggest to design the API in a better way? -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 10 Gerrit-Project: openbsc 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 Mon Dec 12 10:53:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 10:53:43 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (3 comments) ok guys, let's wrap this up. * kwargs have no spaces * we keep uppercase class names * we use 'is None' or 'is not None' https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 35: PROTO = dict(RSL = 0x00, CCM = 0xFE, SCCP = 0xFD, OML = 0xFF, OSMO = 0xEE, MGCP_OLD = 0xFC) > It looks like assignment because it is assignment. I don't get what's the c the official python style guide https://www.python.org/dev/peps/pep-0008/ addresses this in https://www.python.org/dev/peps/pep-0008/#other-recommendations an recommends not to use spaces for kwargs. Let's follow this recommendation and stop wasting time on debates. Line 236: if op != None: > if op is not None: @Max: see http://stackoverflow.com/questions/2209755/python-operation-vs-is-not so it seems indeed in this case "is not" is preferred in python Line 263: if k != var or (val != None and v != val): > 'val is not None' see above comment on 'is none' -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Mon Dec 12 10:58:46 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 10:58:46 +0000 Subject: libosmo-sccp[master]: NULL safety: sccp_create_sccp_addr: copy only non-NULL sock-... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1410 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428 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 Mon Dec 12 10:58:55 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 10:58:55 +0000 Subject: [MERGED] libosmo-sccp[master]: NULL safety: sccp_create_sccp_addr: copy only non-NULL sock-... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti ...................................................................... NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti presumably, sock->gti_len is always zero when sock->gti is NULL, but ensure with a check and make coverity scan happy. Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428 Fixes: coverity CID#57683 --- M src/sccp.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/sccp.c b/src/sccp.c index e6c538d..6c77cc4 100644 --- a/src/sccp.c +++ b/src/sccp.c @@ -510,8 +510,10 @@ msgb_v_put(msg, sock->sccp_ssn); /* copy the gti if it is present */ - gti = msgb_put(msg, sock->gti_len); - memcpy(gti, sock->gti, sock->gti_len); + if (sock->gti) { + gti = msgb_put(msg, sock->gti_len); + memcpy(gti, sock->gti, sock->gti_len); + } /* update the length now */ len[0] = msg->tail - len - 1; -- To view, visit https://gerrit.osmocom.org/1410 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 12 10:59:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 10:59:18 +0000 Subject: libosmo-sccp[master]: fix NULL deref: sua_accept_cb: missing error-return In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1409 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577 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 Mon Dec 12 10:59:20 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 10:59:20 +0000 Subject: [MERGED] libosmo-sccp[master]: fix NULL deref: sua_accept_cb: missing error-return In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix NULL deref: sua_accept_cb: missing error-return ...................................................................... fix NULL deref: sua_accept_cb: missing error-return When server creation failed, besides closing the fd also return an error, instead of continuing to use the NULL srv. Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577 Fixes: coverity CID#57684 --- M src/sua.c 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/sua.c b/src/sua.c index 799d270..442b2a0 100644 --- a/src/sua.c +++ b/src/sua.c @@ -1261,8 +1261,10 @@ srv = osmo_stream_srv_create(user, link, fd, sua_srv_conn_cb, sua_srv_conn_closed_cb, NULL); - if (!srv) + if (!srv) { close(fd); + return -1; + } /* create new SUA link and connect both data structures */ sual = sua_link_new(user, 1); -- To view, visit https://gerrit.osmocom.org/1409 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 12 10:59:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 10:59:39 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:01:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:01:07 +0000 Subject: libosmocore[master]: fix: DLGSUP logging category "unusable" In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1402 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id974c7be158e4d60421a98110f5c807aefd31119 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 Mon Dec 12 11:01:11 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:01:11 +0000 Subject: [MERGED] libosmocore[master]: fix: DLGSUP logging category "unusable" In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix: DLGSUP logging category "unusable" ...................................................................... fix: DLGSUP logging category "unusable" All DL* categories are typically negative, but DLGSUP isn't, and it's also not in libosmocore's internal_cat array. See: 3b6fb0880c3ab1e23a3d7d738d073b00c2a794c2 This means that a program using DLGSUP has to include DLGSUP in its own logging cat array (typically not needed for DL* categories), which means for osmo-nitb that DLGSUP (11) replaces DMGCP (also 11), and DMGCP becomes unusable. Fix this: make DLGSUP -11 and include in internal_cat. In gsup_test.c, no longer add DLGSUP to the logging categories array. External follow-ups are otherwise needed only in osmo-hlr.git and some pending patches for openbsc (Id3938267fa062e1a997d3704cd678874306f86ee). Change-Id: Id974c7be158e4d60421a98110f5c807aefd31119 --- M include/osmocom/core/logging.h M src/logging.c M tests/gsup/gsup_test.c 3 files changed, 6 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index ad775b9..cc3919b 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -92,7 +92,7 @@ #define DLCTRL -8 /*!< Control Interface */ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ -#define DLGSUP 11 /*!< Generic Subscriber Update Protocol */ +#define DLGSUP -11 /*!< Generic Subscriber Update Protocol */ #define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ diff --git a/src/logging.c b/src/logging.c index 1516a7d..30d0b8d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -123,6 +123,11 @@ .description = "Statistics messages and logging", .enabled = 1, .loglevel = LOGL_NOTICE, }, + [INT2IDX(DLGSUP)] = { + .name = "DLGSUP", + .description = "Generic Subscriber Update Protocol", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, }; /*! \brief descriptive string for each log level */ diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index 2b0a293..7af16b7 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -241,11 +241,6 @@ } const struct log_info_cat default_categories[] = { - [DLGSUP] = { - .name = "DLGSUP", - .description = "Generic Subscriber Update Protocol", - .enabled = 0, .loglevel = LOGL_DEBUG, - }, }; static struct log_info info = { -- To view, visit https://gerrit.osmocom.org/1402 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id974c7be158e4d60421a98110f5c807aefd31119 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 Mon Dec 12 11:01:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:01:40 +0000 Subject: libosmocore[master]: import oap message parsing / encoding from openbsc.git; AGPL... In-Reply-To: References: Message-ID: Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:02:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:02:04 +0000 Subject: libosmocore[master]: oap: add encode/decode unit test In-Reply-To: References: Message-ID: Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 Gerrit-PatchSet: 8 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 Mon Dec 12 11:02:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:02:07 +0000 Subject: [MERGED] libosmocore[master]: oap: add encode/decode unit test In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap: add encode/decode unit test ...................................................................... oap: add encode/decode unit test Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 --- M tests/Makefile.am A tests/oap/Makefile.am A tests/oap/oap_test.c A tests/oap/oap_test.ok M tests/testsuite.at 5 files changed, 273 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/Makefile.am b/tests/Makefile.am index 1aad2e9..b9eb8f2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,7 +13,7 @@ vty/vty_test comp128/comp128_test utils/utils_test \ smscb/gsm0341_test stats/stats_test \ bitvec/bitvec_test msgb/msgb_test bits/bitcomp_test \ - tlv/tlv_test gsup/gsup_test fsm/fsm_test \ + tlv/tlv_test gsup/gsup_test oap/oap_test fsm/fsm_test \ write_queue/wqueue_test if ENABLE_MSGFILE @@ -131,6 +131,9 @@ gsup_gsup_test_SOURCES = gsup/gsup_test.c gsup_gsup_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la +oap_oap_test_SOURCES = oap/oap_test.c +oap_oap_test_LDADD = $(top_builddir)/src/gsm/libosmogsm.la $(top_builddir)/src/libosmocore.la + fsm_fsm_test_SOURCES = fsm/fsm_test.c fsm_fsm_test_LDADD = $(top_builddir)/src/libosmocore.la @@ -172,7 +175,8 @@ utils/utils_test.ok stats/stats_test.ok \ bitvec/bitvec_test.ok msgb/msgb_test.ok bits/bitcomp_test.ok \ sim/sim_test.ok tlv/tlv_test.ok gsup/gsup_test.ok \ - fsm/fsm_test.ok fsm/fsm_test.err write_queue/wqueue_test.ok + oap/oap_test.ok fsm/fsm_test.ok fsm/fsm_test.err \ + write_queue/wqueue_test.ok DISTCLEANFILES = atconfig atlocal diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am new file mode 100644 index 0000000..06ccf33 --- /dev/null +++ b/tests/oap/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + oap_test.ok \ + $(NULL) + +if HAVE_LIBGTP +if HAVE_LIBCARES +noinst_PROGRAMS = \ + oap_test \ + $(NULL) +endif +endif + +oap_test_SOURCES = \ + oap_test.c \ + $(NULL) + +oap_test_LDADD = \ + $(top_builddir)/src/gprs/oap.o \ + $(top_builddir)/src/gprs/oap_messages.o \ + $(top_builddir)/src/gprs/gprs_utils.o \ + $(top_builddir)/src/libcommon/libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + -lrt + diff --git a/tests/oap/oap_test.c b/tests/oap/oap_test.c new file mode 100644 index 0000000..f7fe0b7 --- /dev/null +++ b/tests/oap/oap_test.c @@ -0,0 +1,181 @@ +/* Test Osmocom Authentication Protocol */ +/* + * (C) 2016 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 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 + +static struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +{ + struct msgb *msgb = msgb_alloc_headroom(1000, 64, __func__); + OSMO_ASSERT(msgb); + osmo_oap_encode(msgb, oap_msg); + return msgb; +} + +static bool encode_decode_makes_same_msg(struct osmo_oap_message *oap_msg) +{ + struct osmo_oap_message oap_msg_decoded; + struct msgb *msgb; + int rc; + bool result; + memset(&oap_msg_decoded, 0, sizeof(oap_msg_decoded)); + + msgb = oap_encoded(oap_msg); + printf("encoded message:\n%s\n", + osmo_hexdump((void*)msgb_l2(msgb), msgb_l2len(msgb))); + rc = osmo_oap_decode(&oap_msg_decoded, msgb_l2(msgb), msgb_l2len(msgb)); + + if (rc) { + printf("osmo_oap_decode() returned error: %d\n", rc); + result = false; + goto free_msgb; + } + + rc = memcmp(oap_msg, &oap_msg_decoded, sizeof(oap_msg_decoded)); + if (rc) { + printf("decoded message mismatches encoded message\n"); + printf("original:\n%s\n", + osmo_hexdump((void*)oap_msg, sizeof(*oap_msg))); + printf("en- and decoded:\n%s\n", + osmo_hexdump((void*)&oap_msg_decoded, sizeof(oap_msg_decoded))); + result = false; + goto free_msgb; + } + + printf("ok\n"); + result = true; + +free_msgb: + talloc_free(msgb); + return result; +} + +static void test_oap_messages_dec_enc(void) +{ + printf("Testing OAP messages\n"); + + struct osmo_oap_message oap_msg; + +#define CLEAR() memset(&oap_msg, 0, sizeof(oap_msg)) +#define CHECK() OSMO_ASSERT(encode_decode_makes_same_msg(&oap_msg)) + + printf("- Register Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; + oap_msg.client_id = 0x2342; + CHECK(); + + printf("- Register Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_ERROR; + oap_msg.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; + CHECK(); + + printf("- Register Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_REGISTER_RESULT; + CHECK(); + + printf("- Challenge Request, no rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, with rand, no autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + oap_msg.autn_present = 0; + CHECK(); + + printf("- Challenge Request, no rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + oap_msg.rand_present = 0; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Request, with rand, with autn\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_REQUEST; + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_msg.rand, 16); + oap_msg.rand_present = 1; + osmo_hexparse("cec4e3848a33000086781158ca40f136", + oap_msg.autn, 16); + oap_msg.autn_present = 1; + CHECK(); + + printf("- Challenge Error\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_ERROR; + oap_msg.cause = GMM_CAUSE_GSM_AUTH_UNACCEPT; + CHECK(); + + printf("- Challenge Result\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_CHALLENGE_RESULT; + osmo_hexparse("0102030405060708", + oap_msg.xres, 8); + oap_msg.xres_present = 1; + CHECK(); + + printf("- Sync Request\n"); + CLEAR(); + oap_msg.message_type = OAP_MSGT_SYNC_REQUEST; + osmo_hexparse("102030405060708090a0b0c0d0e0f001", + oap_msg.auts, 16); + oap_msg.auts_present = 1; + CHECK(); + + /* Sync Error and Sync Result are not used in OAP */ +} + +const struct log_info_cat default_categories[] = { +}; + +static struct log_info info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + osmo_init_logging(&info); + + test_oap_messages_dec_enc(); + + printf("Done.\n"); + return EXIT_SUCCESS; +} diff --git a/tests/oap/oap_test.ok b/tests/oap/oap_test.ok new file mode 100644 index 0000000..9260d44 --- /dev/null +++ b/tests/oap/oap_test.ok @@ -0,0 +1,42 @@ +Testing OAP messages +- Register Request +encoded message: +04 30 02 23 42 +ok +- Register Error +encoded message: +05 02 01 6f +ok +- Register Result +encoded message: +06 +ok +- Challenge Request, no rand, no autn +encoded message: +08 +ok +- Challenge Request, with rand, no autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 +ok +- Challenge Request, no rand, with autn +encoded message: +08 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Request, with rand, with autn +encoded message: +08 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 23 10 ce c4 e3 84 8a 33 00 00 86 78 11 58 ca 40 f1 36 +ok +- Challenge Error +encoded message: +09 02 01 17 +ok +- Challenge Result +encoded message: +0a 24 08 01 02 03 04 05 06 07 08 +ok +- Sync Request +encoded message: +0c 25 10 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 01 +ok +Done. diff --git a/tests/testsuite.at b/tests/testsuite.at index c01f4af..426c74c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -221,3 +221,10 @@ cat $abs_srcdir/fsm/fsm_test.err > experr AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr]) AT_CLEANUP + +AT_SETUP([oap]) +AT_KEYWORDS([oap]) +cat $abs_srcdir/oap/oap_test.ok > expout +touch experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr]) +AT_CLEANUP -- To view, visit https://gerrit.osmocom.org/1379 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944 Gerrit-PatchSet: 8 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 Mon Dec 12 11:02:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:02:08 +0000 Subject: [MERGED] libosmocore[master]: import oap message parsing / encoding from openbsc.git; AGPL... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: import oap message parsing / encoding from openbsc.git; AGPL->GPL ...................................................................... import oap message parsing / encoding from openbsc.git; AGPL->GPL In the process, also: * Change the license from AGPLv3 to GPLv2-or-later; * correct spelling of 'sysmocom' to lowercase; * add '2016' to the copyright; * rename to osmo_*; * add API docs; * add logging category DLOAP: define id and add to internal_cat; * redirect all oap.c logging to DLOAP. A unit test will follow in a subsequent patch, since it needs a minor tweak for decoding of boolean values. The related openbsc change-id is I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf. Tweaked-by: Neels Hofmeyr Change-Id: If5099e60681a215e798b6675f21813f26769c253 --- M Makefile.am A doc/osmocom-authn-protocol.txt M include/Makefile.am M include/osmocom/core/logging.h A include/osmocom/gsm/oap.h M src/gsm/Makefile.am M src/gsm/libosmogsm.map A src/gsm/oap.c M src/logging.c 9 files changed, 519 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile.am b/Makefile.am index 185127e..9c901ea 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 doc/osmocom-authn-protocol.txt if HAVE_DOXYGEN diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..1b6794e --- /dev/null +++ b/doc/osmocom-authn-protocol.txt @@ -0,0 +1,250 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +The Osmocom Authentication Protocol employs mutual authentication to register a +client with a server over an IPA connection. Milenage is used as the +authentication algorithm, where client and server have a shared secret. + +For example, an SGSN, as OAP client, may use its SGSN ID to register with a MAP +proxy, an OAP server. + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 (OAP) + +2. Procedures + +Ideal communication sequence: + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "test setup": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +Variation "invalid sequence nr": + + Client Server + | | + | Register (ID) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Sync Request (AUTS) | + |----------------------------------->| + | | + | Challenge (RAND'+AUTN') | + |<-----------------------------------| + | | + | Challenge Result (XRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The client sends a REGISTER_REQ message containing an identifier number. + +2.2. Challenge + +The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes +and a milenage authentication token generated from these random bytes, using a +shared secret, to authenticate itself to the OAP client. The server may omit +this challenge entirely, based on its configuration, and immediately reply with +a Register Result response. If the client cannot be registered (e.g. id is +invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the client has received a Challenge, it may verify the server's +authenticity and validity of the sequence number (included in AUTN), and, if +valid, reply with a CHALLENGE_RES message. This shall contain an XRES +authentication token generated by milenage from the same random bytes received +from the server and the same shared secet. If the client decides to cancel the +registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a +CHALLENGE_ERR message may be sent, but is not mandatory. For example, the +client may directly start with a new REGISTER_REQ message. + +2.4. Sync Request + +When the client has received a Challenge but sees an invalid sequence number +(embedded in AUTN, according to the milenage algorithm), the client may send a +SYNC_REQ message containing an AUTS synchronisation token. + +2.5. Sync Result + +If the server has received a valid Sync Request, it shall answer by directly +sending another Challenge (see 2.2.). If an invalid Sync Request is received, +the server shall reply with a REGISTER_ERR message. + +2.6. Register Result + +The server sends a REGISTER_RES message to indicate that registration has been +successful. If the server cannot register the client (e.g. invalid challenge +response), it shall send a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 Client ID big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 XRES octet string (8) M TLV 10 + +3.2.3. Sync Request + +Client -> Server + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 AUTS octet string (16) M TLV 18 + +3.2.4. Sync Error + +Server -> Client + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + | 0 0 0 0 1 1 0 0 - Sync Request | + | 0 0 0 0 1 1 0 1 - Sync Error (not used) | + | 0 0 0 0 1 1 1 0 - Sync Result (not used) | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x23 AUTN octet string | + | 0x24 XRES octet string | + | 0x25 AUTS octet string | + | 0x30 Client ID big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. Client ID + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | Client ID IEI | octet 1 + +-----------------------------------------------------+ + | Length of Client ID IE contents (2) | octet 2 + +-----------------------------------------------------+ + | Client ID number, most significant byte | octet 3 + +-----------------------------------------------------+ + | Client ID number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The Client ID number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset ID. + diff --git a/include/Makefile.am b/include/Makefile.am index c125691..0a300a8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -82,6 +82,7 @@ osmocom/gsm/mncc.h \ osmocom/gsm/prim.h \ osmocom/gsm/l1sap.h \ + osmocom/gsm/oap.h \ osmocom/gsm/protocol/gsm_03_40.h \ osmocom/gsm/protocol/gsm_03_41.h \ osmocom/gsm/protocol/gsm_04_08.h \ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index cc3919b..1ca348a 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -93,7 +93,8 @@ #define DLGTP -9 /*!< GTP (GPRS Tunneling Protocol */ #define DLSTATS -10 /*!< Statistics */ #define DLGSUP -11 /*!< Generic Subscriber Update Protocol */ -#define OSMO_NUM_DLIB 11 /*!< Number of logging sub-systems in libraries */ +#define DLOAP -12 /*!< Osmocom Authentication Protocol */ +#define OSMO_NUM_DLIB 12 /*!< Number of logging sub-systems in libraries */ /*! Configuration of singgle log category / sub-system */ struct log_category { diff --git a/include/osmocom/gsm/oap.h b/include/osmocom/gsm/oap.h new file mode 100644 index 0000000..d973013 --- /dev/null +++ b/include/osmocom/gsm/oap.h @@ -0,0 +1,72 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#pragma once + +#include +#include +#include + +/*! \brief Information Element Identifiers for OAP IEs. + * They match osmo_gsup_iei (so far). */ +enum osmo_oap_iei { + OAP_CAUSE_IE = 0x02, + OAP_RAND_IE = 0x20, + OAP_AUTN_IE = 0x23, + OAP_XRES_IE = 0x24, + OAP_AUTS_IE = 0x25, + OAP_CLIENT_ID_IE = 0x30, +}; + +/*! \brief OAP message types */ +enum osmo_oap_message_type { + OAP_MSGT_REGISTER_REQUEST = 0b00000100, + OAP_MSGT_REGISTER_ERROR = 0b00000101, + OAP_MSGT_REGISTER_RESULT = 0b00000110, + + OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + OAP_MSGT_CHALLENGE_RESULT = 0b00001010, + + OAP_MSGT_SYNC_REQUEST = 0b00001100, + OAP_MSGT_SYNC_ERROR = 0b00001101, + OAP_MSGT_SYNC_RESULT = 0b00001110, +}; + +/*! \brief Parsed/decoded OAP protocol message */ +struct osmo_oap_message { + enum osmo_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t client_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int xres_present; + uint8_t xres[8]; + int auts_present; + uint8_t auts[16]; +}; + +int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, + size_t data_len); +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 3877f78..4ea55e1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -22,7 +22,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 + gsup.c gprs_gea.c gsm0503_conv.c oap.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 3e7333c..a3d224f 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -356,5 +356,8 @@ osmo_gsup_encode; osmo_gsup_decode; +osmo_oap_encode; +osmo_oap_decode; + local: *; }; diff --git a/src/gsm/oap.c b/src/gsm/oap.c new file mode 100644 index 0000000..979bde6 --- /dev/null +++ b/src/gsm/oap.c @@ -0,0 +1,184 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015-2016 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 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, see . + * + */ + +#include +#include +#include +#include +#include + +#include + +/*! \brief Decode OAP message data. + * \param[out] oap_msg Parsed data is written to this instance. + * \param[in] data Pointer to the data buffer containing the OAP message. + * \param[in] data_len Length of the OAP message data. + * \returns 0 on success, a negative cause value on failure. + */ +int osmo_oap_decode(struct osmo_oap_message *oap_msg, + const uint8_t *const_data, size_t data_len) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + + memset(oap_msg, 0, sizeof(*oap_msg)); + + /* message type */ + rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = osmo_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum osmo_oap_iei iei; + + rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case OAP_CLIENT_ID_IE: + if (value_len != 2) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->client_id = osmo_decode_big_endian(value, value_len); + + if (oap_msg->client_id == 0) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type client ID (%d): client ID must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case OAP_XRES_IE: + if (value_len != sizeof(oap_msg->xres)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type XRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->xres, value, value_len); + oap_msg->xres_present = value_len; + break; + + case OAP_AUTS_IE: + if (value_len != sizeof(oap_msg->auts)) { + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type AUTS (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->auts, value, value_len); + oap_msg->auts_present = value_len; + break; + + case OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DLOAP, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DLOAP, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +/*! \brief Compose OAP message data. + * \param[out] msg OAP message data is appended to this message buffer. + * \param[in] oap_msg Elements to encode in the message data. + */ +void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, (uint8_t)oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->client_id > 0) + msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), + osmo_encode_big_endian(oap_msg->client_id, + sizeof(oap_msg->client_id))); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->auts_present) + msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); + + if (oap_msg->xres_present) + msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); + + msg->l2h = msg->data; +} diff --git a/src/logging.c b/src/logging.c index 30d0b8d..92852c9 100644 --- a/src/logging.c +++ b/src/logging.c @@ -128,6 +128,11 @@ .description = "Generic Subscriber Update Protocol", .enabled = 1, .loglevel = LOGL_NOTICE, }, + [INT2IDX(DLOAP)] = { + .name = "DLOAP", + .description = "Osmocom Authentication Protocol", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, }; /*! \brief descriptive string for each log level */ -- To view, visit https://gerrit.osmocom.org/1375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If5099e60681a215e798b6675f21813f26769c253 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 Mon Dec 12 11:02:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:02:08 +0000 Subject: [MERGED] libosmocore[master]: doc: osmocom-authn-protocol.txt: fix numbering, mark unused ... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs ...................................................................... doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a --- M doc/osmocom-authn-protocol.txt 1 file changed, 11 insertions(+), 11 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/doc/osmocom-authn-protocol.txt b/doc/osmocom-authn-protocol.txt index 1b6794e..6d057be 100644 --- a/doc/osmocom-authn-protocol.txt +++ b/doc/osmocom-authn-protocol.txt @@ -142,14 +142,14 @@ 02 Cause GMM cause, M TLV 3 04.08: 10.5.5.14 -3.2.6. Register Result +3.2.3. Register Result Server -> Client IEI Info Element Type Pres. Format Length Message type 4.2.1 M V 1 -3.2.3. Challenge +3.2.4. Challenge Server -> Client @@ -158,7 +158,7 @@ 20 RAND octet string (16) M TLV 18 23 AUTN octet string (16) M TLV 18 -3.2.4. Challenge Error +3.2.5. Challenge Error Client -> Server @@ -167,7 +167,7 @@ 02 Cause GMM cause, M TLV 3 04.08: 10.5.5.14 -3.2.5. Challenge Result +3.2.6. Challenge Result Client -> Server @@ -175,7 +175,7 @@ Message type 4.2.1 M V 1 21 XRES octet string (8) M TLV 10 -3.2.3. Sync Request +3.2.7. Sync Request Client -> Server @@ -183,14 +183,14 @@ Message type 4.2.1 M V 1 20 AUTS octet string (16) M TLV 18 -3.2.4. Sync Error +3.2.8. Sync Error -Server -> Client +Not used. - IEI Info Element Type Pres. Format Length - Message type 4.2.1 M V 1 - 02 Cause GMM cause, M TLV 3 - 04.08: 10.5.5.14 +3.2.9. Sync Result + +Not used. + 4. Information Elements -- To view, visit https://gerrit.osmocom.org/1380 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic1ec5d00de406f9581377ef4b5547782a80f368a Gerrit-PatchSet: 8 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 Mon Dec 12 11:02:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:02:08 +0000 Subject: [MERGED] libosmocore[master]: gsm/oap: more robust: decode presence as clearly either 1 or 0 In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsm/oap: more robust: decode presence as clearly either 1 or 0 ...................................................................... gsm/oap: more robust: decode presence as clearly either 1 or 0 Prepares for the unit test, which can now simply check for encode/decode identity. Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 --- M src/gsm/oap.c 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/oap.c b/src/gsm/oap.c index 979bde6..1494a6a 100644 --- a/src/gsm/oap.c +++ b/src/gsm/oap.c @@ -92,7 +92,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->autn, value, value_len); - oap_msg->autn_present = value_len; + oap_msg->autn_present = value_len ? 1 : 0; break; case OAP_RAND_IE: @@ -103,7 +103,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->rand, value, value_len); - oap_msg->rand_present = value_len; + oap_msg->rand_present = value_len ? 1 : 0; break; case OAP_XRES_IE: @@ -114,7 +114,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->xres, value, value_len); - oap_msg->xres_present = value_len; + oap_msg->xres_present = value_len ? 1 : 0; break; case OAP_AUTS_IE: @@ -125,7 +125,7 @@ return -GMM_CAUSE_PROTO_ERR_UNSPEC; } memcpy(oap_msg->auts, value, value_len); - oap_msg->auts_present = value_len; + oap_msg->auts_present = value_len ? 1 : 0; break; case OAP_CAUSE_IE: -- To view, visit https://gerrit.osmocom.org/1378 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I410ff120d868e8d55df9cb19ba6eefd99749cdf0 Gerrit-PatchSet: 6 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 Mon Dec 12 11:04:00 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:04:00 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 5: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1262/5/openbsc/src/gprs/gprs_sgsn.c File openbsc/src/gprs/gprs_sgsn.c: Line 703: LOGMMCTXP(LOGL_NOTICE, mm, "No MM context to deactivate\n"); now you are loosing the IMSI information from the log line. Please think about making changes like this. For the "No PDP Context" LOGMMCTXP makes sense, for the other cases obviously not. -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:06:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:06:05 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 5: (2 comments) https://gerrit.osmocom.org/#/c/1262/5/openbsc/src/gprs/gprs_sgsn.c File openbsc/src/gprs/gprs_sgsn.c: Line 685: LOGMMCTXP(LOGL_INFO, mm, "SGSN intiated Deactivate PDP request\n"); here LOGMMCTXP makes sense, as it will print the identity of the mm-context (if any). However, you still need to print your %s / imsi, as you don't know at this line whether or not a mmctx was actually found. Line 703: LOGMMCTXP(LOGL_NOTICE, mm, "No MM context to deactivate\n"); > now you are loosing the IMSI information from the log line. Please think a to be more precise: here at this line, LOBMMCTXP makes no sense, but you can use it safely. however. as mm == NULL, you still need to have a %s for your IMSI. -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:07:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:07:35 +0000 Subject: osmo-trx[master]: transceiver: Fix mismatched allocations and deallocations In-Reply-To: References: Message-ID: Patch Set 1: @ttsou: Could you please ack/nack this seemingly trivial change to osmo-trx? it's been pending for over a month. Thanks! -- To view, visit https://gerrit.osmocom.org/1153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9c8bbade8531e8c9c02dcd43bac38cb954b3c89f Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: pierre.baudry Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:08:00 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:08:00 +0000 Subject: libosmo-abis[master]: Expand network error callback In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 12 11:08:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:08:02 +0000 Subject: [MERGED] libosmo-abis[master]: Expand network error callback In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Expand network error callback ...................................................................... Expand network error callback ortp: use extra parameter for network_error callback in log message as it's described in oRTP documentation (error string). Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 --- 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 f7adc93..0f0b9e5 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -130,7 +130,7 @@ int port = rtp_session_get_local_port(rs); LOGP(DLMIB, LOGL_ERROR, - "osmo-ortp(%d): network_error\n", port); + "osmo-ortp(%d): network_error %s\n", port, (char *)data); } static void ortp_sig_cb_ts(RtpSession *rs, void *data) -- To view, visit https://gerrit.osmocom.org/1364 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I581db499d453b80230198d95000f0f6fc20752d1 Gerrit-PatchSet: 3 Gerrit-Project: libosmo-abis 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 Dec 12 11:08:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:08:40 +0000 Subject: openbsc[master]: bsc_control.py: convert to python3 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1358 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 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 Mon Dec 12 11:09:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:09:28 +0000 Subject: osmo-hlr[master]: fix DLGSUP logging cat after change in libosmocore In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1403 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d 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 Mon Dec 12 11:09:42 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:09:42 +0000 Subject: [MERGED] osmo-hlr[master]: fix DLGSUP logging cat after change in libosmocore In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix DLGSUP logging cat after change in libosmocore ...................................................................... fix DLGSUP logging cat after change in libosmocore DLGSUP must no longer be added to applications' logging category arrays after change-id Id974c7be158e4d60421a98110f5c807aefd31119 in libosmocore. Todo: once above change is merged to libosmocore, bump the required libosmocore version in configure.ac. Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d --- M src/logging.c 1 file changed, 0 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/logging.c b/src/logging.c index 54c8900..9b8de45 100644 --- a/src/logging.c +++ b/src/logging.c @@ -13,12 +13,6 @@ .color = "\033[1;31m", .enabled = 1, .loglevel = LOGL_DEBUG, }, - [DLGSUP] = { - .name = "DLGSUP", - .description = "GSUP Protocol", - .color = "\033[1;32m", - .enabled = 1, .loglevel = LOGL_INFO, - }, [DAUC] = { .name = "DAUC", .description = "Authentication Center", -- To view, visit https://gerrit.osmocom.org/1403 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I74ab1a031d1ed144468b016294d2965eba5e7d1d 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 Mon Dec 12 11:11:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:11:33 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1368/1//COMMIT_MSG Commit Message: Line 9: Make warnings related to common memory-related issues into warnings to > "into errors" :) rather than writing a reply to this trivial typo/thiko fix, it makes sense to simply edit the commit message in gerrit. That's what I usually do (and will do now). saves time. -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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 Mon Dec 12 11:11:48 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 11:11:48 +0000 Subject: osmo-bts[master]: Remove duplicated code In-Reply-To: References: Message-ID: Patch Set 8: (2 comments) Pierre is right https://gerrit.osmocom.org/#/c/1046/8/src/osmo-bts-trx/l1_if.c File src/osmo-bts-trx/l1_if.c: Line 155: return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_DEDIC, 0); chan_nr is the RSL Channel Number IE value, a bitfield aggregation of lchan type bits (cbits) and lchan number (lowest three bits) which is expected to differ from our plain lchan->nr channel number. @Pierre, you're right that indeed the patch's line 155 is wrong: it passes lchan->nr instead of originally chan_nr. Unfortunately the chan_nr field "can't" be passed into the scope and would need to be re-calculated, or trx_sched_set_lchan() needs to be refactored? I'll see whether we can fix quickly or revert. Line 162: return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_SACCH, 0); same here -- To view, visit https://gerrit.osmocom.org/1046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9 Gerrit-PatchSet: 8 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-Reviewer: pierre.baudry Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:11:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:11:52 +0000 Subject: [PATCH] openbsc[master]: Turn some warnings into errors 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/1368 to look at the new patch set (#2). Turn some warnings into errors Make warnings related to common memory-related issues into errors to harden the source and decrease chance of errors. Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 --- M openbsc/src/Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/68/1368/2 diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am index cfad7df..f7ba8ac 100644 --- a/openbsc/src/Makefile.am +++ b/openbsc/src/Makefile.am @@ -6,6 +6,8 @@ AM_CFLAGS = \ -Wall \ + -Werror=implicit -Werror=maybe-uninitialized -Werror=memset-transposed-args -Werror=null-dereference \ + -Werror=sizeof-pointer-memaccess -Werror=sizeof-array-argument \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 Gerrit-PatchSet: 2 Gerrit-Project: openbsc 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 Dec 12 11:15:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 11:15:02 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 9: @Vadim: What does it take to move this forward? It saddens me that your work looks like "almost complete" for months but still not ready to merge. -- 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: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder 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 Dec 12 11:19:16 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 11:19:16 +0000 Subject: openbsc[master]: bsc_control.py: use ipa.py module In-Reply-To: References: Message-ID: Patch Set 8: (1 comment) I hope this is more clear https://gerrit.osmocom.org/#/c/1266/8/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 27: do_set_get(sck, var, val) > Erm, pardon but I don't get this at all. Could you please elaborate using m It's just a style improvement suggestion. Below you use do_set_get() to set a var and get the answer like this, twice, so you could do here: a, _, _ = do_set_get(yada yada) return a and below just use a = set_var(yada yada) which is a nuance less dup and more importantly: far easier to read. whoever doesn't care about the answer can just ignore set_var()'s return value. -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 8 Gerrit-Project: openbsc 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 Mon Dec 12 11:31:21 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 11:31:21 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (4 comments) It's a bit tiring to have to make the same explanations repeatedly. https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 27: class IPA(object): > Yes, defines. our defines are always all-caps, but in function names we use all-lowercase. Your argument doesn't hold. I would still prefer "Ipa" to match the class naming scheme typical to python. Line 48: return 'UNKNOWN' > So it's "potential errors due to typos" vs "potential errors due to unneces I think I have made my point very clear. Potential errors due to typos are hard to find and go unseen for long periods of time. Returning None or raising an exception make it impossible to break the code in a hidden way. Line 50: def __tag(self, t, v): > No, the convention is _ means "don't use unless you know what you're doing" from above style guide link: _single_leading_underscore : weak "internal use" indicator. E.g. from M import * does not import objects whose name starts with an underscore. __double_leading_underscore : when naming a class attribute, invokes name mangling (inside class FooBar, __boo becomes _FooBar__boo ; see below). Generally, double leading underscores should be used only to avoid name conflicts with attributes in classes designed to be subclassed. Use a single underscore and be done with it. Line 113: return self.__tag(self.IDTAG['SERNR'], data) > I don't get the question: they are defined in a central place - it's right above do SERNR = 'SERNR' and everywhere else use the constant instead of the string to avoid hidden-typo bugs. A general practice to improve code maintainability. -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Mon Dec 12 11:39:14 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 11:39:14 +0000 Subject: [PATCH] osmo-bts[master]: osmo-bts-trx: fix lchan deactivation Message-ID: Review at https://gerrit.osmocom.org/1412 osmo-bts-trx: fix lchan deactivation Use chan_nr for deactivating lchan instead of lchan->nr: chan_nr is the RSL Channel Number IE value, a bitfield aggregation of lchan type bits (cbits) and lchan number (lowest three bits). The error was introduced in 36153239bfd0b633c4d259a9de0a759f41197a2b. Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d --- M src/osmo-bts-trx/l1_if.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/12/1412/1 diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 6304c1f..a42d39a 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -155,14 +155,16 @@ /* set lchan inactive */ lchan_set_state(lchan, LCHAN_S_NONE); - return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_DEDIC, 0); + return trx_sched_set_lchan(&l1h->l1s, gsm_lchan2chan_nr(lchan), + LID_DEDIC, 0); } int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { struct phy_instance *pinst = trx_phy_instance(lchan->ts->trx); struct trx_l1h *l1h = pinst->u.osmotrx.hdl; - return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_SACCH, 0); + return trx_sched_set_lchan(&l1h->l1s, gsm_lchan2chan_nr(lchan), + LID_SACCH, 0); } /* -- To view, visit https://gerrit.osmocom.org/1412 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:39:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 11:39:26 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 10: (2 comments) https://gerrit.osmocom.org/#/c/1268/10/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 46: """ > How can I make it more helpful? It's the typical JavaDoc syndrome: /** Crank the lever */ public int crankLever(){ } The comment exactly reflects the function name. In those cases I would simply drop the comment entirely. Line 104: pass > Well, yes - if you use wrong handler for the messages than result would be reservation: I haven't yet understood what this class' use is. So far it looks to me like it is designed to do only debug logging? If it or its subclasses are supposed to also take action, I would expect to throw an exception or log an error if an unimplemented section is invoked. -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 10 Gerrit-Project: openbsc 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 Mon Dec 12 11:40:14 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 11:40:14 +0000 Subject: osmo-bts[master]: Remove duplicated code In-Reply-To: References: Message-ID: Patch Set 8: Please have a look at #1412. -- To view, visit https://gerrit.osmocom.org/1046 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9 Gerrit-PatchSet: 8 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-Reviewer: pierre.baudry Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 11:52:50 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Mon, 12 Dec 2016 11:52:50 +0000 Subject: [PATCH] openbsc[master]: Support Deactivate PDP Context Request from network 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/1262 to look at the new patch set (#6). Support Deactivate PDP Context Request from network Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 180 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/62/1262/6 diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 24e286c..b3f250d 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,6 +369,8 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); +void drop_gmm_ctx_for_ms(const char *imsi); + char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..8558029 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,6 +667,44 @@ } } +/* + * High-level function to be called for PDP deactivation initiated from SGSN VTY. + * When there are PDP contexts present for a MM context, PDP context will be + * deactivated along with GMM Detach(MM context deletion). + * If there are no PDP present, MM context will be deleted to avoid further + * PDP context activation for that MS. + */ +void drop_gmm_ctx_for_ms(const char *imsi) +{ + OSMO_ASSERT(imsi != NULL); + struct sgsn_mm_ctx *mm; + struct sgsn_pdp_ctx *pdp; + + /* Search the MM context subscriber */ + mm = sgsn_mm_ctx_by_imsi(imsi); + LOGMMCTXP(LOGL_INFO, mm, + "SGSN intiated Deactivate PDP request for %s\n", imsi); + if (mm) { + /* Search the PDP for this subscriber */ + if (llist_empty(&mm->pdp_list)) { + /* + * Deleting mm context for the subscriber when no PDP + * context is present. + */ + gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); + LOGMMCTXP(LOGL_NOTICE, mm, "No PDP context to deactivate\n"); + } else { + llist_for_each_entry(pdp, &mm->pdp_list, list) { + gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); + LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " + "Successful\n"); + } + } + } else + LOGMMCTXP(LOGL_NOTICE, mm, + "No MM context to deactivate for %s\n", imsi); +} + /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index e7b7458..6f01d44 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,14 +38,17 @@ #include #include +#include void *tall_bsc_ctx; +struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, + .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2363,6 +2366,138 @@ cleanup_test(); } +static void test_pdp_deactivation_with_pdp_ctx(void) +{ + struct apn_ctx *actxs[4]; + struct sgsn_ggsn_ctx *ggc, *ggcs[3]; + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + enum gsm48_gsm_cause gsm_cause; + struct tlv_parsed tp; + uint8_t apn_enc[GSM_APN_LENGTH + 10]; + struct sgsn_subscriber_pdp_data *pdp_data; + char apn_str[GSM_APN_LENGTH]; + + printf("Testing Pdp deactivation for MS with pdp ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + struct sgsn_pdp_ctx *pdp; + + tp.lv[GSM48_IE_GSM_APN].len = 0; + tp.lv[GSM48_IE_GSM_APN].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; + tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; + + ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); + + actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); + actxs[0]->ggsn = ggcs[0]; + + pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); + pdp_data->context_id = 1; + pdp_data->pdp_type = 0x0121; + strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); + + /* Resolve GGSNs */ + tp.lv[GSM48_IE_GSM_APN].len = + gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); + + ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); + + OSMO_ASSERT(ggc != NULL); + OSMO_ASSERT(ggc->id == 0); + + ggc = sgsn_ggsn_ctx_alloc(ggc->id); + /* Create a pdp context */ + pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + gsm48_tx_gsm_deact_pdp_acc(pdp); + gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); + + /* Cleanup */ + + subscr_put(s1); + + sgsn_apn_ctx_free(actxs[0]); + sgsn_ggsn_ctx_free(ggcs[0]); + sgsn_ggsn_ctx_free(ggc); + talloc_free(pdp); + + cleanup_test(); +} + +static void test_pdp_deactivation_with_only_mm_ctx(void) +{ + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + + printf("Testing Pdp deactivation for MS with only MM ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation_without_mm_ctx(void) +{ + const char *imsi1 = "1234567890"; + + printf("Testing Pdp deactivation for MS without MM ctx\n"); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation(void) +{ + printf("Testing pdp deactivation\n"); + + test_pdp_deactivation_with_pdp_ctx(); + test_pdp_deactivation_without_mm_ctx(); + test_pdp_deactivation_with_only_mm_ctx(); +} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2454,6 +2589,7 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); + test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c7a53b9..c36b643 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,4 +34,8 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection +Testing pdp deactivation +Testing Pdp deactivation for MS with pdp ctx +Testing Pdp deactivation for MS without MM ctx +Testing Pdp deactivation for MS with only MM ctx Done -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 12 12:01:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Mon, 12 Dec 2016 12:01:41 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 12:53:49 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Mon, 12 Dec 2016 12:53:49 +0000 Subject: [MERGED] openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: pravin has submitted this change and it was merged. Change subject: Support Deactivate PDP Context Request from network ...................................................................... Support Deactivate PDP Context Request from network Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 180 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 24e286c..b3f250d 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,6 +369,8 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); +void drop_gmm_ctx_for_ms(const char *imsi); + char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..8558029 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,6 +667,44 @@ } } +/* + * High-level function to be called for PDP deactivation initiated from SGSN VTY. + * When there are PDP contexts present for a MM context, PDP context will be + * deactivated along with GMM Detach(MM context deletion). + * If there are no PDP present, MM context will be deleted to avoid further + * PDP context activation for that MS. + */ +void drop_gmm_ctx_for_ms(const char *imsi) +{ + OSMO_ASSERT(imsi != NULL); + struct sgsn_mm_ctx *mm; + struct sgsn_pdp_ctx *pdp; + + /* Search the MM context subscriber */ + mm = sgsn_mm_ctx_by_imsi(imsi); + LOGMMCTXP(LOGL_INFO, mm, + "SGSN intiated Deactivate PDP request for %s\n", imsi); + if (mm) { + /* Search the PDP for this subscriber */ + if (llist_empty(&mm->pdp_list)) { + /* + * Deleting mm context for the subscriber when no PDP + * context is present. + */ + gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); + LOGMMCTXP(LOGL_NOTICE, mm, "No PDP context to deactivate\n"); + } else { + llist_for_each_entry(pdp, &mm->pdp_list, list) { + gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); + LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " + "Successful\n"); + } + } + } else + LOGMMCTXP(LOGL_NOTICE, mm, + "No MM context to deactivate for %s\n", imsi); +} + /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index e7b7458..6f01d44 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,14 +38,17 @@ #include #include +#include void *tall_bsc_ctx; +struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, + .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2363,6 +2366,138 @@ cleanup_test(); } +static void test_pdp_deactivation_with_pdp_ctx(void) +{ + struct apn_ctx *actxs[4]; + struct sgsn_ggsn_ctx *ggc, *ggcs[3]; + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + enum gsm48_gsm_cause gsm_cause; + struct tlv_parsed tp; + uint8_t apn_enc[GSM_APN_LENGTH + 10]; + struct sgsn_subscriber_pdp_data *pdp_data; + char apn_str[GSM_APN_LENGTH]; + + printf("Testing Pdp deactivation for MS with pdp ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + struct sgsn_pdp_ctx *pdp; + + tp.lv[GSM48_IE_GSM_APN].len = 0; + tp.lv[GSM48_IE_GSM_APN].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; + tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; + + ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); + + actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); + actxs[0]->ggsn = ggcs[0]; + + pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); + pdp_data->context_id = 1; + pdp_data->pdp_type = 0x0121; + strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); + + /* Resolve GGSNs */ + tp.lv[GSM48_IE_GSM_APN].len = + gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); + + ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); + + OSMO_ASSERT(ggc != NULL); + OSMO_ASSERT(ggc->id == 0); + + ggc = sgsn_ggsn_ctx_alloc(ggc->id); + /* Create a pdp context */ + pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + gsm48_tx_gsm_deact_pdp_acc(pdp); + gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); + + /* Cleanup */ + + subscr_put(s1); + + sgsn_apn_ctx_free(actxs[0]); + sgsn_ggsn_ctx_free(ggcs[0]); + sgsn_ggsn_ctx_free(ggc); + talloc_free(pdp); + + cleanup_test(); +} + +static void test_pdp_deactivation_with_only_mm_ctx(void) +{ + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + + printf("Testing Pdp deactivation for MS with only MM ctx\n"); + + gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation_without_mm_ctx(void) +{ + const char *imsi1 = "1234567890"; + + printf("Testing Pdp deactivation for MS without MM ctx\n"); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation(void) +{ + printf("Testing pdp deactivation\n"); + + test_pdp_deactivation_with_pdp_ctx(); + test_pdp_deactivation_without_mm_ctx(); + test_pdp_deactivation_with_only_mm_ctx(); +} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2454,6 +2589,7 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); + test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c7a53b9..c36b643 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,4 +34,8 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection +Testing pdp deactivation +Testing Pdp deactivation for MS with pdp ctx +Testing Pdp deactivation for MS without MM ctx +Testing Pdp deactivation for MS with only MM ctx Done -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pravin From gerrit-no-reply at lists.osmocom.org Mon Dec 12 14:03:22 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 14:03:22 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 10: Yes, that's exactly the intention: parse the header and call dispatcher which will just log the message. If derived class would like to do something more sophisticated than it can override corresponding methods as illustrated by several derived classes. I don't see a point in mandating that derived class should handle all the messages. Why shall we force client interested in CTRL protocol to write handler for CCM? -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 10 Gerrit-Project: openbsc 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 Dec 12 14:03:49 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 14:03:49 +0000 Subject: openbsc[master]: bsc_control.py: style corrections In-Reply-To: References: Message-ID: Patch Set 7: Patches are welcomed :) -- To view, visit https://gerrit.osmocom.org/1269 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib79fd4317d40ee4fd87b090b9faf8ebaf4bfca64 Gerrit-PatchSet: 7 Gerrit-Project: openbsc 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 Dec 12 15:09:56 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:56 +0000 Subject: [PATCH] libosmocore[master]: logging test: cosmetic: print target and don't print color Message-ID: Review at https://gerrit.osmocom.org/1413 logging test: cosmetic: print target and don't print color Prepares for upcoming modifications of the logging test to show and fix bugs in the logging system. Change-Id: I9461b987adf85d87469a6af55de5f1aa478f6ebb --- M tests/logging/logging_test.c M tests/logging/logging_test.err 2 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/1413/1 diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 3d1b7d8..91b0aaf 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -75,6 +75,8 @@ log_add_target(stderr_target); log_set_all_filter(stderr_target, 1); log_set_print_filename(stderr_target, 0); + log_set_print_category(stderr_target, 1); + log_set_use_color(stderr_target, 0); log_parse_category_mask(stderr_target, "DRLL:DCC"); log_parse_category_mask(stderr_target, "DRLL"); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 4891491..4a350fa 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -1,4 +1,3 @@ -You should see this -You should see this -You should see this - \ No newline at end of file +DRLL You should see this +DCC You should see this +DRLL You should see this -- To view, visit https://gerrit.osmocom.org/1413 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9461b987adf85d87469a6af55de5f1aa478f6ebb Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:57 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:57 +0000 Subject: [PATCH] libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for inv... Message-ID: Review at https://gerrit.osmocom.org/1414 show bug in logging: erratic redirection to DLGLOBAL for invalid categories Add a check to logging_test.c to show a bug: when a logging category value that is out-of-bounds is passed to the logging system, the internal map_subsys() function should remap that to DLGLOBAL. But in fact DLGLOBAL is -1 and the function fails to map this to a proper positive array index, directly returning -1 instead. This results in a negative array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Note: osmo_log_info->num_cat + 0 is also out-of-bounds, but there is a separate bug there, so leaving this for another patch. Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd --- M tests/logging/logging_test.c 1 file changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/1414/1 diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 91b0aaf..6c5a8f2 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -66,6 +66,8 @@ .filter_fn = test_filter, }; +extern struct log_info *osmo_log_info; + int main(int argc, char **argv) { struct log_target *stderr_target; @@ -108,5 +110,11 @@ select_output = 1; DEBUGP(DRLL, "You should see this\n"); OSMO_ASSERT(filter_called == 5); /* called twice on output */ + + /* Make sure out-of-bounds category maps to DLGLOBAL */ + log_parse_category_mask(stderr_target, "DLGLOBAL,1"); + DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); + DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); + return 0; } -- To view, visit https://gerrit.osmocom.org/1414 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:58 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:58 +0000 Subject: [PATCH] libosmocore[master]: fix logging: redirection to DLGLOBAL for invalid categories Message-ID: Review at https://gerrit.osmocom.org/1415 fix logging: redirection to DLGLOBAL for invalid categories For out-of-bounds logging categories, redirect to the proper DLGLOBAL array index instead of returning -1. Adjust test expectation which shows that the bugs tested for are fixed. Note: there are separate bounds checking problems, left for another patch. Change-Id: I6ea9a59e005a22e0305454291714fdb9531c346b --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/15/1415/1 diff --git a/src/logging.c b/src/logging.c index 92852c9..7102543 100644 --- a/src/logging.c +++ b/src/logging.c @@ -328,13 +328,20 @@ target->output(target, level, buf); } +/* Catch internal logging category indexes as well as out-of-bounds indexes. + * For internal categories, the ID is negative starting with -1; and internal + * logging categories are added behind the user categories. For out-of-bounds + * indexes, return the index of DLGLOBAL. The returned category index is + * guaranteed to exist in osmo_log_info, otherwise the program would abort, + * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { if (subsys < 0) subsys = subsys_lib2index(subsys); if (subsys > osmo_log_info->num_cat) - subsys = DLGLOBAL; + subsys = subsys_lib2index(DLGLOBAL); + return subsys; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 4a350fa..cc21b32 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -1,3 +1,5 @@ DRLL You should see this DCC You should see this DRLL You should see this +DLGLOBAL You should see this on DLGLOBAL (a) +DLGLOBAL You should see this on DLGLOBAL (b) -- To view, visit https://gerrit.osmocom.org/1415 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ea9a59e005a22e0305454291714fdb9531c346b Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:58 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:58 +0000 Subject: [PATCH] libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for fir... Message-ID: Review at https://gerrit.osmocom.org/1416 show bug in logging: erratic redirection to DLGLOBAL for first invalid category Add a check to logging_test.c to show a bug: when a logging category value that is the first out-of-bounds value is passed to the logging system, the internal map_subsys() fails to redirect to DLGLOBAL due to a flawed conditional. This results in a too large array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: I12bf38b6c1f85e2d7bf5a15f942dfe0beed41eba --- M tests/logging/logging_test.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/1416/1 diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 6c5a8f2..3cc6c5b 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -115,6 +115,7 @@ log_parse_category_mask(stderr_target, "DLGLOBAL,1"); DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); + DEBUGP(osmo_log_info->num_cat, "You should see this on DLGLOBAL (c)\n"); return 0; } -- To view, visit https://gerrit.osmocom.org/1416 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12bf38b6c1f85e2d7bf5a15f942dfe0beed41eba Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:58 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:58 +0000 Subject: [PATCH] libosmocore[master]: fix logging: also catch first out-of-bounds logging cat Message-ID: Review at https://gerrit.osmocom.org/1417 fix logging: also catch first out-of-bounds logging cat In map_subsys(), fix the '>' condition to '>=' for array bounds checking. Also make the bounds checking more strict: after both invocations of subsys_lib2index(), re-check validity of the array index. If the final index is still wrong, which should never happen, exit by assertion. Change-Id: I7ca1a1d47724e40350f1c4dfebe90bad01c965f9 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/17/1417/1 diff --git a/src/logging.c b/src/logging.c index 7102543..2a8bfdc 100644 --- a/src/logging.c +++ b/src/logging.c @@ -339,9 +339,11 @@ if (subsys < 0) subsys = subsys_lib2index(subsys); - if (subsys > osmo_log_info->num_cat) + if (subsys < 0 || subsys >= osmo_log_info->num_cat) subsys = subsys_lib2index(DLGLOBAL); + OSMO_ASSERT(!(subsys < 0 || subsys >= osmo_log_info->num_cat)); + return subsys; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index cc21b32..273a852 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -3,3 +3,4 @@ DRLL You should see this DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) +DLGLOBAL You should see this on DLGLOBAL (c) -- To view, visit https://gerrit.osmocom.org/1417 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ca1a1d47724e40350f1c4dfebe90bad01c965f9 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:58 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:58 +0000 Subject: [PATCH] libosmocore[master]: show bug in logging: out-of-bounds check should end with use... Message-ID: Review at https://gerrit.osmocom.org/1418 show bug in logging: out-of-bounds check should end with user categories In the background osmo_log_info array, the user's logging categories are enhanced by the library internal ones. So far logging category range checking only checked for the larger array bounds, although passing a logging category >= num_cat_user is already semantically unknown and should redirect to DLGLOBAL. Add a check to logging_test.c to show that this isn't happening. Instead of DLGLOBAL, a logging category that happens to be at that index is queried. The bug is confirmed by logging_test.err only showing "(e)" and not "(d)": "(e)" is shown because the first category after the user ones happens to be DLGLOBAL. "(d)" is omitted since it hits a category that's not on debug level. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: I397278714018ee9a0ae5101515f31ddddf79c2ec --- M tests/logging/logging_test.c M tests/logging/logging_test.err 2 files changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/18/1418/1 diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 3cc6c5b..5ef214d 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -113,9 +113,13 @@ /* Make sure out-of-bounds category maps to DLGLOBAL */ log_parse_category_mask(stderr_target, "DLGLOBAL,1"); + /* For IDs out of bounds of the overall osmo_log_info array */ DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); DEBUGP(osmo_log_info->num_cat, "You should see this on DLGLOBAL (c)\n"); + /* For IDs out of bounds of the user categories part */ + DEBUGP(log_info.num_cat + 1, "You should see this on DLGLOBAL (d)\n"); + DEBUGP(log_info.num_cat, "You should see this on DLGLOBAL (e)\n"); return 0; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 273a852..f4e9c1f 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,3 +4,4 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1418 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I397278714018ee9a0ae5101515f31ddddf79c2ec Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:58 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:58 +0000 Subject: [PATCH] libosmocore[master]: fix logging: out-of-bounds check should end with user catego... Message-ID: Review at https://gerrit.osmocom.org/1419 fix logging: out-of-bounds check should end with user categories To check category bounds, rather use num_cat_user, to redirect all semantically unknown categories to DLGLOBAL. Adjust logging_test expectations accordingly: "(d)" is now also shown. Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/1419/1 diff --git a/src/logging.c b/src/logging.c index 2a8bfdc..35815ae 100644 --- a/src/logging.c +++ b/src/logging.c @@ -339,7 +339,7 @@ if (subsys < 0) subsys = subsys_lib2index(subsys); - if (subsys < 0 || subsys >= osmo_log_info->num_cat) + if (subsys < 0 || subsys >= osmo_log_info->num_cat_user) subsys = subsys_lib2index(DLGLOBAL); OSMO_ASSERT(!(subsys < 0 || subsys >= osmo_log_info->num_cat)); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index f4e9c1f..4527d83 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,4 +4,5 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1419 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:59 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:59 +0000 Subject: [PATCH] libosmocore[master]: show bug in logging: log_set_category_filter on DL* categories Message-ID: Review at https://gerrit.osmocom.org/1420 show bug in logging: log_set_category_filter on DL* categories Add a check to logging_test.c to show a bug: passing an internal DL* category constant to log_set_category_filter() results in a negative array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: Ie2da77c642a84cafc0f528985930697ec167183b --- M tests/logging/logging_test.c 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/20/1420/1 diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 5ef214d..ce8aac8 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -121,5 +121,11 @@ DEBUGP(log_info.num_cat + 1, "You should see this on DLGLOBAL (d)\n"); DEBUGP(log_info.num_cat, "You should see this on DLGLOBAL (e)\n"); + /* Check log_set_category_filter() with internal categories */ + log_parse_category_mask(stderr_target, "DLGLOBAL,3"); + DEBUGP(DLGLOBAL, "You should not see this (DLGLOBAL not on DEBUG)\n"); + log_set_category_filter(stderr_target, DLGLOBAL, 1, LOGL_DEBUG); + DEBUGP(DLGLOBAL, "You should see this (DLGLOBAL on DEBUG)\n"); + return 0; } -- To view, visit https://gerrit.osmocom.org/1420 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie2da77c642a84cafc0f528985930697ec167183b Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:09:59 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:09:59 +0000 Subject: [PATCH] libosmocore[master]: fix logging: log_set_category_filter() for internal DL* logg... Message-ID: Review at https://gerrit.osmocom.org/1421 fix logging: log_set_category_filter() for internal DL* logging cats In log_set_category_filter(), passing a negative index lead to memory corruption. Particularly dangerous since the internal logging categories have negative values. Fix: apply map_subsys() to interpret negative values as internal logging categories. As a side effect, out-of-bounds logging categories will be mapped to DLGLOBAL instead of being dropped. Fix the expectations in logging_test to match the fixed bug. While at it also guard against a NULL logging target. Change-Id: Ib0725b22bc39498c6b3970a61eb3339cf56d19f1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/21/1421/1 diff --git a/src/logging.c b/src/logging.c index 35815ae..1476551 100644 --- a/src/logging.c +++ b/src/logging.c @@ -572,8 +572,9 @@ void log_set_category_filter(struct log_target *target, int category, int enable, int level) { - if (category >= osmo_log_info->num_cat) + if (!target) return; + category = map_subsys(category); target->categories[category].enabled = !!enable; target->categories[category].loglevel = level; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 4527d83..17b3cad 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -6,3 +6,4 @@ DLGLOBAL You should see this on DLGLOBAL (c) DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) +DLGLOBAL You should see this (DLGLOBAL on DEBUG) -- To view, visit https://gerrit.osmocom.org/1421 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0725b22bc39498c6b3970a61eb3339cf56d19f1 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 15:36:37 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:36:37 +0000 Subject: [PATCH] libosmocore[master]: fix logging: out-of-bounds check should end with user catego... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1419 to look at the new patch set (#2). fix logging: out-of-bounds check should end with user categories To check category bounds, rather use num_cat_user, to redirect all semantically unknown categories to DLGLOBAL. Adjust logging_test expectations accordingly: "(d)" is now also shown. Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/1419/2 diff --git a/src/logging.c b/src/logging.c index 2a8bfdc..6e0056b 100644 --- a/src/logging.c +++ b/src/logging.c @@ -336,6 +336,9 @@ * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { + if (subsys >= osmo_log_info->num_cat_user) + subsys = DLGLOBAL; + if (subsys < 0) subsys = subsys_lib2index(subsys); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index f4e9c1f..4527d83 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,4 +4,5 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1419 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 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 Mon Dec 12 15:38:49 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:38:49 +0000 Subject: libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for fir... In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 As promised, this commit fails the sanitizer build. Let's still merge it, along with the fix. -- To view, visit https://gerrit.osmocom.org/1416 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I12bf38b6c1f85e2d7bf5a15f942dfe0beed41eba 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 Mon Dec 12 15:54:28 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:54:28 +0000 Subject: [PATCH] libosmocore[master]: fix logging: out-of-bounds check should end with user catego... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1419 to look at the new patch set (#3). fix logging: out-of-bounds check should end with user categories To check category bounds, rather use num_cat_user, to redirect all semantically unknown categories to DLGLOBAL. Adjust logging_test expectations accordingly: "(d)" is now also shown. Note: subsys is and needs to be signed, while num_cat* are unsigned. Thus for a negative subsys, 'subsys >= num_cat_user' practically always yields true. Pay close attention to signedness and check upper bound only for positive values. While at it, also assert that we never have more than INT_MAX categories listed. Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/1419/3 diff --git a/src/logging.c b/src/logging.c index 2a8bfdc..338eddc 100644 --- a/src/logging.c +++ b/src/logging.c @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef HAVE_STRINGS_H #include @@ -336,6 +337,13 @@ * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { + /* comparing signed and unsigned integers here, let's make sure: */ + OSMO_ASSERT(osmo_log_info->num_cat <= INT_MAX); + OSMO_ASSERT(osmo_log_info->num_cat_user <= INT_MAX); + + if (subsys > 0 && ((unsigned int)subsys) >= osmo_log_info->num_cat_user) + subsys = DLGLOBAL; + if (subsys < 0) subsys = subsys_lib2index(subsys); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index f4e9c1f..4527d83 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,4 +4,5 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1419 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 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 Mon Dec 12 15:57:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 15:57:12 +0000 Subject: [PATCH] libosmocore[master]: fix logging: out-of-bounds check should end with user catego... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1419 to look at the new patch set (#4). fix logging: out-of-bounds check should end with user categories To check category bounds, rather use num_cat_user, to redirect all semantically unknown categories to DLGLOBAL. Adjust logging_test expectations accordingly: "(d)" is now also shown. Note: subsys is and needs to be signed, while num_cat* are unsigned. Thus for a negative subsys, 'subsys >= num_cat_user' practically always yields true. Pay close attention to signedness and check upper bound only for positive values. Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/1419/4 diff --git a/src/logging.c b/src/logging.c index 2a8bfdc..d32ca43 100644 --- a/src/logging.c +++ b/src/logging.c @@ -336,6 +336,11 @@ * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { + /* Note: comparing signed and unsigned integers */ + + if (subsys > 0 && ((unsigned int)subsys) >= osmo_log_info->num_cat_user) + subsys = DLGLOBAL; + if (subsys < 0) subsys = subsys_lib2index(subsys); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index f4e9c1f..4527d83 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,4 +4,5 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1419 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: move OAP messages implementations to libosmocore 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/1381 to look at the new patch set (#2). move OAP messages implementations to libosmocore This corresponds to change-id If5099e60681a215e798b6675f21813f26769c253 in libosmocore, which is now required to build openbsc. Related: OS#1592 Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf --- M openbsc/configure.ac M openbsc/include/openbsc/Makefile.am D openbsc/include/openbsc/oap_messages.h M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/oap.c D openbsc/src/gprs/oap_messages.c M openbsc/tests/oap/Makefile.am M openbsc/tests/oap/oap_test.c M openbsc/tests/sgsn/Makefile.am 9 files changed, 3 insertions(+), 256 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/81/1381/2 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 4fe1050..0753834 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -33,7 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 9f574e6..8ea95e0 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -55,7 +55,6 @@ nat_rewrite_trie.h \ network_listen.h \ oap.h \ - oap_messages.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h deleted file mode 100644 index ecb66df..0000000 --- a/openbsc/include/openbsc/oap_messages.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Osmocom Authentication Protocol message encoder/decoder */ - -/* (C) 2015 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 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 -#include - -/* Some numbers are out of sequence because (so far) they match gprs_gsup_iei. - */ -enum oap_iei { - OAP_CAUSE_IE = 0x02, - OAP_RAND_IE = 0x20, - OAP_AUTN_IE = 0x23, - OAP_XRES_IE = 0x24, - OAP_AUTS_IE = 0x25, - OAP_CLIENT_ID_IE = 0x30, -}; - -enum osmo_oap_message_type { - OAP_MSGT_REGISTER_REQUEST = 0b00000100, - OAP_MSGT_REGISTER_ERROR = 0b00000101, - OAP_MSGT_REGISTER_RESULT = 0b00000110, - - OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, - OAP_MSGT_CHALLENGE_ERROR = 0b00001001, - OAP_MSGT_CHALLENGE_RESULT = 0b00001010, - - OAP_MSGT_SYNC_REQUEST = 0b00001100, - OAP_MSGT_SYNC_ERROR = 0b00001101, - OAP_MSGT_SYNC_RESULT = 0b00001110, -}; - -struct osmo_oap_message { - enum osmo_oap_message_type message_type; - enum gsm48_gmm_cause cause; - uint16_t client_id; - int rand_present; - uint8_t rand[16]; - int autn_present; - uint8_t autn[16]; - int xres_present; - uint8_t xres[8]; - int auts_present; - uint8_t auts[16]; -}; - -int osmo_oap_decode(struct osmo_oap_message *oap_msg, - const uint8_t *data, size_t data_len); -void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); - diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index a827b77..ab2517e 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -93,7 +93,6 @@ sgsn_ares.c \ slhc.c \ oap.c \ - oap_messages.c \ gprs_llc_xid.c \ v42bis.c \ $(NULL) diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index c7c9777..7efbe81 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -24,10 +24,10 @@ #include #include +#include #include #include -#include int oap_init(struct oap_config *config, struct oap_state *state) { diff --git a/openbsc/src/gprs/oap_messages.c b/openbsc/src/gprs/oap_messages.c deleted file mode 100644 index d81723f..0000000 --- a/openbsc/src/gprs/oap_messages.c +++ /dev/null @@ -1,178 +0,0 @@ -/* Osmocom Authentication Protocol message encoder/decoder */ - -/* (C) 2015 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 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 - - -int osmo_oap_decode(struct osmo_oap_message *oap_msg, - const uint8_t *const_data, size_t data_len) -{ - int rc; - uint8_t tag; - /* the shift/match functions expect non-const pointers, but we'll - * either copy the data or cast pointers back to const before returning - * them - */ - uint8_t *data = (uint8_t *)const_data; - uint8_t *value; - size_t value_len; - - memset(oap_msg, 0, sizeof(*oap_msg)); - - /* message type */ - rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); - if (rc < 0) - return -GMM_CAUSE_INV_MAND_INFO; - oap_msg->message_type = osmo_decode_big_endian(value, 1); - - /* specific parts */ - while (data_len > 0) { - enum oap_iei iei; - - rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); - if (rc < 0) - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - - iei = tag; - - switch (iei) { - case OAP_CLIENT_ID_IE: - if (value_len != 2) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type client ID (%d) should be 2 octets, but has %d\n", - (int)iei, (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - - oap_msg->client_id = osmo_decode_big_endian(value, value_len); - - if (oap_msg->client_id == 0) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type client ID (%d): client ID must be nonzero.\n", - (int)iei); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - break; - - case OAP_AUTN_IE: - if (value_len != sizeof(oap_msg->autn)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type AUTN (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->autn, value, value_len); - oap_msg->autn_present = value_len; - break; - - case OAP_RAND_IE: - if (value_len != sizeof(oap_msg->rand)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type RAND (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->rand, value, value_len); - oap_msg->rand_present = value_len; - break; - - case OAP_XRES_IE: - if (value_len != sizeof(oap_msg->xres)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type XRES (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->xres, value, value_len); - oap_msg->xres_present = value_len; - break; - - case OAP_AUTS_IE: - if (value_len != sizeof(oap_msg->auts)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type AUTS (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->auts, value, value_len); - oap_msg->auts_present = value_len; - break; - - case OAP_CAUSE_IE: - if (value_len > 1) { - LOGP(DGPRS, LOGL_ERROR, - "OAP cause may not exceed one octet, is %d", (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - oap_msg->cause = *value; - break; - - default: - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type %d unknown\n", iei); - continue; - } - } - - return 0; -} - -void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) -{ - uint8_t u8; - - /* generic part */ - OSMO_ASSERT(oap_msg->message_type); - msgb_v_put(msg, (uint8_t)oap_msg->message_type); - - /* specific parts */ - if ((u8 = oap_msg->cause)) - msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); - - if (oap_msg->client_id > 0) - msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), - osmo_encode_big_endian(oap_msg->client_id, - sizeof(oap_msg->client_id))); - - if (oap_msg->rand_present) - msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); - - if (oap_msg->autn_present) - msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); - - if (oap_msg->auts_present) - msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); - - if (oap_msg->xres_present) - msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); - - msg->l2h = msg->data; -} - diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index 06ccf33..bb9ebb2 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -28,7 +28,6 @@ oap_test_LDADD = \ $(top_builddir)/src/gprs/oap.o \ - $(top_builddir)/src/gprs/oap_messages.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index d200ed2..68542fd 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -19,11 +19,10 @@ */ #include +#include #include - #include -#include #include #include diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index c5d90f6..9e1a5a8 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -55,7 +55,6 @@ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ $(top_builddir)/src/gprs/oap.o \ - $(top_builddir)/src/gprs/oap_messages.o \ $(top_builddir)/src/gprs/gprs_llc_xid.o \ $(top_builddir)/src/gprs/gprs_sndcp_xid.o \ $(top_builddir)/src/gprs/slhc.o \ -- To view, visit https://gerrit.osmocom.org/1381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf Gerrit-PatchSet: 2 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 Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category 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/1386 to look at the new patch set (#3). gsup client, gsup_test_client: move logging to DLGSUP category Use the DLGSUP logging category for GSUP. Bump the required version of libosmocore to 0.9.5 to benefit from the DLGSUP logging category fix in core/logging.[hc]. (Id974c7be158e4d60421a98110f5c807aefd31119) Todo: we're using a "Library" logging category, which is not really what the library category was intended for. Instead, the GSUP client should probably be given a logging category like DVLR or DGPRS in its initialization API. Related: OS#1592 Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee --- M openbsc/configure.ac M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gsup_test_client.c 3 files changed, 20 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/1386/3 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 123048f..4fe1050 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -30,7 +30,7 @@ AC_SUBST(LIBRARY_DL) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.4) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 6195fa6..b991563 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -55,29 +55,29 @@ return 0; if (osmo_timer_pending(&gsupc->connect_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: connect timer already running\n"); osmo_timer_del(&gsupc->connect_timer); } if (osmo_timer_pending(&gsupc->ping_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: ping timer already running\n"); osmo_timer_del(&gsupc->ping_timer); } if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); rc = ipa_client_conn_open(gsupc->link); if (rc >= 0) { - LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP connecting to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; } - LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", gsupc->link->addr, gsupc->link->port, strerror(-rc)); if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || @@ -87,7 +87,7 @@ osmo_timer_schedule(&gsupc->connect_timer, GSUP_CLIENT_RECONNECT_INTERVAL, 0); - LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; @@ -119,7 +119,7 @@ rc = oap_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { - LOGP(DGPRS, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); + LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); return; } @@ -130,7 +130,7 @@ { struct gsup_client *gsupc = link->data; - LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); gsupc->is_connected = up; @@ -181,7 +181,7 @@ rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); if (rc < 0) { - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA/CCM message from %s:%d\n", link->addr, link->port); /* Link has been closed */ @@ -194,7 +194,7 @@ uint8_t msg_type = *(msg->l2h); /* CCM message */ if (msg_type == IPAC_MSGT_PONG) { - LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP receiving PONG\n"); gsupc->got_ipa_pong = 1; } @@ -223,7 +223,7 @@ return 0; invalid: - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA message from %s:%d, size = %d\n", link->addr, link->port, msgb_length(msg)); @@ -235,7 +235,7 @@ { struct gsup_client *gsupc = gsupc_; - LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", gsupc->got_ipa_pong ? "got" : "didn't get"); @@ -244,7 +244,7 @@ return; } - LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); + LOGP(DLGSUP, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); ipa_client_conn_close(gsupc->link); gsupc->is_connected = 0; @@ -258,7 +258,7 @@ gsupc->got_ipa_pong = 0; osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0); - LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP sending PING\n"); gsup_client_send_ping(gsupc); } diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index c8ed03d..1889c6f 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -260,17 +260,12 @@ void *tall_bsc_ctx = NULL; /* default categories */ -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", - .enabled = 1, .loglevel = LOGL_INFO, - }, +static struct log_info_cat default_categories[] = { }; -static const struct log_info gprs_log_info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), +static const struct log_info gsup_test_client_log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), }; int main(int argc, char **argv) @@ -279,7 +274,7 @@ char *server_host = "127.0.0.1"; uint16_t server_port = 2222; - osmo_init_logging(&gprs_log_info); + osmo_init_logging(&gsup_test_client_log_info); g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb, NULL); -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap: rename public API from oap_ to oap_client_ 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/1387 to look at the new patch set (#2). oap: rename public API from oap_ to oap_client_ Mainly to differentiate the OAP messaging API (osmo_oap_ in libosmocore) from the OAP client. This is in preparation for moving the oap client to libcommon, which is in turn preparation for libvlr. Add the osmo_ prefix, as all public Osmocom API should have. We also have OAP messages code in libosmocore, so clarify by naming this osmo_oap_client, and by also renaming the oap_test to oap_client_test. This reshuffling will allow an easy move of OAP to libosmocore if we should want to do that. A number of patches will follow up on this. Related: OS#1592 Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 --- M openbsc/include/openbsc/gsup_client.h M openbsc/include/openbsc/oap.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/oap.c M openbsc/tests/oap/oap_test.c 6 files changed, 63 insertions(+), 57 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/87/1387/2 diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index 551f76d..d21a54d 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -41,7 +41,7 @@ gsup_client_read_cb_t read_cb; void *data; - struct oap_state oap_state; + struct oap_client_state oap_state; struct osmo_timer_list ping_timer; struct osmo_timer_list connect_timer; @@ -52,7 +52,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_config *oap_config); + struct oap_client_config *oap_config); void gsup_client_destroy(struct gsup_client *gsupc); int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap.h index 2206184..80c86d5 100644 --- a/openbsc/include/openbsc/oap.h +++ b/openbsc/include/openbsc/oap.h @@ -27,9 +27,10 @@ struct msgb; struct osmo_oap_message; -/* This is the config part for vty. It is essentially copied in oap_state, - * where values are copied over once the config is considered valid. */ -struct oap_config { +/* This is the config part for vty. It is essentially copied in + * oap_client_state, where values are copied over once the config is + * considered valid. */ +struct oap_client_config { uint16_t client_id; int secret_k_present; uint8_t secret_k[16]; @@ -38,9 +39,10 @@ }; /* The runtime state of the OAP client. client_id and the secrets are in fact - * duplicated from oap_config, so that a separate validation of the config data - * is possible, and so that only a struct oap_state* is passed around. */ -struct oap_state { + * duplicated from oap_client_config, so that a separate validation of the + * config data is possible, and so that only a struct oap_client_state* is + * passed around. */ +struct oap_client_state { enum { OAP_UNINITIALIZED = 0, /* just allocated. */ OAP_DISABLED, /* disabled by config. */ @@ -56,23 +58,25 @@ }; /* From config, initialize state. Return 0 on success. */ -int oap_init(struct oap_config *config, struct oap_state *state); +int oap_client_init(struct oap_client_config *config, + struct oap_client_state *state); /* Construct an OAP registration message and return in *msg_tx. Use * state->client_id and update state->state. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_register(struct oap_state *state, struct msgb **msg_tx); +int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx); /* Decode and act on a received OAP message msg_rx. Update state->state. If a * non-NULL pointer is returned in *msg_tx, that msgb should be sent to the OAP * server (and freed) by the caller. The received msg_rx is not freed. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx); +int oap_client_handle(struct oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx); -/* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on - * error. (Like oap_encode(), but also allocates a msgb.) - * About the name: the idea is do_something(oap_encoded(my_struct)) */ -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg); - +/* Allocate a msgb and in it, return the encoded oap_client_msg. Return + * NULL on error. (Like oap_client_encode(), but also allocates a msgb.) + * About the name: the idea is do_something(oap_client_encoded(my_struct)) + */ +struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_client_msg); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 0045fae..c8dcc0d 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -92,7 +92,7 @@ int dynamic_lookup; - struct oap_config oap; + struct oap_client_config oap; /* RFC1144 TCP/IP header compression */ struct { diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index b991563..0360e0a 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -116,7 +116,7 @@ { struct msgb *msg_tx; int rc; - rc = oap_register(&gsupc->oap_state, &msg_tx); + rc = oap_client_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); @@ -155,7 +155,7 @@ int rc; struct msgb *msg_tx; - rc = oap_handle(&gsupc->oap_state, msg_rx, &msg_tx); + rc = oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) return rc; @@ -265,7 +265,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_config *oap_config) + struct oap_client_config *oap_config) { struct gsup_client *gsupc; int rc; @@ -273,7 +273,7 @@ gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client); OSMO_ASSERT(gsupc); - rc = oap_init(oap_config, &gsupc->oap_state); + rc = oap_client_init(oap_config, &gsupc->oap_state); if (rc != 0) goto failed; diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index 7efbe81..ac2b2a4 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -29,7 +29,8 @@ #include #include -int oap_init(struct oap_config *config, struct oap_state *state) +int oap_client_init(struct oap_client_config *config, + struct oap_client_state *state) { OSMO_ASSERT(state->state == OAP_UNINITIALIZED); @@ -66,7 +67,7 @@ * response message and update the state. * Return 0 on success; -1 if OAP is disabled; -2 if rx_random and rx_autn fail * the authentication check; -3 for any other errors. */ -static int oap_evaluate_challenge(const struct oap_state *state, +static int oap_evaluate_challenge(const struct oap_client_state *state, const uint8_t *rx_random, const uint8_t *rx_autn, uint8_t *tx_xres) @@ -119,7 +120,7 @@ return 0; } -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_msg) { struct msgb *msg = msgb_alloc_headroom(1000, 64, __func__); OSMO_ASSERT(msg); @@ -140,10 +141,10 @@ oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; oap_msg.client_id = client_id; - return oap_encoded(&oap_msg); + return oap_client_encoded(&oap_msg); } -int oap_register(struct oap_state *state, struct msgb **msg_tx) +int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx) { *msg_tx = oap_msg_register(state->client_id); if (!(*msg_tx)) @@ -163,10 +164,10 @@ oap_reply.message_type = OAP_MSGT_CHALLENGE_RESULT; memcpy(oap_reply.xres, xres, sizeof(oap_reply.xres)); oap_reply.xres_present = 1; - return oap_encoded(&oap_reply); + return oap_client_encoded(&oap_reply); } -static int handle_challenge(struct oap_state *state, +static int handle_challenge(struct oap_client_state *state, struct osmo_oap_message *oap_rx, struct msgb **msg_tx) { @@ -203,7 +204,8 @@ return rc; } -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx) +int oap_client_handle(struct oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx) { uint8_t *data = msgb_l2(msg_rx); size_t data_len = msgb_l2len(msg_rx); @@ -237,7 +239,7 @@ state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { state->registration_failures ++; - return oap_register(state, msg_tx); + return oap_client_register(state, msg_tx); } return -11; diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index 68542fd..a6f54f6 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -31,11 +31,11 @@ { printf("Testing OAP API\n - Config parsing\n"); - struct oap_config _config; - struct oap_config *config = &_config; + struct oap_client_config _config; + struct oap_client_config *config = &_config; - struct oap_state _state; - struct oap_state *state = &_state; + struct oap_client_state _state; + struct oap_client_state *state = &_state; memset(config, 0, sizeof(*config)); memset(state, 0, sizeof(*state)); @@ -50,7 +50,7 @@ config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); /* reset state */ @@ -60,7 +60,7 @@ config->client_id = 0; config->secret_k_present = 1; config->secret_opc_present = 1; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -69,7 +69,7 @@ config->client_id = 12345; config->secret_k_present = 0; config->secret_opc_present = 1; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -78,7 +78,7 @@ config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 0; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -89,7 +89,7 @@ config->secret_k_present = 1; config->secret_opc_present = 1; /*config->secret_* buffers are still set from the top */ - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); printf(" - AUTN failures\n"); @@ -105,8 +105,8 @@ oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST; oap_rx.rand_present = 0; oap_rx.autn_present = 0; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -114,8 +114,8 @@ osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); oap_rx.rand_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -124,8 +124,8 @@ osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); oap_rx.autn_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -136,25 +136,25 @@ oap_rx.autn, 16); oap_rx.rand_present = 1; oap_rx.autn_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); /* all data correct */ osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); - msg_rx = oap_encoded(&oap_rx); + msg_rx = oap_client_encoded(&oap_rx); /* but refuse to evaluate in uninitialized state */ OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); OSMO_ASSERT(!msg_tx); state->state = OAP_DISABLED; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); OSMO_ASSERT(!msg_tx); state->state = OAP_INITIALIZED; @@ -162,7 +162,7 @@ /* now everything is correct */ printf(" - AUTN success\n"); /* a successful return value here indicates correct autn */ - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); msgb_free(msg_rx); /* Expect the challenge response in msg_tx */ @@ -176,18 +176,18 @@ msgb_free(msg_tx); msg_tx = 0; - struct oap_state saved_state = _state; + struct oap_client_state saved_state = _state; printf(" - Registration failure\n"); memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; - msg_rx = oap_encoded(&oap_rx); + msg_rx = oap_client_encoded(&oap_rx); /* Receive registration error for the first time. */ OSMO_ASSERT(state->registration_failures == 0); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(state->registration_failures == 1); OSMO_ASSERT(msg_tx); OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0); @@ -198,7 +198,7 @@ /* Receive registration error for the Nth time. */ state->registration_failures = 999; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -11); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -11); OSMO_ASSERT(!msg_tx); OSMO_ASSERT(state->state == OAP_INITIALIZED); msgb_free(msg_tx); @@ -211,8 +211,8 @@ _state = saved_state; memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_RESULT; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(!msg_tx); OSMO_ASSERT(state->state == OAP_REGISTERED); msgb_free(msg_rx); -- To view, visit https://gerrit.osmocom.org/1387 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: rename oap.h to oap_client.h 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/1388 to look at the new patch set (#2). rename oap.h to oap_client.h Related: OS#1592 Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec --- M openbsc/include/openbsc/Makefile.am M openbsc/include/openbsc/gsup_client.h R openbsc/include/openbsc/oap_client.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/oap.c M openbsc/tests/oap/oap_test.c 6 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/88/1388/2 diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 8ea95e0..2466ce8 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -54,7 +54,7 @@ mncc_int.h \ nat_rewrite_trie.h \ network_listen.h \ - oap.h \ + oap_client.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index d21a54d..a113225 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -23,7 +23,7 @@ #include -#include +#include #define GSUP_CLIENT_RECONNECT_INTERVAL 10 #define GSUP_CLIENT_PING_INTERVAL 20 diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap_client.h similarity index 100% rename from openbsc/include/openbsc/oap.h rename to openbsc/include/openbsc/oap_client.h diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index c8dcc0d..1ede2c9 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index ac2b2a4..92140c1 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include int oap_client_init(struct oap_client_config *config, diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index a6f54f6..adac911 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1388 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: move gprs/oap.c to libcommon/oap_client.c 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/1389 to look at the new patch set (#2). move gprs/oap.c to libcommon/oap_client.c This is in preparation for libvlr. Related: OS#1592 Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 --- M openbsc/src/gprs/Makefile.am M openbsc/src/libcommon/Makefile.am R openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/Makefile.am M openbsc/tests/sgsn/Makefile.am 5 files changed, 2 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/89/1389/2 diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index ab2517e..d059aee 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -92,7 +92,6 @@ sgsn_cdr.c \ sgsn_ares.c \ slhc.c \ - oap.c \ gprs_llc_xid.c \ v42bis.c \ $(NULL) @@ -137,9 +136,9 @@ gsup_test_client_SOURCES = \ gprs_gsup_client.c \ gsup_test_client.c \ - oap.c \ $(NULL) gsup_test_client_LDADD = \ + $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6cfebc2..6582d1e 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,6 +23,7 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ + oap_client.c \ socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/libcommon/oap_client.c similarity index 100% rename from openbsc/src/gprs/oap.c rename to openbsc/src/libcommon/oap_client.c diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index bb9ebb2..c17abb5 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -27,7 +27,6 @@ $(NULL) oap_test_LDADD = \ - $(top_builddir)/src/gprs/oap.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 9e1a5a8..00b80f6 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -54,7 +54,6 @@ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ - $(top_builddir)/src/gprs/oap.o \ $(top_builddir)/src/gprs/gprs_llc_xid.o \ $(top_builddir)/src/gprs/gprs_sndcp_xid.o \ $(top_builddir)/src/gprs/slhc.o \ -- To view, visit https://gerrit.osmocom.org/1389 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: move grps_gsup_client.c to libcommon/gsup_client.c 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/1390 to look at the new patch set (#2). move grps_gsup_client.c to libcommon/gsup_client.c This is in preparation for libvlr. Related: OS#1592 Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce --- M openbsc/src/gprs/Makefile.am M openbsc/src/libcommon/Makefile.am R openbsc/src/libcommon/gsup_client.c R openbsc/src/libcommon/gsup_test_client.c M openbsc/tests/sgsn/Makefile.am 5 files changed, 17 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/90/1390/2 diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index d059aee..cff17dd 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -37,7 +37,6 @@ $(NULL) bin_PROGRAMS = \ - gsup_test_client \ osmo-gbproxy \ $(NULL) if HAVE_LIBGTP @@ -88,7 +87,6 @@ sgsn_auth.c \ gprs_subscriber.c \ gprs_utils.c \ - gprs_gsup_client.c \ sgsn_cdr.c \ sgsn_ares.c \ slhc.c \ @@ -130,18 +128,5 @@ $(LIBOSMOVTY_LIBS) \ $(LIBCARES_LIBS) \ $(LIBGTP_LIBS) \ - -lrt \ - $(NULL) - -gsup_test_client_SOURCES = \ - gprs_gsup_client.c \ - gsup_test_client.c \ - $(NULL) -gsup_test_client_LDADD = \ - $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBOSMOCORE_LIBS) \ - $(LIBOSMOGSM_LIBS) \ - $(LIBOSMOVTY_LIBS) \ - $(LIBOSMOABIS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6582d1e..0b258c0 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,8 +23,25 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ + gsup_client.c \ oap_client.c \ socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ $(NULL) + +noinst_PROGRAMS = \ + gsup_test_client \ + $(NULL) + +gsup_test_client_SOURCES = \ + gsup_test_client.c \ + $(NULL) +gsup_test_client_LDADD = \ + libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + -lrt \ + $(NULL) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/libcommon/gsup_client.c similarity index 100% rename from openbsc/src/gprs/gprs_gsup_client.c rename to openbsc/src/libcommon/gsup_client.c diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/libcommon/gsup_test_client.c similarity index 100% rename from openbsc/src/gprs/gsup_test_client.c rename to openbsc/src/libcommon/gsup_test_client.c diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 00b80f6..f1606cb 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -50,7 +50,6 @@ $(top_builddir)/src/gprs/sgsn_libgtp.o \ $(top_builddir)/src/gprs/sgsn_auth.o \ $(top_builddir)/src/gprs/sgsn_ares.o \ - $(top_builddir)/src/gprs/gprs_gsup_client.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ -- To view, visit https://gerrit.osmocom.org/1390 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap_test.c: rename to avoid clash with libosmocore oap_test.c 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/1391 to look at the new patch set (#2). oap_test.c: rename to avoid clash with libosmocore oap_test.c Rename to oap_client_test.c, which is also a more accurate name. Related: OS#1592 Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f --- M openbsc/tests/oap/Makefile.am R openbsc/tests/oap/oap_client_test.c R openbsc/tests/oap/oap_client_test.ok M openbsc/tests/testsuite.at 4 files changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/91/1391/2 diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index c17abb5..df0a43f 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -11,22 +11,22 @@ $(NULL) EXTRA_DIST = \ - oap_test.ok \ + oap_client_test.ok \ $(NULL) if HAVE_LIBGTP if HAVE_LIBCARES noinst_PROGRAMS = \ - oap_test \ + oap_client_test \ $(NULL) endif endif -oap_test_SOURCES = \ - oap_test.c \ +oap_client_test_SOURCES = \ + oap_client_test.c \ $(NULL) -oap_test_LDADD = \ +oap_client_test_LDADD = \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_client_test.c similarity index 100% rename from openbsc/tests/oap/oap_test.c rename to openbsc/tests/oap/oap_client_test.c diff --git a/openbsc/tests/oap/oap_test.ok b/openbsc/tests/oap/oap_client_test.ok similarity index 100% rename from openbsc/tests/oap/oap_test.ok rename to openbsc/tests/oap/oap_client_test.ok diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index b44d595..0765c76 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -107,8 +107,8 @@ AT_SETUP([oap]) AT_KEYWORDS([oap]) AT_CHECK([test "$enable_oap_test" != no || exit 77]) -cat $abs_srcdir/oap/oap_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [], [expout], [ignore]) +cat $abs_srcdir/oap/oap_client_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [ignore]) AT_CLEANUP AT_SETUP([gtphub]) -- To view, visit https://gerrit.osmocom.org/1391 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap_client_test: print test descr to stderr, check stderr 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/1392 to look at the new patch set (#2). oap_client_test: print test descr to stderr, check stderr Related: OS#1592 Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 --- M openbsc/tests/oap/Makefile.am M openbsc/tests/oap/oap_client_test.c A openbsc/tests/oap/oap_client_test.err M openbsc/tests/oap/oap_client_test.ok M openbsc/tests/testsuite.at 5 files changed, 56 insertions(+), 30 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/92/1392/2 diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index df0a43f..1bb672d 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -12,6 +12,7 @@ EXTRA_DIST = \ oap_client_test.ok \ + oap_client_test.err \ $(NULL) if HAVE_LIBGTP diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index adac911..1473146 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -29,7 +29,7 @@ static void test_oap_api(void) { - printf("Testing OAP API\n - Config parsing\n"); + printf("Testing OAP API\n"); struct oap_client_config _config; struct oap_client_config *config = &_config; @@ -43,20 +43,20 @@ OSMO_ASSERT(osmo_hexparse("0102030405060708090a0b0c0d0e0f10", config->secret_k, 16) == 16); OSMO_ASSERT(osmo_hexparse("1112131415161718191a1b1c1d1e1f20", config->secret_opc, 16) == 16); - /* make sure filling with zeros means uninitialized */ + fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); - /* invalid client_id and shared secret */ + fprintf(stderr, "- invalid client_id and shared secret\n"); config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); - /* reset state */ + fprintf(stderr, "- reset state\n"); memset(state, 0, sizeof(*state)); - /* only client_id is invalid */ + fprintf(stderr, "- only client_id is invalid\n"); config->client_id = 0; config->secret_k_present = 1; config->secret_opc_present = 1; @@ -65,7 +65,7 @@ memset(state, 0, sizeof(*state)); - /* valid id, but omitted shared_secret (1/2) */ + fprintf(stderr, "- valid id, but omitted shared_secret (1/2)\n"); config->client_id = 12345; config->secret_k_present = 0; config->secret_opc_present = 1; @@ -74,7 +74,7 @@ memset(state, 0, sizeof(*state)); - /* valid id, but omitted shared_secret (2/2) */ + fprintf(stderr, "- valid id, but omitted shared_secret (2/2)\n"); config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 0; @@ -84,7 +84,7 @@ memset(state, 0, sizeof(*state)); - /* mint configuration */ + fprintf(stderr, "- mint configuration\n"); config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 1; @@ -92,16 +92,13 @@ OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); - printf(" - AUTN failures\n"); - struct osmo_oap_message oap_rx; struct osmo_oap_message oap_tx; struct msgb *msg_rx; struct msgb *msg_tx; + fprintf(stderr, "- Missing challenge data\n"); memset(&oap_rx, 0, sizeof(oap_rx)); - - /* Missing challenge data */ oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST; oap_rx.rand_present = 0; oap_rx.autn_present = 0; @@ -110,7 +107,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* AUTN missing */ + fprintf(stderr, "- AUTN missing\n"); osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); oap_rx.rand_present = 1; @@ -119,7 +116,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* RAND missing */ + fprintf(stderr, "- RAND missing\n"); oap_rx.rand_present = 0; osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); @@ -129,7 +126,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* wrong autn (by one bit) */ + fprintf(stderr, "- wrong autn (by one bit)\n"); osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); osmo_hexparse("dec4e3848a33000086781158ca40f136", @@ -141,12 +138,12 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* all data correct */ + fprintf(stderr, "- all data correct\n"); osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); msg_rx = oap_client_encoded(&oap_rx); - /* but refuse to evaluate in uninitialized state */ + fprintf(stderr, "- but refuse to evaluate in uninitialized state\n"); OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; @@ -159,13 +156,12 @@ state->state = OAP_INITIALIZED; - /* now everything is correct */ - printf(" - AUTN success\n"); + fprintf(stderr, "- now everything is correct\n"); /* a successful return value here indicates correct autn */ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); msgb_free(msg_rx); - /* Expect the challenge response in msg_tx */ + fprintf(stderr, "- Expect the challenge response in msg_tx\n"); OSMO_ASSERT(msg_tx); OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0); OSMO_ASSERT(oap_tx.message_type == OAP_MSGT_CHALLENGE_RESULT); @@ -178,14 +174,13 @@ struct oap_client_state saved_state = _state; - printf(" - Registration failure\n"); + fprintf(stderr, "- Receive registration error for the first time.\n"); memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; msg_rx = oap_client_encoded(&oap_rx); - /* Receive registration error for the first time. */ OSMO_ASSERT(state->registration_failures == 0); OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(state->registration_failures == 1); @@ -196,7 +191,7 @@ msgb_free(msg_tx); msg_tx = 0; - /* Receive registration error for the Nth time. */ + fprintf(stderr, "- Receive registration error for the Nth time.\n"); state->registration_failures = 999; OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -11); OSMO_ASSERT(!msg_tx); @@ -206,7 +201,7 @@ msgb_free(msg_rx); - printf(" - Registration success\n"); + fprintf(stderr, "- Registration success\n"); _state = saved_state; memset(&oap_rx, 0, sizeof(oap_rx)); @@ -236,6 +231,12 @@ msgb_talloc_ctx_init(NULL, 0); osmo_init_logging(&info); + OSMO_ASSERT(osmo_stderr_target); + osmo_stderr_target->use_color = 0; + osmo_stderr_target->print_timestamp = 0; + osmo_stderr_target->print_filename = 0; + osmo_stderr_target->print_category = 1; + test_oap_api(); printf("Done\n"); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err new file mode 100644 index 0000000..3272237 --- /dev/null +++ b/openbsc/tests/oap/oap_client_test.err @@ -0,0 +1,28 @@ +- make sure filling with zeros means uninitialized +- invalid client_id and shared secret +- reset state +- only client_id is invalid +- valid id, but omitted shared_secret (1/2) +DGPRS OAP: client ID set, but secret K missing. +- valid id, but omitted shared_secret (2/2) +DGPRS OAP: client ID set, but secret OPC missing. +- mint configuration +- Missing challenge data +DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +- AUTN missing +DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +- RAND missing +DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +- wrong autn (by one bit) +DGPRS OAP: AUTN mismatch! +DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 +DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +- all data correct +- but refuse to evaluate in uninitialized state +- now everything is correct +- Expect the challenge response in msg_tx +- Receive registration error for the first time. +DGPRS OAP registration failed +- Receive registration error for the Nth time. +DGPRS OAP registration failed +- Registration success diff --git a/openbsc/tests/oap/oap_client_test.ok b/openbsc/tests/oap/oap_client_test.ok index 2e9ecf0..59108a7 100644 --- a/openbsc/tests/oap/oap_client_test.ok +++ b/openbsc/tests/oap/oap_client_test.ok @@ -1,7 +1,2 @@ Testing OAP API - - Config parsing - - AUTN failures - - AUTN success - - Registration failure - - Registration success Done diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index 0765c76..01737a3 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -108,7 +108,8 @@ AT_KEYWORDS([oap]) AT_CHECK([test "$enable_oap_test" != no || exit 77]) cat $abs_srcdir/oap/oap_client_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [ignore]) +cat $abs_srcdir/oap/oap_client_test.err > experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [experr]) AT_CLEANUP AT_SETUP([gtphub]) -- To view, visit https://gerrit.osmocom.org/1392 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap_client: move logging to DLOAP logging category In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1393 to look at the new patch set (#2). oap_client: move logging to DLOAP logging category libosmocore since recently offers the DLOAP logging category for OAP. Use it. Todo: we're using a "Library" logging category, which is not really what the library category was intended for. Instead, the OAP client should probably be given a logging category like DVLR or DGPRS in its initialization API. Related: OS#1592 Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a --- M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 3 files changed, 27 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/93/1393/2 diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 92140c1..46dbcdd 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -38,12 +38,12 @@ goto disable; if (config->secret_k_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); goto disable; } if (config->secret_opc_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); goto disable; } @@ -101,16 +101,16 @@ osmo_auth_gen_vec(&vec, &auth, rx_random); if (vec.res_len != 8) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", vec.res_len); return -3; } if (osmo_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) { - LOGP(DGPRS, LOGL_ERROR, "OAP: AUTN mismatch!\n"); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN from server: %s\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: AUTN mismatch!\n"); + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN from server: %s\n", osmo_hexdump_nospc(rx_autn, sizeof(vec.autn))); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN expected: %s\n", + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN expected: %s\n", osmo_hexdump_nospc(vec.autn, sizeof(vec.autn))); return -2; } @@ -135,7 +135,7 @@ struct osmo_oap_message oap_msg = {0}; if (client_id < 1) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); + LOGP(DLOAP, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); return NULL; } @@ -175,7 +175,7 @@ uint8_t xres[8]; if (!(oap_rx->rand_present && oap_rx->autn_present)) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n", oap_rx->rand_present, oap_rx->autn_present); rc = -2; @@ -218,7 +218,7 @@ rc = osmo_oap_decode(&oap_msg, data, data_len); if (rc < 0) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Decoding OAP message failed with error '%s' (%d)\n", get_value_string(gsm48_gmm_cause_names, -rc), -rc); return -10; @@ -234,7 +234,7 @@ break; case OAP_MSGT_REGISTER_ERROR: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP registration failed\n"); state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { @@ -245,13 +245,13 @@ case OAP_MSGT_REGISTER_REQUEST: case OAP_MSGT_CHALLENGE_RESULT: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Received invalid OAP message type for OAP client side: %d\n", (int)oap_msg.message_type); return -12; default: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Unknown OAP message type: %d\n", (int)oap_msg.message_type); return -13; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 1473146..919bbb7 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -213,17 +213,12 @@ msgb_free(msg_rx); } -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", - .enabled = 1, .loglevel = LOGL_DEBUG, - }, +static struct log_info_cat oap_client_test_categories[] = { }; static struct log_info info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), + .cat = oap_client_test_categories, + .num_cat = ARRAY_SIZE(oap_client_test_categories), }; int main(int argc, char **argv) @@ -232,10 +227,10 @@ osmo_init_logging(&info); OSMO_ASSERT(osmo_stderr_target); - osmo_stderr_target->use_color = 0; - osmo_stderr_target->print_timestamp = 0; - osmo_stderr_target->print_filename = 0; - osmo_stderr_target->print_category = 1; + log_set_use_color(osmo_stderr_target, 0); + log_set_print_timestamp(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, 0); + log_set_print_category(osmo_stderr_target, 1); test_oap_api(); printf("Done\n"); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 3272237..362105c 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -3,26 +3,24 @@ - reset state - only client_id is invalid - valid id, but omitted shared_secret (1/2) -DGPRS OAP: client ID set, but secret K missing. +DLOAP OAP: client ID set, but secret K missing. - valid id, but omitted shared_secret (2/2) -DGPRS OAP: client ID set, but secret OPC missing. +DLOAP OAP: client ID set, but secret OPC missing. - mint configuration - Missing challenge data -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 0) - AUTN missing -DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 1, autn_present: 0) - RAND missing -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 1) - wrong autn (by one bit) -DGPRS OAP: AUTN mismatch! -DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 -DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN mismatch! - all data correct - but refuse to evaluate in uninitialized state - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Receive registration error for the Nth time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Registration success -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a Gerrit-PatchSet: 2 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 Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap_client_test: show bug: disabled state does not reject me... 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/1394 to look at the new patch set (#2). oap_client_test: show bug: disabled state does not reject message There is a hole in OAP where a disabled OAP still accepts at least a Registration Reject message, after which it will do things it shouldn't. Show this by expecting the bugs, to be adjusted with the upcoming fix. Related: OS#1592 Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 --- M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 2 files changed, 41 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/94/1394/2 diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 919bbb7..4acbbe1 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -37,6 +37,12 @@ struct oap_client_state _state; struct oap_client_state *state = &_state; + struct osmo_oap_message oap_rx; + struct msgb *msg_rx; + + struct osmo_oap_message oap_tx; + struct msgb *msg_tx; + memset(config, 0, sizeof(*config)); memset(state, 0, sizeof(*state)); @@ -46,7 +52,38 @@ fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); + fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n"); + memset(&oap_rx, 0, sizeof(oap_rx)); + state->client_id = 1; + oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; + msg_rx = oap_client_encoded(&oap_rx); + /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP + * happily accepts this message and breaks the uninitialized state. The + * expected rc, state and msg_tx will be fixed along with the fix. */ + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); + OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */); + msgb_free(msg_rx); + OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); + msgb_free(msg_tx); + + fprintf(stderr, "- reject messages in disabled state\n"); + memset(state, 0, sizeof(*state)); + memset(&oap_rx, 0, sizeof(oap_rx)); + state->state = OAP_DISABLED; + state->client_id = 1; + oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; + msg_rx = oap_client_encoded(&oap_rx); + /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP + * happily accepts this message and breaks the uninitialized state. The + * expected rc, state and msg_tx will be fixed along with the fix. */ + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); + OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */); + msgb_free(msg_rx); + OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); + msgb_free(msg_tx); + fprintf(stderr, "- invalid client_id and shared secret\n"); + memset(state, 0, sizeof(*state)); config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; @@ -92,10 +129,6 @@ OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); - struct osmo_oap_message oap_rx; - struct osmo_oap_message oap_tx; - struct msgb *msg_rx; - struct msgb *msg_tx; fprintf(stderr, "- Missing challenge data\n"); memset(&oap_rx, 0, sizeof(oap_rx)); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 362105c..69eb103 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,4 +1,8 @@ - make sure filling with zeros means uninitialized +- reject messages in uninitialized state EXPECTING BUGS +DLOAP OAP registration failed +- reject messages in disabled state +DLOAP OAP registration failed - invalid client_id and shared secret - reset state - only client_id is invalid -- To view, visit https://gerrit.osmocom.org/1394 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap_client: reject all messages in disabled/uninitialized state 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/1395 to look at the new patch set (#2). oap_client: reject all messages in disabled/uninitialized state Fixes the bug indicated in oap_client_test.c: adjust to actually expect the proper behavior. Also adjust for modified return value for message rejection. Instead of -1, just expect < 0. Adjust experr for new error messages. Related: OS#1592 Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 --- M openbsc/src/libcommon/gsup_client.c M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 4 files changed, 31 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/95/1395/2 diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c index 0360e0a..4c1fe61 100644 --- a/openbsc/src/libcommon/gsup_client.c +++ b/openbsc/src/libcommon/gsup_client.c @@ -155,6 +155,7 @@ int rc; struct msgb *msg_tx; + /* If the oap_state is disabled, this will reject the messages. */ rc = oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 46dbcdd..e372ede 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -224,6 +225,21 @@ return -10; } + switch (state->state) { + case OAP_UNINITIALIZED: + LOGP(DLOAP, LOGL_ERROR, + "Received OAP message %d, but the OAP client is" + " not initialized\n", oap_msg.message_type); + return -ENOTCONN; + case OAP_DISABLED: + LOGP(DLOAP, LOGL_ERROR, + "Received OAP message %d, but the OAP client is" + " disabled\n", oap_msg.message_type); + return -ENOTCONN; + default: + break; + } + switch (oap_msg.message_type) { case OAP_MSGT_CHALLENGE_REQUEST: return handle_challenge(state, &oap_msg, msg_tx); diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 4acbbe1..0163a0c 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -52,19 +52,15 @@ fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); - fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n"); + fprintf(stderr, "- reject messages in uninitialized state\n"); memset(&oap_rx, 0, sizeof(oap_rx)); state->client_id = 1; oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; msg_rx = oap_client_encoded(&oap_rx); - /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP - * happily accepts this message and breaks the uninitialized state. The - * expected rc, state and msg_tx will be fixed along with the fix. */ - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); - OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); + OSMO_ASSERT(state->state == OAP_UNINITIALIZED); msgb_free(msg_rx); - OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); - msgb_free(msg_tx); + OSMO_ASSERT(!msg_tx); fprintf(stderr, "- reject messages in disabled state\n"); memset(state, 0, sizeof(*state)); @@ -73,14 +69,10 @@ state->client_id = 1; oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; msg_rx = oap_client_encoded(&oap_rx); - /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP - * happily accepts this message and breaks the uninitialized state. The - * expected rc, state and msg_tx will be fixed along with the fix. */ - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); - OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); + OSMO_ASSERT(state->state == OAP_DISABLED); msgb_free(msg_rx); - OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); - msgb_free(msg_tx); + OSMO_ASSERT(!msg_tx); fprintf(stderr, "- invalid client_id and shared secret\n"); memset(state, 0, sizeof(*state)); @@ -180,11 +172,11 @@ OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); OSMO_ASSERT(!msg_tx); state->state = OAP_DISABLED; - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); OSMO_ASSERT(!msg_tx); state->state = OAP_INITIALIZED; diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 69eb103..d014390 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,8 +1,8 @@ - make sure filling with zeros means uninitialized -- reject messages in uninitialized state EXPECTING BUGS -DLOAP OAP registration failed +- reject messages in uninitialized state +DLOAP Received OAP message 5, but the OAP client is not initialized - reject messages in disabled state -DLOAP OAP registration failed +DLOAP Received OAP message 5, but the OAP client is disabled - invalid client_id and shared secret - reset state - only client_id is invalid @@ -21,6 +21,8 @@ DLOAP OAP: AUTN mismatch! - all data correct - but refuse to evaluate in uninitialized state +DLOAP Received OAP message 8, but the OAP client is not initialized +DLOAP Received OAP message 8, but the OAP client is disabled - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -- To view, visit https://gerrit.osmocom.org/1395 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 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 Mon Dec 12 16:07:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:17 +0000 Subject: [PATCH] openbsc[master]: oap_client: make use of OAP optional: disable for NULL config 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/1396 to look at the new patch set (#2). oap_client: make use of OAP optional: disable for NULL config When passing a NULL config to osmo_oap_client_init(), set OAP to disabled state. Along with the previous fix that ensures message rejection in the disabled state, this makes use of OAP in the GSUP client optional. oap_client_test: expect null config to set state to disabled. Related: OS#1592 Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 --- M openbsc/src/libcommon/gsup_client.c M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 4 files changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/96/1396/2 diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c index 4c1fe61..2e920a6 100644 --- a/openbsc/src/libcommon/gsup_client.c +++ b/openbsc/src/libcommon/gsup_client.c @@ -266,7 +266,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_client_config *oap_config) + struct oap_client_config *oapc_config) { struct gsup_client *gsupc; int rc; @@ -274,7 +274,8 @@ gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client); OSMO_ASSERT(gsupc); - rc = oap_client_init(oap_config, &gsupc->oap_state); + /* a NULL oapc_config will mark oap_state disabled. */ + rc = oap_client_init(oapc_config, &gsupc->oap_state); if (rc != 0) goto failed; diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index e372ede..54b71e4 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -35,6 +35,9 @@ { OSMO_ASSERT(state->state == OAP_UNINITIALIZED); + if (!config) + goto disable; + if (config->client_id == 0) goto disable; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 0163a0c..fac7315 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -62,6 +62,10 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); + fprintf(stderr, "- NULL config should disable\n"); + OSMO_ASSERT( oap_client_init(NULL, state) == 0 ); + OSMO_ASSERT(state->state == OAP_DISABLED); + fprintf(stderr, "- reject messages in disabled state\n"); memset(state, 0, sizeof(*state)); memset(&oap_rx, 0, sizeof(oap_rx)); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index d014390..8e15ecb 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,6 +1,7 @@ - make sure filling with zeros means uninitialized - reject messages in uninitialized state DLOAP Received OAP message 5, but the OAP client is not initialized +- NULL config should disable - reject messages in disabled state DLOAP Received OAP message 5, but the OAP client is disabled - invalid client_id and shared secret -- To view, visit https://gerrit.osmocom.org/1396 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 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 Mon Dec 12 16:07:20 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:07:20 +0000 Subject: [PATCH] openbsc[master]: build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP Message-ID: Review at https://gerrit.osmocom.org/1422 build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP GSUP was added to libosmocore in 0.9.4. We're using it here, so make up for a previously missing bump. (BTW: I'm pretty sure that other dependencies are also in dire need of a bump, but leaving that for another patch) Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 --- M openbsc/configure.ac 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/22/1422/1 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 093d42f..123048f 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -30,10 +30,10 @@ AC_SUBST(LIBRARY_DL) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.4) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -- To view, visit https://gerrit.osmocom.org/1422 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 16:16:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:16:35 +0000 Subject: [PATCH] openbsc[master]: oap_client: move logging to DLOAP logging category In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1393 to look at the new patch set (#3). oap_client: move logging to DLOAP logging category Use libosmocore's DLOAP logging category for OAP. oap_client_test.c: make sure DLOAP is in DEBUG level to not lose any logging messages from experr. Todo: we're using a "Library" logging category, which is not really what the library category was intended for. Instead, the OAP client should probably be given a logging category like DVLR or DGPRS in its initialization API. Related: OS#1592 Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a --- M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 3 files changed, 30 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/93/1393/3 diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 92140c1..46dbcdd 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -38,12 +38,12 @@ goto disable; if (config->secret_k_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); goto disable; } if (config->secret_opc_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); goto disable; } @@ -101,16 +101,16 @@ osmo_auth_gen_vec(&vec, &auth, rx_random); if (vec.res_len != 8) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", vec.res_len); return -3; } if (osmo_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) { - LOGP(DGPRS, LOGL_ERROR, "OAP: AUTN mismatch!\n"); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN from server: %s\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: AUTN mismatch!\n"); + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN from server: %s\n", osmo_hexdump_nospc(rx_autn, sizeof(vec.autn))); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN expected: %s\n", + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN expected: %s\n", osmo_hexdump_nospc(vec.autn, sizeof(vec.autn))); return -2; } @@ -135,7 +135,7 @@ struct osmo_oap_message oap_msg = {0}; if (client_id < 1) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); + LOGP(DLOAP, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); return NULL; } @@ -175,7 +175,7 @@ uint8_t xres[8]; if (!(oap_rx->rand_present && oap_rx->autn_present)) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n", oap_rx->rand_present, oap_rx->autn_present); rc = -2; @@ -218,7 +218,7 @@ rc = osmo_oap_decode(&oap_msg, data, data_len); if (rc < 0) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Decoding OAP message failed with error '%s' (%d)\n", get_value_string(gsm48_gmm_cause_names, -rc), -rc); return -10; @@ -234,7 +234,7 @@ break; case OAP_MSGT_REGISTER_ERROR: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP registration failed\n"); state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { @@ -245,13 +245,13 @@ case OAP_MSGT_REGISTER_REQUEST: case OAP_MSGT_CHALLENGE_RESULT: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Received invalid OAP message type for OAP client side: %d\n", (int)oap_msg.message_type); return -12; default: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Unknown OAP message type: %d\n", (int)oap_msg.message_type); return -13; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 1473146..a54e386 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -213,17 +213,12 @@ msgb_free(msg_rx); } -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", - .enabled = 1, .loglevel = LOGL_DEBUG, - }, +static struct log_info_cat oap_client_test_categories[] = { }; static struct log_info info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), + .cat = oap_client_test_categories, + .num_cat = ARRAY_SIZE(oap_client_test_categories), }; int main(int argc, char **argv) @@ -232,10 +227,11 @@ osmo_init_logging(&info); OSMO_ASSERT(osmo_stderr_target); - osmo_stderr_target->use_color = 0; - osmo_stderr_target->print_timestamp = 0; - osmo_stderr_target->print_filename = 0; - osmo_stderr_target->print_category = 1; + log_set_use_color(osmo_stderr_target, 0); + log_set_print_timestamp(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, 0); + log_set_print_category(osmo_stderr_target, 1); + log_parse_category_mask(osmo_stderr_target, "DLOAP,1"); test_oap_api(); printf("Done\n"); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 3272237..248808e 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -3,26 +3,26 @@ - reset state - only client_id is invalid - valid id, but omitted shared_secret (1/2) -DGPRS OAP: client ID set, but secret K missing. +DLOAP OAP: client ID set, but secret K missing. - valid id, but omitted shared_secret (2/2) -DGPRS OAP: client ID set, but secret OPC missing. +DLOAP OAP: client ID set, but secret OPC missing. - mint configuration - Missing challenge data -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 0) - AUTN missing -DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 1, autn_present: 0) - RAND missing -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 1) - wrong autn (by one bit) -DGPRS OAP: AUTN mismatch! -DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 -DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN mismatch! +DLOAP OAP: AUTN from server: dec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN expected: cec4e3848a33000086781158ca40f136 - all data correct - but refuse to evaluate in uninitialized state - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Receive registration error for the Nth time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Registration success -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a 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 Mon Dec 12 16:21:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:21:03 +0000 Subject: [PATCH] openbsc[master]: Add IPA multiplex 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/1265 to look at the new patch set (#10). Add IPA multiplex Add base class and derived Ctrl class implementing ctrl-specific routines. Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Related: SYS#3028 --- A openbsc/contrib/ipa.py 1 file changed, 278 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/1265/10 diff --git a/openbsc/contrib/ipa.py b/openbsc/contrib/ipa.py new file mode 100755 index 0000000..25133f1 --- /dev/null +++ b/openbsc/contrib/ipa.py @@ -0,0 +1,278 @@ +#!/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. + */ +""" + +import struct, random, sys + +class IPA(object): + """ + Stateless IPA protocol multiplexer: add/remove/parse (extended) header + """ + version = "0.0.5" + TCP_PORT_OML = 3002 + TCP_PORT_RSL = 3003 + # OpenBSC extensions: OSMO, MGCP_OLD + PROTO = dict(RSL=0x00, CCM=0xFE, SCCP=0xFD, OML=0xFF, OSMO=0xEE, MGCP_OLD=0xFC) + # ...OML Router Control, GSUP GPRS extension, Osmocom Authn Protocol + EXT = dict(CTRL=0, MGCP=1, LAC=2, SMSC=3, ORC=4, GSUP=5, OAP=6) + # OpenBSC extension: SCCP_OLD + MSGT = dict(PING=0x00, PONG=0x01, ID_GET=0x04, ID_RESP=0x05, ID_ACK=0x06, SCCP_OLD=0xFF) + IDTAG = dict(SERNR=0, UNITNAME=1, LOCATION=2, TYPE=3, EQUIPVERS=4, SWVERSION=5, IPADDR=6, MACADDR=7, UNIT=8) + CTRL_GET = 'GET' + CTRL_SET = 'SET' + CTRL_REP = 'REPLY' + CTRL_ERR = 'ERR' + CTRL_TRAP = 'TRAP' + + def _l(self, d, p): + """ + Reverse dictionary lookup: return key for a given value + """ + if p is None: + return 'UNKNOWN' + return list(d.keys())[list(d.values()).index(p)] + + def _tag(self, t, v): + """ + Create TAG as TLV data + """ + return struct.pack(">HB", len(v) + 1, t) + v + + def proto(self, p): + """ + Lookup protocol name + """ + return self._l(self.PROTO, p) + + def ext(self, p): + """ + Lookup protocol extension name + """ + return self._l(self.EXT, p) + + def msgt(self, p): + """ + Lookup message type name + """ + return self._l(self.MSGT, p) + + def idtag(self, p): + """ + Lookup ID tag name + """ + return self._l(self.IDTAG, p) + + def ext_name(self, proto, exten): + """ + Return proper extension byte name depending on the protocol used + """ + if self.PROTO['CCM'] == proto: + return self.msgt(exten) + if self.PROTO['OSMO'] == proto: + return self.ext(exten) + return None + + def add_header(self, data, proto, ext=None): + """ + Add IPA header (with extension if necessary), data must be represented as bytes + """ + if ext is None: + return struct.pack(">HB", len(data) + 1, proto) + data + return struct.pack(">HBB", len(data) + 1, proto, ext) + data + + def del_header(self, data): + """ + Strip IPA protocol header correctly removing extension if present + Returns data length, IPA protocol, extension (or None if not defined for a give protocol) and the data without header + """ + if not len(data): + return None, None, None, None + (dlen, proto) = struct.unpack('>HB', data[:3]) + if self.PROTO['OSMO'] == proto or self.PROTO['CCM'] == proto: # there's extension which we have to unpack + return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data + return dlen, proto, None, data[3:] # length, protocol, _, data + + def split_combined(self, data): + """ + Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where rest contains remaining messages, first is the single IPA message + """ + (length, _, _, _) = self.del_header(data) + return data[:(length + 3)], data[(length + 3):] + + def tag_serial(self, data): + """ + Make TAG for serial number + """ + return self._tag(self.IDTAG['SERNR'], data) + + def tag_name(self, data): + """ + Make TAG for unit name + """ + return self._tag(self.IDTAG['UNITNAME'], data) + + def tag_loc(self, data): + """ + Make TAG for location + """ + return self._tag(self.IDTAG['LOCATION'], data) + + def tag_type(self, data): + """ + Make TAG for unit type + """ + return self._tag(self.IDTAG['TYPE'], data) + + def tag_equip(self, data): + """ + Make TAG for equipment version + """ + return self._tag(self.IDTAG['EQUIPVERS'], data) + + def tag_sw(self, data): + """ + Make TAG for software version + """ + return self._tag(self.IDTAG['SWVERSION'], data) + + def tag_ip(self, data): + """ + Make TAG for IP address + """ + return self._tag(self.IDTAG['IPADDR'], data) + + def tag_mac(self, data): + """ + Make TAG for MAC address + """ + return self._tag(self.IDTAG['MACADDR'], data) + + def tag_unit(self, data): + """ + Make TAG for unit ID + """ + return self._tag(self.IDTAG['UNIT'], data) + + def identity(self, unit=b'', mac=b'', location=b'', utype=b'', equip=b'', sw=b'', name=b'', serial=b''): + """ + Make IPA IDENTITY tag list, by default returns empty concatenated bytes of tag list + """ + return self.tag_unit(unit) + self.tag_mac(mac) + self.tag_loc(location) + self.tag_type(utype) + self.tag_equip(equip) + self.tag_sw(sw) + self.tag_name(name) + self.tag_serial(serial) + + def ping(self): + """ + Make PING message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PING']) + + def pong(self): + """ + Make PONG message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PONG']) + + def id_ack(self): + """ + Make ID_ACK CCM message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['ID_ACK']) + + def id_get(self): + """ + Make ID_GET CCM message + """ + return self.add_header(self.identity(), self.PROTO['CCM'], self.MSGT['ID_GET']) + + def id_resp(self, data): + """ + Make ID_RESP CCM message + """ + return self.add_header(data, self.PROTO['CCM'], self.MSGT['ID_RESP']) + +class Ctrl(IPA): + """ + Osmocom CTRL protocol implemented on top of IPA multiplexer + """ + def __init__(self): + random.seed() + + def add_header(self, data): + """ + Add CTRL header + """ + return super(Ctrl, self).add_header(data.encode('utf-8'), IPA.PROTO['OSMO'], IPA.EXT['CTRL']) + + def rem_header(self, data): + """ + Remove CTRL header, check for appropriate protocol and extension + """ + (_, proto, ext, d) = super(Ctrl, self).del_header(data) + if self.PROTO['OSMO'] != proto or self.EXT['CTRL'] != ext: + return None + return d + + def parse(self, data, op=None): + """ + Parse Ctrl string returning (var, value) pair + var could be None in case of ERROR message + value could be None in case of GET message + """ + (s, i, v) = data.split(' ', 2) + if s == self.CTRL_ERR: + return None, v + if s == self.CTRL_GET: + return v, None + (s, i, var, val) = data.split(' ', 3) + if s == self.CTRL_TRAP and i != '0': + return None, '%s with non-zero id %s' % (s, i) + if op is not None and i != op: + if s == self.CTRL_GET + '_' + self.CTRL_REP or s == self.CTRL_SET + '_' + self.CTRL_REP: + return None, '%s with unexpected id %s' % (s, i) + return var, val + + def trap(self, var, val): + """ + Make TRAP message with given (vak, val) pair + """ + return self.add_header("%s 0 %s %s" % (self.CTRL_TRAP, var, val)) + + def cmd(self, var, val=None): + """ + Make SET/GET command message: returns (r, m) tuple where r is random operation id and m is assembled message + """ + r = random.randint(1, sys.maxsize) + if val is not None: + return r, self.add_header("%s %s %s %s" % (self.CTRL_SET, r, var, val)) + return r, self.add_header("%s %s %s" % (self.CTRL_GET, r, var)) + + def verify(self, reply, r, var, val=None): + """ + Verify reply to SET/GET command: returns (b, v) tuple where v is True/False verification result and v is the variable value + """ + (k, v) = self.parse(reply) + if k != var or (val is not None and v != val): + return False, v + return True, v + +if __name__ == '__main__': + print("IPA multiplexer v%s loaded." % IPA.version) -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 10 Gerrit-Project: openbsc 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 Dec 12 16:21:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:21:03 +0000 Subject: [PATCH] openbsc[master]: bsc_control.py: use ipa.py module 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/1266 to look at the new patch set (#9). bsc_control.py: use ipa.py module Simplify code by using Ctrl implementation from ipa.py Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 --- M openbsc/contrib/bsc_control.py 1 file changed, 28 insertions(+), 61 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/1266/9 diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index ba86947..cd2ba6d 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,29 +1,12 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- -import sys,os, random +import random from optparse import OptionParser +from ipa import Ctrl import socket -import struct verbose = False - -def prefix_ipa_ctrl_header(data): - return struct.pack(">HBB", len(data)+1, 0xee, 0) + data - -def ipa_ctrl_header(header): - (plen, ipa_proto, osmo_proto) = struct.unpack(">HBB", header) - return None if (ipa_proto != 0xee or osmo_proto != 0) else plen - -def remove_ipa_ctrl_header(data): - if (len(data) < 4): - raise BaseException("Answer too short!") - plen = ipa_ctrl_header(data[:4]) - if (None == plen): - raise BaseException("Wrong protocol in answer!") - if (plen + 3 > len(data)): - print "Warning: Wrong payload length (expected %i, got %i)" % (plen, len(data) - 3) - return data[4:plen+3], data[plen+3:] def connect(host, port): if verbose: @@ -34,39 +17,31 @@ sck.connect((host, port)) return sck -def send(sck, data): - if verbose: - print "Sending \"%s\"" %(data) - data = prefix_ipa_ctrl_header(data) - sck.send(data) - -def do_set(var, value, op_id, sck): - setmsg = "SET %s %s %s" %(op_id, var, value) - send(sck, setmsg) - -def do_get(var, op_id, sck): - getmsg = "GET %s %s" %(op_id, var) - send(sck, getmsg) - def do_set_get(sck, var, value = None): - r = random.randint(1, sys.maxint) - if (value != None): - s = 'SET_REPLY' - do_set(var, value, r, sck) - else: - s = 'GET_REPLY' - do_get(var, r, sck) - (answer, data) = remove_ipa_ctrl_header(sck.recv(4096)) - x = answer.split() - if (s == x[0] and str(r) == x[1] and var == x[2]): - return None if ('SET_REPLY' == s and value != x[3]) else x[3] - return None + (r, c) = Ctrl().cmd(var, value) + sck.send(c) + answer = Ctrl().rem_header(sck.recv(4096)) + return (answer,) + Ctrl().verify(answer, r, var, value) def set_var(sck, var, val): - return do_set_get(sck, var, val) + (a, _, _) = do_set_get(sck, var, val) + return a def get_var(sck, var): - return do_set_get(sck, var) + (_, _, v) = do_set_get(sck, var) + return v + +def _leftovers(sck): + data = sck.recv(1024) + if len(data) != 0: + tail = data + while True: + (head, tail) = Ctrl().split_combined(tail) + print "Got message:", Ctrl().rem_header(head) + if len(tail) == 0: + break + return True + return False if __name__ == '__main__': random.seed() @@ -105,27 +80,19 @@ if options.cmd_set: if len(args) < 2: parser.error("Set requires var and value arguments") - do_set(args[0], ' '.join(args[1:]), options.op_id, sock) + _leftovers(sock) + print "Got message:", set_var(sock, args[0], ' '.join(args[1:])) if options.cmd_get: if len(args) != 1: parser.error("Get requires the var argument") - do_get(args[0], options.op_id, sock) - - data = sock.recv(1024) - while (len(data)>0): - (answer, data) = remove_ipa_ctrl_header(data) - print "Got message:", answer + _leftovers(sock) + (a, _, _) = do_set_get(sock, args[0]) + print "Got message:", a if options.monitor: while True: - data = sock.recv(1024) - if len(data) == 0: + if not _leftovers(sock): print "Connection is gone." break - - while len(data) > 0: - (answer, data) = remove_ipa_ctrl_header(data) - print "Got message:", answer - sock.close() -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 9 Gerrit-Project: openbsc 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 Dec 12 16:21:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:21:03 +0000 Subject: [PATCH] openbsc[master]: Add twisted-based IPA multiplex 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/1268 to look at the new patch set (#11). Add twisted-based IPA multiplex Add sample applications using twisted framework for IPA and CTRL multiplex. Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Related: SYS#3028 --- A openbsc/contrib/twisted_ipa.py 1 file changed, 373 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/68/1268/11 diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py new file mode 100755 index 0000000..8d0ef9f --- /dev/null +++ b/openbsc/contrib/twisted_ipa.py @@ -0,0 +1,373 @@ +#!/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 ipa import Ctrl, IPA +from twisted.internet.protocol import ReconnectingClientFactory +from twisted.internet import reactor +from twisted.protocols import basic +import argparse + +class IPACommon(basic.Int16StringReceiver): + """ + Generic IPA protocol handler: include some routines for simpler subprotocols. + It's not intended as full implementation of all subprotocols, rather common ground and example code. + """ + def dbg(self, line): + """ + Debug print helper + """ + if self.factory.debug: + print(line) + + def osmo_CTRL(self, data): + """ + OSMO CTRL protocol + Placeholder, see corresponding derived class + """ + pass + + def osmo_MGCP(self, data): + """ + OSMO MGCP extension + """ + self.dbg('OSMO MGCP received %s' % data) + + def osmo_LAC(self, data): + """ + OSMO LAC extension + """ + self.dbg('OSMO LAC received %s' % data) + + def osmo_SMSC(self, data): + """ + OSMO SMSC extension + """ + self.dbg('OSMO SMSC received %s' % data) + + def osmo_ORC(self, data): + """ + OSMO ORC extension + """ + self.dbg('OSMO ORC received %s' % data) + + def osmo_GSUP(self, data): + """ + OSMO GSUP extension + """ + self.dbg('OSMO GSUP received %s' % data) + + def osmo_OAP(self, data): + """ + OSMO OAP extension + """ + self.dbg('OSMO OAP received %s' % data) + + def osmo_UNKNOWN(self, data): + """ + OSMO defaul extension handler + """ + self.dbg('OSMO unknown extension received %s' % data) + + def handle_RSL(self, data, proto, extension): + """ + RSL protocol handler + """ + self.dbg('IPA RSL received message with extension %s' % extension) + + def handle_CCM(self, data, proto, msgt): + """ + CCM (IPA Connection Management) + Placeholder, see corresponding derived class + """ + pass + + def handle_SCCP(self, data, proto, extension): + """ + SCCP protocol handler + """ + self.dbg('IPA SCCP received message with extension %s' % extension) + + def handle_OML(self, data, proto, extension): + """ + OML protocol handler + """ + self.dbg('IPA OML received message with extension %s' % extension) + + def handle_OSMO(self, data, proto, extension): + """ + Dispatcher point for OSMO subprotocols based on extension name, lambda default should never happen + """ + method = getattr(self, 'osmo_' + IPA().ext(extension), lambda: "extension dispatch failure") + method(data) + + def handle_MGCP(self, data, proto, extension): + """ + MGCP protocol handler + """ + self.dbg('IPA MGCP received message with attribute %s' % extension) + + def handle_UNKNOWN(self, data, proto, extension): + """ + Default protocol handler + """ + self.dbg('IPA received message for %s (%s) protocol with attribute %s' % (IPA().proto(proto), proto, extension)) + + def process_chunk(self, data): + """ + Generic message dispatcher for IPA (sub)protocols based on protocol name, lambda default should never happen + """ + (_, proto, extension, content) = IPA().del_header(data) + if content is not None: + self.dbg('IPA received %s::%s [%d/%d] %s' % (IPA().proto(proto), IPA().ext_name(proto, extension), len(data), len(content), content)) + method = getattr(self, 'handle_' + IPA().proto(proto), lambda: "protocol dispatch failure") + method(content, proto, extension) + + def dataReceived(self, data): + """ + Override for dataReceived from Int16StringReceiver because of inherently incompatible interpretation of length + If default handler is used than we would always get off-by-1 error (Int16StringReceiver use equivalent of l + 2) + """ + if len(data): + (head, tail) = IPA().split_combined(data) + self.process_chunk(head) + self.dataReceived(tail) + + def connectionMade(self): + """ + 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!') + self.factory.resetDelay() + + +class CCM(IPACommon): + """ + Implementation of CCM protocol for IPA multiplex + """ + def ack(self): + self.transport.write(IPA().id_ack()) + + def ping(self): + self.transport.write(IPA().ping()) + + def pong(self): + self.transport.write(IPA().pong()) + + def handle_CCM(self, data, proto, msgt): + """ + CCM (IPA Connection Management) + Only basic logic necessary for tests is implemented (ping-pong, id ack etc) + """ + if msgt == IPA.MSGT['ID_GET']: + self.transport.getHandle().sendall(IPA().id_resp(self.factory.ccm_id)) + # if we call + # self.transport.write(IPA().id_resp(self.factory.test_id)) + # instead, than we would have to also call + # reactor.callLater(1, self.ack) + # instead of self.ack() + # otherwise the writes will be glued together - hence the necessity for ugly hack with 1s timeout + # Note: this still might work depending on the IPA implementation details on the other side + self.ack() + # schedule PING in 4s + reactor.callLater(4, self.ping) + if msgt == IPA.MSGT['PING']: + self.pong() + + +class CTRL(IPACommon): + """ + Implementation of Osmocom control protocol for IPA multiplex + """ + def ctrl_SET(self, data, op_id, v): + """ + Handle CTRL SET command + """ + self.dbg('CTRL SET [%s] %s' % (op_id, v)) + + def ctrl_SET_REPLY(self, data, op_id, v): + """ + Handle CTRL SET reply + """ + self.dbg('CTRL SET REPLY [%s] %s' % (op_id, v)) + + def ctrl_GET(self, data, op_id, v): + """ + Handle CTRL GET command + """ + self.dbg('CTRL GET [%s] %s' % (op_id, v)) + + def ctrl_GET_REPLY(self, data, op_id, v): + """ + Handle CTRL GET reply + """ + self.dbg('CTRL GET REPLY [%s] %s' % (op_id, v)) + + def ctrl_TRAP(self, data, op_id, v): + """ + Handle CTRL TRAP command + """ + self.dbg('CTRL TRAP [%s] %s' % (op_id, v)) + + def ctrl_ERROR(self, data, op_id, v): + """ + Handle CTRL ERROR reply + """ + self.dbg('CTRL ERROR [%s] %s' % (op_id, v)) + + def osmo_CTRL(self, data): + """ + OSMO CTRL message dispatcher, lambda default should never happen + For basic tests only, appropriate handling routines should be replaced: see CtrlServer for example + """ + self.dbg('OSMO CTRL received %s::%s' % Ctrl().parse(data.decode('utf-8'))) + (cmd, op_id, v) = data.decode('utf-8').split(' ', 2) + method = getattr(self, 'ctrl_' + cmd, lambda: "CTRL unknown command") + method(data, op_id, v) + + +class IPAServer(CCM): + """ + Test implementation of IPA server + Demonstrate CCM opearation by overriding necessary bits from CCM + """ + def connectionMade(self): + """ + Keep reconnection logic working by calling routine from CCM + Initiate CCM upon connection + """ + print('IPA server connection made!') + super(IPAServer, self).connectionMade() + self.transport.write(IPA().id_get()) + + +class CtrlServer(CTRL): + """ + Test implementation of CTRL server + Demonstarte CTRL handling by overriding simpler routines from CTRL + """ + def connectionMade(self): + """ + Keep reconnection logic working by calling routine from CTRL + 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!') + super(CtrlServer, self).connectionMade() + self.transport.write(Ctrl().trap('LOL', 'what')) + self.transport.write(Ctrl().trap('rulez', 'XXX')) + + def reply(self, r): + self.transport.write(Ctrl().add_header(r)) + + def ctrl_SET(self, data, op_id, v): + """ + CTRL SET command: always succeed + """ + print('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.reply('ERROR %s No variable found' % op_id) + + +class IPAFactory(ReconnectingClientFactory): + """ + Generic IPA Client Factory which can be used to store state for various subprotocols and manage connections + Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity + """ + protocol = IPACommon + debug = False + 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): + if proto: + self.protocol = proto + if debug: + self.debug = debug + if ccm_id: + self.ccm_id = ccm_id + + 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()) + 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()) + 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('-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() + cs.add_argument("-c", "--client", action='store_true', help="asume client role") + cs.add_argument("-s", "--server", action='store_true', help="asume server role") + ic = p.add_mutually_exclusive_group() + ic.add_argument("--ipa", action='store_true', help="use IPA protocol") + ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") + args = p.parse_args() + test = False + 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)) + 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)) + 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)) + 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)) + test = True + if test: + reactor.run() + else: + print("Please specify which protocol in which role you'd like to test.") -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 11 Gerrit-Project: openbsc 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 Dec 12 16:21:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:21:03 +0000 Subject: [PATCH] openbsc[master]: bsc_control.py: remove unused -i option 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/1270 to look at the new patch set (#8). bsc_control.py: remove unused -i option This option only served to demonstrate possibility of manually selecting field in CTRL protocol. Since the transition to generic ipa module this is no longer exposed so the option became no-op. Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded --- M openbsc/contrib/bsc_control.py 1 file changed, 0 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/70/1270/8 diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index cd2ba6d..66a41eb 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- -import random from optparse import OptionParser from ipa import Ctrl import socket @@ -44,8 +43,6 @@ return False if __name__ == '__main__': - random.seed() - parser = OptionParser("Usage: %prog [options] var [value]") parser.add_option("-d", "--host", dest="host", help="connect to HOST", metavar="HOST") @@ -55,8 +52,6 @@ dest="cmd_get", help="perform GET operation") parser.add_option("-s", "--set", action="store_true", dest="cmd_set", help="perform SET operation") - parser.add_option("-i", "--id", dest="op_id", default=random.randint(1, sys.maxint), - help="set id manually", metavar="ID") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="be verbose", default=False) parser.add_option("-m", "--monitor", action="store_true", -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 8 Gerrit-Project: openbsc 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 Dec 12 16:21:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:21:03 +0000 Subject: [PATCH] openbsc[master]: bsc_control.py: convert to python3 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/1358 to look at the new patch set (#2). bsc_control.py: convert to python3 Let's be consistent with other .py in contrib and use python3 explicitly. Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 --- M openbsc/contrib/bsc_control.py 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/58/1358/2 diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index 66a41eb..fd6d12f 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- mode: python-mode; py-indent-tabs-mode: nil -*- from optparse import OptionParser @@ -9,7 +9,7 @@ def connect(host, port): if verbose: - print "Connecting to host %s:%i" % (host, port) + print("Connecting to host %s:%i" % (host, port)) sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sck.setblocking(1) @@ -20,7 +20,7 @@ (r, c) = Ctrl().cmd(var, value) sck.send(c) answer = Ctrl().rem_header(sck.recv(4096)) - return (answer,) + Ctrl().verify(answer, r, var, value) + return (answer,) + Ctrl().verify(answer.decode('utf-8'), r, var, value) def set_var(sck, var, val): (a, _, _) = do_set_get(sck, var, val) @@ -36,7 +36,7 @@ tail = data while True: (head, tail) = Ctrl().split_combined(tail) - print "Got message:", Ctrl().rem_header(head) + print("Got message:", Ctrl().rem_header(head)) if len(tail) == 0: break return True @@ -76,18 +76,18 @@ if len(args) < 2: parser.error("Set requires var and value arguments") _leftovers(sock) - print "Got message:", set_var(sock, args[0], ' '.join(args[1:])) + print("Got message:", set_var(sock, args[0], ' '.join(args[1:]))) if options.cmd_get: if len(args) != 1: parser.error("Get requires the var argument") _leftovers(sock) (a, _, _) = do_set_get(sock, args[0]) - print "Got message:", a + print("Got message:", a) if options.monitor: while True: if not _leftovers(sock): - print "Connection is gone." + print("Connection is gone.") break sock.close() -- To view, visit https://gerrit.osmocom.org/1358 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 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 Mon Dec 12 16:28:13 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:28:13 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (2 comments) In general - please always provide feedback for the latest patchset to avoid confusion. https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 27: class IPA(object): > our defines are always all-caps, but in function names we use all-lowercase This isn't a function, it's class. See Harald's comment above. Line 48: return 'UNKNOWN' > I think I have made my point very clear. Potential errors due to typos are Could you please provide an example code with such a error? I really don't want to overcomplicate code for the sake of avoiding potential error which might never happen. -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Mon Dec 12 16:34:26 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:34:26 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 113: return self.__tag(self.IDTAG['SERNR'], data) > above do So you suggest to use SERNR = 'SERNR' return self.__tag(self.IDTAG[SERNR], data) instead of return self.__tag(self.IDTAG['SERNR'], data) ? I don't see how this prevents any errors. -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Mon Dec 12 16:35:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 12 Dec 2016 16:35:23 +0000 Subject: [PATCH] osmo-hlr[master]: build: recoin db_test as non-installable program Message-ID: Review at https://gerrit.osmocom.org/1423 build: recoin db_test as non-installable program Change-Id: Id21e7cc1d94824af75a5639810c7d61d7fa7964c --- M src/Makefile.am 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/23/1423/1 diff --git a/src/Makefile.am b/src/Makefile.am index 3286560..6c6c9e6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,6 +22,9 @@ bin_PROGRAMS = \ osmo-hlr \ + $(NULL) + +noinst_PROGRAMS = \ db_test \ $(NULL) -- To view, visit https://gerrit.osmocom.org/1423 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id21e7cc1d94824af75a5639810c7d61d7fa7964c Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 12 16:46:37 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:46:37 +0000 Subject: osmo-bts[master]: DTX: fix TS adjustment for ONSET In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 Waiting for additional feedback from customer. -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Gerrit-PatchSet: 2 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 Dec 12 16:47:03 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 16:47:03 +0000 Subject: [ABANDON] openbsc[master]: Use arch-independent type for SI length In-Reply-To: References: Message-ID: Max has abandoned this change. Change subject: Use arch-independent type for SI length ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/1371 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I6e35d4c5e9822696e4b979e68a89bec6c99fec2f 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 Mon Dec 12 17:09:10 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 17:09:10 +0000 Subject: osmo-pcu[master]: struct pcu_l1_meas_ts: initialize ms_i_level In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1329 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I93de7589d746b91ba26b1b36bf2690f125277cd0 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 17:09:37 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 12 Dec 2016 17:09:37 +0000 Subject: osmo-pcu[master]: Fix uninitialized members in pcu_l1_meas() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1330 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76a03c9f54be474ab9ece908ef782807d555c6ac Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 17:24:49 2016 From: gerrit-no-reply at lists.osmocom.org (pierre.baudry) Date: Mon, 12 Dec 2016 17:24:49 +0000 Subject: osmo-bts[master]: osmo-bts-trx: fix lchan deactivation In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 Verified+1 This is exactly what I've done on my side to fix the issue mentioned in #1046 -- To view, visit https://gerrit.osmocom.org/1412 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: pierre.baudry Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 21:51:02 2016 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 12 Dec 2016 21:51:02 +0000 Subject: osmo-trx[master]: transceiver: Fix mismatched allocations and deallocations In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9c8bbade8531e8c9c02dcd43bac38cb954b3c89f Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: pierre.baudry Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 12 21:51:09 2016 From: gerrit-no-reply at lists.osmocom.org (Tom Tsou) Date: Mon, 12 Dec 2016 21:51:09 +0000 Subject: [MERGED] osmo-trx[master]: transceiver: Fix mismatched allocations and deallocations In-Reply-To: References: Message-ID: Tom Tsou has submitted this change and it was merged. Change subject: transceiver: Fix mismatched allocations and deallocations ...................................................................... transceiver: Fix mismatched allocations and deallocations The behaviour of a mismatched pair of allocation and deallocation is undefined Also fixes a memory leak if malloc fails (which stops the application anyway) Change-Id: I9c8bbade8531e8c9c02dcd43bac38cb954b3c89f --- M Transceiver52M/ChannelizerBase.cpp M Transceiver52M/Resampler.cpp M Transceiver52M/radioBuffer.cpp 3 files changed, 6 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/ChannelizerBase.cpp b/Transceiver52M/ChannelizerBase.cpp index 1576821..9989940 100644 --- a/Transceiver52M/ChannelizerBase.cpp +++ b/Transceiver52M/ChannelizerBase.cpp @@ -80,8 +80,10 @@ return false; subFilters = (float **) malloc(sizeof(float *) * m); - if (!subFilters) + if (!subFilters) { + delete[] proto; return false; + } for (size_t i = 0; i < m; i++) { subFilters[i] = (float *) @@ -122,7 +124,7 @@ for (size_t i = 0; i < m; i++) reverse(subFilters[i], hLen); - delete proto; + delete[] proto; return true; } diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp index 070adda..8a73b79 100644 --- a/Transceiver52M/Resampler.cpp +++ b/Transceiver52M/Resampler.cpp @@ -61,7 +61,7 @@ partitions = (float **) malloc(sizeof(float *) * p); if (!partitions) { - free(proto); + delete[] proto; return false; } diff --git a/Transceiver52M/radioBuffer.cpp b/Transceiver52M/radioBuffer.cpp index 9e6f079..a2b42c4 100644 --- a/Transceiver52M/radioBuffer.cpp +++ b/Transceiver52M/radioBuffer.cpp @@ -47,7 +47,7 @@ RadioBuffer::~RadioBuffer() { - delete buffer; + delete[] buffer; } void RadioBuffer::reset() -- To view, visit https://gerrit.osmocom.org/1153 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9c8bbade8531e8c9c02dcd43bac38cb954b3c89f Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: pierre.baudry Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou From gerrit-no-reply at lists.osmocom.org Tue Dec 13 00:48:38 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 00:48:38 +0000 Subject: [ABANDON] libosmo-netif[master]: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: osmo_stream_srv_fd_cb(): don't leak socket FDs on errors ...................................................................... Abandoned temporarily abandoning to free some space until I get around to testing it, noted by https://osmocom.org/issues/1875 -- To view, visit https://gerrit.osmocom.org/1320 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I3a3ce9194ab7ca5c1921fc79c2a1c9e10a552cf0 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 13 00:49:29 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 00:49:29 +0000 Subject: libosmocore[master]: gsm0480.c: code dup: have common msgb alloc functions In-Reply-To: References: Message-ID: Patch Set 3: "last chance", I'll soon abandon this -- To view, visit https://gerrit.osmocom.org/1341 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I029551dd74410ad6f326ce52eb7a75d912d3b875 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 Tue Dec 13 00:52:15 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 00:52:15 +0000 Subject: osmo-bts[master]: osmo-bts-trx: fix lchan deactivation In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1412 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: pierre.baudry Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 13 00:52:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 00:52:17 +0000 Subject: [MERGED] osmo-bts[master]: osmo-bts-trx: fix lchan deactivation In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: osmo-bts-trx: fix lchan deactivation ...................................................................... osmo-bts-trx: fix lchan deactivation Use chan_nr for deactivating lchan instead of lchan->nr: chan_nr is the RSL Channel Number IE value, a bitfield aggregation of lchan type bits (cbits) and lchan number (lowest three bits). The error was introduced in 36153239bfd0b633c4d259a9de0a759f41197a2b. Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d --- M src/osmo-bts-trx/l1_if.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: pierre.baudry: Looks good to me, but someone else must approve; Verified 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 6304c1f..a42d39a 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -155,14 +155,16 @@ /* set lchan inactive */ lchan_set_state(lchan, LCHAN_S_NONE); - return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_DEDIC, 0); + return trx_sched_set_lchan(&l1h->l1s, gsm_lchan2chan_nr(lchan), + LID_DEDIC, 0); } int bts_model_lchan_deactivate_sacch(struct gsm_lchan *lchan) { struct phy_instance *pinst = trx_phy_instance(lchan->ts->trx); struct trx_l1h *l1h = pinst->u.osmotrx.hdl; - return trx_sched_set_lchan(&l1h->l1s, lchan->nr, LID_SACCH, 0); + return trx_sched_set_lchan(&l1h->l1s, gsm_lchan2chan_nr(lchan), + LID_SACCH, 0); } /* -- To view, visit https://gerrit.osmocom.org/1412 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6dd7060422ab9d18743c1ff2ab419e3e7299d74d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: pierre.baudry From gerrit-no-reply at lists.osmocom.org Tue Dec 13 09:59:31 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 09:59:31 +0000 Subject: openbsc[master]: bsc_control.py: use ipa.py module In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+2 (2 comments) again leaving it up to you... https://gerrit.osmocom.org/#/c/1266/9/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 20: def do_set_get(sck, var, value = None): Now I notice that I don't understand the return values of do_set_get(), maybe a short doc would be good. Line 90: (a, _, _) = do_set_get(sock, args[0]) ah, so this is actually a "get", at first I misread as a "set". Maybe get_var() above could also return the answer, instead of the 'v'? Then this would explicitly be "get_var(...)", no misunderstanding possible... -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 9 Gerrit-Project: openbsc 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 Tue Dec 13 10:05:10 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 10:05:10 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (2 comments) yea, now that we've got the discussion going on PS3, it's hard to jump to the latest patch set. But I wish we'd be through discussing this one anyway :) https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 27: class IPA(object): > This isn't a function, it's class. See Harald's comment above. I know. The point is that even libosmocore doesn't always use all-caps everywhere, but whatever capitalization matches the situation. All I'm saying is that here, I'd prefer "Ipa" to indicate a class name. Many hackers do keep acronym class names in all-caps, but IMHO it then looks like a string constant or the like. Anyway, we've talked about this minor issue way too much already... Line 113: return self.__tag(self.IDTAG['SERNR'], data) > So you suggest to use In one central place, define SERNR = 'SERNR' and make sure that all callers everywhere use only the string constant. That's how to prevent typo mistakes. Does this not make sense here? -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Tue Dec 13 10:11:48 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 10:11:48 +0000 Subject: [PATCH] openbsc[master]: Add IPA multiplex 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/1265 to look at the new patch set (#11). Add IPA multiplex Add base class and derived Ctrl class implementing ctrl-specific routines. Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Related: SYS#3028 --- A openbsc/contrib/ipa.py 1 file changed, 278 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/1265/11 diff --git a/openbsc/contrib/ipa.py b/openbsc/contrib/ipa.py new file mode 100755 index 0000000..71cbf45 --- /dev/null +++ b/openbsc/contrib/ipa.py @@ -0,0 +1,278 @@ +#!/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. + */ +""" + +import struct, random, sys + +class IPA(object): + """ + Stateless IPA protocol multiplexer: add/remove/parse (extended) header + """ + version = "0.0.5" + TCP_PORT_OML = 3002 + TCP_PORT_RSL = 3003 + # OpenBSC extensions: OSMO, MGCP_OLD + PROTO = dict(RSL=0x00, CCM=0xFE, SCCP=0xFD, OML=0xFF, OSMO=0xEE, MGCP_OLD=0xFC) + # ...OML Router Control, GSUP GPRS extension, Osmocom Authn Protocol + EXT = dict(CTRL=0, MGCP=1, LAC=2, SMSC=3, ORC=4, GSUP=5, OAP=6) + # OpenBSC extension: SCCP_OLD + MSGT = dict(PING=0x00, PONG=0x01, ID_GET=0x04, ID_RESP=0x05, ID_ACK=0x06, SCCP_OLD=0xFF) + _IDTAG = dict(SERNR=0, UNITNAME=1, LOCATION=2, TYPE=3, EQUIPVERS=4, SWVERSION=5, IPADDR=6, MACADDR=7, UNIT=8) + CTRL_GET = 'GET' + CTRL_SET = 'SET' + CTRL_REP = 'REPLY' + CTRL_ERR = 'ERR' + CTRL_TRAP = 'TRAP' + + def _l(self, d, p): + """ + Reverse dictionary lookup: return key for a given value + """ + if p is None: + return 'UNKNOWN' + return list(d.keys())[list(d.values()).index(p)] + + def _tag(self, t, v): + """ + Create TAG as TLV data + """ + return struct.pack(">HB", len(v) + 1, t) + v + + def proto(self, p): + """ + Lookup protocol name + """ + return self._l(self.PROTO, p) + + def ext(self, p): + """ + Lookup protocol extension name + """ + return self._l(self.EXT, p) + + def msgt(self, p): + """ + Lookup message type name + """ + return self._l(self.MSGT, p) + + def idtag(self, p): + """ + Lookup ID tag name + """ + return self._l(self._IDTAG, p) + + def ext_name(self, proto, exten): + """ + Return proper extension byte name depending on the protocol used + """ + if self.PROTO['CCM'] == proto: + return self.msgt(exten) + if self.PROTO['OSMO'] == proto: + return self.ext(exten) + return None + + def add_header(self, data, proto, ext=None): + """ + Add IPA header (with extension if necessary), data must be represented as bytes + """ + if ext is None: + return struct.pack(">HB", len(data) + 1, proto) + data + return struct.pack(">HBB", len(data) + 1, proto, ext) + data + + def del_header(self, data): + """ + Strip IPA protocol header correctly removing extension if present + Returns data length, IPA protocol, extension (or None if not defined for a give protocol) and the data without header + """ + if not len(data): + return None, None, None, None + (dlen, proto) = struct.unpack('>HB', data[:3]) + if self.PROTO['OSMO'] == proto or self.PROTO['CCM'] == proto: # there's extension which we have to unpack + return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data + return dlen, proto, None, data[3:] # length, protocol, _, data + + def split_combined(self, data): + """ + Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where rest contains remaining messages, first is the single IPA message + """ + (length, _, _, _) = self.del_header(data) + return data[:(length + 3)], data[(length + 3):] + + def tag_serial(self, data): + """ + Make TAG for serial number + """ + return self._tag(self._IDTAG['SERNR'], data) + + def tag_name(self, data): + """ + Make TAG for unit name + """ + return self._tag(self._IDTAG['UNITNAME'], data) + + def tag_loc(self, data): + """ + Make TAG for location + """ + return self._tag(self._IDTAG['LOCATION'], data) + + def tag_type(self, data): + """ + Make TAG for unit type + """ + return self._tag(self._IDTAG['TYPE'], data) + + def tag_equip(self, data): + """ + Make TAG for equipment version + """ + return self._tag(self._IDTAG['EQUIPVERS'], data) + + def tag_sw(self, data): + """ + Make TAG for software version + """ + return self._tag(self._IDTAG['SWVERSION'], data) + + def tag_ip(self, data): + """ + Make TAG for IP address + """ + return self._tag(self._IDTAG['IPADDR'], data) + + def tag_mac(self, data): + """ + Make TAG for MAC address + """ + return self._tag(self._IDTAG['MACADDR'], data) + + def tag_unit(self, data): + """ + Make TAG for unit ID + """ + return self._tag(self._IDTAG['UNIT'], data) + + def identity(self, unit=b'', mac=b'', location=b'', utype=b'', equip=b'', sw=b'', name=b'', serial=b''): + """ + Make IPA IDENTITY tag list, by default returns empty concatenated bytes of tag list + """ + return self.tag_unit(unit) + self.tag_mac(mac) + self.tag_loc(location) + self.tag_type(utype) + self.tag_equip(equip) + self.tag_sw(sw) + self.tag_name(name) + self.tag_serial(serial) + + def ping(self): + """ + Make PING message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PING']) + + def pong(self): + """ + Make PONG message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PONG']) + + def id_ack(self): + """ + Make ID_ACK CCM message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['ID_ACK']) + + def id_get(self): + """ + Make ID_GET CCM message + """ + return self.add_header(self.identity(), self.PROTO['CCM'], self.MSGT['ID_GET']) + + def id_resp(self, data): + """ + Make ID_RESP CCM message + """ + return self.add_header(data, self.PROTO['CCM'], self.MSGT['ID_RESP']) + +class Ctrl(IPA): + """ + Osmocom CTRL protocol implemented on top of IPA multiplexer + """ + def __init__(self): + random.seed() + + def add_header(self, data): + """ + Add CTRL header + """ + return super(Ctrl, self).add_header(data.encode('utf-8'), IPA.PROTO['OSMO'], IPA.EXT['CTRL']) + + def rem_header(self, data): + """ + Remove CTRL header, check for appropriate protocol and extension + """ + (_, proto, ext, d) = super(Ctrl, self).del_header(data) + if self.PROTO['OSMO'] != proto or self.EXT['CTRL'] != ext: + return None + return d + + def parse(self, data, op=None): + """ + Parse Ctrl string returning (var, value) pair + var could be None in case of ERROR message + value could be None in case of GET message + """ + (s, i, v) = data.split(' ', 2) + if s == self.CTRL_ERR: + return None, v + if s == self.CTRL_GET: + return v, None + (s, i, var, val) = data.split(' ', 3) + if s == self.CTRL_TRAP and i != '0': + return None, '%s with non-zero id %s' % (s, i) + if op is not None and i != op: + if s == self.CTRL_GET + '_' + self.CTRL_REP or s == self.CTRL_SET + '_' + self.CTRL_REP: + return None, '%s with unexpected id %s' % (s, i) + return var, val + + def trap(self, var, val): + """ + Make TRAP message with given (vak, val) pair + """ + return self.add_header("%s 0 %s %s" % (self.CTRL_TRAP, var, val)) + + def cmd(self, var, val=None): + """ + Make SET/GET command message: returns (r, m) tuple where r is random operation id and m is assembled message + """ + r = random.randint(1, sys.maxsize) + if val is not None: + return r, self.add_header("%s %s %s %s" % (self.CTRL_SET, r, var, val)) + return r, self.add_header("%s %s %s" % (self.CTRL_GET, r, var)) + + def verify(self, reply, r, var, val=None): + """ + Verify reply to SET/GET command: returns (b, v) tuple where v is True/False verification result and v is the variable value + """ + (k, v) = self.parse(reply) + if k != var or (val is not None and v != val): + return False, v + return True, v + +if __name__ == '__main__': + print("IPA multiplexer v%s loaded." % IPA.version) -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 11 Gerrit-Project: openbsc 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 Dec 13 10:14:51 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 10:14:51 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (1 comment) See the latest patchset. Also, please comment in there too. https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 113: return self.__tag(self.IDTAG['SERNR'], data) > In one central place, define I believe that you honestly want to improve the code, I just don't follow your train of thought: how come making typo in 2 lines of code is harder than in 1? Anyway, I've marked this as private to make sure that it's only used within ipa.py itself - hopefully this can finally resolve this. -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Tue Dec 13 10:21:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 10:21:12 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/1265/3/openbsc/contrib/ipa.py File openbsc/contrib/ipa.py: Line 113: return self.__tag(self.IDTAG['SERNR'], data) > I believe that you honestly want to improve the code, I just don't follow y well, it makes sense only if the string is used more than once, obviously. Maybe it's not appropriate here. -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 3 Gerrit-Project: openbsc 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 Tue Dec 13 10:21:38 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 10:21:38 +0000 Subject: openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Patch Set 11: Code-Review+2 It's good enough, let's not discuss more... -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 11 Gerrit-Project: openbsc 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 Dec 13 10:26:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 10:26:41 +0000 Subject: openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Patch Set 12: Code-Review+2 (2 comments) https://gerrit.osmocom.org/#/c/1268/12/openbsc/contrib/twisted_ipa.py File openbsc/contrib/twisted_ipa.py: Line 255: def connectionMade(self): for python it's more typical to use underscored names: connection_made (like you do everywhere else) but that's coming from twisted, right? Line 265: class CtrlServer(CTRL): above it's 'CTRL', here it's 'CtrlServer'... Why not also 'Ctrl' and 'IpaServer' :) well, anyway. -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 12 Gerrit-Project: openbsc 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 Tue Dec 13 10:52:24 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 10:52:24 +0000 Subject: [MERGED] openbsc[master]: Add IPA multiplex In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add IPA multiplex ...................................................................... Add IPA multiplex Add base class and derived Ctrl class implementing ctrl-specific routines. Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Related: SYS#3028 --- A openbsc/contrib/ipa.py 1 file changed, 278 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/ipa.py b/openbsc/contrib/ipa.py new file mode 100755 index 0000000..71cbf45 --- /dev/null +++ b/openbsc/contrib/ipa.py @@ -0,0 +1,278 @@ +#!/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. + */ +""" + +import struct, random, sys + +class IPA(object): + """ + Stateless IPA protocol multiplexer: add/remove/parse (extended) header + """ + version = "0.0.5" + TCP_PORT_OML = 3002 + TCP_PORT_RSL = 3003 + # OpenBSC extensions: OSMO, MGCP_OLD + PROTO = dict(RSL=0x00, CCM=0xFE, SCCP=0xFD, OML=0xFF, OSMO=0xEE, MGCP_OLD=0xFC) + # ...OML Router Control, GSUP GPRS extension, Osmocom Authn Protocol + EXT = dict(CTRL=0, MGCP=1, LAC=2, SMSC=3, ORC=4, GSUP=5, OAP=6) + # OpenBSC extension: SCCP_OLD + MSGT = dict(PING=0x00, PONG=0x01, ID_GET=0x04, ID_RESP=0x05, ID_ACK=0x06, SCCP_OLD=0xFF) + _IDTAG = dict(SERNR=0, UNITNAME=1, LOCATION=2, TYPE=3, EQUIPVERS=4, SWVERSION=5, IPADDR=6, MACADDR=7, UNIT=8) + CTRL_GET = 'GET' + CTRL_SET = 'SET' + CTRL_REP = 'REPLY' + CTRL_ERR = 'ERR' + CTRL_TRAP = 'TRAP' + + def _l(self, d, p): + """ + Reverse dictionary lookup: return key for a given value + """ + if p is None: + return 'UNKNOWN' + return list(d.keys())[list(d.values()).index(p)] + + def _tag(self, t, v): + """ + Create TAG as TLV data + """ + return struct.pack(">HB", len(v) + 1, t) + v + + def proto(self, p): + """ + Lookup protocol name + """ + return self._l(self.PROTO, p) + + def ext(self, p): + """ + Lookup protocol extension name + """ + return self._l(self.EXT, p) + + def msgt(self, p): + """ + Lookup message type name + """ + return self._l(self.MSGT, p) + + def idtag(self, p): + """ + Lookup ID tag name + """ + return self._l(self._IDTAG, p) + + def ext_name(self, proto, exten): + """ + Return proper extension byte name depending on the protocol used + """ + if self.PROTO['CCM'] == proto: + return self.msgt(exten) + if self.PROTO['OSMO'] == proto: + return self.ext(exten) + return None + + def add_header(self, data, proto, ext=None): + """ + Add IPA header (with extension if necessary), data must be represented as bytes + """ + if ext is None: + return struct.pack(">HB", len(data) + 1, proto) + data + return struct.pack(">HBB", len(data) + 1, proto, ext) + data + + def del_header(self, data): + """ + Strip IPA protocol header correctly removing extension if present + Returns data length, IPA protocol, extension (or None if not defined for a give protocol) and the data without header + """ + if not len(data): + return None, None, None, None + (dlen, proto) = struct.unpack('>HB', data[:3]) + if self.PROTO['OSMO'] == proto or self.PROTO['CCM'] == proto: # there's extension which we have to unpack + return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data + return dlen, proto, None, data[3:] # length, protocol, _, data + + def split_combined(self, data): + """ + Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where rest contains remaining messages, first is the single IPA message + """ + (length, _, _, _) = self.del_header(data) + return data[:(length + 3)], data[(length + 3):] + + def tag_serial(self, data): + """ + Make TAG for serial number + """ + return self._tag(self._IDTAG['SERNR'], data) + + def tag_name(self, data): + """ + Make TAG for unit name + """ + return self._tag(self._IDTAG['UNITNAME'], data) + + def tag_loc(self, data): + """ + Make TAG for location + """ + return self._tag(self._IDTAG['LOCATION'], data) + + def tag_type(self, data): + """ + Make TAG for unit type + """ + return self._tag(self._IDTAG['TYPE'], data) + + def tag_equip(self, data): + """ + Make TAG for equipment version + """ + return self._tag(self._IDTAG['EQUIPVERS'], data) + + def tag_sw(self, data): + """ + Make TAG for software version + """ + return self._tag(self._IDTAG['SWVERSION'], data) + + def tag_ip(self, data): + """ + Make TAG for IP address + """ + return self._tag(self._IDTAG['IPADDR'], data) + + def tag_mac(self, data): + """ + Make TAG for MAC address + """ + return self._tag(self._IDTAG['MACADDR'], data) + + def tag_unit(self, data): + """ + Make TAG for unit ID + """ + return self._tag(self._IDTAG['UNIT'], data) + + def identity(self, unit=b'', mac=b'', location=b'', utype=b'', equip=b'', sw=b'', name=b'', serial=b''): + """ + Make IPA IDENTITY tag list, by default returns empty concatenated bytes of tag list + """ + return self.tag_unit(unit) + self.tag_mac(mac) + self.tag_loc(location) + self.tag_type(utype) + self.tag_equip(equip) + self.tag_sw(sw) + self.tag_name(name) + self.tag_serial(serial) + + def ping(self): + """ + Make PING message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PING']) + + def pong(self): + """ + Make PONG message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['PONG']) + + def id_ack(self): + """ + Make ID_ACK CCM message + """ + return self.add_header(b'', self.PROTO['CCM'], self.MSGT['ID_ACK']) + + def id_get(self): + """ + Make ID_GET CCM message + """ + return self.add_header(self.identity(), self.PROTO['CCM'], self.MSGT['ID_GET']) + + def id_resp(self, data): + """ + Make ID_RESP CCM message + """ + return self.add_header(data, self.PROTO['CCM'], self.MSGT['ID_RESP']) + +class Ctrl(IPA): + """ + Osmocom CTRL protocol implemented on top of IPA multiplexer + """ + def __init__(self): + random.seed() + + def add_header(self, data): + """ + Add CTRL header + """ + return super(Ctrl, self).add_header(data.encode('utf-8'), IPA.PROTO['OSMO'], IPA.EXT['CTRL']) + + def rem_header(self, data): + """ + Remove CTRL header, check for appropriate protocol and extension + """ + (_, proto, ext, d) = super(Ctrl, self).del_header(data) + if self.PROTO['OSMO'] != proto or self.EXT['CTRL'] != ext: + return None + return d + + def parse(self, data, op=None): + """ + Parse Ctrl string returning (var, value) pair + var could be None in case of ERROR message + value could be None in case of GET message + """ + (s, i, v) = data.split(' ', 2) + if s == self.CTRL_ERR: + return None, v + if s == self.CTRL_GET: + return v, None + (s, i, var, val) = data.split(' ', 3) + if s == self.CTRL_TRAP and i != '0': + return None, '%s with non-zero id %s' % (s, i) + if op is not None and i != op: + if s == self.CTRL_GET + '_' + self.CTRL_REP or s == self.CTRL_SET + '_' + self.CTRL_REP: + return None, '%s with unexpected id %s' % (s, i) + return var, val + + def trap(self, var, val): + """ + Make TRAP message with given (vak, val) pair + """ + return self.add_header("%s 0 %s %s" % (self.CTRL_TRAP, var, val)) + + def cmd(self, var, val=None): + """ + Make SET/GET command message: returns (r, m) tuple where r is random operation id and m is assembled message + """ + r = random.randint(1, sys.maxsize) + if val is not None: + return r, self.add_header("%s %s %s %s" % (self.CTRL_SET, r, var, val)) + return r, self.add_header("%s %s %s" % (self.CTRL_GET, r, var)) + + def verify(self, reply, r, var, val=None): + """ + Verify reply to SET/GET command: returns (b, v) tuple where v is True/False verification result and v is the variable value + """ + (k, v) = self.parse(reply) + if k != var or (val is not None and v != val): + return False, v + return True, v + +if __name__ == '__main__': + print("IPA multiplexer v%s loaded." % IPA.version) -- To view, visit https://gerrit.osmocom.org/1265 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I41e37ec143183e422c0b31af95d183bd84f0c328 Gerrit-PatchSet: 12 Gerrit-Project: openbsc 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 Dec 13 12:09:30 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 12:09:30 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 6: This introduces a segfault that only happens in the asan build. See http://lists.osmocom.org/pipermail/openbsc/2016-December/009966.html -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 13 12:11:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 12:11:12 +0000 Subject: [PATCH] openbsc[master]: Revert "Support Deactivate PDP Context Request from network" Message-ID: Review at https://gerrit.osmocom.org/1424 Revert "Support Deactivate PDP Context Request from network" This reverts commit 1611df5226199da2bf2fba3d22d93cc1a6c6c777. This is due to a segfault introduced to the asan build only. See: http://lists.osmocom.org/pipermail/openbsc/2016-December/009966.html Subject: new sanitizer breakage: SIGSEGV in sgsn_create_pdp_ctx() Date: Tue Dec 13 12:08:32 UTC 2016 Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 0 insertions(+), 180 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/24/1424/1 diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index b3f250d..24e286c 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,8 +369,6 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); -void drop_gmm_ctx_for_ms(const char *imsi); - char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 8558029..e5a54d9 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,44 +667,6 @@ } } -/* - * High-level function to be called for PDP deactivation initiated from SGSN VTY. - * When there are PDP contexts present for a MM context, PDP context will be - * deactivated along with GMM Detach(MM context deletion). - * If there are no PDP present, MM context will be deleted to avoid further - * PDP context activation for that MS. - */ -void drop_gmm_ctx_for_ms(const char *imsi) -{ - OSMO_ASSERT(imsi != NULL); - struct sgsn_mm_ctx *mm; - struct sgsn_pdp_ctx *pdp; - - /* Search the MM context subscriber */ - mm = sgsn_mm_ctx_by_imsi(imsi); - LOGMMCTXP(LOGL_INFO, mm, - "SGSN intiated Deactivate PDP request for %s\n", imsi); - if (mm) { - /* Search the PDP for this subscriber */ - if (llist_empty(&mm->pdp_list)) { - /* - * Deleting mm context for the subscriber when no PDP - * context is present. - */ - gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); - LOGMMCTXP(LOGL_NOTICE, mm, "No PDP context to deactivate\n"); - } else { - llist_for_each_entry(pdp, &mm->pdp_list, list) { - gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); - LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " - "Successful\n"); - } - } - } else - LOGMMCTXP(LOGL_NOTICE, mm, - "No MM context to deactivate for %s\n", imsi); -} - /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 6f01d44..e7b7458 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,17 +38,14 @@ #include #include -#include void *tall_bsc_ctx; -struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, - .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2366,138 +2363,6 @@ cleanup_test(); } -static void test_pdp_deactivation_with_pdp_ctx(void) -{ - struct apn_ctx *actxs[4]; - struct sgsn_ggsn_ctx *ggc, *ggcs[3]; - struct gsm_subscriber *s1; - const char *imsi1 = "1234567890"; - struct sgsn_mm_ctx *ctx; - struct gprs_ra_id raid = { 0, }; - uint32_t local_tlli = 0xffeeddcc; - enum gsm48_gsm_cause gsm_cause; - struct tlv_parsed tp; - uint8_t apn_enc[GSM_APN_LENGTH + 10]; - struct sgsn_subscriber_pdp_data *pdp_data; - char apn_str[GSM_APN_LENGTH]; - - printf("Testing Pdp deactivation for MS with pdp ctx\n"); - - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; - - /* Check for emptiness */ - OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); - - /* Create a context */ - OSMO_ASSERT(count(gprs_llme_list()) == 0); - ctx = alloc_mm_ctx(local_tlli, &raid); - strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); - - /* Allocate and attach a subscriber */ - s1 = gprs_subscr_get_or_create_by_mmctx(ctx); - assert_subscr(s1, imsi1); - - struct sgsn_pdp_ctx *pdp; - - tp.lv[GSM48_IE_GSM_APN].len = 0; - tp.lv[GSM48_IE_GSM_APN].val = apn_enc; - - tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; - tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; - - tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; - tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; - - ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); - - actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); - actxs[0]->ggsn = ggcs[0]; - - pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); - pdp_data->context_id = 1; - pdp_data->pdp_type = 0x0121; - strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); - - /* Resolve GGSNs */ - tp.lv[GSM48_IE_GSM_APN].len = - gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); - - ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); - - OSMO_ASSERT(ggc != NULL); - OSMO_ASSERT(ggc->id == 0); - - ggc = sgsn_ggsn_ctx_alloc(ggc->id); - /* Create a pdp context */ - pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); - - /* Intiate PDP deactivation for imsi1 */ - drop_gmm_ctx_for_ms(imsi1); - gsm48_tx_gsm_deact_pdp_acc(pdp); - gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); - - /* Cleanup */ - - subscr_put(s1); - - sgsn_apn_ctx_free(actxs[0]); - sgsn_ggsn_ctx_free(ggcs[0]); - sgsn_ggsn_ctx_free(ggc); - talloc_free(pdp); - - cleanup_test(); -} - -static void test_pdp_deactivation_with_only_mm_ctx(void) -{ - struct gsm_subscriber *s1; - const char *imsi1 = "1234567890"; - struct sgsn_mm_ctx *ctx; - struct gprs_ra_id raid = { 0, }; - uint32_t local_tlli = 0xffeeddcc; - - printf("Testing Pdp deactivation for MS with only MM ctx\n"); - - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; - - /* Check for emptiness */ - OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); - - /* Create a context */ - OSMO_ASSERT(count(gprs_llme_list()) == 0); - ctx = alloc_mm_ctx(local_tlli, &raid); - strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); - - /* Allocate and attach a subscriber */ - s1 = gprs_subscr_get_or_create_by_mmctx(ctx); - assert_subscr(s1, imsi1); - - /* Intiate PDP deactivation for imsi1 */ - drop_gmm_ctx_for_ms(imsi1); - - cleanup_test(); -} - -static void test_pdp_deactivation_without_mm_ctx(void) -{ - const char *imsi1 = "1234567890"; - - printf("Testing Pdp deactivation for MS without MM ctx\n"); - - /* Intiate PDP deactivation for imsi1 */ - drop_gmm_ctx_for_ms(imsi1); - - cleanup_test(); -} - -static void test_pdp_deactivation(void) -{ - printf("Testing pdp deactivation\n"); - - test_pdp_deactivation_with_pdp_ctx(); - test_pdp_deactivation_without_mm_ctx(); - test_pdp_deactivation_with_only_mm_ctx(); -} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2589,7 +2454,6 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); - test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c36b643..c7a53b9 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,8 +34,4 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection -Testing pdp deactivation -Testing Pdp deactivation for MS with pdp ctx -Testing Pdp deactivation for MS without MM ctx -Testing Pdp deactivation for MS with only MM ctx Done -- To view, visit https://gerrit.osmocom.org/1424 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 13 12:11:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 12:11:12 +0000 Subject: openbsc[master]: Revert "Support Deactivate PDP Context Request from network" In-Reply-To: References: Message-ID: Neels Hofmeyr has reverted this change. Change subject: Revert "Support Deactivate PDP Context Request from network" ...................................................................... Uploaded patch set 1. -- To view, visit https://gerrit.osmocom.org/1424 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: revert Gerrit-Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 13 12:16:40 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 12:16:40 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 6: reverting in https://gerrit.osmocom.org/1424 -- To view, visit https://gerrit.osmocom.org/1262 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 13 12:42:38 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 12:42:38 +0000 Subject: openbsc[master]: Revert "Support Deactivate PDP Context Request from network" In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1424 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 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 Tue Dec 13 12:42:47 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 12:42:47 +0000 Subject: [MERGED] openbsc[master]: Revert "Support Deactivate PDP Context Request from network" In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: Revert "Support Deactivate PDP Context Request from network" ...................................................................... Revert "Support Deactivate PDP Context Request from network" This reverts commit 1611df5226199da2bf2fba3d22d93cc1a6c6c777. This is due to a segfault introduced to the asan build only. See: http://lists.osmocom.org/pipermail/openbsc/2016-December/009966.html Subject: new sanitizer breakage: SIGSEGV in sgsn_create_pdp_ctx() Date: Tue Dec 13 12:08:32 UTC 2016 Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 0 insertions(+), 180 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index b3f250d..24e286c 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,8 +369,6 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); -void drop_gmm_ctx_for_ms(const char *imsi); - char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 8558029..e5a54d9 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,44 +667,6 @@ } } -/* - * High-level function to be called for PDP deactivation initiated from SGSN VTY. - * When there are PDP contexts present for a MM context, PDP context will be - * deactivated along with GMM Detach(MM context deletion). - * If there are no PDP present, MM context will be deleted to avoid further - * PDP context activation for that MS. - */ -void drop_gmm_ctx_for_ms(const char *imsi) -{ - OSMO_ASSERT(imsi != NULL); - struct sgsn_mm_ctx *mm; - struct sgsn_pdp_ctx *pdp; - - /* Search the MM context subscriber */ - mm = sgsn_mm_ctx_by_imsi(imsi); - LOGMMCTXP(LOGL_INFO, mm, - "SGSN intiated Deactivate PDP request for %s\n", imsi); - if (mm) { - /* Search the PDP for this subscriber */ - if (llist_empty(&mm->pdp_list)) { - /* - * Deleting mm context for the subscriber when no PDP - * context is present. - */ - gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); - LOGMMCTXP(LOGL_NOTICE, mm, "No PDP context to deactivate\n"); - } else { - llist_for_each_entry(pdp, &mm->pdp_list, list) { - gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); - LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " - "Successful\n"); - } - } - } else - LOGMMCTXP(LOGL_NOTICE, mm, - "No MM context to deactivate for %s\n", imsi); -} - /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 6f01d44..e7b7458 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,17 +38,14 @@ #include #include -#include void *tall_bsc_ctx; -struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, - .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2366,138 +2363,6 @@ cleanup_test(); } -static void test_pdp_deactivation_with_pdp_ctx(void) -{ - struct apn_ctx *actxs[4]; - struct sgsn_ggsn_ctx *ggc, *ggcs[3]; - struct gsm_subscriber *s1; - const char *imsi1 = "1234567890"; - struct sgsn_mm_ctx *ctx; - struct gprs_ra_id raid = { 0, }; - uint32_t local_tlli = 0xffeeddcc; - enum gsm48_gsm_cause gsm_cause; - struct tlv_parsed tp; - uint8_t apn_enc[GSM_APN_LENGTH + 10]; - struct sgsn_subscriber_pdp_data *pdp_data; - char apn_str[GSM_APN_LENGTH]; - - printf("Testing Pdp deactivation for MS with pdp ctx\n"); - - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; - - /* Check for emptiness */ - OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); - - /* Create a context */ - OSMO_ASSERT(count(gprs_llme_list()) == 0); - ctx = alloc_mm_ctx(local_tlli, &raid); - strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); - - /* Allocate and attach a subscriber */ - s1 = gprs_subscr_get_or_create_by_mmctx(ctx); - assert_subscr(s1, imsi1); - - struct sgsn_pdp_ctx *pdp; - - tp.lv[GSM48_IE_GSM_APN].len = 0; - tp.lv[GSM48_IE_GSM_APN].val = apn_enc; - - tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; - tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; - - tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; - tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; - - ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); - - actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); - actxs[0]->ggsn = ggcs[0]; - - pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); - pdp_data->context_id = 1; - pdp_data->pdp_type = 0x0121; - strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); - - /* Resolve GGSNs */ - tp.lv[GSM48_IE_GSM_APN].len = - gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); - - ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); - - OSMO_ASSERT(ggc != NULL); - OSMO_ASSERT(ggc->id == 0); - - ggc = sgsn_ggsn_ctx_alloc(ggc->id); - /* Create a pdp context */ - pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); - - /* Intiate PDP deactivation for imsi1 */ - drop_gmm_ctx_for_ms(imsi1); - gsm48_tx_gsm_deact_pdp_acc(pdp); - gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); - - /* Cleanup */ - - subscr_put(s1); - - sgsn_apn_ctx_free(actxs[0]); - sgsn_ggsn_ctx_free(ggcs[0]); - sgsn_ggsn_ctx_free(ggc); - talloc_free(pdp); - - cleanup_test(); -} - -static void test_pdp_deactivation_with_only_mm_ctx(void) -{ - struct gsm_subscriber *s1; - const char *imsi1 = "1234567890"; - struct sgsn_mm_ctx *ctx; - struct gprs_ra_id raid = { 0, }; - uint32_t local_tlli = 0xffeeddcc; - - printf("Testing Pdp deactivation for MS with only MM ctx\n"); - - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; - - /* Check for emptiness */ - OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); - - /* Create a context */ - OSMO_ASSERT(count(gprs_llme_list()) == 0); - ctx = alloc_mm_ctx(local_tlli, &raid); - strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); - - /* Allocate and attach a subscriber */ - s1 = gprs_subscr_get_or_create_by_mmctx(ctx); - assert_subscr(s1, imsi1); - - /* Intiate PDP deactivation for imsi1 */ - drop_gmm_ctx_for_ms(imsi1); - - cleanup_test(); -} - -static void test_pdp_deactivation_without_mm_ctx(void) -{ - const char *imsi1 = "1234567890"; - - printf("Testing Pdp deactivation for MS without MM ctx\n"); - - /* Intiate PDP deactivation for imsi1 */ - drop_gmm_ctx_for_ms(imsi1); - - cleanup_test(); -} - -static void test_pdp_deactivation(void) -{ - printf("Testing pdp deactivation\n"); - - test_pdp_deactivation_with_pdp_ctx(); - test_pdp_deactivation_without_mm_ctx(); - test_pdp_deactivation_with_only_mm_ctx(); -} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2589,7 +2454,6 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); - test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c36b643..c7a53b9 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,8 +34,4 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection -Testing pdp deactivation -Testing Pdp deactivation for MS with pdp ctx -Testing Pdp deactivation for MS without MM ctx -Testing Pdp deactivation for MS with only MM ctx Done -- To view, visit https://gerrit.osmocom.org/1424 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 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 Tue Dec 13 13:33:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 13 Dec 2016 13:33:35 +0000 Subject: [PATCH] osmo-hlr[master]: build: actually make sqlite mandatory Message-ID: Review at https://gerrit.osmocom.org/1425 build: actually make sqlite mandatory Change-Id: I9f7183c6a1e1b3a4bc887a67faf2a1c4dfb44762 --- M configure.ac 1 file changed, 1 insertion(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/25/1425/1 diff --git a/configure.ac b/configure.ac index 189a53a..ce0010c 100644 --- a/configure.ac +++ b/configure.ac @@ -33,10 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) -found_sqlite3=yes -PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) -AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) -AC_SUBST(found_sqlite3) +PKG_CHECK_MODULES(SQLITE3, sqlite3) AC_CONFIG_MACRO_DIR([m4]) -- To view, visit https://gerrit.osmocom.org/1425 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9f7183c6a1e1b3a4bc887a67faf2a1c4dfb44762 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 13 14:46:59 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:46:59 +0000 Subject: [MERGED] openbsc[master]: Use IPA module for vty tests In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Use IPA module for vty tests ...................................................................... Use IPA module for vty tests Replace hackish ipa_send_* routines with proper implementation from IPA module thus making it part of extended tests. Change-Id: If13ed7fd243ce3aeef505d2e8468e221aa62f79e --- M openbsc/tests/vty_test_runner.py 1 file changed, 9 insertions(+), 31 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 cf2cf18..89b7a19 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -15,13 +15,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os +import os, sys import time import unittest import socket import osmopy.obscvty as obscvty import osmopy.osmoutil as osmoutil + +sys.path.append("../contrib") +from ipa import IPA confpath = '.' @@ -911,13 +914,13 @@ self.assertEqual(data, "\x00\x01\xfe\x04") print "Going to send ID_RESP response" - res = ipa_send_resp(ussdSocket, "\x6b\x65\x79") + res = ussdSocket.send(IPA().id_resp(IPA().tag_name('key'))) self.assertEqual(res, 10) # initiating PING/PONG cycle to know, that the ID_RESP message has been processed print "Going to send PING request" - res = ipa_send_ping(ussdSocket) + res = ussdSocket.send(IPA().ping()) self.assertEqual(res, 4) print "Expecting PONG response" @@ -1184,31 +1187,6 @@ test = unittest.TestLoader().loadTestsFromTestCase(TestVTYNAT) suite.addTest(test) -def ipa_send_pong(x, verbose = False): - if (verbose): - print "\tBSC -> NAT: PONG!" - return x.send("\x00\x01\xfe\x01") - -def ipa_send_ping(x, verbose = False): - if (verbose): - print "\tBSC -> NAT: PING?" - return x.send("\x00\x01\xfe\x00") - -def ipa_send_ack(x, verbose = False): - if (verbose): - print "\tBSC -> NAT: IPA ID ACK" - return x.send("\x00\x01\xfe\x06") - -def ipa_send_reset(x, verbose = False): - if (verbose): - print "\tBSC -> NAT: RESET" - return x.send("\x00\x12\xfd\x09\x00\x03\x05\x07\x02\x42\xfe\x02\x42\xfe\x06\x00\x04\x30\x04\x01\x20") - -def ipa_send_resp(x, tk, verbose = False): - if (verbose): - print "\tBSC -> NAT: IPA ID RESP" - return x.send("\x00\x07\xfe\x05\x00\x04\x01" + tk) - def nat_bsc_reload(x): x.vty.command("configure terminal") x.vty.command("nat") @@ -1264,11 +1242,11 @@ if "0001fe00" == s: if (verbose): print "\tBSC <- NAT: PING?" - ipa_send_pong(x, verbose) + x.send(IPA().pong()) elif "0001fe06" == s: if (verbose): print "\tBSC <- NAT: IPA ID ACK" - ipa_send_ack(x, verbose) + x.send(IPA().id_ack()) elif "0001fe00" == s: if (verbose): print "\tBSC <- NAT: PONG!" @@ -1279,7 +1257,7 @@ def ipa_handle_resp(x, tk, verbose = False): s = data2str(x.recv(38)) if "0023fe040108010701020103010401050101010011" in s: - ipa_send_resp(x, tk, verbose) + x.send(IPA().id_resp(IPA().identity(name = tk.encode('utf-8')))) else: if (verbose): print "\tBSC <- NAT: ", s -- To view, visit https://gerrit.osmocom.org/1267 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If13ed7fd243ce3aeef505d2e8468e221aa62f79e Gerrit-PatchSet: 12 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 Tue Dec 13 14:48:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:48:10 +0000 Subject: osmo-hlr[master]: build: recoin db_test as non-installable program In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1423 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id21e7cc1d94824af75a5639810c7d61d7fa7964c 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 Tue Dec 13 14:48:12 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:48:12 +0000 Subject: osmo-hlr[master]: build: actually make sqlite mandatory In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1425 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9f7183c6a1e1b3a4bc887a67faf2a1c4dfb44762 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 Tue Dec 13 14:48:16 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:48:16 +0000 Subject: [MERGED] osmo-hlr[master]: build: recoin db_test as non-installable program In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: build: recoin db_test as non-installable program ...................................................................... build: recoin db_test as non-installable program Change-Id: Id21e7cc1d94824af75a5639810c7d61d7fa7964c --- M src/Makefile.am 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/Makefile.am b/src/Makefile.am index 3286560..6c6c9e6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,6 +22,9 @@ bin_PROGRAMS = \ osmo-hlr \ + $(NULL) + +noinst_PROGRAMS = \ db_test \ $(NULL) -- To view, visit https://gerrit.osmocom.org/1423 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id21e7cc1d94824af75a5639810c7d61d7fa7964c Gerrit-PatchSet: 1 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 Tue Dec 13 14:48:18 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:48:18 +0000 Subject: [MERGED] osmo-hlr[master]: build: actually make sqlite mandatory In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: build: actually make sqlite mandatory ...................................................................... build: actually make sqlite mandatory Change-Id: I9f7183c6a1e1b3a4bc887a67faf2a1c4dfb44762 --- M configure.ac 1 file changed, 1 insertion(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/configure.ac b/configure.ac index 189a53a..ce0010c 100644 --- a/configure.ac +++ b/configure.ac @@ -33,10 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.9.0) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) -found_sqlite3=yes -PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) -AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) -AC_SUBST(found_sqlite3) +PKG_CHECK_MODULES(SQLITE3, sqlite3) AC_CONFIG_MACRO_DIR([m4]) -- To view, visit https://gerrit.osmocom.org/1425 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9f7183c6a1e1b3a4bc887a67faf2a1c4dfb44762 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 Tue Dec 13 14:48:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 14:48:21 +0000 Subject: [MERGED] openbsc[master]: Add twisted-based IPA multiplex In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add twisted-based IPA multiplex ...................................................................... Add twisted-based IPA multiplex Add sample applications using twisted framework for IPA and CTRL multiplex. Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Related: SYS#3028 --- A openbsc/contrib/twisted_ipa.py 1 file changed, 373 insertions(+), 0 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 new file mode 100755 index 0000000..8d0ef9f --- /dev/null +++ b/openbsc/contrib/twisted_ipa.py @@ -0,0 +1,373 @@ +#!/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 ipa import Ctrl, IPA +from twisted.internet.protocol import ReconnectingClientFactory +from twisted.internet import reactor +from twisted.protocols import basic +import argparse + +class IPACommon(basic.Int16StringReceiver): + """ + Generic IPA protocol handler: include some routines for simpler subprotocols. + It's not intended as full implementation of all subprotocols, rather common ground and example code. + """ + def dbg(self, line): + """ + Debug print helper + """ + if self.factory.debug: + print(line) + + def osmo_CTRL(self, data): + """ + OSMO CTRL protocol + Placeholder, see corresponding derived class + """ + pass + + def osmo_MGCP(self, data): + """ + OSMO MGCP extension + """ + self.dbg('OSMO MGCP received %s' % data) + + def osmo_LAC(self, data): + """ + OSMO LAC extension + """ + self.dbg('OSMO LAC received %s' % data) + + def osmo_SMSC(self, data): + """ + OSMO SMSC extension + """ + self.dbg('OSMO SMSC received %s' % data) + + def osmo_ORC(self, data): + """ + OSMO ORC extension + """ + self.dbg('OSMO ORC received %s' % data) + + def osmo_GSUP(self, data): + """ + OSMO GSUP extension + """ + self.dbg('OSMO GSUP received %s' % data) + + def osmo_OAP(self, data): + """ + OSMO OAP extension + """ + self.dbg('OSMO OAP received %s' % data) + + def osmo_UNKNOWN(self, data): + """ + OSMO defaul extension handler + """ + self.dbg('OSMO unknown extension received %s' % data) + + def handle_RSL(self, data, proto, extension): + """ + RSL protocol handler + """ + self.dbg('IPA RSL received message with extension %s' % extension) + + def handle_CCM(self, data, proto, msgt): + """ + CCM (IPA Connection Management) + Placeholder, see corresponding derived class + """ + pass + + def handle_SCCP(self, data, proto, extension): + """ + SCCP protocol handler + """ + self.dbg('IPA SCCP received message with extension %s' % extension) + + def handle_OML(self, data, proto, extension): + """ + OML protocol handler + """ + self.dbg('IPA OML received message with extension %s' % extension) + + def handle_OSMO(self, data, proto, extension): + """ + Dispatcher point for OSMO subprotocols based on extension name, lambda default should never happen + """ + method = getattr(self, 'osmo_' + IPA().ext(extension), lambda: "extension dispatch failure") + method(data) + + def handle_MGCP(self, data, proto, extension): + """ + MGCP protocol handler + """ + self.dbg('IPA MGCP received message with attribute %s' % extension) + + def handle_UNKNOWN(self, data, proto, extension): + """ + Default protocol handler + """ + self.dbg('IPA received message for %s (%s) protocol with attribute %s' % (IPA().proto(proto), proto, extension)) + + def process_chunk(self, data): + """ + Generic message dispatcher for IPA (sub)protocols based on protocol name, lambda default should never happen + """ + (_, proto, extension, content) = IPA().del_header(data) + if content is not None: + self.dbg('IPA received %s::%s [%d/%d] %s' % (IPA().proto(proto), IPA().ext_name(proto, extension), len(data), len(content), content)) + method = getattr(self, 'handle_' + IPA().proto(proto), lambda: "protocol dispatch failure") + method(content, proto, extension) + + def dataReceived(self, data): + """ + Override for dataReceived from Int16StringReceiver because of inherently incompatible interpretation of length + If default handler is used than we would always get off-by-1 error (Int16StringReceiver use equivalent of l + 2) + """ + if len(data): + (head, tail) = IPA().split_combined(data) + self.process_chunk(head) + self.dataReceived(tail) + + def connectionMade(self): + """ + 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!') + self.factory.resetDelay() + + +class CCM(IPACommon): + """ + Implementation of CCM protocol for IPA multiplex + """ + def ack(self): + self.transport.write(IPA().id_ack()) + + def ping(self): + self.transport.write(IPA().ping()) + + def pong(self): + self.transport.write(IPA().pong()) + + def handle_CCM(self, data, proto, msgt): + """ + CCM (IPA Connection Management) + Only basic logic necessary for tests is implemented (ping-pong, id ack etc) + """ + if msgt == IPA.MSGT['ID_GET']: + self.transport.getHandle().sendall(IPA().id_resp(self.factory.ccm_id)) + # if we call + # self.transport.write(IPA().id_resp(self.factory.test_id)) + # instead, than we would have to also call + # reactor.callLater(1, self.ack) + # instead of self.ack() + # otherwise the writes will be glued together - hence the necessity for ugly hack with 1s timeout + # Note: this still might work depending on the IPA implementation details on the other side + self.ack() + # schedule PING in 4s + reactor.callLater(4, self.ping) + if msgt == IPA.MSGT['PING']: + self.pong() + + +class CTRL(IPACommon): + """ + Implementation of Osmocom control protocol for IPA multiplex + """ + def ctrl_SET(self, data, op_id, v): + """ + Handle CTRL SET command + """ + self.dbg('CTRL SET [%s] %s' % (op_id, v)) + + def ctrl_SET_REPLY(self, data, op_id, v): + """ + Handle CTRL SET reply + """ + self.dbg('CTRL SET REPLY [%s] %s' % (op_id, v)) + + def ctrl_GET(self, data, op_id, v): + """ + Handle CTRL GET command + """ + self.dbg('CTRL GET [%s] %s' % (op_id, v)) + + def ctrl_GET_REPLY(self, data, op_id, v): + """ + Handle CTRL GET reply + """ + self.dbg('CTRL GET REPLY [%s] %s' % (op_id, v)) + + def ctrl_TRAP(self, data, op_id, v): + """ + Handle CTRL TRAP command + """ + self.dbg('CTRL TRAP [%s] %s' % (op_id, v)) + + def ctrl_ERROR(self, data, op_id, v): + """ + Handle CTRL ERROR reply + """ + self.dbg('CTRL ERROR [%s] %s' % (op_id, v)) + + def osmo_CTRL(self, data): + """ + OSMO CTRL message dispatcher, lambda default should never happen + For basic tests only, appropriate handling routines should be replaced: see CtrlServer for example + """ + self.dbg('OSMO CTRL received %s::%s' % Ctrl().parse(data.decode('utf-8'))) + (cmd, op_id, v) = data.decode('utf-8').split(' ', 2) + method = getattr(self, 'ctrl_' + cmd, lambda: "CTRL unknown command") + method(data, op_id, v) + + +class IPAServer(CCM): + """ + Test implementation of IPA server + Demonstrate CCM opearation by overriding necessary bits from CCM + """ + def connectionMade(self): + """ + Keep reconnection logic working by calling routine from CCM + Initiate CCM upon connection + """ + print('IPA server connection made!') + super(IPAServer, self).connectionMade() + self.transport.write(IPA().id_get()) + + +class CtrlServer(CTRL): + """ + Test implementation of CTRL server + Demonstarte CTRL handling by overriding simpler routines from CTRL + """ + def connectionMade(self): + """ + Keep reconnection logic working by calling routine from CTRL + 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!') + super(CtrlServer, self).connectionMade() + self.transport.write(Ctrl().trap('LOL', 'what')) + self.transport.write(Ctrl().trap('rulez', 'XXX')) + + def reply(self, r): + self.transport.write(Ctrl().add_header(r)) + + def ctrl_SET(self, data, op_id, v): + """ + CTRL SET command: always succeed + """ + print('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.reply('ERROR %s No variable found' % op_id) + + +class IPAFactory(ReconnectingClientFactory): + """ + Generic IPA Client Factory which can be used to store state for various subprotocols and manage connections + Note: so far we do not really need separate Factory for acting as a server due to protocol simplicity + """ + protocol = IPACommon + debug = False + 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): + if proto: + self.protocol = proto + if debug: + self.debug = debug + if ccm_id: + self.ccm_id = ccm_id + + 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()) + 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()) + 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('-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() + cs.add_argument("-c", "--client", action='store_true', help="asume client role") + cs.add_argument("-s", "--server", action='store_true', help="asume server role") + ic = p.add_mutually_exclusive_group() + ic.add_argument("--ipa", action='store_true', help="use IPA protocol") + ic.add_argument("--ctrl", action='store_true', help="use CTRL protocol") + args = p.parse_args() + test = False + 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)) + 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)) + 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)) + 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)) + test = True + if test: + reactor.run() + else: + print("Please specify which protocol in which role you'd like to test.") -- To view, visit https://gerrit.osmocom.org/1268 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I07559df420b7fe8418f3412f45acd9a375e43bc5 Gerrit-PatchSet: 13 Gerrit-Project: openbsc 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 Dec 13 14:48:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 14:48:21 +0000 Subject: [MERGED] openbsc[master]: bsc_control.py: style corrections In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: bsc_control.py: style corrections ...................................................................... bsc_control.py: style corrections * replace some tabs indent with spaces * add comment to make sure no new tabs are used for indentation by emacs * remove unnecessary parenthesis Change-Id: Ib79fd4317d40ee4fd87b090b9faf8ebaf4bfca64 --- M openbsc/contrib/bsc_control.py 1 file changed, 22 insertions(+), 21 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/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index de0c2a9..ba86947 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- mode: python-mode; py-indent-tabs-mode: nil -*- import sys,os, random from optparse import OptionParser @@ -25,13 +26,13 @@ return data[4:plen+3], data[plen+3:] def connect(host, port): - if verbose: - print "Connecting to host %s:%i" % (host, port) + if verbose: + print "Connecting to host %s:%i" % (host, port) - sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sck.setblocking(1) - sck.connect((host, port)) - return sck + sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sck.setblocking(1) + sck.connect((host, port)) + return sck def send(sck, data): if verbose: @@ -91,24 +92,24 @@ verbose = options.verbose if options.cmd_set and options.cmd_get: - parser.error("Get and set options are mutually exclusive!") + parser.error("Get and set options are mutually exclusive!") if not (options.cmd_get or options.cmd_set or options.monitor): - parser.error("One of -m, -g, or -s must be set") + parser.error("One of -m, -g, or -s must be set") if not (options.host): - parser.error("Destination host and port required!") + parser.error("Destination host and port required!") sock = connect(options.host, options.port) if options.cmd_set: - if len(args) < 2: - parser.error("Set requires var and value arguments") + if len(args) < 2: + parser.error("Set requires var and value arguments") do_set(args[0], ' '.join(args[1:]), options.op_id, sock) if options.cmd_get: - if len(args) != 1: - parser.error("Get requires the var argument") + if len(args) != 1: + parser.error("Get requires the var argument") do_get(args[0], options.op_id, sock) data = sock.recv(1024) @@ -117,14 +118,14 @@ print "Got message:", answer if options.monitor: - while (True): - data = sock.recv(1024) - if len(data) == 0: - print "Connection is gone." - break + while True: + data = sock.recv(1024) + if len(data) == 0: + print "Connection is gone." + break - while (len(data)>0): - (answer, data) = remove_ipa_ctrl_header(data) - print "Got message:", answer + while len(data) > 0: + (answer, data) = remove_ipa_ctrl_header(data) + print "Got message:", answer sock.close() -- To view, visit https://gerrit.osmocom.org/1269 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib79fd4317d40ee4fd87b090b9faf8ebaf4bfca64 Gerrit-PatchSet: 10 Gerrit-Project: openbsc 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 Dec 13 14:48:38 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 14:48:38 +0000 Subject: [MERGED] openbsc[master]: bsc_control.py: use ipa.py module In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: bsc_control.py: use ipa.py module ...................................................................... bsc_control.py: use ipa.py module Simplify code by using Ctrl implementation from ipa.py Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 --- M openbsc/contrib/bsc_control.py 1 file changed, 28 insertions(+), 61 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index ba86947..cd2ba6d 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,29 +1,12 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- -import sys,os, random +import random from optparse import OptionParser +from ipa import Ctrl import socket -import struct verbose = False - -def prefix_ipa_ctrl_header(data): - return struct.pack(">HBB", len(data)+1, 0xee, 0) + data - -def ipa_ctrl_header(header): - (plen, ipa_proto, osmo_proto) = struct.unpack(">HBB", header) - return None if (ipa_proto != 0xee or osmo_proto != 0) else plen - -def remove_ipa_ctrl_header(data): - if (len(data) < 4): - raise BaseException("Answer too short!") - plen = ipa_ctrl_header(data[:4]) - if (None == plen): - raise BaseException("Wrong protocol in answer!") - if (plen + 3 > len(data)): - print "Warning: Wrong payload length (expected %i, got %i)" % (plen, len(data) - 3) - return data[4:plen+3], data[plen+3:] def connect(host, port): if verbose: @@ -34,39 +17,31 @@ sck.connect((host, port)) return sck -def send(sck, data): - if verbose: - print "Sending \"%s\"" %(data) - data = prefix_ipa_ctrl_header(data) - sck.send(data) - -def do_set(var, value, op_id, sck): - setmsg = "SET %s %s %s" %(op_id, var, value) - send(sck, setmsg) - -def do_get(var, op_id, sck): - getmsg = "GET %s %s" %(op_id, var) - send(sck, getmsg) - def do_set_get(sck, var, value = None): - r = random.randint(1, sys.maxint) - if (value != None): - s = 'SET_REPLY' - do_set(var, value, r, sck) - else: - s = 'GET_REPLY' - do_get(var, r, sck) - (answer, data) = remove_ipa_ctrl_header(sck.recv(4096)) - x = answer.split() - if (s == x[0] and str(r) == x[1] and var == x[2]): - return None if ('SET_REPLY' == s and value != x[3]) else x[3] - return None + (r, c) = Ctrl().cmd(var, value) + sck.send(c) + answer = Ctrl().rem_header(sck.recv(4096)) + return (answer,) + Ctrl().verify(answer, r, var, value) def set_var(sck, var, val): - return do_set_get(sck, var, val) + (a, _, _) = do_set_get(sck, var, val) + return a def get_var(sck, var): - return do_set_get(sck, var) + (_, _, v) = do_set_get(sck, var) + return v + +def _leftovers(sck): + data = sck.recv(1024) + if len(data) != 0: + tail = data + while True: + (head, tail) = Ctrl().split_combined(tail) + print "Got message:", Ctrl().rem_header(head) + if len(tail) == 0: + break + return True + return False if __name__ == '__main__': random.seed() @@ -105,27 +80,19 @@ if options.cmd_set: if len(args) < 2: parser.error("Set requires var and value arguments") - do_set(args[0], ' '.join(args[1:]), options.op_id, sock) + _leftovers(sock) + print "Got message:", set_var(sock, args[0], ' '.join(args[1:])) if options.cmd_get: if len(args) != 1: parser.error("Get requires the var argument") - do_get(args[0], options.op_id, sock) - - data = sock.recv(1024) - while (len(data)>0): - (answer, data) = remove_ipa_ctrl_header(data) - print "Got message:", answer + _leftovers(sock) + (a, _, _) = do_set_get(sock, args[0]) + print "Got message:", a if options.monitor: while True: - data = sock.recv(1024) - if len(data) == 0: + if not _leftovers(sock): print "Connection is gone." break - - while len(data) > 0: - (answer, data) = remove_ipa_ctrl_header(data) - print "Got message:", answer - sock.close() -- To view, visit https://gerrit.osmocom.org/1266 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I25fd7cd4b42126354b72abd60a3837be5d13e159 Gerrit-PatchSet: 11 Gerrit-Project: openbsc 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 Dec 13 14:48:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:48:40 +0000 Subject: openbsc[master]: move OAP messages implementations to libosmocore In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf Gerrit-PatchSet: 2 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 Tue Dec 13 14:49:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:49:33 +0000 Subject: openbsc[master]: rename oap.h to oap_client.h In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1388 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec 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 Tue Dec 13 14:49:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:49:48 +0000 Subject: openbsc[master]: build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1422 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 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 Tue Dec 13 14:49:55 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:49:55 +0000 Subject: openbsc[master]: add gsup_test_client program In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 Gerrit-PatchSet: 3 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 Tue Dec 13 14:49:58 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:49:58 +0000 Subject: openbsc[master]: comments: gsup client: rename to Generic, adjust copyright a... In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1383 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 Gerrit-PatchSet: 3 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 Tue Dec 13 14:50:16 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:16 +0000 Subject: openbsc[master]: gprs_gsup_client*: remove the gprs_ prefix In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1384 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 13 14:50:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:22 +0000 Subject: openbsc[master]: rename gprs_gsup_client.h to gsup_client.h In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1385 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c Gerrit-PatchSet: 3 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 Tue Dec 13 14:50:29 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:29 +0000 Subject: openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 13 14:50:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:48 +0000 Subject: openbsc[master]: oap: rename public API from oap_ to oap_client_ In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1387 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 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 Tue Dec 13 14:50:54 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:54 +0000 Subject: openbsc[master]: move gprs/oap.c to libcommon/oap_client.c In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1389 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 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 Tue Dec 13 14:50:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:56 +0000 Subject: openbsc[master]: move grps_gsup_client.c to libcommon/gsup_client.c In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1390 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce 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 Tue Dec 13 14:50:59 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:50:59 +0000 Subject: openbsc[master]: oap_test.c: rename to avoid clash with libosmocore oap_test.c In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1391 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f 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 Tue Dec 13 14:51:01 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:51:01 +0000 Subject: openbsc[master]: oap_client_test: print test descr to stderr, check stderr In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1392 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 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 Tue Dec 13 14:51:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:51:09 +0000 Subject: openbsc[master]: oap_client: move logging to DLOAP logging category In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 13 14:51:23 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:51:23 +0000 Subject: openbsc[master]: oap_client_test: show bug: disabled state does not reject me... In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1394 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 Gerrit-PatchSet: 3 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 Tue Dec 13 14:53:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:53:56 +0000 Subject: openbsc[master]: oap_client: reject all messages in disabled/uninitialized state In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1395 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 Gerrit-PatchSet: 3 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 Tue Dec 13 14:53:59 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:53:59 +0000 Subject: openbsc[master]: oap_client: make use of OAP optional: disable for NULL config In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1396 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 Gerrit-PatchSet: 3 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 Tue Dec 13 14:54:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:02 +0000 Subject: [MERGED] openbsc[master]: oap_client: make use of OAP optional: disable for NULL config In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap_client: make use of OAP optional: disable for NULL config ...................................................................... oap_client: make use of OAP optional: disable for NULL config When passing a NULL config to osmo_oap_client_init(), set OAP to disabled state. Along with the previous fix that ensures message rejection in the disabled state, this makes use of OAP in the GSUP client optional. oap_client_test: expect null config to set state to disabled. Related: OS#1592 Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 --- M openbsc/src/libcommon/gsup_client.c M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 4 files changed, 11 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c index 4c1fe61..2e920a6 100644 --- a/openbsc/src/libcommon/gsup_client.c +++ b/openbsc/src/libcommon/gsup_client.c @@ -266,7 +266,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_client_config *oap_config) + struct oap_client_config *oapc_config) { struct gsup_client *gsupc; int rc; @@ -274,7 +274,8 @@ gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client); OSMO_ASSERT(gsupc); - rc = oap_client_init(oap_config, &gsupc->oap_state); + /* a NULL oapc_config will mark oap_state disabled. */ + rc = oap_client_init(oapc_config, &gsupc->oap_state); if (rc != 0) goto failed; diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index e372ede..54b71e4 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -35,6 +35,9 @@ { OSMO_ASSERT(state->state == OAP_UNINITIALIZED); + if (!config) + goto disable; + if (config->client_id == 0) goto disable; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index ab651e6..e6501cb 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -62,6 +62,10 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); + fprintf(stderr, "- NULL config should disable\n"); + OSMO_ASSERT( oap_client_init(NULL, state) == 0 ); + OSMO_ASSERT(state->state == OAP_DISABLED); + fprintf(stderr, "- reject messages in disabled state\n"); memset(state, 0, sizeof(*state)); memset(&oap_rx, 0, sizeof(oap_rx)); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 8c538dc..62ddc9e 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,6 +1,7 @@ - make sure filling with zeros means uninitialized - reject messages in uninitialized state DLOAP Received OAP message 5, but the OAP client is not initialized +- NULL config should disable - reject messages in disabled state DLOAP Received OAP message 5, but the OAP client is disabled - invalid client_id and shared secret -- To view, visit https://gerrit.osmocom.org/1396 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie4d622fcfd24cb7d89d19f93e4b2571d8fadd1a3 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 Tue Dec 13 14:54:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:03 +0000 Subject: [MERGED] openbsc[master]: oap_client: reject all messages in disabled/uninitialized state In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap_client: reject all messages in disabled/uninitialized state ...................................................................... oap_client: reject all messages in disabled/uninitialized state Fixes the bug indicated in oap_client_test.c: adjust to actually expect the proper behavior. Also adjust for modified return value for message rejection. Instead of -1, just expect < 0. Adjust experr for new error messages. Related: OS#1592 Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 --- M openbsc/src/libcommon/gsup_client.c M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 4 files changed, 31 insertions(+), 20 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c index 0360e0a..4c1fe61 100644 --- a/openbsc/src/libcommon/gsup_client.c +++ b/openbsc/src/libcommon/gsup_client.c @@ -155,6 +155,7 @@ int rc; struct msgb *msg_tx; + /* If the oap_state is disabled, this will reject the messages. */ rc = oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 46dbcdd..e372ede 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -224,6 +225,21 @@ return -10; } + switch (state->state) { + case OAP_UNINITIALIZED: + LOGP(DLOAP, LOGL_ERROR, + "Received OAP message %d, but the OAP client is" + " not initialized\n", oap_msg.message_type); + return -ENOTCONN; + case OAP_DISABLED: + LOGP(DLOAP, LOGL_ERROR, + "Received OAP message %d, but the OAP client is" + " disabled\n", oap_msg.message_type); + return -ENOTCONN; + default: + break; + } + switch (oap_msg.message_type) { case OAP_MSGT_CHALLENGE_REQUEST: return handle_challenge(state, &oap_msg, msg_tx); diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 45decf8..ab651e6 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -52,19 +52,15 @@ fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); - fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n"); + fprintf(stderr, "- reject messages in uninitialized state\n"); memset(&oap_rx, 0, sizeof(oap_rx)); state->client_id = 1; oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; msg_rx = oap_client_encoded(&oap_rx); - /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP - * happily accepts this message and breaks the uninitialized state. The - * expected rc, state and msg_tx will be fixed along with the fix. */ - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); - OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); + OSMO_ASSERT(state->state == OAP_UNINITIALIZED); msgb_free(msg_rx); - OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); - msgb_free(msg_tx); + OSMO_ASSERT(!msg_tx); fprintf(stderr, "- reject messages in disabled state\n"); memset(state, 0, sizeof(*state)); @@ -73,14 +69,10 @@ state->client_id = 1; oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; msg_rx = oap_client_encoded(&oap_rx); - /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP - * happily accepts this message and breaks the uninitialized state. The - * expected rc, state and msg_tx will be fixed along with the fix. */ - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); - OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); + OSMO_ASSERT(state->state == OAP_DISABLED); msgb_free(msg_rx); - OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); - msgb_free(msg_tx); + OSMO_ASSERT(!msg_tx); fprintf(stderr, "- invalid client_id and shared secret\n"); memset(state, 0, sizeof(*state)); @@ -180,11 +172,11 @@ OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); OSMO_ASSERT(!msg_tx); state->state = OAP_DISABLED; - OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) < 0); OSMO_ASSERT(!msg_tx); state->state = OAP_INITIALIZED; diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 9e52357..8c538dc 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,8 +1,8 @@ - make sure filling with zeros means uninitialized -- reject messages in uninitialized state EXPECTING BUGS -DLOAP OAP registration failed +- reject messages in uninitialized state +DLOAP Received OAP message 5, but the OAP client is not initialized - reject messages in disabled state -DLOAP OAP registration failed +DLOAP Received OAP message 5, but the OAP client is disabled - invalid client_id and shared secret - reset state - only client_id is invalid @@ -23,6 +23,8 @@ DLOAP OAP: AUTN expected: cec4e3848a33000086781158ca40f136 - all data correct - but refuse to evaluate in uninitialized state +DLOAP Received OAP message 8, but the OAP client is not initialized +DLOAP Received OAP message 8, but the OAP client is disabled - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -- To view, visit https://gerrit.osmocom.org/1395 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I16165d228653e8a2689f9df94b77b470c06480c6 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 Tue Dec 13 14:54:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:03 +0000 Subject: [MERGED] openbsc[master]: oap_client_test: show bug: disabled state does not reject me... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap_client_test: show bug: disabled state does not reject message ...................................................................... oap_client_test: show bug: disabled state does not reject message There is a hole in OAP where a disabled OAP still accepts at least a Registration Reject message, after which it will do things it shouldn't. Show this by expecting the bugs, to be adjusted with the upcoming fix. Related: OS#1592 Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 --- M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 2 files changed, 41 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index a54e386..45decf8 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -37,6 +37,12 @@ struct oap_client_state _state; struct oap_client_state *state = &_state; + struct osmo_oap_message oap_rx; + struct msgb *msg_rx; + + struct osmo_oap_message oap_tx; + struct msgb *msg_tx; + memset(config, 0, sizeof(*config)); memset(state, 0, sizeof(*state)); @@ -46,7 +52,38 @@ fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); + fprintf(stderr, "- reject messages in uninitialized state EXPECTING BUGS\n"); + memset(&oap_rx, 0, sizeof(oap_rx)); + state->client_id = 1; + oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; + msg_rx = oap_client_encoded(&oap_rx); + /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP + * happily accepts this message and breaks the uninitialized state. The + * expected rc, state and msg_tx will be fixed along with the fix. */ + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); + OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_UNINITIALIZED */); + msgb_free(msg_rx); + OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); + msgb_free(msg_tx); + + fprintf(stderr, "- reject messages in disabled state\n"); + memset(state, 0, sizeof(*state)); + memset(&oap_rx, 0, sizeof(oap_rx)); + state->state = OAP_DISABLED; + state->client_id = 1; + oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; + msg_rx = oap_client_encoded(&oap_rx); + /* ATTENTION: This shows a bug in OAP: the rc should be < 0, but OAP + * happily accepts this message and breaks the uninitialized state. The + * expected rc, state and msg_tx will be fixed along with the fix. */ + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0 /* BUG, expecting < 0 */); + OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE /* BUG, expecting OAP_DISABLED */); + msgb_free(msg_rx); + OSMO_ASSERT(msg_tx /* BUG, expecting NULL */); + msgb_free(msg_tx); + fprintf(stderr, "- invalid client_id and shared secret\n"); + memset(state, 0, sizeof(*state)); config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; @@ -92,10 +129,6 @@ OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); - struct osmo_oap_message oap_rx; - struct osmo_oap_message oap_tx; - struct msgb *msg_rx; - struct msgb *msg_tx; fprintf(stderr, "- Missing challenge data\n"); memset(&oap_rx, 0, sizeof(oap_rx)); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 248808e..9e52357 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -1,4 +1,8 @@ - make sure filling with zeros means uninitialized +- reject messages in uninitialized state EXPECTING BUGS +DLOAP OAP registration failed +- reject messages in disabled state +DLOAP OAP registration failed - invalid client_id and shared secret - reset state - only client_id is invalid -- To view, visit https://gerrit.osmocom.org/1394 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4a5fde308b876946fea2571ea1a550f0cc7ee136 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 Tue Dec 13 14:54:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:03 +0000 Subject: [MERGED] openbsc[master]: oap_client: move logging to DLOAP logging category In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap_client: move logging to DLOAP logging category ...................................................................... oap_client: move logging to DLOAP logging category Use libosmocore's DLOAP logging category for OAP. oap_client_test.c: make sure DLOAP is in DEBUG level to not lose any logging messages from experr. Todo: we're using a "Library" logging category, which is not really what the library category was intended for. Instead, the OAP client should probably be given a logging category like DVLR or DGPRS in its initialization API. Related: OS#1592 Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a --- M openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/oap_client_test.c M openbsc/tests/oap/oap_client_test.err 3 files changed, 30 insertions(+), 34 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c index 92140c1..46dbcdd 100644 --- a/openbsc/src/libcommon/oap_client.c +++ b/openbsc/src/libcommon/oap_client.c @@ -38,12 +38,12 @@ goto disable; if (config->secret_k_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n"); goto disable; } if (config->secret_opc_present == 0) { - LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); + LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n"); goto disable; } @@ -101,16 +101,16 @@ osmo_auth_gen_vec(&vec, &auth, rx_random); if (vec.res_len != 8) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n", vec.res_len); return -3; } if (osmo_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) { - LOGP(DGPRS, LOGL_ERROR, "OAP: AUTN mismatch!\n"); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN from server: %s\n", + LOGP(DLOAP, LOGL_ERROR, "OAP: AUTN mismatch!\n"); + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN from server: %s\n", osmo_hexdump_nospc(rx_autn, sizeof(vec.autn))); - LOGP(DGPRS, LOGL_INFO, "OAP: AUTN expected: %s\n", + LOGP(DLOAP, LOGL_INFO, "OAP: AUTN expected: %s\n", osmo_hexdump_nospc(vec.autn, sizeof(vec.autn))); return -2; } @@ -135,7 +135,7 @@ struct osmo_oap_message oap_msg = {0}; if (client_id < 1) { - LOGP(DGPRS, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); + LOGP(DLOAP, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id); return NULL; } @@ -175,7 +175,7 @@ uint8_t xres[8]; if (!(oap_rx->rand_present && oap_rx->autn_present)) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n", oap_rx->rand_present, oap_rx->autn_present); rc = -2; @@ -218,7 +218,7 @@ rc = osmo_oap_decode(&oap_msg, data, data_len); if (rc < 0) { - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Decoding OAP message failed with error '%s' (%d)\n", get_value_string(gsm48_gmm_cause_names, -rc), -rc); return -10; @@ -234,7 +234,7 @@ break; case OAP_MSGT_REGISTER_ERROR: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "OAP registration failed\n"); state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { @@ -245,13 +245,13 @@ case OAP_MSGT_REGISTER_REQUEST: case OAP_MSGT_CHALLENGE_RESULT: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Received invalid OAP message type for OAP client side: %d\n", (int)oap_msg.message_type); return -12; default: - LOGP(DGPRS, LOGL_ERROR, + LOGP(DLOAP, LOGL_ERROR, "Unknown OAP message type: %d\n", (int)oap_msg.message_type); return -13; diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index 1473146..a54e386 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -213,17 +213,12 @@ msgb_free(msg_rx); } -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", - .enabled = 1, .loglevel = LOGL_DEBUG, - }, +static struct log_info_cat oap_client_test_categories[] = { }; static struct log_info info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), + .cat = oap_client_test_categories, + .num_cat = ARRAY_SIZE(oap_client_test_categories), }; int main(int argc, char **argv) @@ -232,10 +227,11 @@ osmo_init_logging(&info); OSMO_ASSERT(osmo_stderr_target); - osmo_stderr_target->use_color = 0; - osmo_stderr_target->print_timestamp = 0; - osmo_stderr_target->print_filename = 0; - osmo_stderr_target->print_category = 1; + log_set_use_color(osmo_stderr_target, 0); + log_set_print_timestamp(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, 0); + log_set_print_category(osmo_stderr_target, 1); + log_parse_category_mask(osmo_stderr_target, "DLOAP,1"); test_oap_api(); printf("Done\n"); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err index 3272237..248808e 100644 --- a/openbsc/tests/oap/oap_client_test.err +++ b/openbsc/tests/oap/oap_client_test.err @@ -3,26 +3,26 @@ - reset state - only client_id is invalid - valid id, but omitted shared_secret (1/2) -DGPRS OAP: client ID set, but secret K missing. +DLOAP OAP: client ID set, but secret K missing. - valid id, but omitted shared_secret (2/2) -DGPRS OAP: client ID set, but secret OPC missing. +DLOAP OAP: client ID set, but secret OPC missing. - mint configuration - Missing challenge data -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 0) - AUTN missing -DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +DLOAP OAP challenge incomplete (rand_present: 1, autn_present: 0) - RAND missing -DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 1) - wrong autn (by one bit) -DGPRS OAP: AUTN mismatch! -DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 -DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN mismatch! +DLOAP OAP: AUTN from server: dec4e3848a33000086781158ca40f136 +DLOAP OAP: AUTN expected: cec4e3848a33000086781158ca40f136 - all data correct - but refuse to evaluate in uninitialized state - now everything is correct - Expect the challenge response in msg_tx - Receive registration error for the first time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Receive registration error for the Nth time. -DGPRS OAP registration failed +DLOAP OAP registration failed - Registration success -- To view, visit https://gerrit.osmocom.org/1393 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a Gerrit-PatchSet: 4 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 Dec 13 14:54:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:03 +0000 Subject: [MERGED] openbsc[master]: oap_client_test: print test descr to stderr, check stderr In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap_client_test: print test descr to stderr, check stderr ...................................................................... oap_client_test: print test descr to stderr, check stderr Related: OS#1592 Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 --- M openbsc/tests/oap/Makefile.am M openbsc/tests/oap/oap_client_test.c A openbsc/tests/oap/oap_client_test.err M openbsc/tests/oap/oap_client_test.ok M openbsc/tests/testsuite.at 5 files changed, 56 insertions(+), 30 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index df0a43f..1bb672d 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -12,6 +12,7 @@ EXTRA_DIST = \ oap_client_test.ok \ + oap_client_test.err \ $(NULL) if HAVE_LIBGTP diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c index adac911..1473146 100644 --- a/openbsc/tests/oap/oap_client_test.c +++ b/openbsc/tests/oap/oap_client_test.c @@ -29,7 +29,7 @@ static void test_oap_api(void) { - printf("Testing OAP API\n - Config parsing\n"); + printf("Testing OAP API\n"); struct oap_client_config _config; struct oap_client_config *config = &_config; @@ -43,20 +43,20 @@ OSMO_ASSERT(osmo_hexparse("0102030405060708090a0b0c0d0e0f10", config->secret_k, 16) == 16); OSMO_ASSERT(osmo_hexparse("1112131415161718191a1b1c1d1e1f20", config->secret_opc, 16) == 16); - /* make sure filling with zeros means uninitialized */ + fprintf(stderr, "- make sure filling with zeros means uninitialized\n"); OSMO_ASSERT(state->state == OAP_UNINITIALIZED); - /* invalid client_id and shared secret */ + fprintf(stderr, "- invalid client_id and shared secret\n"); config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); - /* reset state */ + fprintf(stderr, "- reset state\n"); memset(state, 0, sizeof(*state)); - /* only client_id is invalid */ + fprintf(stderr, "- only client_id is invalid\n"); config->client_id = 0; config->secret_k_present = 1; config->secret_opc_present = 1; @@ -65,7 +65,7 @@ memset(state, 0, sizeof(*state)); - /* valid id, but omitted shared_secret (1/2) */ + fprintf(stderr, "- valid id, but omitted shared_secret (1/2)\n"); config->client_id = 12345; config->secret_k_present = 0; config->secret_opc_present = 1; @@ -74,7 +74,7 @@ memset(state, 0, sizeof(*state)); - /* valid id, but omitted shared_secret (2/2) */ + fprintf(stderr, "- valid id, but omitted shared_secret (2/2)\n"); config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 0; @@ -84,7 +84,7 @@ memset(state, 0, sizeof(*state)); - /* mint configuration */ + fprintf(stderr, "- mint configuration\n"); config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 1; @@ -92,16 +92,13 @@ OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); - printf(" - AUTN failures\n"); - struct osmo_oap_message oap_rx; struct osmo_oap_message oap_tx; struct msgb *msg_rx; struct msgb *msg_tx; + fprintf(stderr, "- Missing challenge data\n"); memset(&oap_rx, 0, sizeof(oap_rx)); - - /* Missing challenge data */ oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST; oap_rx.rand_present = 0; oap_rx.autn_present = 0; @@ -110,7 +107,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* AUTN missing */ + fprintf(stderr, "- AUTN missing\n"); osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); oap_rx.rand_present = 1; @@ -119,7 +116,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* RAND missing */ + fprintf(stderr, "- RAND missing\n"); oap_rx.rand_present = 0; osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); @@ -129,7 +126,7 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* wrong autn (by one bit) */ + fprintf(stderr, "- wrong autn (by one bit)\n"); osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); osmo_hexparse("dec4e3848a33000086781158ca40f136", @@ -141,12 +138,12 @@ msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); - /* all data correct */ + fprintf(stderr, "- all data correct\n"); osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); msg_rx = oap_client_encoded(&oap_rx); - /* but refuse to evaluate in uninitialized state */ + fprintf(stderr, "- but refuse to evaluate in uninitialized state\n"); OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; @@ -159,13 +156,12 @@ state->state = OAP_INITIALIZED; - /* now everything is correct */ - printf(" - AUTN success\n"); + fprintf(stderr, "- now everything is correct\n"); /* a successful return value here indicates correct autn */ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); msgb_free(msg_rx); - /* Expect the challenge response in msg_tx */ + fprintf(stderr, "- Expect the challenge response in msg_tx\n"); OSMO_ASSERT(msg_tx); OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0); OSMO_ASSERT(oap_tx.message_type == OAP_MSGT_CHALLENGE_RESULT); @@ -178,14 +174,13 @@ struct oap_client_state saved_state = _state; - printf(" - Registration failure\n"); + fprintf(stderr, "- Receive registration error for the first time.\n"); memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; msg_rx = oap_client_encoded(&oap_rx); - /* Receive registration error for the first time. */ OSMO_ASSERT(state->registration_failures == 0); OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(state->registration_failures == 1); @@ -196,7 +191,7 @@ msgb_free(msg_tx); msg_tx = 0; - /* Receive registration error for the Nth time. */ + fprintf(stderr, "- Receive registration error for the Nth time.\n"); state->registration_failures = 999; OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -11); OSMO_ASSERT(!msg_tx); @@ -206,7 +201,7 @@ msgb_free(msg_rx); - printf(" - Registration success\n"); + fprintf(stderr, "- Registration success\n"); _state = saved_state; memset(&oap_rx, 0, sizeof(oap_rx)); @@ -236,6 +231,12 @@ msgb_talloc_ctx_init(NULL, 0); osmo_init_logging(&info); + OSMO_ASSERT(osmo_stderr_target); + osmo_stderr_target->use_color = 0; + osmo_stderr_target->print_timestamp = 0; + osmo_stderr_target->print_filename = 0; + osmo_stderr_target->print_category = 1; + test_oap_api(); printf("Done\n"); diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err new file mode 100644 index 0000000..3272237 --- /dev/null +++ b/openbsc/tests/oap/oap_client_test.err @@ -0,0 +1,28 @@ +- make sure filling with zeros means uninitialized +- invalid client_id and shared secret +- reset state +- only client_id is invalid +- valid id, but omitted shared_secret (1/2) +DGPRS OAP: client ID set, but secret K missing. +- valid id, but omitted shared_secret (2/2) +DGPRS OAP: client ID set, but secret OPC missing. +- mint configuration +- Missing challenge data +DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0) +- AUTN missing +DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0) +- RAND missing +DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1) +- wrong autn (by one bit) +DGPRS OAP: AUTN mismatch! +DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136 +DGPRS OAP: AUTN expected: cec4e3848a33000086781158ca40f136 +- all data correct +- but refuse to evaluate in uninitialized state +- now everything is correct +- Expect the challenge response in msg_tx +- Receive registration error for the first time. +DGPRS OAP registration failed +- Receive registration error for the Nth time. +DGPRS OAP registration failed +- Registration success diff --git a/openbsc/tests/oap/oap_client_test.ok b/openbsc/tests/oap/oap_client_test.ok index 2e9ecf0..59108a7 100644 --- a/openbsc/tests/oap/oap_client_test.ok +++ b/openbsc/tests/oap/oap_client_test.ok @@ -1,7 +1,2 @@ Testing OAP API - - Config parsing - - AUTN failures - - AUTN success - - Registration failure - - Registration success Done diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index 0765c76..01737a3 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -108,7 +108,8 @@ AT_KEYWORDS([oap]) AT_CHECK([test "$enable_oap_test" != no || exit 77]) cat $abs_srcdir/oap/oap_client_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [ignore]) +cat $abs_srcdir/oap/oap_client_test.err > experr +AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [experr]) AT_CLEANUP AT_SETUP([gtphub]) -- To view, visit https://gerrit.osmocom.org/1392 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If1696c8e7bfa696b250f7eac24f08f85f8f492a2 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 Tue Dec 13 14:54:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:03 +0000 Subject: [MERGED] openbsc[master]: oap_test.c: rename to avoid clash with libosmocore oap_test.c In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap_test.c: rename to avoid clash with libosmocore oap_test.c ...................................................................... oap_test.c: rename to avoid clash with libosmocore oap_test.c Rename to oap_client_test.c, which is also a more accurate name. Related: OS#1592 Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f --- M openbsc/tests/oap/Makefile.am R openbsc/tests/oap/oap_client_test.c R openbsc/tests/oap/oap_client_test.ok M openbsc/tests/testsuite.at 4 files changed, 7 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index c17abb5..df0a43f 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -11,22 +11,22 @@ $(NULL) EXTRA_DIST = \ - oap_test.ok \ + oap_client_test.ok \ $(NULL) if HAVE_LIBGTP if HAVE_LIBCARES noinst_PROGRAMS = \ - oap_test \ + oap_client_test \ $(NULL) endif endif -oap_test_SOURCES = \ - oap_test.c \ +oap_client_test_SOURCES = \ + oap_client_test.c \ $(NULL) -oap_test_LDADD = \ +oap_client_test_LDADD = \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_client_test.c similarity index 100% rename from openbsc/tests/oap/oap_test.c rename to openbsc/tests/oap/oap_client_test.c diff --git a/openbsc/tests/oap/oap_test.ok b/openbsc/tests/oap/oap_client_test.ok similarity index 100% rename from openbsc/tests/oap/oap_test.ok rename to openbsc/tests/oap/oap_client_test.ok diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at index b44d595..0765c76 100644 --- a/openbsc/tests/testsuite.at +++ b/openbsc/tests/testsuite.at @@ -107,8 +107,8 @@ AT_SETUP([oap]) AT_KEYWORDS([oap]) AT_CHECK([test "$enable_oap_test" != no || exit 77]) -cat $abs_srcdir/oap/oap_test.ok > expout -AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [], [expout], [ignore]) +cat $abs_srcdir/oap/oap_client_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [], [expout], [ignore]) AT_CLEANUP AT_SETUP([gtphub]) -- To view, visit https://gerrit.osmocom.org/1391 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f 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 Tue Dec 13 14:54:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:04 +0000 Subject: [MERGED] openbsc[master]: move grps_gsup_client.c to libcommon/gsup_client.c In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: move grps_gsup_client.c to libcommon/gsup_client.c ...................................................................... move grps_gsup_client.c to libcommon/gsup_client.c This is in preparation for libvlr. Related: OS#1592 Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce --- M openbsc/src/gprs/Makefile.am M openbsc/src/libcommon/Makefile.am R openbsc/src/libcommon/gsup_client.c R openbsc/src/libcommon/gsup_test_client.c M openbsc/tests/sgsn/Makefile.am 5 files changed, 17 insertions(+), 16 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index d059aee..cff17dd 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -37,7 +37,6 @@ $(NULL) bin_PROGRAMS = \ - gsup_test_client \ osmo-gbproxy \ $(NULL) if HAVE_LIBGTP @@ -88,7 +87,6 @@ sgsn_auth.c \ gprs_subscriber.c \ gprs_utils.c \ - gprs_gsup_client.c \ sgsn_cdr.c \ sgsn_ares.c \ slhc.c \ @@ -130,18 +128,5 @@ $(LIBOSMOVTY_LIBS) \ $(LIBCARES_LIBS) \ $(LIBGTP_LIBS) \ - -lrt \ - $(NULL) - -gsup_test_client_SOURCES = \ - gprs_gsup_client.c \ - gsup_test_client.c \ - $(NULL) -gsup_test_client_LDADD = \ - $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBOSMOCORE_LIBS) \ - $(LIBOSMOGSM_LIBS) \ - $(LIBOSMOVTY_LIBS) \ - $(LIBOSMOABIS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6582d1e..0b258c0 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,8 +23,25 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ + gsup_client.c \ oap_client.c \ socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ $(NULL) + +noinst_PROGRAMS = \ + gsup_test_client \ + $(NULL) + +gsup_test_client_SOURCES = \ + gsup_test_client.c \ + $(NULL) +gsup_test_client_LDADD = \ + libcommon.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + -lrt \ + $(NULL) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/libcommon/gsup_client.c similarity index 100% rename from openbsc/src/gprs/gprs_gsup_client.c rename to openbsc/src/libcommon/gsup_client.c diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/libcommon/gsup_test_client.c similarity index 100% rename from openbsc/src/gprs/gsup_test_client.c rename to openbsc/src/libcommon/gsup_test_client.c diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 00b80f6..f1606cb 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -50,7 +50,6 @@ $(top_builddir)/src/gprs/sgsn_libgtp.o \ $(top_builddir)/src/gprs/sgsn_auth.o \ $(top_builddir)/src/gprs/sgsn_ares.o \ - $(top_builddir)/src/gprs/gprs_gsup_client.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ -- To view, visit https://gerrit.osmocom.org/1390 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9ad7dc7f17f3b033c779de9ae8bc120655502fce 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 Tue Dec 13 14:54:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:04 +0000 Subject: [MERGED] openbsc[master]: move gprs/oap.c to libcommon/oap_client.c In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: move gprs/oap.c to libcommon/oap_client.c ...................................................................... move gprs/oap.c to libcommon/oap_client.c This is in preparation for libvlr. Related: OS#1592 Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 --- M openbsc/src/gprs/Makefile.am M openbsc/src/libcommon/Makefile.am R openbsc/src/libcommon/oap_client.c M openbsc/tests/oap/Makefile.am M openbsc/tests/sgsn/Makefile.am 5 files changed, 2 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index ab2517e..d059aee 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -92,7 +92,6 @@ sgsn_cdr.c \ sgsn_ares.c \ slhc.c \ - oap.c \ gprs_llc_xid.c \ v42bis.c \ $(NULL) @@ -137,9 +136,9 @@ gsup_test_client_SOURCES = \ gprs_gsup_client.c \ gsup_test_client.c \ - oap.c \ $(NULL) gsup_test_client_LDADD = \ + $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ diff --git a/openbsc/src/libcommon/Makefile.am b/openbsc/src/libcommon/Makefile.am index 6cfebc2..6582d1e 100644 --- a/openbsc/src/libcommon/Makefile.am +++ b/openbsc/src/libcommon/Makefile.am @@ -23,6 +23,7 @@ debug.c \ gsm_data.c \ gsm_data_shared.c \ + oap_client.c \ socket.c \ talloc_ctx.c \ gsm_subscriber_base.c \ diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/libcommon/oap_client.c similarity index 100% rename from openbsc/src/gprs/oap.c rename to openbsc/src/libcommon/oap_client.c diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index bb9ebb2..c17abb5 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -27,7 +27,6 @@ $(NULL) oap_test_LDADD = \ - $(top_builddir)/src/gprs/oap.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 9e1a5a8..00b80f6 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -54,7 +54,6 @@ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ - $(top_builddir)/src/gprs/oap.o \ $(top_builddir)/src/gprs/gprs_llc_xid.o \ $(top_builddir)/src/gprs/gprs_sndcp_xid.o \ $(top_builddir)/src/gprs/slhc.o \ -- To view, visit https://gerrit.osmocom.org/1389 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib526df6d9de55a1e59a379d5e2c8541ed0ef67e3 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 Tue Dec 13 14:54:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:05 +0000 Subject: [MERGED] openbsc[master]: oap: rename public API from oap_ to oap_client_ In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: oap: rename public API from oap_ to oap_client_ ...................................................................... oap: rename public API from oap_ to oap_client_ Mainly to differentiate the OAP messaging API (osmo_oap_ in libosmocore) from the OAP client. This is in preparation for moving the oap client to libcommon, which is in turn preparation for libvlr. Add the osmo_ prefix, as all public Osmocom API should have. We also have OAP messages code in libosmocore, so clarify by naming this osmo_oap_client, and by also renaming the oap_test to oap_client_test. This reshuffling will allow an easy move of OAP to libosmocore if we should want to do that. A number of patches will follow up on this. Related: OS#1592 Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 --- M openbsc/include/openbsc/gsup_client.h M openbsc/include/openbsc/oap.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/oap.c M openbsc/tests/oap/oap_test.c 6 files changed, 63 insertions(+), 57 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index 551f76d..d21a54d 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -41,7 +41,7 @@ gsup_client_read_cb_t read_cb; void *data; - struct oap_state oap_state; + struct oap_client_state oap_state; struct osmo_timer_list ping_timer; struct osmo_timer_list connect_timer; @@ -52,7 +52,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_config *oap_config); + struct oap_client_config *oap_config); void gsup_client_destroy(struct gsup_client *gsupc); int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap.h index 2206184..80c86d5 100644 --- a/openbsc/include/openbsc/oap.h +++ b/openbsc/include/openbsc/oap.h @@ -27,9 +27,10 @@ struct msgb; struct osmo_oap_message; -/* This is the config part for vty. It is essentially copied in oap_state, - * where values are copied over once the config is considered valid. */ -struct oap_config { +/* This is the config part for vty. It is essentially copied in + * oap_client_state, where values are copied over once the config is + * considered valid. */ +struct oap_client_config { uint16_t client_id; int secret_k_present; uint8_t secret_k[16]; @@ -38,9 +39,10 @@ }; /* The runtime state of the OAP client. client_id and the secrets are in fact - * duplicated from oap_config, so that a separate validation of the config data - * is possible, and so that only a struct oap_state* is passed around. */ -struct oap_state { + * duplicated from oap_client_config, so that a separate validation of the + * config data is possible, and so that only a struct oap_client_state* is + * passed around. */ +struct oap_client_state { enum { OAP_UNINITIALIZED = 0, /* just allocated. */ OAP_DISABLED, /* disabled by config. */ @@ -56,23 +58,25 @@ }; /* From config, initialize state. Return 0 on success. */ -int oap_init(struct oap_config *config, struct oap_state *state); +int oap_client_init(struct oap_client_config *config, + struct oap_client_state *state); /* Construct an OAP registration message and return in *msg_tx. Use * state->client_id and update state->state. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_register(struct oap_state *state, struct msgb **msg_tx); +int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx); /* Decode and act on a received OAP message msg_rx. Update state->state. If a * non-NULL pointer is returned in *msg_tx, that msgb should be sent to the OAP * server (and freed) by the caller. The received msg_rx is not freed. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx); +int oap_client_handle(struct oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx); -/* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on - * error. (Like oap_encode(), but also allocates a msgb.) - * About the name: the idea is do_something(oap_encoded(my_struct)) */ -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg); - +/* Allocate a msgb and in it, return the encoded oap_client_msg. Return + * NULL on error. (Like oap_client_encode(), but also allocates a msgb.) + * About the name: the idea is do_something(oap_client_encoded(my_struct)) + */ +struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_client_msg); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 0045fae..c8dcc0d 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -92,7 +92,7 @@ int dynamic_lookup; - struct oap_config oap; + struct oap_client_config oap; /* RFC1144 TCP/IP header compression */ struct { diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index b991563..0360e0a 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -116,7 +116,7 @@ { struct msgb *msg_tx; int rc; - rc = oap_register(&gsupc->oap_state, &msg_tx); + rc = oap_client_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); @@ -155,7 +155,7 @@ int rc; struct msgb *msg_tx; - rc = oap_handle(&gsupc->oap_state, msg_rx, &msg_tx); + rc = oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); msgb_free(msg_rx); if (rc < 0) return rc; @@ -265,7 +265,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_config *oap_config) + struct oap_client_config *oap_config) { struct gsup_client *gsupc; int rc; @@ -273,7 +273,7 @@ gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client); OSMO_ASSERT(gsupc); - rc = oap_init(oap_config, &gsupc->oap_state); + rc = oap_client_init(oap_config, &gsupc->oap_state); if (rc != 0) goto failed; diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index 7efbe81..ac2b2a4 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -29,7 +29,8 @@ #include #include -int oap_init(struct oap_config *config, struct oap_state *state) +int oap_client_init(struct oap_client_config *config, + struct oap_client_state *state) { OSMO_ASSERT(state->state == OAP_UNINITIALIZED); @@ -66,7 +67,7 @@ * response message and update the state. * Return 0 on success; -1 if OAP is disabled; -2 if rx_random and rx_autn fail * the authentication check; -3 for any other errors. */ -static int oap_evaluate_challenge(const struct oap_state *state, +static int oap_evaluate_challenge(const struct oap_client_state *state, const uint8_t *rx_random, const uint8_t *rx_autn, uint8_t *tx_xres) @@ -119,7 +120,7 @@ return 0; } -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg) +struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_msg) { struct msgb *msg = msgb_alloc_headroom(1000, 64, __func__); OSMO_ASSERT(msg); @@ -140,10 +141,10 @@ oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST; oap_msg.client_id = client_id; - return oap_encoded(&oap_msg); + return oap_client_encoded(&oap_msg); } -int oap_register(struct oap_state *state, struct msgb **msg_tx) +int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx) { *msg_tx = oap_msg_register(state->client_id); if (!(*msg_tx)) @@ -163,10 +164,10 @@ oap_reply.message_type = OAP_MSGT_CHALLENGE_RESULT; memcpy(oap_reply.xres, xres, sizeof(oap_reply.xres)); oap_reply.xres_present = 1; - return oap_encoded(&oap_reply); + return oap_client_encoded(&oap_reply); } -static int handle_challenge(struct oap_state *state, +static int handle_challenge(struct oap_client_state *state, struct osmo_oap_message *oap_rx, struct msgb **msg_tx) { @@ -203,7 +204,8 @@ return rc; } -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx) +int oap_client_handle(struct oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx) { uint8_t *data = msgb_l2(msg_rx); size_t data_len = msgb_l2len(msg_rx); @@ -237,7 +239,7 @@ state->state = OAP_INITIALIZED; if (state->registration_failures < 3) { state->registration_failures ++; - return oap_register(state, msg_tx); + return oap_client_register(state, msg_tx); } return -11; diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index 68542fd..a6f54f6 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -31,11 +31,11 @@ { printf("Testing OAP API\n - Config parsing\n"); - struct oap_config _config; - struct oap_config *config = &_config; + struct oap_client_config _config; + struct oap_client_config *config = &_config; - struct oap_state _state; - struct oap_state *state = &_state; + struct oap_client_state _state; + struct oap_client_state *state = &_state; memset(config, 0, sizeof(*config)); memset(state, 0, sizeof(*state)); @@ -50,7 +50,7 @@ config->client_id = 0; config->secret_k_present = 0; config->secret_opc_present = 0; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); /* reset state */ @@ -60,7 +60,7 @@ config->client_id = 0; config->secret_k_present = 1; config->secret_opc_present = 1; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -69,7 +69,7 @@ config->client_id = 12345; config->secret_k_present = 0; config->secret_opc_present = 1; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -78,7 +78,7 @@ config->client_id = 12345; config->secret_k_present = 1; config->secret_opc_present = 0; - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_DISABLED); memset(state, 0, sizeof(*state)); @@ -89,7 +89,7 @@ config->secret_k_present = 1; config->secret_opc_present = 1; /*config->secret_* buffers are still set from the top */ - OSMO_ASSERT( oap_init(config, state) == 0 ); + OSMO_ASSERT( oap_client_init(config, state) == 0 ); OSMO_ASSERT(state->state == OAP_INITIALIZED); printf(" - AUTN failures\n"); @@ -105,8 +105,8 @@ oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST; oap_rx.rand_present = 0; oap_rx.autn_present = 0; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -114,8 +114,8 @@ osmo_hexparse("0102030405060708090a0b0c0d0e0f10", oap_rx.rand, 16); oap_rx.rand_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -124,8 +124,8 @@ osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); oap_rx.autn_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); @@ -136,25 +136,25 @@ oap_rx.autn, 16); oap_rx.rand_present = 1; oap_rx.autn_present = 1; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2); msgb_free(msg_rx); OSMO_ASSERT(!msg_tx); /* all data correct */ osmo_hexparse("cec4e3848a33000086781158ca40f136", oap_rx.autn, 16); - msg_rx = oap_encoded(&oap_rx); + msg_rx = oap_client_encoded(&oap_rx); /* but refuse to evaluate in uninitialized state */ OSMO_ASSERT(state->state == OAP_INITIALIZED); state->state = OAP_UNINITIALIZED; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); OSMO_ASSERT(!msg_tx); state->state = OAP_DISABLED; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1); OSMO_ASSERT(!msg_tx); state->state = OAP_INITIALIZED; @@ -162,7 +162,7 @@ /* now everything is correct */ printf(" - AUTN success\n"); /* a successful return value here indicates correct autn */ - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); msgb_free(msg_rx); /* Expect the challenge response in msg_tx */ @@ -176,18 +176,18 @@ msgb_free(msg_tx); msg_tx = 0; - struct oap_state saved_state = _state; + struct oap_client_state saved_state = _state; printf(" - Registration failure\n"); memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_ERROR; oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC; - msg_rx = oap_encoded(&oap_rx); + msg_rx = oap_client_encoded(&oap_rx); /* Receive registration error for the first time. */ OSMO_ASSERT(state->registration_failures == 0); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(state->registration_failures == 1); OSMO_ASSERT(msg_tx); OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0); @@ -198,7 +198,7 @@ /* Receive registration error for the Nth time. */ state->registration_failures = 999; - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -11); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -11); OSMO_ASSERT(!msg_tx); OSMO_ASSERT(state->state == OAP_INITIALIZED); msgb_free(msg_tx); @@ -211,8 +211,8 @@ _state = saved_state; memset(&oap_rx, 0, sizeof(oap_rx)); oap_rx.message_type = OAP_MSGT_REGISTER_RESULT; - msg_rx = oap_encoded(&oap_rx); - OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0); + msg_rx = oap_client_encoded(&oap_rx); + OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0); OSMO_ASSERT(!msg_tx); OSMO_ASSERT(state->state == OAP_REGISTERED); msgb_free(msg_rx); -- To view, visit https://gerrit.osmocom.org/1387 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1 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 Tue Dec 13 14:54:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:06 +0000 Subject: [MERGED] openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gsup client, gsup_test_client: move logging to DLGSUP category ...................................................................... gsup client, gsup_test_client: move logging to DLGSUP category Use the DLGSUP logging category for GSUP. Bump the required version of libosmocore to 0.9.5 to benefit from the DLGSUP logging category fix in core/logging.[hc]. (Id974c7be158e4d60421a98110f5c807aefd31119) Todo: we're using a "Library" logging category, which is not really what the library category was intended for. Instead, the GSUP client should probably be given a logging category like DVLR or DGPRS in its initialization API. Related: OS#1592 Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee --- M openbsc/configure.ac M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gsup_test_client.c 3 files changed, 20 insertions(+), 25 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 123048f..4fe1050 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -30,7 +30,7 @@ AC_SUBST(LIBRARY_DL) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.4) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 6195fa6..b991563 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -55,29 +55,29 @@ return 0; if (osmo_timer_pending(&gsupc->connect_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: connect timer already running\n"); osmo_timer_del(&gsupc->connect_timer); } if (osmo_timer_pending(&gsupc->ping_timer)) { - LOGP(DLINP, LOGL_DEBUG, + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: ping timer already running\n"); osmo_timer_del(&gsupc->ping_timer); } if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); rc = ipa_client_conn_open(gsupc->link); if (rc >= 0) { - LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP connecting to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; } - LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", gsupc->link->addr, gsupc->link->port, strerror(-rc)); if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || @@ -87,7 +87,7 @@ osmo_timer_schedule(&gsupc->connect_timer, GSUP_CLIENT_RECONNECT_INTERVAL, 0); - LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", + LOGP(DLGSUP, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); return 0; @@ -119,7 +119,7 @@ rc = oap_register(&gsupc->oap_state, &msg_tx); if ((rc < 0) || (!msg_tx)) { - LOGP(DGPRS, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); + LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); return; } @@ -130,7 +130,7 @@ { struct gsup_client *gsupc = link->data; - LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); gsupc->is_connected = up; @@ -181,7 +181,7 @@ rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); if (rc < 0) { - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA/CCM message from %s:%d\n", link->addr, link->port); /* Link has been closed */ @@ -194,7 +194,7 @@ uint8_t msg_type = *(msg->l2h); /* CCM message */ if (msg_type == IPAC_MSGT_PONG) { - LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP receiving PONG\n"); gsupc->got_ipa_pong = 1; } @@ -223,7 +223,7 @@ return 0; invalid: - LOGP(DGPRS, LOGL_NOTICE, + LOGP(DLGSUP, LOGL_NOTICE, "GSUP received an invalid IPA message from %s:%d, size = %d\n", link->addr, link->port, msgb_length(msg)); @@ -235,7 +235,7 @@ { struct gsup_client *gsupc = gsupc_; - LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", + LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", gsupc->got_ipa_pong ? "got" : "didn't get"); @@ -244,7 +244,7 @@ return; } - LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); + LOGP(DLGSUP, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); ipa_client_conn_close(gsupc->link); gsupc->is_connected = 0; @@ -258,7 +258,7 @@ gsupc->got_ipa_pong = 0; osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0); - LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); + LOGP(DLGSUP, LOGL_DEBUG, "GSUP sending PING\n"); gsup_client_send_ping(gsupc); } diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index c8ed03d..1889c6f 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -260,17 +260,12 @@ void *tall_bsc_ctx = NULL; /* default categories */ -static struct log_info_cat gprs_categories[] = { - [DGPRS] = { - .name = "DGPRS", - .description = "GPRS Packet Service", - .enabled = 1, .loglevel = LOGL_INFO, - }, +static struct log_info_cat default_categories[] = { }; -static const struct log_info gprs_log_info = { - .cat = gprs_categories, - .num_cat = ARRAY_SIZE(gprs_categories), +static const struct log_info gsup_test_client_log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), }; int main(int argc, char **argv) @@ -279,7 +274,7 @@ char *server_host = "127.0.0.1"; uint16_t server_port = 2222; - osmo_init_logging(&gprs_log_info); + osmo_init_logging(&gsup_test_client_log_info); g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb, NULL); -- To view, visit https://gerrit.osmocom.org/1386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee Gerrit-PatchSet: 4 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 Dec 13 14:54:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:06 +0000 Subject: [MERGED] openbsc[master]: rename gprs_gsup_client.h to gsup_client.h In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: rename gprs_gsup_client.h to gsup_client.h ...................................................................... rename gprs_gsup_client.h to gsup_client.h This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. Related: OS#1592 Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c --- M openbsc/include/openbsc/Makefile.am R openbsc/include/openbsc/gsup_client.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/gprs/gsup_test_client.c M openbsc/src/gprs/sgsn_vty.c M openbsc/tests/sgsn/sgsn_test.c 7 files changed, 6 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 2b54c43..9f574e6 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -23,7 +23,6 @@ gb_proxy.h \ gprs_gb_parse.h \ gprs_gmm.h \ - gprs_gsup_client.h \ gprs_llc.h \ gprs_llc_xid.h \ gprs_sgsn.h \ @@ -39,6 +38,7 @@ gsm_data.h \ gsm_data_shared.h \ gsm_subscriber.h \ + gsup_client.h \ gtphub.h \ handover.h \ handover_decision.h \ diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gsup_client.h similarity index 100% rename from openbsc/include/openbsc/gprs_gsup_client.h rename to openbsc/include/openbsc/gsup_client.h diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index cd94a8a..6195fa6 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -21,7 +21,7 @@ * */ -#include +#include #include #include diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 100fd91..23dbdd4 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index 901b870..c8ed03d 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include static struct gsup_client *g_gc; diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 1b477e5..21c865b 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 16eb6c9..b4bcaf6 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1385 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c 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 Tue Dec 13 14:54:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:06 +0000 Subject: [MERGED] openbsc[master]: gprs_gsup_client*: remove the gprs_ prefix In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gprs_gsup_client*: remove the gprs_ prefix ...................................................................... gprs_gsup_client*: remove the gprs_ prefix Make sure everything is named gsup_client_ / GSUP_CLIENT_. Rename static gsup_client_send() to client_send() to avoid clash with public gprs_gsup_client_send() being renamed to gsup_client_send(). This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. libvlr and osmo-sgsn will use the same GSUP client code. A number of patches will follow up on this, also for the the OAP client. Related: OS#1592 Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 --- M openbsc/include/openbsc/gprs_gsup_client.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/gprs_gsup_client.c M openbsc/src/gprs/gprs_subscriber.c M openbsc/src/gprs/gsup_test_client.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c 7 files changed, 79 insertions(+), 76 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gprs_gsup_client.h index ccfa388..551f76d 100644 --- a/openbsc/include/openbsc/gprs_gsup_client.h +++ b/openbsc/include/openbsc/gprs_gsup_client.h @@ -25,35 +25,36 @@ #include -#define GPRS_GSUP_RECONNECT_INTERVAL 10 -#define GPRS_GSUP_PING_INTERVAL 20 +#define GSUP_CLIENT_RECONNECT_INTERVAL 10 +#define GSUP_CLIENT_PING_INTERVAL 20 struct msgb; struct ipa_client_conn; -struct gprs_gsup_client; +struct gsup_client; /* Expects message in msg->l2h */ -typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg); +typedef int (*gsup_client_read_cb_t)(struct gsup_client *gsupc, + struct msgb *msg); -struct gprs_gsup_client { - struct ipa_client_conn *link; - gprs_gsup_read_cb_t read_cb; - void *data; +struct gsup_client { + struct ipa_client_conn *link; + gsup_client_read_cb_t read_cb; + void *data; - struct oap_state oap_state; + struct oap_state oap_state; - struct osmo_timer_list ping_timer; - struct osmo_timer_list connect_timer; - int is_connected; - int got_ipa_pong; + struct osmo_timer_list ping_timer; + struct osmo_timer_list connect_timer; + int is_connected; + int got_ipa_pong; }; -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb, - struct oap_config *oap_config); +struct gsup_client *gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + gsup_client_read_cb_t read_cb, + struct oap_config *oap_config); -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc); -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -struct msgb *gprs_gsup_msgb_alloc(void); +void gsup_client_destroy(struct gsup_client *gsupc); +int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); +struct msgb *gsup_client_msgb_alloc(void); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 786e2b2..0045fae 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -123,7 +123,7 @@ /* GSN instance for libgtp */ struct gsn_t *gsn; /* Subscriber */ - struct gprs_gsup_client *gsup_client; + struct gsup_client *gsup_client; /* LLME inactivity timer */ struct osmo_timer_list llme_timer; diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index 41b88ad..cd94a8a 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -35,11 +35,11 @@ extern void *tall_bsc_ctx; -static void start_test_procedure(struct gprs_gsup_client *gsupc); +static void start_test_procedure(struct gsup_client *gsupc); -static void gsup_client_send_ping(struct gprs_gsup_client *gsupc) +static void gsup_client_send_ping(struct gsup_client *gsupc) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = gsup_client_msgb_alloc(); msg->l2h = msgb_put(msg, 1); msg->l2h[0] = IPAC_MSGT_PING; @@ -47,7 +47,7 @@ ipa_client_conn_send(gsupc->link, msg); } -static int gsup_client_connect(struct gprs_gsup_client *gsupc) +static int gsup_client_connect(struct gsup_client *gsupc) { int rc; @@ -84,7 +84,8 @@ rc == -EINVAL) return rc; - osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); + osmo_timer_schedule(&gsupc->connect_timer, + GSUP_CLIENT_RECONNECT_INTERVAL, 0); LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", gsupc->link->addr, gsupc->link->port); @@ -94,7 +95,7 @@ static void connect_timer_cb(void *gsupc_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct gsup_client *gsupc = gsupc_; if (gsupc->is_connected) return; @@ -102,7 +103,8 @@ gsup_client_connect(gsupc); } -static void gsup_client_send(struct gprs_gsup_client *gsupc, int proto_ext, struct msgb *msg_tx) +static void client_send(struct gsup_client *gsupc, int proto_ext, + struct msgb *msg_tx) { ipa_prepend_header_ext(msg_tx, proto_ext); ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO); @@ -110,7 +112,7 @@ /* msg_tx is now queued and will be freed. */ } -static void gsup_client_oap_register(struct gprs_gsup_client *gsupc) +static void gsup_client_oap_register(struct gsup_client *gsupc) { struct msgb *msg_tx; int rc; @@ -121,12 +123,12 @@ return; } - gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); + client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); } static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) { - struct gprs_gsup_client *gsupc = link->data; + struct gsup_client *gsupc = link->data; LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", link->addr, link->port, up ? "UP" : "DOWN"); @@ -144,11 +146,11 @@ osmo_timer_del(&gsupc->ping_timer); osmo_timer_schedule(&gsupc->connect_timer, - GPRS_GSUP_RECONNECT_INTERVAL, 0); + GSUP_CLIENT_RECONNECT_INTERVAL, 0); } } -static int gsup_client_oap_handle(struct gprs_gsup_client *gsupc, struct msgb *msg_rx) +static int gsup_client_oap_handle(struct gsup_client *gsupc, struct msgb *msg_rx) { int rc; struct msgb *msg_tx; @@ -159,7 +161,7 @@ return rc; if (msg_tx) - gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); + client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); return 0; } @@ -168,7 +170,7 @@ { struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); - struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data; + struct gsup_client *gsupc = (struct gsup_client *)link->data; int rc; static struct ipaccess_unit ipa_dev = { .unit_name = "SGSN" @@ -231,7 +233,7 @@ static void ping_timer_cb(void *gsupc_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct gsup_client *gsupc = gsupc_; LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", gsupc->is_connected ? "connected" : "not connected", @@ -249,26 +251,26 @@ gsup_client_connect(gsupc); } -static void start_test_procedure(struct gprs_gsup_client *gsupc) +static void start_test_procedure(struct gsup_client *gsupc) { gsupc->ping_timer.data = gsupc; gsupc->ping_timer.cb = &ping_timer_cb; gsupc->got_ipa_pong = 0; - osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0); + osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0); LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); gsup_client_send_ping(gsupc); } -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb, - struct oap_config *oap_config) +struct gsup_client *gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + gsup_client_read_cb_t read_cb, + struct oap_config *oap_config) { - struct gprs_gsup_client *gsupc; + struct gsup_client *gsupc; int rc; - gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client); OSMO_ASSERT(gsupc); rc = oap_init(oap_config, &gsupc->oap_state); @@ -299,11 +301,11 @@ return gsupc; failed: - gprs_gsup_client_destroy(gsupc); + gsup_client_destroy(gsupc); return NULL; } -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc) +void gsup_client_destroy(struct gsup_client *gsupc) { osmo_timer_del(&gsupc->connect_timer); osmo_timer_del(&gsupc->ping_timer); @@ -316,7 +318,7 @@ talloc_free(gsupc); } -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) { if (!gsupc) { msgb_free(msg); @@ -328,12 +330,12 @@ return -EAGAIN; } - gsup_client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); + client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); return 0; } -struct msgb *gprs_gsup_msgb_alloc(void) +struct msgb *gsup_client_msgb_alloc(void) { return msgb_alloc_headroom(4000, 64, __func__); } diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 658ce04..100fd91 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -45,7 +45,7 @@ extern void *tall_bsc_ctx; -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg); +static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg); /* TODO: Some functions are specific to the SGSN, but this file is more general * (it has gprs_* name). Either move these functions elsewhere, split them and @@ -62,7 +62,7 @@ addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr); - sgi->gsup_client = gprs_gsup_client_create( + sgi->gsup_client = gsup_client_create( addr_str, sgi->cfg.gsup_server_port, &gsup_read_cb, &sgi->cfg.oap); @@ -73,7 +73,7 @@ return 1; } -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg) { int rc; @@ -161,7 +161,7 @@ static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr, struct osmo_gsup_message *gsup_msg) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = gsup_client_msgb_alloc(); if (strlen(gsup_msg->imsi) == 0 && subscr) strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1); @@ -176,7 +176,7 @@ return -ENOTSUP; } - return gprs_gsup_client_send(sgsn->gsup_client, msg); + return gsup_client_send(sgsn->gsup_client, msg); } static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr, diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c index 5f123b8..901b870 100644 --- a/openbsc/src/gprs/gsup_test_client.c +++ b/openbsc/src/gprs/gsup_test_client.c @@ -12,7 +12,7 @@ #include #include -static struct gprs_gsup_client *g_gc; +static struct gsup_client *g_gc; /*********************************************************************** @@ -113,7 +113,7 @@ osmo_gsup_encode(msg, &gsup); - return gprs_gsup_client_send(g_gc, msg); + return gsup_client_send(g_gc, msg); } /* allocate + generate + send Send-Auth-Info */ @@ -128,7 +128,7 @@ osmo_gsup_encode(msg, &gsup); - return gprs_gsup_client_send(g_gc, msg); + return gsup_client_send(g_gc, msg); } int resp_isd(struct imsi_op *io) @@ -143,7 +143,7 @@ imsi_op_release(io); - return gprs_gsup_client_send(g_gc, msg); + return gsup_client_send(g_gc, msg); } /* receive an incoming GSUP message */ @@ -196,7 +196,7 @@ } } -static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +static int gsupc_read_cb(struct gsup_client *gsupc, struct msgb *msg) { struct osmo_gsup_message gsup_msg = {0}; struct imsi_op *io; @@ -281,8 +281,8 @@ osmo_init_logging(&gprs_log_info); - g_gc = gprs_gsup_client_create(server_host, server_port, - gsupc_read_cb, NULL); + g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb, + NULL); signal(SIGINT, sig_cb); diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 9ee5455..c5d90f6 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -36,7 +36,7 @@ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ - -Wl,--wrap=gprs_gsup_client_send \ + -Wl,--wrap=gsup_client_send \ $(NULL) sgsn_test_LDADD = \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index e7b7458..16eb6c9 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -146,14 +146,14 @@ return (*subscr_request_auth_info_cb)(mmctx); }; -/* override, requires '-Wl,--wrap=gprs_gsup_client_send' */ -int __real_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -int (*gprs_gsup_client_send_cb)(struct gprs_gsup_client *gsupc, struct msgb *msg) = - &__real_gprs_gsup_client_send; +/* override, requires '-Wl,--wrap=gsup_client_send' */ +int __real_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); +int (*gsup_client_send_cb)(struct gsup_client *gsupc, struct msgb *msg) = + &__real_gsup_client_send; -int __wrap_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int __wrap_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) { - return (*gprs_gsup_client_send_cb)(gsupc, msg); + return (*gsup_client_send_cb)(gsupc, msg); }; static int count(struct llist_head *head) @@ -714,7 +714,7 @@ cleanup_test(); } -int my_gprs_gsup_client_send_dummy(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_gsup_client_send_dummy(struct gsup_client *gsupc, struct msgb *msg) { msgb_free(msg); return 0; @@ -1281,7 +1281,7 @@ cleanup_test(); } -int my_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) { struct osmo_gsup_message to_peer = {0}; struct osmo_gsup_message from_peer = {0}; @@ -1323,7 +1323,7 @@ return 0; } - reply_msg = gprs_gsup_msgb_alloc(); + reply_msg = gsup_client_msgb_alloc(); reply_msg->l2h = reply_msg->data; osmo_gsup_encode(reply_msg, &from_peer); gprs_subscr_rx_gsup_message(reply_msg); @@ -1338,9 +1338,9 @@ struct gsm_subscriber *subscr; sgsn_inst.cfg.auth_policy = SGSN_AUTH_POLICY_REMOTE; - gprs_gsup_client_send_cb = my_gprs_gsup_client_send; + gsup_client_send_cb = my_gsup_client_send; - sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gsup_client); if (retry) { upd_loc_skip = 3; @@ -1355,7 +1355,7 @@ assert_no_subscrs(); sgsn->cfg.auth_policy = saved_auth_policy; - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + gsup_client_send_cb = __real_gsup_client_send; upd_loc_skip = 0; auth_info_skip = 0; talloc_free(sgsn->gsup_client); @@ -2239,7 +2239,7 @@ printf("Testing GGSN selection\n"); - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + gsup_client_send_cb = my_gsup_client_send_dummy; /* Check for emptiness */ OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); @@ -2358,7 +2358,7 @@ sgsn_ggsn_ctx_free(ggcs[1]); sgsn_ggsn_ctx_free(ggcs[2]); - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + gsup_client_send_cb = __real_gsup_client_send; cleanup_test(); } -- To view, visit https://gerrit.osmocom.org/1384 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51 Gerrit-PatchSet: 4 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 Dec 13 14:54:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:07 +0000 Subject: [MERGED] openbsc[master]: comments: gsup client: rename to Generic, adjust copyright a... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: comments: gsup client: rename to Generic, adjust copyright and authors ...................................................................... comments: gsup client: rename to Generic, adjust copyright and authors Related: OS#1592 Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 --- M openbsc/src/gprs/gprs_gsup_client.c 1 file changed, 3 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index deaf156..41b88ad 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -1,9 +1,10 @@ -/* GPRS Subscriber Update Protocol client */ +/* Generic Subscriber Update Protocol client */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH +/* (C) 2014-2016 by Sysmocom s.f.m.c. GmbH * All Rights Reserved * * Author: Jacob Erlbeck + * 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 -- To view, visit https://gerrit.osmocom.org/1383 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2c5d145e05aa4afd43ef1341d22563448f1c3577 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 Tue Dec 13 14:54:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:07 +0000 Subject: [MERGED] openbsc[master]: add gsup_test_client program In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: add gsup_test_client program ...................................................................... add gsup_test_client program Related: OS#1592 Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 --- M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gprs_gsup_client.c A openbsc/src/gprs/gsup_test_client.c 3 files changed, 319 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index d228b39..a827b77 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -37,6 +37,7 @@ $(NULL) bin_PROGRAMS = \ + gsup_test_client \ osmo-gbproxy \ $(NULL) if HAVE_LIBGTP @@ -133,3 +134,16 @@ $(LIBGTP_LIBS) \ -lrt \ $(NULL) + +gsup_test_client_SOURCES = \ + gprs_gsup_client.c \ + gsup_test_client.c \ + oap.c \ + $(NULL) +gsup_test_client_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + -lrt \ + $(NULL) diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c index a4aca09..deaf156 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/gprs_gsup_client.c @@ -25,6 +25,7 @@ #include #include #include +#include #include diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c new file mode 100644 index 0000000..5f123b8 --- /dev/null +++ b/openbsc/src/gprs/gsup_test_client.c @@ -0,0 +1,304 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +static struct gprs_gsup_client *g_gc; + + +/*********************************************************************** + * IMSI Operation + ***********************************************************************/ +static LLIST_HEAD(g_imsi_ops); + +struct imsi_op_stats { + uint32_t num_alloc; + uint32_t num_released; + uint32_t num_rx_success; + uint32_t num_rx_error; + uint32_t num_timeout; +}; + +enum imsi_op_type { + IMSI_OP_SAI, + IMSI_OP_LU, + IMSI_OP_ISD, + _NUM_IMSI_OP +}; + +static const struct value_string imsi_op_names[] = { + { IMSI_OP_SAI, "SAI" }, + { IMSI_OP_LU, "LU" }, + { IMSI_OP_ISD, "ISD" }, + { 0, NULL } +}; + +static struct imsi_op_stats imsi_op_stats[_NUM_IMSI_OP]; + +struct imsi_op { + struct llist_head list; + char imsi[17]; + enum imsi_op_type type; + struct osmo_timer_list timer; +}; + +static struct imsi_op *imsi_op_find(const char *imsi, + enum imsi_op_type type) +{ + struct imsi_op *io; + + llist_for_each_entry(io, &g_imsi_ops, list) { + if (!strcmp(io->imsi, imsi) && io->type == type) + return io; + } + return NULL; +} + +static void imsi_op_timer_cb(void *data); + +static struct imsi_op *imsi_op_alloc(void *ctx, const char *imsi, + enum imsi_op_type type) +{ + struct imsi_op *io; + + if (imsi_op_find(imsi, type)) + return NULL; + + io = talloc_zero(ctx, struct imsi_op); + strncpy(io->imsi, imsi, sizeof(io->imsi)); + io->imsi[sizeof(io->imsi)-1] = '\0'; + io->type = type; + io->timer.cb = imsi_op_timer_cb; + io->timer.data = io; + llist_add(&io->list, &g_imsi_ops); + imsi_op_stats[type].num_alloc++; + + return io; +} + +static void imsi_op_release(struct imsi_op *io) +{ + osmo_timer_del(&io->timer); + llist_del(&io->list); + imsi_op_stats[io->type].num_released++; + talloc_free(io); +} + +static void imsi_op_timer_cb(void *data) +{ + struct imsi_op *io = data; + printf("%s: Timer expiration\n", io->imsi); + imsi_op_stats[io->type].num_timeout++; + imsi_op_release(io); +} + +/* allocate + generate + send Send-Auth-Info */ +int req_auth_info(const char *imsi) +{ + struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_SAI); + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST; + + osmo_gsup_encode(msg, &gsup); + + return gprs_gsup_client_send(g_gc, msg); +} + +/* allocate + generate + send Send-Auth-Info */ +int req_loc_upd(const char *imsi) +{ + struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_LU); + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST; + + osmo_gsup_encode(msg, &gsup); + + return gprs_gsup_client_send(g_gc, msg); +} + +int resp_isd(struct imsi_op *io) +{ + struct osmo_gsup_message gsup = {0}; + struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); + + strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_RESULT; + + osmo_gsup_encode(msg, &gsup); + + imsi_op_release(io); + + return gprs_gsup_client_send(g_gc, msg); +} + +/* receive an incoming GSUP message */ +static void imsi_op_rx_gsup(struct imsi_op *io, const struct osmo_gsup_message *gsup) +{ + int is_error = 0; + + if (OSMO_GSUP_IS_MSGT_ERROR(gsup->message_type)) { + imsi_op_stats[io->type].num_rx_error++; + is_error = 1; + } else + imsi_op_stats[io->type].num_rx_success++; + + switch (io->type) { + case IMSI_OP_SAI: + printf("%s; SAI Response%s\n", io->imsi, is_error ? ": ERROR" : ""); + /* now that we have auth tuples, request LU */ + req_loc_upd(io->imsi); + imsi_op_release(io); + break; + case IMSI_OP_LU: + printf("%s; LU Response%s\n", io->imsi, is_error ? ": ERROR" : ""); + imsi_op_release(io); + break; + case IMSI_OP_ISD: + printf("%s; ISD Request%s\n", io->imsi, is_error ? ": ERROR" : ""); + resp_isd(io); + break; + default: + printf("%s: Unknown\n", io->imsi); + imsi_op_release(io); + break; + } +} + +static int op_type_by_gsup_msgt(enum osmo_gsup_message_type msg_type) +{ + switch (msg_type) { + case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT: + case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR: + return IMSI_OP_SAI; + case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT: + case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR: + return IMSI_OP_LU; + case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST: + return IMSI_OP_ISD; + default: + printf("Unknown GSUP msg_type %u\n", msg_type); + return -1; + } +} + +static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) +{ + struct osmo_gsup_message gsup_msg = {0}; + struct imsi_op *io; + int rc; + + DEBUGP(DGPRS, "Rx GSUP %s\n", osmo_hexdump(msgb_l2(msg), msgb_l2len(msg))); + + rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup_msg); + if (rc < 0) + return rc; + + if (!gsup_msg.imsi[0]) + return -1; + + rc = op_type_by_gsup_msgt(gsup_msg.message_type); + if (rc < 0) + return rc; + + switch (rc) { + case IMSI_OP_SAI: + case IMSI_OP_LU: + io = imsi_op_find(gsup_msg.imsi, rc); + if (!io) + return -1; + break; + case IMSI_OP_ISD: + /* ISD is an inbound transaction */ + io = imsi_op_alloc(g_gc, gsup_msg.imsi, IMSI_OP_ISD); + break; + } + + imsi_op_rx_gsup(io, &gsup_msg); + msgb_free(msg); + + return 0; +} + +static void print_report(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(imsi_op_stats); i++) { + struct imsi_op_stats *st = &imsi_op_stats[i]; + const char *name = get_value_string(imsi_op_names, i); + printf("%s: %u alloc, %u released, %u success, %u error , %u tout\n", + name, st->num_alloc, st->num_released, st->num_rx_success, + st->num_rx_error, st->num_timeout); + } +} + +static void sig_cb(int sig) +{ + switch (sig) { + case SIGINT: + print_report(); + exit(0); + break; + } +} + +void *tall_bsc_ctx = NULL; + +/* default categories */ +static struct log_info_cat gprs_categories[] = { + [DGPRS] = { + .name = "DGPRS", + .description = "GPRS Packet Service", + .enabled = 1, .loglevel = LOGL_INFO, + }, +}; + +static const struct log_info gprs_log_info = { + .cat = gprs_categories, + .num_cat = ARRAY_SIZE(gprs_categories), +}; + +int main(int argc, char **argv) +{ + unsigned long long i; + char *server_host = "127.0.0.1"; + uint16_t server_port = 2222; + + osmo_init_logging(&gprs_log_info); + + g_gc = gprs_gsup_client_create(server_host, server_port, + gsupc_read_cb, NULL); + + + signal(SIGINT, sig_cb); + + for (i = 0; i < 10000; i++) { + unsigned long long imsi = 901790000000000 + i; + char imsi_buf[17]; + snprintf(imsi_buf, sizeof(imsi_buf), "%015llu", imsi); + req_auth_info(imsi_buf); + osmo_select_main(0); + } + + while (1) { + osmo_select_main(0); + } + + print_report(); + exit(0); +} -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 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 Tue Dec 13 14:54:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:08 +0000 Subject: [MERGED] openbsc[master]: build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP ...................................................................... build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP GSUP was added to libosmocore in 0.9.4. We're using it here, so make up for a previously missing bump. (BTW: I'm pretty sure that other dependencies are also in dire need of a bump, but leaving that for another patch) Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 --- M openbsc/configure.ac 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 093d42f..123048f 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -30,10 +30,10 @@ AC_SUBST(LIBRARY_DL) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.4) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -- To view, visit https://gerrit.osmocom.org/1422 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 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 Tue Dec 13 14:54:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:08 +0000 Subject: [MERGED] openbsc[master]: rename oap.h to oap_client.h In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: rename oap.h to oap_client.h ...................................................................... rename oap.h to oap_client.h Related: OS#1592 Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec --- M openbsc/include/openbsc/Makefile.am M openbsc/include/openbsc/gsup_client.h R openbsc/include/openbsc/oap_client.h M openbsc/include/openbsc/sgsn.h M openbsc/src/gprs/oap.c M openbsc/tests/oap/oap_test.c 6 files changed, 5 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 8ea95e0..2466ce8 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -54,7 +54,7 @@ mncc_int.h \ nat_rewrite_trie.h \ network_listen.h \ - oap.h \ + oap_client.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index d21a54d..a113225 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -23,7 +23,7 @@ #include -#include +#include #define GSUP_CLIENT_RECONNECT_INTERVAL 10 #define GSUP_CLIENT_PING_INTERVAL 20 diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap_client.h similarity index 100% rename from openbsc/include/openbsc/oap.h rename to openbsc/include/openbsc/oap_client.h diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index c8dcc0d..1ede2c9 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index ac2b2a4..92140c1 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include int oap_client_init(struct oap_client_config *config, diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index a6f54f6..adac911 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include -- To view, visit https://gerrit.osmocom.org/1388 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec 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 Tue Dec 13 14:54:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:08 +0000 Subject: [MERGED] openbsc[master]: move OAP messages implementations to libosmocore In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: move OAP messages implementations to libosmocore ...................................................................... move OAP messages implementations to libosmocore This corresponds to change-id If5099e60681a215e798b6675f21813f26769c253 in libosmocore, which is now required to build openbsc. Related: OS#1592 Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf --- M openbsc/configure.ac M openbsc/include/openbsc/Makefile.am D openbsc/include/openbsc/oap_messages.h M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/oap.c D openbsc/src/gprs/oap_messages.c M openbsc/tests/oap/Makefile.am M openbsc/tests/oap/oap_test.c M openbsc/tests/sgsn/Makefile.am 9 files changed, 3 insertions(+), 256 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 4fe1050..0753834 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -33,7 +33,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 9f574e6..8ea95e0 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -55,7 +55,6 @@ nat_rewrite_trie.h \ network_listen.h \ oap.h \ - oap_messages.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/openbsc/include/openbsc/oap_messages.h b/openbsc/include/openbsc/oap_messages.h deleted file mode 100644 index ecb66df..0000000 --- a/openbsc/include/openbsc/oap_messages.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Osmocom Authentication Protocol message encoder/decoder */ - -/* (C) 2015 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 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 -#include - -/* Some numbers are out of sequence because (so far) they match gprs_gsup_iei. - */ -enum oap_iei { - OAP_CAUSE_IE = 0x02, - OAP_RAND_IE = 0x20, - OAP_AUTN_IE = 0x23, - OAP_XRES_IE = 0x24, - OAP_AUTS_IE = 0x25, - OAP_CLIENT_ID_IE = 0x30, -}; - -enum osmo_oap_message_type { - OAP_MSGT_REGISTER_REQUEST = 0b00000100, - OAP_MSGT_REGISTER_ERROR = 0b00000101, - OAP_MSGT_REGISTER_RESULT = 0b00000110, - - OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, - OAP_MSGT_CHALLENGE_ERROR = 0b00001001, - OAP_MSGT_CHALLENGE_RESULT = 0b00001010, - - OAP_MSGT_SYNC_REQUEST = 0b00001100, - OAP_MSGT_SYNC_ERROR = 0b00001101, - OAP_MSGT_SYNC_RESULT = 0b00001110, -}; - -struct osmo_oap_message { - enum osmo_oap_message_type message_type; - enum gsm48_gmm_cause cause; - uint16_t client_id; - int rand_present; - uint8_t rand[16]; - int autn_present; - uint8_t autn[16]; - int xres_present; - uint8_t xres[8]; - int auts_present; - uint8_t auts[16]; -}; - -int osmo_oap_decode(struct osmo_oap_message *oap_msg, - const uint8_t *data, size_t data_len); -void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); - diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index a827b77..ab2517e 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -93,7 +93,6 @@ sgsn_ares.c \ slhc.c \ oap.c \ - oap_messages.c \ gprs_llc_xid.c \ v42bis.c \ $(NULL) diff --git a/openbsc/src/gprs/oap.c b/openbsc/src/gprs/oap.c index c7c9777..7efbe81 100644 --- a/openbsc/src/gprs/oap.c +++ b/openbsc/src/gprs/oap.c @@ -24,10 +24,10 @@ #include #include +#include #include #include -#include int oap_init(struct oap_config *config, struct oap_state *state) { diff --git a/openbsc/src/gprs/oap_messages.c b/openbsc/src/gprs/oap_messages.c deleted file mode 100644 index d81723f..0000000 --- a/openbsc/src/gprs/oap_messages.c +++ /dev/null @@ -1,178 +0,0 @@ -/* Osmocom Authentication Protocol message encoder/decoder */ - -/* (C) 2015 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 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 - - -int osmo_oap_decode(struct osmo_oap_message *oap_msg, - const uint8_t *const_data, size_t data_len) -{ - int rc; - uint8_t tag; - /* the shift/match functions expect non-const pointers, but we'll - * either copy the data or cast pointers back to const before returning - * them - */ - uint8_t *data = (uint8_t *)const_data; - uint8_t *value; - size_t value_len; - - memset(oap_msg, 0, sizeof(*oap_msg)); - - /* message type */ - rc = osmo_shift_v_fixed(&data, &data_len, 1, &value); - if (rc < 0) - return -GMM_CAUSE_INV_MAND_INFO; - oap_msg->message_type = osmo_decode_big_endian(value, 1); - - /* specific parts */ - while (data_len > 0) { - enum oap_iei iei; - - rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len); - if (rc < 0) - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - - iei = tag; - - switch (iei) { - case OAP_CLIENT_ID_IE: - if (value_len != 2) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type client ID (%d) should be 2 octets, but has %d\n", - (int)iei, (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - - oap_msg->client_id = osmo_decode_big_endian(value, value_len); - - if (oap_msg->client_id == 0) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type client ID (%d): client ID must be nonzero.\n", - (int)iei); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - break; - - case OAP_AUTN_IE: - if (value_len != sizeof(oap_msg->autn)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type AUTN (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->autn, value, value_len); - oap_msg->autn_present = value_len; - break; - - case OAP_RAND_IE: - if (value_len != sizeof(oap_msg->rand)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type RAND (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->rand, value, value_len); - oap_msg->rand_present = value_len; - break; - - case OAP_XRES_IE: - if (value_len != sizeof(oap_msg->xres)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type XRES (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->xres), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->xres, value, value_len); - oap_msg->xres_present = value_len; - break; - - case OAP_AUTS_IE: - if (value_len != sizeof(oap_msg->auts)) { - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type AUTS (%d) should be %d octets, but has %d\n", - (int)iei, (int)sizeof(oap_msg->auts), (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - memcpy(oap_msg->auts, value, value_len); - oap_msg->auts_present = value_len; - break; - - case OAP_CAUSE_IE: - if (value_len > 1) { - LOGP(DGPRS, LOGL_ERROR, - "OAP cause may not exceed one octet, is %d", (int)value_len); - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - } - oap_msg->cause = *value; - break; - - default: - LOGP(DGPRS, LOGL_NOTICE, - "OAP IE type %d unknown\n", iei); - continue; - } - } - - return 0; -} - -void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg) -{ - uint8_t u8; - - /* generic part */ - OSMO_ASSERT(oap_msg->message_type); - msgb_v_put(msg, (uint8_t)oap_msg->message_type); - - /* specific parts */ - if ((u8 = oap_msg->cause)) - msgb_tlv_put(msg, OAP_CAUSE_IE, sizeof(u8), &u8); - - if (oap_msg->client_id > 0) - msgb_tlv_put(msg, OAP_CLIENT_ID_IE, sizeof(oap_msg->client_id), - osmo_encode_big_endian(oap_msg->client_id, - sizeof(oap_msg->client_id))); - - if (oap_msg->rand_present) - msgb_tlv_put(msg, OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); - - if (oap_msg->autn_present) - msgb_tlv_put(msg, OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); - - if (oap_msg->auts_present) - msgb_tlv_put(msg, OAP_AUTS_IE, sizeof(oap_msg->auts), oap_msg->auts); - - if (oap_msg->xres_present) - msgb_tlv_put(msg, OAP_XRES_IE, sizeof(oap_msg->xres), oap_msg->xres); - - msg->l2h = msg->data; -} - diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am index 06ccf33..bb9ebb2 100644 --- a/openbsc/tests/oap/Makefile.am +++ b/openbsc/tests/oap/Makefile.am @@ -28,7 +28,6 @@ oap_test_LDADD = \ $(top_builddir)/src/gprs/oap.o \ - $(top_builddir)/src/gprs/oap_messages.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c index d200ed2..68542fd 100644 --- a/openbsc/tests/oap/oap_test.c +++ b/openbsc/tests/oap/oap_test.c @@ -19,11 +19,10 @@ */ #include +#include #include - #include -#include #include #include diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index c5d90f6..9e1a5a8 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -55,7 +55,6 @@ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gprs_gb_parse.o \ $(top_builddir)/src/gprs/oap.o \ - $(top_builddir)/src/gprs/oap_messages.o \ $(top_builddir)/src/gprs/gprs_llc_xid.o \ $(top_builddir)/src/gprs/gprs_sndcp_xid.o \ $(top_builddir)/src/gprs/slhc.o \ -- To view, visit https://gerrit.osmocom.org/1381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf 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 Dec 13 14:54:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:24 +0000 Subject: libosmocore[master]: logging test: cosmetic: print target and don't print color In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1413 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9461b987adf85d87469a6af55de5f1aa478f6ebb 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 Dec 13 14:54:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:54:56 +0000 Subject: libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for inv... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1414 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd 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 Dec 13 14:55:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:55:07 +0000 Subject: libosmocore[master]: fix logging: redirection to DLGLOBAL for invalid categories In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1415 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6ea9a59e005a22e0305454291714fdb9531c346b 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 Dec 13 14:55:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:55:26 +0000 Subject: libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for fir... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1416 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I12bf38b6c1f85e2d7bf5a15f942dfe0beed41eba Gerrit-PatchSet: 1 Gerrit-Project: libosmocore 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 Tue Dec 13 14:55:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:55:33 +0000 Subject: libosmocore[master]: fix logging: also catch first out-of-bounds logging cat In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1417 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7ca1a1d47724e40350f1c4dfebe90bad01c965f9 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 Dec 13 14:56:01 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:01 +0000 Subject: libosmocore[master]: show bug in logging: out-of-bounds check should end with use... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1418 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I397278714018ee9a0ae5101515f31ddddf79c2ec 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 Dec 13 14:56:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:09 +0000 Subject: libosmocore[master]: fix logging: out-of-bounds check should end with user catego... In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1419 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 Gerrit-PatchSet: 4 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 Dec 13 14:56:15 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:15 +0000 Subject: libosmocore[master]: show bug in logging: log_set_category_filter on DL* categories In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1420 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie2da77c642a84cafc0f528985930697ec167183b Gerrit-PatchSet: 4 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 Dec 13 14:56:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:28 +0000 Subject: [MERGED] libosmocore[master]: show bug in logging: log_set_category_filter on DL* categories In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: show bug in logging: log_set_category_filter on DL* categories ...................................................................... show bug in logging: log_set_category_filter on DL* categories Add a check to logging_test.c to show a bug: passing an internal DL* category constant to log_set_category_filter() results in a negative array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: Ie2da77c642a84cafc0f528985930697ec167183b --- M tests/logging/logging_test.c 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 5ef214d..ce8aac8 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -121,5 +121,11 @@ DEBUGP(log_info.num_cat + 1, "You should see this on DLGLOBAL (d)\n"); DEBUGP(log_info.num_cat, "You should see this on DLGLOBAL (e)\n"); + /* Check log_set_category_filter() with internal categories */ + log_parse_category_mask(stderr_target, "DLGLOBAL,3"); + DEBUGP(DLGLOBAL, "You should not see this (DLGLOBAL not on DEBUG)\n"); + log_set_category_filter(stderr_target, DLGLOBAL, 1, LOGL_DEBUG); + DEBUGP(DLGLOBAL, "You should see this (DLGLOBAL on DEBUG)\n"); + return 0; } -- To view, visit https://gerrit.osmocom.org/1420 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie2da77c642a84cafc0f528985930697ec167183b 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 Tue Dec 13 14:56:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:28 +0000 Subject: [MERGED] libosmocore[master]: fix logging: out-of-bounds check should end with user catego... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix logging: out-of-bounds check should end with user categories ...................................................................... fix logging: out-of-bounds check should end with user categories To check category bounds, rather use num_cat_user, to redirect all semantically unknown categories to DLGLOBAL. Adjust logging_test expectations accordingly: "(d)" is now also shown. Note: subsys is and needs to be signed, while num_cat* are unsigned. Thus for a negative subsys, 'subsys >= num_cat_user' practically always yields true. Pay close attention to signedness and check upper bound only for positive values. Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 6 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 2a8bfdc..d32ca43 100644 --- a/src/logging.c +++ b/src/logging.c @@ -336,6 +336,11 @@ * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { + /* Note: comparing signed and unsigned integers */ + + if (subsys > 0 && ((unsigned int)subsys) >= osmo_log_info->num_cat_user) + subsys = DLGLOBAL; + if (subsys < 0) subsys = subsys_lib2index(subsys); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index f4e9c1f..4527d83 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,4 +4,5 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1419 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1 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 Tue Dec 13 14:56:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:28 +0000 Subject: [MERGED] libosmocore[master]: show bug in logging: out-of-bounds check should end with use... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: show bug in logging: out-of-bounds check should end with user categories ...................................................................... show bug in logging: out-of-bounds check should end with user categories In the background osmo_log_info array, the user's logging categories are enhanced by the library internal ones. So far logging category range checking only checked for the larger array bounds, although passing a logging category >= num_cat_user is already semantically unknown and should redirect to DLGLOBAL. Add a check to logging_test.c to show that this isn't happening. Instead of DLGLOBAL, a logging category that happens to be at that index is queried. The bug is confirmed by logging_test.err only showing "(e)" and not "(d)": "(e)" is shown because the first category after the user ones happens to be DLGLOBAL. "(d)" is omitted since it hits a category that's not on debug level. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: I397278714018ee9a0ae5101515f31ddddf79c2ec --- M tests/logging/logging_test.c M tests/logging/logging_test.err 2 files changed, 5 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 3cc6c5b..5ef214d 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -113,9 +113,13 @@ /* Make sure out-of-bounds category maps to DLGLOBAL */ log_parse_category_mask(stderr_target, "DLGLOBAL,1"); + /* For IDs out of bounds of the overall osmo_log_info array */ DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); DEBUGP(osmo_log_info->num_cat, "You should see this on DLGLOBAL (c)\n"); + /* For IDs out of bounds of the user categories part */ + DEBUGP(log_info.num_cat + 1, "You should see this on DLGLOBAL (d)\n"); + DEBUGP(log_info.num_cat, "You should see this on DLGLOBAL (e)\n"); return 0; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 273a852..f4e9c1f 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,3 +4,4 @@ DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (e) -- To view, visit https://gerrit.osmocom.org/1418 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I397278714018ee9a0ae5101515f31ddddf79c2ec 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 Tue Dec 13 14:56:29 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:29 +0000 Subject: [MERGED] libosmocore[master]: fix logging: also catch first out-of-bounds logging cat In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix logging: also catch first out-of-bounds logging cat ...................................................................... fix logging: also catch first out-of-bounds logging cat In map_subsys(), fix the '>' condition to '>=' for array bounds checking. Also make the bounds checking more strict: after both invocations of subsys_lib2index(), re-check validity of the array index. If the final index is still wrong, which should never happen, exit by assertion. Change-Id: I7ca1a1d47724e40350f1c4dfebe90bad01c965f9 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 4 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/logging.c b/src/logging.c index 7102543..2a8bfdc 100644 --- a/src/logging.c +++ b/src/logging.c @@ -339,9 +339,11 @@ if (subsys < 0) subsys = subsys_lib2index(subsys); - if (subsys > osmo_log_info->num_cat) + if (subsys < 0 || subsys >= osmo_log_info->num_cat) subsys = subsys_lib2index(DLGLOBAL); + OSMO_ASSERT(!(subsys < 0 || subsys >= osmo_log_info->num_cat)); + return subsys; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index cc21b32..273a852 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -3,3 +3,4 @@ DRLL You should see this DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) +DLGLOBAL You should see this on DLGLOBAL (c) -- To view, visit https://gerrit.osmocom.org/1417 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7ca1a1d47724e40350f1c4dfebe90bad01c965f9 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 Tue Dec 13 14:56:29 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:29 +0000 Subject: [MERGED] libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for fir... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: show bug in logging: erratic redirection to DLGLOBAL for first invalid category ...................................................................... show bug in logging: erratic redirection to DLGLOBAL for first invalid category Add a check to logging_test.c to show a bug: when a logging category value that is the first out-of-bounds value is passed to the logging system, the internal map_subsys() fails to redirect to DLGLOBAL due to a flawed conditional. This results in a too large array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: I12bf38b6c1f85e2d7bf5a15f942dfe0beed41eba --- M tests/logging/logging_test.c 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Neels Hofmeyr: Verified Harald Welte: Looks good to me, approved diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 6c5a8f2..3cc6c5b 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -115,6 +115,7 @@ log_parse_category_mask(stderr_target, "DLGLOBAL,1"); DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); + DEBUGP(osmo_log_info->num_cat, "You should see this on DLGLOBAL (c)\n"); return 0; } -- To view, visit https://gerrit.osmocom.org/1416 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I12bf38b6c1f85e2d7bf5a15f942dfe0beed41eba Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 13 14:56:29 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:29 +0000 Subject: [MERGED] libosmocore[master]: fix logging: redirection to DLGLOBAL for invalid categories In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix logging: redirection to DLGLOBAL for invalid categories ...................................................................... fix logging: redirection to DLGLOBAL for invalid categories For out-of-bounds logging categories, redirect to the proper DLGLOBAL array index instead of returning -1. Adjust test expectation which shows that the bugs tested for are fixed. Note: there are separate bounds checking problems, left for another patch. Change-Id: I6ea9a59e005a22e0305454291714fdb9531c346b --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 10 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/logging.c b/src/logging.c index 92852c9..7102543 100644 --- a/src/logging.c +++ b/src/logging.c @@ -328,13 +328,20 @@ target->output(target, level, buf); } +/* Catch internal logging category indexes as well as out-of-bounds indexes. + * For internal categories, the ID is negative starting with -1; and internal + * logging categories are added behind the user categories. For out-of-bounds + * indexes, return the index of DLGLOBAL. The returned category index is + * guaranteed to exist in osmo_log_info, otherwise the program would abort, + * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { if (subsys < 0) subsys = subsys_lib2index(subsys); if (subsys > osmo_log_info->num_cat) - subsys = DLGLOBAL; + subsys = subsys_lib2index(DLGLOBAL); + return subsys; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 4a350fa..cc21b32 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -1,3 +1,5 @@ DRLL You should see this DCC You should see this DRLL You should see this +DLGLOBAL You should see this on DLGLOBAL (a) +DLGLOBAL You should see this on DLGLOBAL (b) -- To view, visit https://gerrit.osmocom.org/1415 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6ea9a59e005a22e0305454291714fdb9531c346b 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 Tue Dec 13 14:56:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:30 +0000 Subject: [MERGED] libosmocore[master]: show bug in logging: erratic redirection to DLGLOBAL for inv... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: show bug in logging: erratic redirection to DLGLOBAL for invalid categories ...................................................................... show bug in logging: erratic redirection to DLGLOBAL for invalid categories Add a check to logging_test.c to show a bug: when a logging category value that is out-of-bounds is passed to the logging system, the internal map_subsys() function should remap that to DLGLOBAL. But in fact DLGLOBAL is -1 and the function fails to map this to a proper positive array index, directly returning -1 instead. This results in a negative array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Note: osmo_log_info->num_cat + 0 is also out-of-bounds, but there is a separate bug there, so leaving this for another patch. Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd --- M tests/logging/logging_test.c 1 file changed, 8 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 91b0aaf..6c5a8f2 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -66,6 +66,8 @@ .filter_fn = test_filter, }; +extern struct log_info *osmo_log_info; + int main(int argc, char **argv) { struct log_target *stderr_target; @@ -108,5 +110,11 @@ select_output = 1; DEBUGP(DRLL, "You should see this\n"); OSMO_ASSERT(filter_called == 5); /* called twice on output */ + + /* Make sure out-of-bounds category maps to DLGLOBAL */ + log_parse_category_mask(stderr_target, "DLGLOBAL,1"); + DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); + DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); + return 0; } -- To view, visit https://gerrit.osmocom.org/1414 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd 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 Tue Dec 13 14:56:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:56:30 +0000 Subject: [MERGED] libosmocore[master]: logging test: cosmetic: print target and don't print color In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: logging test: cosmetic: print target and don't print color ...................................................................... logging test: cosmetic: print target and don't print color Prepares for upcoming modifications of the logging test to show and fix bugs in the logging system. Change-Id: I9461b987adf85d87469a6af55de5f1aa478f6ebb --- M tests/logging/logging_test.c M tests/logging/logging_test.err 2 files changed, 5 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 3d1b7d8..91b0aaf 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -75,6 +75,8 @@ log_add_target(stderr_target); log_set_all_filter(stderr_target, 1); log_set_print_filename(stderr_target, 0); + log_set_print_category(stderr_target, 1); + log_set_use_color(stderr_target, 0); log_parse_category_mask(stderr_target, "DRLL:DCC"); log_parse_category_mask(stderr_target, "DRLL"); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 4891491..4a350fa 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -1,4 +1,3 @@ -You should see this -You should see this -You should see this - \ No newline at end of file +DRLL You should see this +DCC You should see this +DRLL You should see this -- To view, visit https://gerrit.osmocom.org/1413 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9461b987adf85d87469a6af55de5f1aa478f6ebb 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 Tue Dec 13 14:57:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:57:09 +0000 Subject: libosmocore[master]: fix logging: log_set_category_filter() for internal DL* logg... In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1421 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0725b22bc39498c6b3970a61eb3339cf56d19f1 Gerrit-PatchSet: 4 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 Dec 13 14:57:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Tue, 13 Dec 2016 14:57:10 +0000 Subject: [MERGED] libosmocore[master]: fix logging: log_set_category_filter() for internal DL* logg... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fix logging: log_set_category_filter() for internal DL* logging cats ...................................................................... fix logging: log_set_category_filter() for internal DL* logging cats In log_set_category_filter(), passing a negative index lead to memory corruption. Particularly dangerous since the internal logging categories have negative values. Fix: apply map_subsys() to interpret negative values as internal logging categories. As a side effect, out-of-bounds logging categories will be mapped to DLGLOBAL instead of being dropped. Fix the expectations in logging_test to match the fixed bug. While at it also guard against a NULL logging target. Change-Id: Ib0725b22bc39498c6b3970a61eb3339cf56d19f1 --- M src/logging.c M tests/logging/logging_test.err 2 files changed, 3 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/logging.c b/src/logging.c index d32ca43..b0bca54 100644 --- a/src/logging.c +++ b/src/logging.c @@ -577,8 +577,9 @@ void log_set_category_filter(struct log_target *target, int category, int enable, int level) { - if (category >= osmo_log_info->num_cat) + if (!target) return; + category = map_subsys(category); target->categories[category].enabled = !!enable; target->categories[category].loglevel = level; } diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index 4527d83..17b3cad 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -6,3 +6,4 @@ DLGLOBAL You should see this on DLGLOBAL (c) DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) +DLGLOBAL You should see this (DLGLOBAL on DEBUG) -- To view, visit https://gerrit.osmocom.org/1421 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib0725b22bc39498c6b3970a61eb3339cf56d19f1 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 Tue Dec 13 15:47:58 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 15:47:58 +0000 Subject: [PATCH] libosmocore[master]: Remove illegal pkg-config directive Message-ID: Review at https://gerrit.osmocom.org/1426 Remove illegal pkg-config directive Gets rid of pkg-config-bad-directive lintian in Debian packages. Max's comment: this directive is present in src/gb/Makefile.am anyway. Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da --- M libosmogb.pc.in 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/1426/1 diff --git a/libosmogb.pc.in b/libosmogb.pc.in index a163cc4..a97ce32 100644 --- a/libosmogb.pc.in +++ b/libosmogb.pc.in @@ -7,5 +7,5 @@ Description: Osmocom GPRS Gb Interface (NS/BSSGP) Library Version: @VERSION@ Libs: -L${libdir} @TALLOC_LIBS@ -losmogb -losmovty -losmocore -Cflags: -I${includedir}/ -fno-strict-aliasing +Cflags: -I${includedir}/ -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Tue Dec 13 15:52:01 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 15:52:01 +0000 Subject: openbsc[master]: build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP In-Reply-To: References: Message-ID: Patch Set 2: This will likely break our debian packages as those still use 0.9.3 libosmocore. -- To view, visit https://gerrit.osmocom.org/1422 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 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 Tue Dec 13 17:50:48 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 17:50:48 +0000 Subject: [PATCH] libosmocore[master]: Catch-up with git version tags Message-ID: Review at https://gerrit.osmocom.org/1427 Catch-up with git version tags * update debian/changelog * update TODO-RELEASE Change-Id: I22c257e357f597519120232d742d6a61289db021 --- M TODO-RELEASE M debian/changelog 2 files changed, 26 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/1427/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 17f6521..b52538a 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,7 +1 @@ #library what description / commit summary line -libosmogsm internal API update Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths -libosmocore change major external talloc dependency / internal talloc removal -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information -libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker -libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/debian/changelog b/debian/changelog index 0877d27..ae05e69 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +libosmocore (0.9.6) yakkety; urgency=medium + + * doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs + * New upstream release of libosmocore. + + -- Max Tue, 13 Dec 2016 18:23:56 +0100 + +libosmocore (0.9.5) yakkety; urgency=medium + + * fix: DLGSUP logging category "unusable" + * New upstream release of libosmocore. + * ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information + * size of ph_tch_param struct changed / Extend with RTP Marker + * size of struct log_target changed / Extend with GSMTAP + + -- Max Tue, 13 Dec 2016 18:22:56 +0100 + +libosmocore (0.9.4) yakkety; urgency=medium + + * New upstream release of libosmocore. + * Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths + * external talloc dependency / internal talloc removal + * size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information + + -- Max Tue, 13 Dec 2016 18:21:56 +0100 + libosmocore (0.9.3) unstable; urgency=medium * Send all stats values after re-configuration. -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 13 18:01:22 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 13 Dec 2016 18:01:22 +0000 Subject: osmo-hlr[master]: bump required libosmocore version to 0.9.5 In-Reply-To: References: Message-ID: Patch Set 1: I think we should cleanup libosmocore version mess before merging this - see gerrit #1427. -- To view, visit https://gerrit.osmocom.org/1407 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd 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 Tue Dec 13 22:58:12 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Tue, 13 Dec 2016 22:58:12 +0000 Subject: libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 The point of TODO-RELEASE is to remember ABI changes. An ABI change requires increasing the version number of the .so files (see the libtool link in Makefile.am for exact rules but we only bump for incompatible versions). So the change should include Makefile.am changes, and renames in debian/*.install -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Dec 14 11:12:30 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Wed, 14 Dec 2016 11:12:30 +0000 Subject: [PATCH] osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu Message-ID: Review at https://gerrit.osmocom.org/1428 Adds rate_ctr_init in the startup of osmo-pcu Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b --- M src/pcu_main.cpp 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/28/1428/1 diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp index 4a75c79..0a0362b 100644 --- a/src/pcu_main.cpp +++ b/src/pcu_main.cpp @@ -221,6 +221,7 @@ osmo_init_logging(&gprs_log_info); osmo_stats_init(tall_pcu_ctx); + rate_ctr_init(tall_pcu_ctx); gprs_ns_set_log_ss(DNS); bssgp_set_log_ss(DBSSGP); -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari From gerrit-no-reply at lists.osmocom.org Wed Dec 14 11:55:08 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 11:55:08 +0000 Subject: [PATCH] libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Hello Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1427 to look at the new patch set (#2). Catch-up with git version tags * update debian/changelog * update TODO-RELEASE * add comments to Makefile.am and TODO-RELEASE to simplify the process in future Related: OS#1861 Change-Id: I22c257e357f597519120232d742d6a61289db021 --- M TODO-RELEASE M debian/changelog R debian/libosmocore8.install R debian/libosmogsm7.install M src/Makefile.am M src/gsm/Makefile.am 6 files changed, 38 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/1427/2 diff --git a/TODO-RELEASE b/TODO-RELEASE index 17f6521..fb0bfea 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,7 +1,9 @@ +# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install +# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info +# In short: +# LIBVERSION=c:r:a +# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. +# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0. +# If any interfaces have been added since the last public release: c:r:a + 1. +# If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -libosmogsm internal API update Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths -libosmocore change major external talloc dependency / internal talloc removal -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information -libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker -libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/debian/changelog b/debian/changelog index 0877d27..ae05e69 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +libosmocore (0.9.6) yakkety; urgency=medium + + * doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs + * New upstream release of libosmocore. + + -- Max Tue, 13 Dec 2016 18:23:56 +0100 + +libosmocore (0.9.5) yakkety; urgency=medium + + * fix: DLGSUP logging category "unusable" + * New upstream release of libosmocore. + * ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information + * size of ph_tch_param struct changed / Extend with RTP Marker + * size of struct log_target changed / Extend with GSMTAP + + -- Max Tue, 13 Dec 2016 18:22:56 +0100 + +libosmocore (0.9.4) yakkety; urgency=medium + + * New upstream release of libosmocore. + * Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths + * external talloc dependency / internal talloc removal + * size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information + + -- Max Tue, 13 Dec 2016 18:21:56 +0100 + libosmocore (0.9.3) unstable; urgency=medium * Send all stats values after re-configuration. diff --git a/debian/libosmocore7.install b/debian/libosmocore8.install similarity index 100% rename from debian/libosmocore7.install rename to debian/libosmocore8.install diff --git a/debian/libosmogsm5.install b/debian/libosmogsm7.install similarity index 100% rename from debian/libosmogsm5.install rename to debian/libosmogsm7.install diff --git a/src/Makefile.am b/src/Makefile.am index 6a9c675..937e324 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=7:0:0 +# Please read Chapter "Library interface versions" of the libtool documentation before making any modification: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=8:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall $(TALLOC_CFLAGS) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 4ea55e1..cae21b1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -1,6 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=6:0:1 +# Please read Chapter "Library interface versions" of the libtool documentation before making any modification: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=7:0:1 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 14 13:14:09 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 13:14:09 +0000 Subject: osmo-hlr[master]: bump required libosmocore version to 0.9.5 In-Reply-To: References: Message-ID: Patch Set 1: There is no mess in terms of the tag 0.9.5 to reference existing in the repository. We can merge this and clean up the changelogs / debian / tar releases independently. -- To view, visit https://gerrit.osmocom.org/1407 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd 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 Wed Dec 14 13:29:10 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 13:29:10 +0000 Subject: openbsc[master]: build: bump required libosmocore, libosmogsm to 0.9.4, for GSUP In-Reply-To: References: Message-ID: Patch Set 2: I'm not sure that it does. AFAICT the version number is determined only from the signed tag in the git repository. Admittedly, the debian files might reflect a version number mismatching the packaged software version number? -- To view, visit https://gerrit.osmocom.org/1422 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4f245a7d78d0889b37084c52478372bddb8289d6 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 Dec 14 13:54:51 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 13:54:51 +0000 Subject: [PATCH] openbsc[master]: Prevent segfault in range encoding Message-ID: Review at https://gerrit.osmocom.org/1429 Prevent segfault in range encoding Explicitly check when ARFCN array split is impossible and return gracefully instead of using negative index. Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Related: RT#7379 --- M openbsc/src/libbsc/arfcn_range_encode.c 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/29/1429/1 diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index dce864d..8260593 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -109,6 +109,8 @@ /* Now do the processing */ split_at = range_enc_find_index(range, arfcns, size); + if (split_at < 0) + return; /* we now know where to split */ out[index] = 1 + arfcns[split_at]; -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 14 14:18:18 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 14:18:18 +0000 Subject: [PATCH] openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1429 to look at the new patch set (#2). Prevent segfault in range encoding Explicitly check when ARFCN array split is impossible and return gracefully instead of using negative index. Add separate test-case for the segfault previously triggered by this bug. Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Related: RT#7379 --- M openbsc/src/libbsc/arfcn_range_encode.c M openbsc/tests/gsm0408/gsm0408_test.c M openbsc/tests/gsm0408/gsm0408_test.ok 3 files changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/29/1429/2 diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index 7f90ce1..59db69e 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -109,6 +109,8 @@ /* Now do the processing */ split_at = range_enc_find_index(range, arfcns, size); + if (split_at < 0) + return; /* we now know where to split */ out[index] = 1 + arfcns[split_at]; diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 9e7babb..9aa3164 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -120,6 +120,21 @@ gen(bts); } +static inline void test_si2q_segfault(void) +{ + struct gsm_bts *bts; + struct gsm_network *network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); + printf("Test SI2quater UARFCN (same scrambling code and diversity):\n"); + + if (!network) + exit(1); + bts = gsm_bts_alloc(network); + + _bts_uarfcn_add(bts, 10564, 319, 0); + _bts_uarfcn_add(bts, 10612, 319, 0); + gen(bts); +} + static inline void test_si2q_u(void) { struct gsm_bts *bts; @@ -590,6 +605,7 @@ test_range_encoding(); test_gsm411_rp_ref_wrap(); + test_si2q_segfault(); test_si2q_e(); test_si2q_u(); printf("Done.\n"); diff --git a/openbsc/tests/gsm0408/gsm0408_test.ok b/openbsc/tests/gsm0408/gsm0408_test.ok index ebe9476..f120fb3 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.ok +++ b/openbsc/tests/gsm0408/gsm0408_test.ok @@ -62,6 +62,10 @@ Allocated reference: 255 Allocated reference: 0 Allocated reference: 1 +Test SI2quater UARFCN (same scrambling code and diversity): +generated valid SI2quater: [23] 59 06 07 c0 00 25 52 88 0a 7e 10 99 64 00 0b 2b 2b 2b 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 52 e8 10 00 00 00 44 b2 00 03 2b 2b 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 52 e8 10 00 00 00 44 b2 00 03 2b 2b 2b 2b 2b 2b 2b Testing SYSINFO_TYPE_2quater EARFCN generation: generated invalid SI2quater: [23] 59 06 07 c0 00 04 86 59 0a 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b added EARFCN 1917 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be c8 50 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Dec 14 14:18:18 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 14:18:18 +0000 Subject: [PATCH] openbsc[master]: Cosmetic fixes around SI generation 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/1372 to look at the new patch set (#2). Cosmetic fixes around SI generation * add missing spaces after comma and minus * make range_enc_arfcns() return void instead of always returning 0 * prevent useless recursion calls * mark static function as such Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e --- M openbsc/include/openbsc/arfcn_range_encode.h M openbsc/src/libbsc/arfcn_range_encode.c M openbsc/src/libbsc/bsc_init.c M openbsc/src/libbsc/system_information.c 4 files changed, 12 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/72/1372/2 diff --git a/openbsc/include/openbsc/arfcn_range_encode.h b/openbsc/include/openbsc/arfcn_range_encode.h index bd85d6a..11192d1 100644 --- a/openbsc/include/openbsc/arfcn_range_encode.h +++ b/openbsc/include/openbsc/arfcn_range_encode.h @@ -14,7 +14,7 @@ #define RANGE_ENC_MAX_ARFCNS 29 int range_enc_determine_range(const int *arfcns, int size, int *f0_out); -int range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); +void range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); int range_enc_find_index(const int rng, const int *arfcns, int size); int range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included); diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index e67bf0a..7f90ce1 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -27,7 +27,7 @@ #include -int greatest_power_of_2_lesser_or_equal_to(int index) +static inline int greatest_power_of_2_lesser_or_equal_to(int index) { int power_of_2 = 1; @@ -79,7 +79,7 @@ * \param size The size of the list of ARFCNs * \param out Place to store the W(i) output. */ -int range_enc_arfcns(const int range, +void range_enc_arfcns(const int range, const int *arfcns, int size, int *out, const int index) { @@ -100,11 +100,11 @@ /* Test the two recursion anchors and stop processing */ if (size == 0) - return 0; + return; if (size == 1) { out[index] = 1 + arfcns[0]; - return 0; + return; } /* Now do the processing */ @@ -127,11 +127,12 @@ * Now recurse and we need to make this iterative... but as the * tree is balanced the stack will not be too deep. */ - range_enc_arfcns(range / 2, arfcns_left, l_size, + if (l_size) + range_enc_arfcns(range / 2, arfcns_left, l_size, out, index + greatest_power_of_2_lesser_or_equal_to(index + 1)); - range_enc_arfcns((range -1 ) / 2, arfcns_right, r_size, + if (r_size) + range_enc_arfcns((range - 1) / 2, arfcns_right, r_size, out, index + (2 * greatest_power_of_2_lesser_or_equal_to(index + 1))); - return 0; } /* diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 9e913d6..b17ff79 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -193,7 +193,7 @@ return 0; err_out: - LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>," + LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, " "most likely a problem with neighbor cell list generation\n", get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc)); return rc; diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 3f6d6b9..1b4145c 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -325,7 +325,7 @@ int w[RANGE_ENC_MAX_ARFCNS]; int f0_included = 0; int arfcns_used = 0; - int i, rc, range, f0; + int i, range, f0; /* * Select ARFCNs according to the rules in bitvec2freq_list @@ -354,9 +354,7 @@ f0, &f0_included); memset(w, 0, sizeof(w)); - rc = range_enc_arfcns(range, arfcns, arfcns_used, w, 0); - if (rc != 0) - return -3; + range_enc_arfcns(range, arfcns, arfcns_used, w, 0); /* Select the range and the amount of bits needed */ switch (range) { -- To view, visit https://gerrit.osmocom.org/1372 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e 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 Dec 14 14:29:16 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 14:29:16 +0000 Subject: openbsc[master]: Revert "Support Deactivate PDP Context Request from network" In-Reply-To: References: Message-ID: Patch Set 2: re-applying this patch will require a change: my_gprs_gsup_client_* was renamed to my_gsup_client_* by a patch merged to master recently. -- To view, visit https://gerrit.osmocom.org/1424 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02 Gerrit-PatchSet: 2 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 Wed Dec 14 14:39:57 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 14:39:57 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 This patch has an identical commit log message as #1398. Please be more specific in the summary line to distinguish patches, and please also write in the commit log which error you expect to fix with this. Looking forward to merging this once that is fixed. Thanks! -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Dec 14 14:43:20 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 14:43:20 +0000 Subject: [ABANDON] openbsc[master]: Add test-case which breaks range1024 encoding In-Reply-To: References: Message-ID: Max has abandoned this change. Change subject: Add test-case which breaks range1024 encoding ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/1373 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I99f917d80232b63d1bb518842c24517b3dd18be4 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 Wed Dec 14 17:03:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 17:03:24 +0000 Subject: [PATCH] libosmocore[master]: fsm: add LOGPFSML to pass explicit logging level Message-ID: Review at https://gerrit.osmocom.org/1430 fsm: add LOGPFSML to pass explicit logging level Provide one central LOGPFSML to print FSM information, take the FSM logging subsystem from the FSM instance but use an explicitly provided log level instead of the FSM's default level. Use to replace some, essentially, duplications of the LOGPFSM macro. In effect, the fsm_test's expected error changes, since the previous code dup for logging events used round braces to indicate the fi's state, while the central macro uses curly braces. Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 --- M include/osmocom/core/fsm.h M src/fsm.c M tests/fsm/fsm_test.err 3 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/30/1430/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index fba5497..026ed01 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -110,11 +110,14 @@ void osmo_fsm_log_addr(bool log_addr); -#define LOGPFSM(fi, fmt, args...) \ - LOGP((fi)->fsm->log_subsys, (fi)->log_level, "%s{%s}: " fmt, \ +#define LOGPFSML(fi, level, fmt, args...) \ + LOGP((fi)->fsm->log_subsys, level, "%s{%s}: " fmt, \ osmo_fsm_inst_name(fi), \ osmo_fsm_state_name((fi)->fsm, (fi)->state), ## args) +#define LOGPFSM(fi, fmt, args...) \ + LOGPFSML(fi, (fi)->log_level, fmt, ## args) + int osmo_fsm_register(struct osmo_fsm *fsm); void osmo_fsm_unregister(struct osmo_fsm *fsm); struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv, diff --git a/src/fsm.c b/src/fsm.c index 9dc6b98..1db39f7 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -311,11 +311,9 @@ /* validate if new_state is a valid state */ if (!(st->out_state_mask & (1 << new_state))) { - LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): transition to " - "state %s not permitted!\n", - osmo_fsm_inst_name(fi), - osmo_fsm_state_name(fsm, fi->state), - osmo_fsm_state_name(fsm, new_state)); + LOGPFSML(fi, LOGL_ERROR, + "transition to state %s not permitted!\n", + osmo_fsm_state_name(fsm, new_state)); return -EPERM; } @@ -376,10 +374,9 @@ } if (!((1 << event) & fs->in_event_mask)) { - LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): Event %s not " - "permitted\n", osmo_fsm_inst_name(fi), - osmo_fsm_state_name(fsm, fi->state), - osmo_fsm_event_name(fsm, event)); + LOGPFSML(fi, LOGL_ERROR, + "Event %s not permitted\n", + osmo_fsm_event_name(fsm, event)); return -1; } fs->action(fi, event, data); diff --git a/tests/fsm/fsm_test.err b/tests/fsm/fsm_test.err index b9c738c..c9021bb 100644 --- a/tests/fsm/fsm_test.err +++ b/tests/fsm/fsm_test.err @@ -1,7 +1,7 @@ Checking FSM allocation Test FSM{NULL}: Allocated Test FSM{NULL}: Received Event 1 -Test FSM(NULL): Event 1 not permitted +Test FSM{NULL}: Event 1 not permitted Test FSM{NULL}: Received Event 0 Test FSM{NULL}: state_chg to ONE Test FSM{ONE}: Received Event 1 -- To view, visit https://gerrit.osmocom.org/1430 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 14 17:03:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 17:03:24 +0000 Subject: [PATCH] libosmocore[master]: fsm: log caller's source for events and state changes, not f... Message-ID: Review at https://gerrit.osmocom.org/1431 fsm: log caller's source for events and state changes, not fsm.c lines When looking at log output, it is not interesting to see that a state transition's petty details are implemented in fsm.c. Rather log the *caller's* source file and line that caused an event, state change and cascading events. To that end, introduce LOGPSRC() absorbing the guts of LOGP(), to be able to explicitly pass the source file and line information. Prepend an underscore to the function names of osmo_fsm_inst_state_chg(), osmo_fsm_inst_dispatch() and osmo_fsm_inst_term(), and add file and line arguments to them. Provide the previous names as macros that insert the caller's __BASE_FILE__ and __LINE__ constants for the new arguments. Hence no calling code needs to be changed. In fsm.c, add LOGPFSMSRC to call LOGPSRC, and add LOGPFSMLSRC, and use them in above _osmo_fsm_inst_* functions. In addition, in _osmo_fsm_inst_term(), pass the caller's source file and line on to nested event dispatches, so showing where a cascade originated from. Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd --- M include/osmocom/core/fsm.h M include/osmocom/core/logging.h M src/fsm.c 3 files changed, 102 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/1431/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 026ed01..77072ef 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -131,11 +131,40 @@ const char *osmo_fsm_inst_name(struct osmo_fsm_inst *fi); const char *osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state); -int osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, - unsigned long timeout_secs, int T); -int osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data); +/*! \brief perform a state change of the given FSM instance + * + * This is a macro that calls _osmo_fsm_inst_state_chg() with the given + * parameters as well as the caller's source file and line number for logging + * purposes. See there for documentation. + */ +#define osmo_fsm_inst_state_chg(fi, new_state, timeout_secs, T) \ + _osmo_fsm_inst_state_chg(fi, new_state, timeout_secs, T, \ + __BASE_FILE__, __LINE__) +int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, + unsigned long timeout_secs, int T, + const char *file, int line); -void osmo_fsm_inst_term(struct osmo_fsm_inst *fi, - enum osmo_fsm_term_cause cause, void *data); +/*! \brief dispatch an event to an osmocom finite state machine instance + * + * This is a macro that calls _osmo_fsm_inst_dispatch() with the given + * parameters as well as the caller's source file and line number for logging + * purposes. See there for documentation. + */ +#define osmo_fsm_inst_dispatch(fi, event, data) \ + _osmo_fsm_inst_dispatch(fi, event, data, __BASE_FILE__, __LINE__) +int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, + const char *file, int line); + +/*! \brief Terminate FSM instance with given cause + * + * This is a macro that calls _osmo_fsm_inst_term() with the given parameters + * as well as the caller's source file and line number for logging purposes. + * See there for documentation. + */ +#define osmo_fsm_inst_term(fi, cause, data) \ + _osmo_fsm_inst_term(fi, cause, data, __BASE_FILE__, __LINE__) +void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, void *data, + const char *file, int line); /*! @} */ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 1ca348a..fe9ae93 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -55,10 +55,7 @@ * \param[in] args variable argument list */ #define LOGP(ss, level, fmt, args...) \ - do { \ - if (log_check_level(ss, level)) \ - logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ - } while(0) + LOGPSRC(ss, level, NULL, 0, fmt, ## args) /*! \brief Continue a log message through the Osmocom logging framework * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) @@ -72,6 +69,28 @@ logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \ } while(0) +/*! \brief Log through the Osmocom logging framework with explicit source. + * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used + * instead of caller_file and caller_line (so that this macro here defines + * both cases in the same place, and to catch cases where callers fail to pass + * a non-null filename string). + * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) + * \param[in] level logging level (e.g. \ref LOGL_NOTICE) + * \param[in] caller_file caller's source file string (e.g. __BASE_FILE__) + * \param[in] caller_line caller's source line nr (e.g. __LINE__) + * \param[in] fmt format string + * \param[in] args variable argument list + */ +#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \ + do { \ + if (log_check_level(ss, level)) {\ + if (caller_file) \ + logp2(ss, level, caller_file, caller_line, 0, fmt, ##args); \ + else \ + logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ + }\ + } while(0) + /*! \brief different log levels */ #define LOGL_DEBUG 1 /*!< \brief debugging information */ #define LOGL_INFO 3 /*!< \brief general information */ diff --git a/src/fsm.c b/src/fsm.c index 1db39f7..ef1b2ab 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -284,7 +284,24 @@ return fsm->states[state].name; } +#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ + LOGPSRC((fi)->fsm->log_subsys, level, \ + caller_file, caller_line, \ + "%s{%s}: " fmt, \ + osmo_fsm_inst_name(fi), \ + osmo_fsm_state_name((fi)->fsm, (fi)->state), \ + ## args) + +#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ + LOGPFSMLSRC(fi, (fi)->log_level, \ + caller_file, caller_line, \ + fmt, ## args) + /*! \brief perform a state change of the given FSM instance + * + * Best invoke via the osmo_fsm_inst_state_chg() macro which logs the source + * file where the state change was effected. Alternatively, you may pass \a + * file as NULL to use the normal file/line indication instead. * * All changes to the FSM instance state must be made via this * function. It verifies that the existing state actually permits a @@ -302,8 +319,9 @@ * \param[in] T Timer number (if \ref timeout_secs != 0) * \returns 0 on success; negative on error */ -int osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, - unsigned long timeout_secs, int T) +int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, + unsigned long timeout_secs, int T, + const char *file, int line) { struct osmo_fsm *fsm = fi->fsm; uint32_t old_state = fi->state; @@ -311,9 +329,9 @@ /* validate if new_state is a valid state */ if (!(st->out_state_mask & (1 << new_state))) { - LOGPFSML(fi, LOGL_ERROR, - "transition to state %s not permitted!\n", - osmo_fsm_state_name(fsm, new_state)); + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "transition to state %s not permitted!\n", + osmo_fsm_state_name(fsm, new_state)); return -EPERM; } @@ -323,7 +341,8 @@ if (st->onleave) st->onleave(fi, new_state); - LOGPFSM(fi, "state_chg to %s\n", osmo_fsm_state_name(fsm, new_state)); + LOGPFSMSRC(fi, file, line, "state_chg to %s\n", + osmo_fsm_state_name(fsm, new_state)); fi->state = new_state; st = &fsm->states[new_state]; @@ -341,6 +360,10 @@ /*! \brief dispatch an event to an osmocom finite state machine instance * + * Best invoke via the osmo_fsm_inst_dispatch() macro which logs the source + * file where the event was effected. Alternatively, you may pass \a file as + * NULL to use the normal file/line indication instead. + * * Any incoming events to \ref osmo_fsm instances must be dispatched to * them via this function. It verifies, whether the event is permitted * based on the current state of the FSM. If not, -1 is returned. @@ -350,7 +373,8 @@ * \param[in] data Data to pass along with the event * \returns 0 in case of success; negative on error */ -int osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data) +int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, + const char *file, int line) { struct osmo_fsm *fsm; const struct osmo_fsm_state *fs; @@ -366,7 +390,8 @@ OSMO_ASSERT(fi->state < fsm->num_states); fs = &fi->fsm->states[fi->state]; - LOGPFSM(fi, "Received Event %s\n", osmo_fsm_event_name(fsm, event)); + LOGPFSMSRC(fi, file, line, + "Received Event %s\n", osmo_fsm_event_name(fsm, event)); if (((1 << event) & fsm->allstate_event_mask) && fsm->allstate_action) { fsm->allstate_action(fi, event, data); @@ -374,9 +399,9 @@ } if (!((1 << event) & fs->in_event_mask)) { - LOGPFSML(fi, LOGL_ERROR, - "Event %s not permitted\n", - osmo_fsm_event_name(fsm, event)); + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "Event %s not permitted\n", + osmo_fsm_event_name(fsm, event)); return -1; } fs->action(fi, event, data); @@ -398,19 +423,21 @@ * \param[in] cause Cause / reason for termination * \param[in] data Opaqueevent data to be passed to parent */ -void osmo_fsm_inst_term(struct osmo_fsm_inst *fi, - enum osmo_fsm_term_cause cause, void *data) +void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, void *data, + const char *file, int line) { struct osmo_fsm_inst *child, *child2; struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; - LOGPFSM(fi, "Terminating (cause = %u)\n", cause); + LOGPFSMSRC(fi, file, line, "Terminating (cause = %u)\n", cause); /* iterate over all children */ llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { /* terminate child */ - osmo_fsm_inst_term(child, OSMO_FSM_TERM_PARENT, NULL); + _osmo_fsm_inst_term(child, OSMO_FSM_TERM_PARENT, NULL, + file, line); } /* delete ourselves from the parent */ @@ -420,12 +447,13 @@ if (fi->fsm->cleanup) fi->fsm->cleanup(fi, cause); - LOGPFSM(fi, "Release\n"); + LOGPFSMSRC(fi, file, line, "Release\n"); osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ if (parent && cause != OSMO_FSM_TERM_PARENT) - osmo_fsm_inst_dispatch(parent, parent_term_event, data); + _osmo_fsm_inst_dispatch(parent, parent_term_event, data, + file, line); } /*! @} */ -- To view, visit https://gerrit.osmocom.org/1431 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 14 17:04:14 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 17:04:14 +0000 Subject: libosmocore[master]: fsm: log caller's source for events and state changes, not f... In-Reply-To: References: Message-ID: Patch Set 1: I think this is pretty neat, but feel free to disagree... -- To view, visit https://gerrit.osmocom.org/1431 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Dec 14 17:36:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 17:36:17 +0000 Subject: [PATCH] libosmocore[master]: typo in comment for osmo_fsm_log_addr() Message-ID: Review at https://gerrit.osmocom.org/1432 typo in comment for osmo_fsm_log_addr() Change-Id: I6f683ed0c864a87bf1232994eb2deaf9b313a244 --- M src/fsm.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/1432/1 diff --git a/src/fsm.c b/src/fsm.c index ef1b2ab..dc57e5e 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -92,7 +92,7 @@ /*! \brief specify if FSM instance addresses should be logged or not * * By default, the FSM name includes the pointer address of the \ref - * osmo_fsm_inst. This behaviro can be disabled (and re-enabled) + * osmo_fsm_inst. This behavior can be disabled (and re-enabled) * using this function. * * \param[in] log_addr Indicate if FSM instance address shall be logged -- To view, visit https://gerrit.osmocom.org/1432 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6f683ed0c864a87bf1232994eb2deaf9b313a244 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 14 17:36:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 14 Dec 2016 17:36:17 +0000 Subject: [PATCH] libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... Message-ID: Review at https://gerrit.osmocom.org/1433 add value strings for enum osmo_fsm_term_cause and use for logging Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 21 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/1433/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 77072ef..72e6018 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -30,6 +30,9 @@ OSMO_FSM_TERM_TIMEOUT, }; +extern const struct value_string osmo_fsm_term_cause_names[]; +const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause); + /*! \brief description of a rule in the FSM */ struct osmo_fsm_state { /*! \brief bit-mask of permitted input events for this state */ diff --git a/src/fsm.c b/src/fsm.c index dc57e5e..034193c 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -431,7 +431,8 @@ struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; - LOGPFSMSRC(fi, file, line, "Terminating (cause = %u)\n", cause); + LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", + osmo_fsm_term_cause_name(cause)); /* iterate over all children */ llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { @@ -456,4 +457,20 @@ file, line); } +#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } + +const struct value_string osmo_fsm_term_cause_names[] = { + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + { 0, NULL } +}; + +const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause) +{ + return get_value_string(osmo_fsm_term_cause_names, cause); +} + /*! @} */ -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 14 17:51:18 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 17:51:18 +0000 Subject: libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... In-Reply-To: References: Message-ID: Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/1433/1/src/fsm.c File src/fsm.c: Line 460: #define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } This seems like generally useful macro. Perhaps move to utils? Line 471: const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause) I thought the consensus was to use get_value_string directly instead of introducing more 1-line functions. -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 Gerrit-PatchSet: 1 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 Wed Dec 14 17:57:19 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 17:57:19 +0000 Subject: libosmocore[master]: fsm: add LOGPFSML to pass explicit logging level In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1430 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 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 Wed Dec 14 18:17:57 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 14 Dec 2016 18:17:57 +0000 Subject: osmo-bts[master]: DTX: fix TS adjustment for ONSET In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 Seems to be ok. -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Gerrit-PatchSet: 2 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 Dec 15 01:04:30 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 01:04:30 +0000 Subject: libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... In-Reply-To: References: Message-ID: Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/1433/1/src/fsm.c File src/fsm.c: Line 460: #define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } > This seems like generally useful macro. Perhaps move to utils? I think I use a similar one in gtphub somewhere, IIRC... do other reviewers think it's worth putting this in a public header? It would need an OSMO_ prefix then, right? Line 471: const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause) > I thought the consensus was to use get_value_string directly instead of int I remember it so that we agreed to provide the value strings array publicly (this one is, it's declared in the .h) and to add a ... :) ... an inline function if we like. Gotcha, this isn't an inline function. Generally: we do have quite a number of shim functions to shortcut for get_value_string(long_array_name, enum_val), and I find them very useful, and I intend to add more as I go. I wish I could link to the comment directly, but see Harald's comment on PS3: https://gerrit.osmocom.org/267 ... I will change this into an inline function then. -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 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: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 15 01:26:36 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 01:26:36 +0000 Subject: [PATCH] libosmocore[master]: fsm: explicitly log attempt to transition to same state Message-ID: Review at https://gerrit.osmocom.org/1434 fsm: explicitly log attempt to transition to same state Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3 --- M src/fsm.c 1 file changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/34/1434/1 diff --git a/src/fsm.c b/src/fsm.c index 034193c..d5c8f96 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -327,6 +327,14 @@ uint32_t old_state = fi->state; const struct osmo_fsm_state *st = &fsm->states[fi->state]; + /* refuse nop transition */ + if (old_state == new_state) { + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "already in state %s\n", + osmo_fsm_state_name(fsm, old_state)); + return -EINVAL; + } + /* validate if new_state is a valid state */ if (!(st->out_state_mask & (1 << new_state))) { LOGPFSMLSRC(fi, LOGL_ERROR, file, line, -- To view, visit https://gerrit.osmocom.org/1434 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 15 01:36:51 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 01:36:51 +0000 Subject: [PATCH] libosmocore[master]: fsm: explicitly log removal from parent fsm Message-ID: Review at https://gerrit.osmocom.org/1435 fsm: explicitly log removal from parent fsm Since removing an FSM from its parent twice causes a segfault, it is very interesting to see when that is attempted. Removing could be made more robust, but logging is interesting for investigating why an FSM is being removed twice in the first place (currently the case in openbsc's vlr_lu_fsm). Change-Id: Idec6b7aa5344f1e903c9d2aa2a3640cab0d70fb0 --- M src/fsm.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/35/1435/1 diff --git a/src/fsm.c b/src/fsm.c index d5c8f96..35831df 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -450,6 +450,9 @@ } /* delete ourselves from the parent */ + if (parent) + LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", + osmo_fsm_inst_name(parent)); llist_del(&fi->proc.child); /* call destructor / clean-up function */ -- To view, visit https://gerrit.osmocom.org/1435 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idec6b7aa5344f1e903c9d2aa2a3640cab0d70fb0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 15 07:24:27 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Thu, 15 Dec 2016 07:24:27 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for TbfTest In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1411/1//COMMIT_MSG Commit Message: Line 9: Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Modify the commit message specific to issue it fixes -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 15 07:30:56 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Thu, 15 Dec 2016 07:30:56 +0000 Subject: [PATCH] osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... 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/1411 to look at the new patch set (#2). Sanitizer build fix for invalid value of variable of type egprs_puncturing_values This patch is probable fix for "tbf_dl.cpp:766:65: runtime error: load of value 32766, which is not a valid value for type 'egprs_puncturing_values'" Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 --- M src/tbf_dl.cpp 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/1411/2 diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 2af2ff0..dfbacb2 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -627,7 +627,8 @@ GprsCodingScheme cs; int bsns[ARRAY_SIZE(rlc.block_info)]; unsigned num_bsns; - enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)]; + enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)] = + {EGPRS_PS_INVALID}; bool need_padding = false; enum egprs_rlcmac_dl_spb spb = EGPRS_RLCMAC_DL_NO_RETX; unsigned int spb_status = get_egprs_dl_spb_status(index); -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Thu Dec 15 07:31:59 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Thu, 15 Dec 2016 07:31:59 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1411/2//COMMIT_MSG Commit Message: Line 7: Sanitizer build fix for invalid value of variable of type egprs_puncturing_values fix empty space -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 15 07:32:30 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Thu, 15 Dec 2016 07:32:30 +0000 Subject: [PATCH] osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... 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/1411 to look at the new patch set (#3). Sanitizer build fix for invalid value of variable of type egprs_puncturing_values This patch is probable fix for "tbf_dl.cpp:766:65: runtime error: load of value 32766, which is not a valid value for type 'egprs_puncturing_values'" Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 --- M src/tbf_dl.cpp 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/1411/3 diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 2af2ff0..dfbacb2 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -627,7 +627,8 @@ GprsCodingScheme cs; int bsns[ARRAY_SIZE(rlc.block_info)]; unsigned num_bsns; - enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)]; + enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)] = + {EGPRS_PS_INVALID}; bool need_padding = false; enum egprs_rlcmac_dl_spb spb = EGPRS_RLCMAC_DL_NO_RETX; unsigned int spb_status = get_egprs_dl_spb_status(index); -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Thu Dec 15 07:32:53 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Thu, 15 Dec 2016 07:32:53 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 10:28:58 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 10:28:58 +0000 Subject: osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 10:30:04 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 10:30:04 +0000 Subject: osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Patch Set 1: A bit more information in the commit log would be nice: how was it working before? what's the issue this fixes? -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 10:36:04 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 10:36:04 +0000 Subject: [PATCH] libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1433 to look at the new patch set (#2). add value strings for enum osmo_fsm_term_cause and use for logging Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 20 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/1433/2 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 77072ef..5a67961 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -30,6 +30,13 @@ OSMO_FSM_TERM_TIMEOUT, }; +extern const struct value_string osmo_fsm_term_cause_names[]; +static inline const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause) +{ + return get_value_string(osmo_fsm_term_cause_names, cause); +} + + /*! \brief description of a rule in the FSM */ struct osmo_fsm_state { /*! \brief bit-mask of permitted input events for this state */ diff --git a/src/fsm.c b/src/fsm.c index dc57e5e..d251cfd 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -431,7 +431,8 @@ struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; - LOGPFSMSRC(fi, file, line, "Terminating (cause = %u)\n", cause); + LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", + osmo_fsm_term_cause_name(cause)); /* iterate over all children */ llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { @@ -456,4 +457,15 @@ file, line); } +#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } + +const struct value_string osmo_fsm_term_cause_names[] = { + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + { 0, NULL } +}; + /*! @} */ -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 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 Thu Dec 15 10:50:16 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 10:50:16 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 3: > Patch Set 3: Code-Review+1 Aravind, it's of no use to give a CR+1 to your own patches, only produces noise... -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 11:14:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 11:14:23 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 3: Code-Review-1 (2 comments) https://gerrit.osmocom.org/#/c/1411/3//COMMIT_MSG Commit Message: Line 7: Sanitizer build fix for invalid value of variable of type egprs_puncturing_values Now that I've looked at the patch in more detail, I notice another problem with this commit log. Let's look at what this is: the sanitizer build shows a failure. The sanitizer build is not a goal in itself, it shows bugs that we fix. This patch suggests that you've found an actual bug in the code, hence the commit log should focus on the bug. What was wrong before, how did you fix it? Mentioning the error fixed in the sanitizer build is also good to mention, but should not be the center stage of this commit log. https://gerrit.osmocom.org/#/c/1411/3/src/tbf_dl.cpp File src/tbf_dl.cpp: Line 631: {EGPRS_PS_INVALID}; Are you aware that you're initializing only the first element of the array to _INVALID? The rest are set to zero instead, incidentally EGPRS_PS_1. Observe the output of #include int main(void){ int foo[10] = {23}; int i; for (i = 0; i < 10; i++) printf("[%d] = %d\n", i, foo[i]); return 0; } Furthermore it looks to me like this is a cover-up for a real failure. Somewhere below, it seems to me, an element of this array is failed to be initialized, although the general logic looks like we expect each element to be initialized individually. By initializing to "invalid"/zero, we don't run into the sanitizer failure because the value is now a valid enum val, but we've not fixed the missing initialization issue at all. Am I guessing right? -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 15 11:35:03 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 11:35:03 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 3: gprs_rlc_mcs_cps(), where the puncturing values are passed into, does not check against *_INVALID items, but simply uses them. So now I'm sure that this patch is not "the real" fix. -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 11:56:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 15 Dec 2016 11:56:27 +0000 Subject: [ABANDON] libosmocore[master]: gsm0480.c: code dup: have common msgb alloc functions In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: gsm0480.c: code dup: have common msgb alloc functions ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/1341 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I029551dd74410ad6f326ce52eb7a75d912d3b875 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 Dec 15 12:13:55 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Thu, 15 Dec 2016 12:13:55 +0000 Subject: [PATCH] osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1428 to look at the new patch set (#2). Adds rate_ctr_init in the startup of osmo-pcu Issue:Though the rate_ctr framework is used in osmo-pcu for bts statistics, the interval counters are always 0. Fix:rate_ctr_init is added in the startup which arms the timer and hence the rate ctr intervals is displayed with proper values. Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b --- M src/pcu_main.cpp 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/28/1428/2 diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp index 4a75c79..0a0362b 100644 --- a/src/pcu_main.cpp +++ b/src/pcu_main.cpp @@ -221,6 +221,7 @@ osmo_init_logging(&gprs_log_info); osmo_stats_init(tall_pcu_ctx); + rate_ctr_init(tall_pcu_ctx); gprs_ns_set_log_ss(DNS); bssgp_set_log_ss(DBSSGP); -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 15 12:15:25 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 12:15:25 +0000 Subject: osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 16:05:19 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 16:05:19 +0000 Subject: libosmocore[master]: fsm: explicitly log attempt to transition to same state In-Reply-To: References: Message-ID: Patch Set 1: I think it should be NOTICE not ERROR - same state transition is a perfectly valid thing when it comes to FSM. -- To view, visit https://gerrit.osmocom.org/1434 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3 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 Dec 15 16:32:43 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 16:32:43 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: Note, this only fixes the segfault itself - the generated data is still incorrect. -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Gerrit-PatchSet: 2 Gerrit-Project: openbsc 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 Dec 15 19:04:10 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 19:04:10 +0000 Subject: [PATCH] libosmo-abis[master]: Enable adaptive jitter compensation Message-ID: Review at https://gerrit.osmocom.org/1436 Enable adaptive jitter compensation Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 --- M src/trau/osmo_ortp.c 1 file changed, 4 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/36/1436/1 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 0f0b9e5..2a81aa9 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -288,17 +288,16 @@ int rc = 0; switch (param) { + case OSMO_RTP_P_JIT_ADAP: + rtp_session_enable_adaptive_jitter_compensation(rs->sess, + (bool)val); + /* fall-through on-purpose - we have to set val anyway */ case OSMO_RTP_P_JITBUF: rtp_session_enable_jitter_buffer(rs->sess, (val) ? TRUE : FALSE); if (val) rtp_session_set_jitter_compensation(rs->sess, val); break; -#if 0 - case OSMO_RTP_P_JIT_ADAP: - rc = jitter_control_enable_adaptive(rs->sess, val); - break; -#endif default: return -EINVAL; } @@ -332,7 +331,6 @@ rtp_session_set_data(rs->sess, rs); rtp_session_set_profile(rs->sess, osmo_pt_profile); rtp_session_set_jitter_compensation(rs->sess, 100); - //jitter_control_enable_adaptive(rs->sess, 0); rtp_session_signal_connect(rs->sess, "ssrc_changed", (RtpCallback) ortp_sig_cb_ssrc, -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 15 19:04:55 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 19:04:55 +0000 Subject: libosmo-abis[master]: Enable adaptive jitter compensation In-Reply-To: References: Message-ID: Patch Set 1: Note: the bts side support for adaptive compensation have not been tested yet. -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis 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 Dec 15 19:06:17 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 15 Dec 2016 19:06:17 +0000 Subject: [PATCH] osmo-bts[master]: DTX: fix TS adjustment for ONSET 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/1399 to look at the new patch set (#3). DTX: fix TS adjustment for ONSET Previously timestamp was always adjusted according to FN difference. In case of ONSET event this causes unnecessary TS gap with subsequent speech packet. Fix this by checking Marker bit before performing adjustment. Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Related: OS#1801 --- M src/common/l1sap.c 1 file changed, 15 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/99/1399/3 diff --git a/src/common/l1sap.c b/src/common/l1sap.c index cfa02bd..e9c94f0 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -71,16 +71,26 @@ static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); -static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn) +static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan) { - if (last_fn != LCHAN_FN_DUMMY) { + 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) + return GSM_RTP_DURATION; + + if (lchan->tch.last_fn != LCHAN_FN_DUMMY) { /* 12/13 frames usable for audio in TCH, 160 samples per RTP packet, 1 RTP packet per 4 frames */ - uint32_t samples_passed = (fn - last_fn) * 12 * 160 / (13 * 4); + samples_passed = (fn - lchan->tch.last_fn) * 12 * 160 / (13 * 4); /* round number of samples to the nearest multiple of GSM_RTP_DURATION */ - uint32_t r = samples_passed + GSM_RTP_DURATION / 2; + r = samples_passed + GSM_RTP_DURATION / 2; r -= r % GSM_RTP_DURATION; return r; } @@ -912,7 +922,7 @@ /* hand msg to RTP code for transmission */ if (lchan->abis_ip.rtp_socket) osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket, - msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker); + msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker); /* if loopback is enabled, also queue received RTP data */ if (lchan->loopback) { -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c 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 Dec 15 19:56:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 19:56:05 +0000 Subject: [PATCH] openggsn[master]: gtp.c: Improve debug statements about GTP header flags Message-ID: Review at https://gerrit.osmocom.org/1437 gtp.c: Improve debug statements about GTP header flags * as there are muptiple flags in the field, use plural * print the flags as hex value, not decimal. Hex is customary for bitfields. Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b --- M gtp/gtp.c 1 file changed, 8 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/37/1437/1 diff --git a/gtp/gtp.c b/gtp/gtp.c index dcbe777..42aa4ea 100644 --- a/gtp/gtp.c +++ b/gtp/gtp.c @@ -210,7 +210,7 @@ } else if ((packet->flags & 0xe2) == 0x22) { /* Version 1 with seq */ return ntoh16(packet->gtp1l.h.seq); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return 0; } } @@ -246,7 +246,7 @@ } else if ((packet->flags & 0xe7) == 0x20) { /* Short version 1 */ return GTP1_HEADER_SIZE_SHORT; } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return 0; } } @@ -265,7 +265,7 @@ } else if ((packet->flags & 0xe0) == 0x20) { /* Version 1 */ return ntoh32(packet->gtp1l.h.tei); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return 0xffffffff; } } @@ -388,7 +388,7 @@ packet->gtp1l.h.tei = hton32(pdp->teic_gn); fd = gsn->fd1c; } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return -1; } @@ -537,7 +537,7 @@ else if (pdp) packet->gtp1l.h.tei = hton32(pdp->teic_gn); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return -1; } @@ -595,7 +595,7 @@ packet->gtp1l.h.length = hton16(len - GTP1_HEADER_SIZE_SHORT); packet->gtp1l.h.seq = hton16(seq); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return -1; } @@ -2864,7 +2864,7 @@ if (((pheader->flags & 0xf7) != 0x32)) { gsn->unsup++; GTP_LOGPKG(LOGL_ERROR, &peer, buffer, - status, "Unsupported packet flag\n"); + status, "Unsupported packet flags: 0x%02x\n", pheader->flags); continue; } @@ -3039,7 +3039,7 @@ if (((pheader->flags & 0xf5) != 0x30)) { gsn->unsup++; GTP_LOGPKG(LOGL_ERROR, &peer, buffer, - status, "Unsupported packet flag\n"); + status, "Unsupported packet flags 0x%02x\n", pheader->flags); continue; } -- To view, visit https://gerrit.osmocom.org/1437 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Dec 15 19:56:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 19:56:56 +0000 Subject: osmo-bts[master]: DTX: fix TS adjustment for ONSET In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 19:57:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 19:57:04 +0000 Subject: [MERGED] osmo-bts[master]: DTX: fix TS adjustment for ONSET In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: DTX: fix TS adjustment for ONSET ...................................................................... DTX: fix TS adjustment for ONSET Previously timestamp was always adjusted according to FN difference. In case of ONSET event this causes unnecessary TS gap with subsequent speech packet. Fix this by checking Marker bit before performing adjustment. Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Related: OS#1801 --- M src/common/l1sap.c 1 file changed, 15 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/l1sap.c b/src/common/l1sap.c index cfa02bd..e9c94f0 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -71,16 +71,26 @@ static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap); -static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn) +static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan) { - if (last_fn != LCHAN_FN_DUMMY) { + 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) + return GSM_RTP_DURATION; + + if (lchan->tch.last_fn != LCHAN_FN_DUMMY) { /* 12/13 frames usable for audio in TCH, 160 samples per RTP packet, 1 RTP packet per 4 frames */ - uint32_t samples_passed = (fn - last_fn) * 12 * 160 / (13 * 4); + samples_passed = (fn - lchan->tch.last_fn) * 12 * 160 / (13 * 4); /* round number of samples to the nearest multiple of GSM_RTP_DURATION */ - uint32_t r = samples_passed + GSM_RTP_DURATION / 2; + r = samples_passed + GSM_RTP_DURATION / 2; r -= r % GSM_RTP_DURATION; return r; } @@ -912,7 +922,7 @@ /* hand msg to RTP code for transmission */ if (lchan->abis_ip.rtp_socket) osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket, - msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker); + msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker); /* if loopback is enabled, also queue received RTP data */ if (lchan->loopback) { -- To view, visit https://gerrit.osmocom.org/1399 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Gerrit-PatchSet: 4 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 Dec 15 19:58:12 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 19:58:12 +0000 Subject: libosmo-abis[master]: Enable adaptive jitter compensation In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-2 we cannot enable it unconditionally. We have to keep the current behavior but can add a vty command to enable it on user request. -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis 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 Dec 15 19:58:37 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 19:58:37 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 would like to see holgers comment on this. -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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 Dec 15 20:00:38 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:00:38 +0000 Subject: libosmocore[master]: fsm: explicitly log attempt to transition to same state In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 I don't think this is the right approach. The FSM can very well define that the current state is permitted as a next state of the FSM. Also, in formal descriptions of FSMs in ITU/3GPP specs you often see states pointing back to themselves. So I think when an osmo_fsm is defined, you as the author can decide if you want to permit the current state as a possible exit state or not. If it is permitted, it is fine. If not, then an error message and/or negative return code are appropriate. -- To view, visit https://gerrit.osmocom.org/1434 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3 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 Thu Dec 15 20:05:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:05:24 +0000 Subject: libosmocore[master]: fsm: add LOGPFSML to pass explicit logging level In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1430 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 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 Thu Dec 15 20:06:37 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:06:37 +0000 Subject: libosmocore[master]: fsm: log caller's source for events and state changes, not f... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 I really like this! -- To view, visit https://gerrit.osmocom.org/1431 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 20:06:44 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:06:44 +0000 Subject: libosmocore[master]: typo in comment for osmo_fsm_log_addr() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1432 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6f683ed0c864a87bf1232994eb2deaf9b313a244 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 Dec 15 20:15:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:15:56 +0000 Subject: libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... In-Reply-To: References: Message-ID: Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/1433/1/src/fsm.c File src/fsm.c: Line 460: #define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } > I think I use a similar one in gtphub somewhere, IIRC... do other reviewers Yes, please let's add that. Line 471: const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause) > I remember it so that we agreed to provide the value strings array publicly Yes, an inline wrapper function should be the way to go. Gives us best of both worlds. We should keep old non-inline functions. Or is there any advantage of a "real" function that I miss out? -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 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-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 15 20:16:03 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:16:03 +0000 Subject: [MERGED] libosmocore[master]: typo in comment for osmo_fsm_log_addr() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: typo in comment for osmo_fsm_log_addr() ...................................................................... typo in comment for osmo_fsm_log_addr() Change-Id: I6f683ed0c864a87bf1232994eb2deaf9b313a244 --- M src/fsm.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index ef1b2ab..dc57e5e 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -92,7 +92,7 @@ /*! \brief specify if FSM instance addresses should be logged or not * * By default, the FSM name includes the pointer address of the \ref - * osmo_fsm_inst. This behaviro can be disabled (and re-enabled) + * osmo_fsm_inst. This behavior can be disabled (and re-enabled) * using this function. * * \param[in] log_addr Indicate if FSM instance address shall be logged -- To view, visit https://gerrit.osmocom.org/1432 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6f683ed0c864a87bf1232994eb2deaf9b313a244 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 Dec 15 20:16:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:16:06 +0000 Subject: [MERGED] libosmocore[master]: fsm: log caller's source for events and state changes, not f... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: log caller's source for events and state changes, not fsm.c lines ...................................................................... fsm: log caller's source for events and state changes, not fsm.c lines When looking at log output, it is not interesting to see that a state transition's petty details are implemented in fsm.c. Rather log the *caller's* source file and line that caused an event, state change and cascading events. To that end, introduce LOGPSRC() absorbing the guts of LOGP(), to be able to explicitly pass the source file and line information. Prepend an underscore to the function names of osmo_fsm_inst_state_chg(), osmo_fsm_inst_dispatch() and osmo_fsm_inst_term(), and add file and line arguments to them. Provide the previous names as macros that insert the caller's __BASE_FILE__ and __LINE__ constants for the new arguments. Hence no calling code needs to be changed. In fsm.c, add LOGPFSMSRC to call LOGPSRC, and add LOGPFSMLSRC, and use them in above _osmo_fsm_inst_* functions. In addition, in _osmo_fsm_inst_term(), pass the caller's source file and line on to nested event dispatches, so showing where a cascade originated from. Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd --- M include/osmocom/core/fsm.h M include/osmocom/core/logging.h M src/fsm.c 3 files changed, 102 insertions(+), 26 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/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 026ed01..77072ef 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -131,11 +131,40 @@ const char *osmo_fsm_inst_name(struct osmo_fsm_inst *fi); const char *osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state); -int osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, - unsigned long timeout_secs, int T); -int osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data); +/*! \brief perform a state change of the given FSM instance + * + * This is a macro that calls _osmo_fsm_inst_state_chg() with the given + * parameters as well as the caller's source file and line number for logging + * purposes. See there for documentation. + */ +#define osmo_fsm_inst_state_chg(fi, new_state, timeout_secs, T) \ + _osmo_fsm_inst_state_chg(fi, new_state, timeout_secs, T, \ + __BASE_FILE__, __LINE__) +int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, + unsigned long timeout_secs, int T, + const char *file, int line); -void osmo_fsm_inst_term(struct osmo_fsm_inst *fi, - enum osmo_fsm_term_cause cause, void *data); +/*! \brief dispatch an event to an osmocom finite state machine instance + * + * This is a macro that calls _osmo_fsm_inst_dispatch() with the given + * parameters as well as the caller's source file and line number for logging + * purposes. See there for documentation. + */ +#define osmo_fsm_inst_dispatch(fi, event, data) \ + _osmo_fsm_inst_dispatch(fi, event, data, __BASE_FILE__, __LINE__) +int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, + const char *file, int line); + +/*! \brief Terminate FSM instance with given cause + * + * This is a macro that calls _osmo_fsm_inst_term() with the given parameters + * as well as the caller's source file and line number for logging purposes. + * See there for documentation. + */ +#define osmo_fsm_inst_term(fi, cause, data) \ + _osmo_fsm_inst_term(fi, cause, data, __BASE_FILE__, __LINE__) +void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, void *data, + const char *file, int line); /*! @} */ diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 1ca348a..fe9ae93 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -55,10 +55,7 @@ * \param[in] args variable argument list */ #define LOGP(ss, level, fmt, args...) \ - do { \ - if (log_check_level(ss, level)) \ - logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ - } while(0) + LOGPSRC(ss, level, NULL, 0, fmt, ## args) /*! \brief Continue a log message through the Osmocom logging framework * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) @@ -72,6 +69,28 @@ logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \ } while(0) +/*! \brief Log through the Osmocom logging framework with explicit source. + * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used + * instead of caller_file and caller_line (so that this macro here defines + * both cases in the same place, and to catch cases where callers fail to pass + * a non-null filename string). + * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) + * \param[in] level logging level (e.g. \ref LOGL_NOTICE) + * \param[in] caller_file caller's source file string (e.g. __BASE_FILE__) + * \param[in] caller_line caller's source line nr (e.g. __LINE__) + * \param[in] fmt format string + * \param[in] args variable argument list + */ +#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \ + do { \ + if (log_check_level(ss, level)) {\ + if (caller_file) \ + logp2(ss, level, caller_file, caller_line, 0, fmt, ##args); \ + else \ + logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ + }\ + } while(0) + /*! \brief different log levels */ #define LOGL_DEBUG 1 /*!< \brief debugging information */ #define LOGL_INFO 3 /*!< \brief general information */ diff --git a/src/fsm.c b/src/fsm.c index 1db39f7..ef1b2ab 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -284,7 +284,24 @@ return fsm->states[state].name; } +#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ + LOGPSRC((fi)->fsm->log_subsys, level, \ + caller_file, caller_line, \ + "%s{%s}: " fmt, \ + osmo_fsm_inst_name(fi), \ + osmo_fsm_state_name((fi)->fsm, (fi)->state), \ + ## args) + +#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ + LOGPFSMLSRC(fi, (fi)->log_level, \ + caller_file, caller_line, \ + fmt, ## args) + /*! \brief perform a state change of the given FSM instance + * + * Best invoke via the osmo_fsm_inst_state_chg() macro which logs the source + * file where the state change was effected. Alternatively, you may pass \a + * file as NULL to use the normal file/line indication instead. * * All changes to the FSM instance state must be made via this * function. It verifies that the existing state actually permits a @@ -302,8 +319,9 @@ * \param[in] T Timer number (if \ref timeout_secs != 0) * \returns 0 on success; negative on error */ -int osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, - unsigned long timeout_secs, int T) +int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, + unsigned long timeout_secs, int T, + const char *file, int line) { struct osmo_fsm *fsm = fi->fsm; uint32_t old_state = fi->state; @@ -311,9 +329,9 @@ /* validate if new_state is a valid state */ if (!(st->out_state_mask & (1 << new_state))) { - LOGPFSML(fi, LOGL_ERROR, - "transition to state %s not permitted!\n", - osmo_fsm_state_name(fsm, new_state)); + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "transition to state %s not permitted!\n", + osmo_fsm_state_name(fsm, new_state)); return -EPERM; } @@ -323,7 +341,8 @@ if (st->onleave) st->onleave(fi, new_state); - LOGPFSM(fi, "state_chg to %s\n", osmo_fsm_state_name(fsm, new_state)); + LOGPFSMSRC(fi, file, line, "state_chg to %s\n", + osmo_fsm_state_name(fsm, new_state)); fi->state = new_state; st = &fsm->states[new_state]; @@ -341,6 +360,10 @@ /*! \brief dispatch an event to an osmocom finite state machine instance * + * Best invoke via the osmo_fsm_inst_dispatch() macro which logs the source + * file where the event was effected. Alternatively, you may pass \a file as + * NULL to use the normal file/line indication instead. + * * Any incoming events to \ref osmo_fsm instances must be dispatched to * them via this function. It verifies, whether the event is permitted * based on the current state of the FSM. If not, -1 is returned. @@ -350,7 +373,8 @@ * \param[in] data Data to pass along with the event * \returns 0 in case of success; negative on error */ -int osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data) +int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, + const char *file, int line) { struct osmo_fsm *fsm; const struct osmo_fsm_state *fs; @@ -366,7 +390,8 @@ OSMO_ASSERT(fi->state < fsm->num_states); fs = &fi->fsm->states[fi->state]; - LOGPFSM(fi, "Received Event %s\n", osmo_fsm_event_name(fsm, event)); + LOGPFSMSRC(fi, file, line, + "Received Event %s\n", osmo_fsm_event_name(fsm, event)); if (((1 << event) & fsm->allstate_event_mask) && fsm->allstate_action) { fsm->allstate_action(fi, event, data); @@ -374,9 +399,9 @@ } if (!((1 << event) & fs->in_event_mask)) { - LOGPFSML(fi, LOGL_ERROR, - "Event %s not permitted\n", - osmo_fsm_event_name(fsm, event)); + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "Event %s not permitted\n", + osmo_fsm_event_name(fsm, event)); return -1; } fs->action(fi, event, data); @@ -398,19 +423,21 @@ * \param[in] cause Cause / reason for termination * \param[in] data Opaqueevent data to be passed to parent */ -void osmo_fsm_inst_term(struct osmo_fsm_inst *fi, - enum osmo_fsm_term_cause cause, void *data) +void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, void *data, + const char *file, int line) { struct osmo_fsm_inst *child, *child2; struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; - LOGPFSM(fi, "Terminating (cause = %u)\n", cause); + LOGPFSMSRC(fi, file, line, "Terminating (cause = %u)\n", cause); /* iterate over all children */ llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { /* terminate child */ - osmo_fsm_inst_term(child, OSMO_FSM_TERM_PARENT, NULL); + _osmo_fsm_inst_term(child, OSMO_FSM_TERM_PARENT, NULL, + file, line); } /* delete ourselves from the parent */ @@ -420,12 +447,13 @@ if (fi->fsm->cleanup) fi->fsm->cleanup(fi, cause); - LOGPFSM(fi, "Release\n"); + LOGPFSMSRC(fi, file, line, "Release\n"); osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ if (parent && cause != OSMO_FSM_TERM_PARENT) - osmo_fsm_inst_dispatch(parent, parent_term_event, data); + _osmo_fsm_inst_dispatch(parent, parent_term_event, data, + file, line); } /*! @} */ -- To view, visit https://gerrit.osmocom.org/1431 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd 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 From gerrit-no-reply at lists.osmocom.org Thu Dec 15 20:16:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:16:07 +0000 Subject: [MERGED] libosmocore[master]: fsm: add LOGPFSML to pass explicit logging level In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: add LOGPFSML to pass explicit logging level ...................................................................... fsm: add LOGPFSML to pass explicit logging level Provide one central LOGPFSML to print FSM information, take the FSM logging subsystem from the FSM instance but use an explicitly provided log level instead of the FSM's default level. Use to replace some, essentially, duplications of the LOGPFSM macro. In effect, the fsm_test's expected error changes, since the previous code dup for logging events used round braces to indicate the fi's state, while the central macro uses curly braces. Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 --- M include/osmocom/core/fsm.h M src/fsm.c M tests/fsm/fsm_test.err 3 files changed, 12 insertions(+), 12 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/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index fba5497..026ed01 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -110,11 +110,14 @@ void osmo_fsm_log_addr(bool log_addr); -#define LOGPFSM(fi, fmt, args...) \ - LOGP((fi)->fsm->log_subsys, (fi)->log_level, "%s{%s}: " fmt, \ +#define LOGPFSML(fi, level, fmt, args...) \ + LOGP((fi)->fsm->log_subsys, level, "%s{%s}: " fmt, \ osmo_fsm_inst_name(fi), \ osmo_fsm_state_name((fi)->fsm, (fi)->state), ## args) +#define LOGPFSM(fi, fmt, args...) \ + LOGPFSML(fi, (fi)->log_level, fmt, ## args) + int osmo_fsm_register(struct osmo_fsm *fsm); void osmo_fsm_unregister(struct osmo_fsm *fsm); struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv, diff --git a/src/fsm.c b/src/fsm.c index 9dc6b98..1db39f7 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -311,11 +311,9 @@ /* validate if new_state is a valid state */ if (!(st->out_state_mask & (1 << new_state))) { - LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): transition to " - "state %s not permitted!\n", - osmo_fsm_inst_name(fi), - osmo_fsm_state_name(fsm, fi->state), - osmo_fsm_state_name(fsm, new_state)); + LOGPFSML(fi, LOGL_ERROR, + "transition to state %s not permitted!\n", + osmo_fsm_state_name(fsm, new_state)); return -EPERM; } @@ -376,10 +374,9 @@ } if (!((1 << event) & fs->in_event_mask)) { - LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): Event %s not " - "permitted\n", osmo_fsm_inst_name(fi), - osmo_fsm_state_name(fsm, fi->state), - osmo_fsm_event_name(fsm, event)); + LOGPFSML(fi, LOGL_ERROR, + "Event %s not permitted\n", + osmo_fsm_event_name(fsm, event)); return -1; } fs->action(fi, event, data); diff --git a/tests/fsm/fsm_test.err b/tests/fsm/fsm_test.err index b9c738c..c9021bb 100644 --- a/tests/fsm/fsm_test.err +++ b/tests/fsm/fsm_test.err @@ -1,7 +1,7 @@ Checking FSM allocation Test FSM{NULL}: Allocated Test FSM{NULL}: Received Event 1 -Test FSM(NULL): Event 1 not permitted +Test FSM{NULL}: Event 1 not permitted Test FSM{NULL}: Received Event 0 Test FSM{NULL}: state_chg to ONE Test FSM{ONE}: Received Event 1 -- To view, visit https://gerrit.osmocom.org/1430 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If295fdabb3f31a0fd9490d1e0df57794c75ae547 Gerrit-PatchSet: 1 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 Thu Dec 15 20:16:37 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:16:37 +0000 Subject: libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 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: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 20:16:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:16:48 +0000 Subject: osmo-hlr[master]: bump required libosmocore version to 0.9.5 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1407 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 20:16:50 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:16:50 +0000 Subject: [MERGED] osmo-hlr[master]: bump required libosmocore version to 0.9.5 In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bump required libosmocore version to 0.9.5 ...................................................................... bump required libosmocore version to 0.9.5 0.9.5 tags the version from which on DLGSUP is properly handled in libosmocore's internal logging. This bump follows up on previous osmo-hlr change I74ab1a031d1ed144468b016294d2965eba5e7d1d. Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd --- M configure.ac 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/configure.ac b/configure.ac index ce0010c..3ac99c7 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.0) +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(LIBOSMOABIS, libosmoabis >= 0.3.2) -- To view, visit https://gerrit.osmocom.org/1407 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2af7a9eff3f116bd3bd02edd42e6e0a64f8280cd Gerrit-PatchSet: 2 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 Dec 15 20:17:46 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 15 Dec 2016 20:17:46 +0000 Subject: libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 I'd like to agree, but I wonder why this was put there in the first place and whether ther is a reason for that? -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 15 22:04:47 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Thu, 15 Dec 2016 22:04:47 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: Is the error propagating back to the SI generation? -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 06:55:15 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 16 Dec 2016 06:55:15 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 3: There are 3 Puncturing values, namely PS1,PS2,PS3. These are valid only for EGPRS case. Punct[0] corresponds to 1st EGPRS RLC block, Punct[1] corresponds to 2nd EGPRS RLC block. In case of EGPRS header type 2 and 3, only Punct[0] valid. Punct[1] along with Punct[0] is valid only for the case of HeaderType 1. For GPRS case, Punct[0] and Punct[1] shall be initialized to INVALID and EGPRS(type 2,type 3) case Punct[1] shall be initialized to INVALID. For me, Any value other than specification defined is invalid. Hence EGPRS_PS_INVALID is set to 3. >gprs_rlc_mcs_cps(), where the puncturing values are passed into, does not check >against *_INVALID items, but simply uses them. So now I'm sure that this patch >is not "the real" fix. I would suggest not to jump into verdict before having proper analysis of code. With the explanation as reference above, please have a close look into gprs_rlc_mcs_cps function. You would realize initializing the "punct" to INVALID is a proper fix. However I agree that, We need to memset the both indexes of "punct" to EGPRS_PS_INVALID as suggested by you. Let me know if you have any queries. -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 07:29:29 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Fri, 16 Dec 2016 07:29:29 +0000 Subject: [PATCH] osmo-pcu[master]: Add counter at BTS level And statistics at TBF/MS level. Message-ID: Review at https://gerrit.osmocom.org/1438 Add counter at BTS level And statistics at TBF/MS level. Adds spb counters at BTS level(show bts statistics). Adds RLC/MAC downlink control msg at ms level(show ms imsi ). Adds the number of coding schemes counter for UL at TBF level. Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38 --- M src/bts.cpp M src/bts.h M src/gprs_ms.cpp M src/gprs_ms.h M src/gprs_rlcmac_sched.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp M src/tbf_ul.cpp 10 files changed, 134 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/38/1438/1 diff --git a/src/bts.cpp b/src/bts.cpp index 603da56..a47d7d8 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -90,6 +90,10 @@ { "llc.ul_bytes", "full PDUs received "}, { "rach.requests", "RACH requests "}, { "11bit_rach.requests", "11BIT_RACH requests "}, + { "spb.uplink_first_segment", "First seg of UL SPB "}, + { "spb.uplink_second_segment", "Second seg of UL SPB "}, + { "spb.downlink_first_segment", "First seg of DL SPB "}, + { "spb.downlink_second_segment","Second seg of DL SPB "}, { "immediate.assignment_UL", "Immediate Assign UL "}, { "immediate.assignment_rej", "Immediate Assign Rej "}, { "immediate.assignment_DL", "Immediate Assign DL "}, diff --git a/src/bts.h b/src/bts.h index ac870d5..636c7ec 100644 --- a/src/bts.h +++ b/src/bts.h @@ -266,6 +266,10 @@ CTR_LLC_DL_BYTES, CTR_LLC_UL_BYTES, CTR_RACH_REQUESTS, + CTR_SPB_UL_FIRST_SEGMENT, + CTR_SPB_UL_SECOND_SEGMENT, + CTR_SPB_DL_FIRST_SEGMENT, + CTR_SPB_DL_SECOND_SEGMENT, CTR_11BIT_RACH_REQUESTS, CTR_IMMEDIATE_ASSIGN_UL_TBF, CTR_IMMEDIATE_ASSIGN_REJ, @@ -397,6 +401,10 @@ void llc_dl_bytes(int bytes); void llc_ul_bytes(int bytes); void rach_frame(); + void spb_uplink_first_segment(); + void spb_uplink_second_segment(); + void spb_downlink_first_segment(); + void spb_downlink_second_segment(); void rach_frame_11bit(); void immediate_assignment_ul_tbf(); void immediate_assignment_reject(); @@ -594,6 +602,10 @@ CREATE_COUNT_ADD_INLINE(llc_dl_bytes, CTR_LLC_DL_BYTES); CREATE_COUNT_ADD_INLINE(llc_ul_bytes, CTR_LLC_UL_BYTES); CREATE_COUNT_INLINE(rach_frame, CTR_RACH_REQUESTS); +CREATE_COUNT_INLINE(spb_uplink_first_segment, CTR_SPB_UL_FIRST_SEGMENT); +CREATE_COUNT_INLINE(spb_uplink_second_segment, CTR_SPB_UL_SECOND_SEGMENT); +CREATE_COUNT_INLINE(spb_downlink_first_segment, CTR_SPB_DL_FIRST_SEGMENT); +CREATE_COUNT_INLINE(spb_downlink_second_segment, CTR_SPB_DL_SECOND_SEGMENT); CREATE_COUNT_INLINE(rach_frame_11bit, CTR_11BIT_RACH_REQUESTS); CREATE_COUNT_INLINE(immediate_assignment_ul_tbf, CTR_IMMEDIATE_ASSIGN_UL_TBF); CREATE_COUNT_INLINE(immediate_assignment_reject, CTR_IMMEDIATE_ASSIGN_REJ); diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp index 8facc50..c6b7e34 100644 --- a/src/gprs_ms.cpp +++ b/src/gprs_ms.cpp @@ -108,7 +108,8 @@ m_reserved_ul_slots(0), m_current_trx(NULL), m_codel_state(NULL), - m_mode(GprsCodingScheme::GPRS) + m_mode(GprsCodingScheme::GPRS), + m_dl_ctrl_msg(0) { int codel_interval = LLC_CODEL_USE_DEFAULT; diff --git a/src/gprs_ms.h b/src/gprs_ms.h index bcc4fb3..72a86c9 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -130,6 +130,8 @@ void update_l1_meas(const pcu_l1_meas *meas); const pcu_l1_meas* l1_meas() const {return &m_l1_meas;}; unsigned nack_rate_dl() const; + unsigned dl_ctrl_msg() const; + void update_dl_ctrl_msg(); /* internal use */ static void timeout(void *priv_); @@ -180,6 +182,8 @@ struct gprs_codel *m_codel_state; GprsCodingScheme::Mode m_mode; + + unsigned m_dl_ctrl_msg; }; inline bool GprsMs::is_idle() const @@ -263,6 +267,16 @@ return m_nack_rate_dl; } +inline unsigned GprsMs::dl_ctrl_msg() const +{ + return m_dl_ctrl_msg; +} + +inline void GprsMs::update_dl_ctrl_msg() +{ + m_dl_ctrl_msg++; +} + inline uint8_t GprsMs::reserved_dl_slots() const { return m_reserved_dl_slots; diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index a3723df..fdda79d 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -179,6 +179,8 @@ LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling control " "message at RTS for %s (TRX=%d, TS=%d)\n", tbf_name(tbf), trx, ts); + /* Updates the dl ctrl msg counter for ms */ + tbf->ms()->update_dl_ctrl_msg(); return msg; } /* schedule PACKET PAGING REQUEST */ @@ -186,6 +188,9 @@ if (msg) { LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling paging request " "message at RTS for (TRX=%d, TS=%d)\n", trx, ts); + + /* Updates the dl ctrl msg counter for ms */ + tbf->ms()->update_dl_ctrl_msg(); return msg; } diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 4b4b36d..ce79e05 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -70,6 +70,13 @@ gprs_rlc_ul_window *win = &ul_tbf->m_window; vty_out(vty, " V(Q)=%d V(R)=%d", win->v_q(), win->v_r()); + vty_out(vty, "%s", VTY_NEWLINE); + vty_out(vty, " TBF Statistics:%s", VTY_NEWLINE); + if(GprsCodingScheme::GPRS == tbf->ms()->mode()) { + vty_out_rate_ctr_group(vty, " ", ul_tbf->m_ul_gprs_ctrs); + } else { + vty_out_rate_ctr_group(vty, " ", ul_tbf->m_ul_egprs_ctrs); + } } if (dl_tbf) { gprs_rlc_dl_window *win = &dl_tbf->m_window; @@ -178,6 +185,8 @@ vty_out(vty, " MS I level (slot %d): %d dB%s", i, ms->l1_meas()->ts[i].ms_i_level, VTY_NEWLINE); } + vty_out(vty, " RLC/MAC DL Control Msg: %d%s", ms->dl_ctrl_msg(), + VTY_NEWLINE); if (ms->ul_tbf()) vty_out(vty, " Uplink TBF: TFI=%d, state=%s%s", ms->ul_tbf()->tfi(), diff --git a/src/tbf.cpp b/src/tbf.cpp index 60fba68..0e4d6cc 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -66,6 +66,25 @@ { "egprs.downlink.mcs9", "MCS9 " }, }; +static const struct rate_ctr_desc tbf_ul_gprs_ctr_description[] = { + { "gprs.uplink.cs1", "CS1 " }, + { "gprs.uplink.cs2", "CS2 " }, + { "gprs.uplink.cs3", "CS3 " }, + { "gprs.uplink.cs4", "CS4 " }, +}; + +static const struct rate_ctr_desc tbf_ul_egprs_ctr_description[] = { + { "egprs.uplink.mcs1", "MCS1 " }, + { "egprs.uplink.mcs2", "MCS2 " }, + { "egprs.uplink.mcs3", "MCS3 " }, + { "egprs.uplink.mcs4", "MCS4 " }, + { "egprs.uplink.mcs5", "MCS5 " }, + { "egprs.uplink.mcs6", "MCS6 " }, + { "egprs.uplink.mcs7", "MCS7 " }, + { "egprs.uplink.mcs8", "MCS8 " }, + { "egprs.uplink.mcs9", "MCS9 " }, +}; + static const struct rate_ctr_group_desc tbf_ctrg_desc = { "pcu.tbf", "TBF Statistics", @@ -88,6 +107,22 @@ OSMO_STATS_CLASS_SUBSCRIBER, ARRAY_SIZE(tbf_dl_egprs_ctr_description), tbf_dl_egprs_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_ul_gprs_ctrg_desc = { + "tbf.gprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_ul_gprs_ctr_description), + tbf_ul_gprs_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_ul_egprs_ctrg_desc = { + "tbf.egprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_ul_egprs_ctr_description), + tbf_ul_egprs_ctr_description, }; gprs_rlcmac_tbf::Meas::Meas() : @@ -370,9 +405,12 @@ { /* update counters */ if (tbf->direction == GPRS_RLCMAC_UL_TBF) { + gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf); tbf->bts->tbf_ul_freed(); if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_ul_aborted(); + rate_ctr_group_free(ul_tbf->m_ul_egprs_ctrs); + rate_ctr_group_free(ul_tbf->m_ul_gprs_ctrs); } else { gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); if (tbf->is_egprs_enabled()) { @@ -713,7 +751,9 @@ m_rx_counter(0), m_n3103(0), m_contention_resolution_done(0), - m_final_ack_sent(0) + m_final_ack_sent(0), + m_ul_gprs_ctrs(NULL), + m_ul_egprs_ctrs(NULL) { memset(&m_usf, 0, sizeof(m_usf)); } @@ -782,6 +822,9 @@ return NULL; } + tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_egprs_ctrg_desc, 0); + tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_gprs_ctrg_desc, 0); + llist_add(&tbf->list(), &bts->bts->ul_tbfs()); tbf->bts->tbf_ul_created(); diff --git a/src/tbf.h b/src/tbf.h index 5017d3e..ad1ece2 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -102,6 +102,25 @@ TBF_CTR_EGPRS_DL_MCS9, }; +enum tbf_gprs_ul_counters { + TBF_CTR_GPRS_UL_CS1, + TBF_CTR_GPRS_UL_CS2, + TBF_CTR_GPRS_UL_CS3, + TBF_CTR_GPRS_UL_CS4, +}; + +enum tbf_egprs_ul_counters { + TBF_CTR_EGPRS_UL_MCS1, + TBF_CTR_EGPRS_UL_MCS2, + TBF_CTR_EGPRS_UL_MCS3, + TBF_CTR_EGPRS_UL_MCS4, + TBF_CTR_EGPRS_UL_MCS5, + TBF_CTR_EGPRS_UL_MCS6, + TBF_CTR_EGPRS_UL_MCS7, + TBF_CTR_EGPRS_UL_MCS8, + TBF_CTR_EGPRS_UL_MCS9, +}; + #define GPRS_RLCMAC_FLAG_CCCH 0 /* assignment on CCCH */ #define GPRS_RLCMAC_FLAG_PACCH 1 /* assignment on PACCH */ #define GPRS_RLCMAC_FLAG_UL_DATA 2 /* uplink data received */ @@ -511,6 +530,9 @@ uint8_t m_contention_resolution_done; /* set after done */ uint8_t m_final_ack_sent; /* set if we sent final ack */ + struct rate_ctr_group *m_ul_gprs_ctrs; + struct rate_ctr_group *m_ul_egprs_ctrs; + protected: void maybe_schedule_uplink_acknack(const gprs_rlc_data_info *rlc); }; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 2af2ff0..78f06e9 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -1298,16 +1298,21 @@ * other wise it should be 2 */ if (block_status_dl == EGPRS_RESEG_FIRST_SEG_SENT) { + + /* statistics */ + bts->spb_downlink_second_segment(); return EGPRS_RLCMAC_DL_SEC_SEG; } else if ((cs_init.headerTypeData() == GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1) || (cs_init.headerTypeData() == GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2)) { + bts->spb_downlink_first_segment(); return EGPRS_RLCMAC_DL_FIRST_SEG; } else if ((GprsCodingScheme::Scheme(cs_init) == GprsCodingScheme::MCS4) && (GprsCodingScheme::Scheme(cs_current_trans) == GprsCodingScheme::MCS1)) { + bts->spb_downlink_first_segment(); return EGPRS_RLCMAC_DL_FIRST_SEG; } } diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 420fc1a..0de0127 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -397,6 +397,8 @@ union split_block_status *spb_status = &block->spb_status; uint8_t *rlc_data = &block->block[0]; + bts->spb_uplink_second_segment(); + if (spb_status->block_status_ul & EGPRS_RESEG_FIRST_SEG_RXD) { LOGP(DRLCMACUL, LOGL_DEBUG, @@ -432,6 +434,8 @@ const gprs_rlc_data_block_info *rdbi = &rlc->block_info[block_idx]; uint8_t *rlc_data = &block->block[0]; union split_block_status *spb_status = &block->spb_status; + + bts->spb_uplink_first_segment(); if (spb_status->block_status_ul & EGPRS_RESEG_SECOND_SEG_RXD) { LOGP(DRLCMACUL, LOGL_DEBUG, @@ -527,45 +531,58 @@ switch (coding_scheme) { case GprsCodingScheme::CS1 : bts->gprs_ul_cs1(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS1]); break; case GprsCodingScheme::CS2 : bts->gprs_ul_cs2(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS2]); break; case GprsCodingScheme::CS3 : bts->gprs_ul_cs3(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS3]); break; case GprsCodingScheme::CS4 : bts->gprs_ul_cs4(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS4]); break; } } else { switch (coding_scheme) { case GprsCodingScheme::MCS1 : bts->egprs_ul_mcs1(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS1]); break; case GprsCodingScheme::MCS2 : bts->egprs_ul_mcs2(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS2]); break; case GprsCodingScheme::MCS3 : bts->egprs_ul_mcs3(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS3]); break; case GprsCodingScheme::MCS4 : bts->egprs_ul_mcs4(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS4]); break; case GprsCodingScheme::MCS5 : bts->egprs_ul_mcs5(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS5]); break; case GprsCodingScheme::MCS6 : bts->egprs_ul_mcs6(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS6]); break; case GprsCodingScheme::MCS7 : bts->egprs_ul_mcs7(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS7]); break; case GprsCodingScheme::MCS8 : bts->egprs_ul_mcs8(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS8]); break; case GprsCodingScheme::MCS9 : bts->egprs_ul_mcs9(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS9]); break; } } -- To view, visit https://gerrit.osmocom.org/1438 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari From gerrit-no-reply at lists.osmocom.org Fri Dec 16 09:14:23 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 09:14:23 +0000 Subject: libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Patch Set 1: Well, the only person who could possibly know this for sure is... you :) It was added in your commit ca0af8a in 2012. -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da 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: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 09:17:00 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 09:17:00 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: No: the error was never checked before. I can add it but first I'd like to check if it's possible to fix it. From the spec for si2q it seems like having the same input to range1024 is a legitimate use case. Spec for range1024 does not forbid it explicitly either. -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 10:10:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 10:10:19 +0000 Subject: libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 > Well, the only person who could possibly know this for sure is... > you :) It was added in your commit ca0af8a in 2012. Well, then you should read the commit log message and understand that it is required for the msgb->cb typecasting that we use in the header files and thus the related cflags are required by the applications? -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da 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: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 10:13:52 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 16 Dec 2016 10:13:52 +0000 Subject: [ABANDON] osmo-pcu[master]: Fix: DL slot allocation based on direction configured In-Reply-To: References: Message-ID: arvind.sirsikar has abandoned this change. Change subject: Fix: DL slot allocation based on direction configured ...................................................................... Abandoned please refer https://osmocom.org/issues/1792 for more details -- To view, visit https://gerrit.osmocom.org/819 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I4b4a99194ccae68bb3417bce538d16e944d5ec71 Gerrit-PatchSet: 8 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 16 10:54:40 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 10:54:40 +0000 Subject: libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Patch Set 1: The part I don't get is: is it enough to just build the library with -fno-strict-aliasing or the applications which link to the library have to be built this way as well? The commit refers to linux kernel as a source of inspiration - do you recall by any chance some documentation chapter which I could read to understand this? -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da 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: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:23:32 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 16 Dec 2016 11:23:32 +0000 Subject: [PATCH] osmo-pcu[master]: Handle packet access reject during packet resource request In-Reply-To: References: Message-ID: Hello Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1216 to look at the new patch set (#9). Handle packet access reject during packet resource request When Packet resource request is received, PCU will generate the packet access reject if no resources are present. The encoding is done based on section 7.1.3.2.1 and 8.1.2.5 of 44.060 version 7.27.0 Release 7. This patch also includes the test case to validate the generated packet access reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I05ff25124b58905586caa0c0c37023d69724f121 --- M src/bts.cpp M src/gprs_rlcmac_sched.cpp M src/tbf.cpp M src/tbf.h M tests/tbf/TbfTest.cpp M tests/tbf/TbfTest.err M tests/tbf/TbfTest.ok 7 files changed, 394 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/16/1216/9 diff --git a/src/bts.cpp b/src/bts.cpp index 603da56..de6a758 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1343,8 +1343,12 @@ egprs_ms_class); ul_tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class, egprs_ms_class, tlli, ta, ms); - if (!ul_tbf) + + if (!ul_tbf) { + handle_tbf_reject(bts_data(), ms, tlli, + trx_no(), ts_no); return; + } /* set control ts to current MS's TS, until assignment complete */ LOGP(DRLCMAC, LOGL_DEBUG, "Change control TS to %d until assinment is complete.\n", ts_no); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index a3723df..a8b716d 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -56,7 +56,9 @@ *ul_ack_tbf = ul_tbf; if (ul_tbf->dl_ass_state == GPRS_RLCMAC_DL_ASS_SEND_ASS) *dl_ass_tbf = ul_tbf; - if (ul_tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS) + if (ul_tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS + || ul_tbf->ul_ass_state == + GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ) *ul_ass_tbf = ul_tbf; #warning "Is this supposed to be fair? The last TBF for each wins? Maybe use llist_add_tail and skip once we have all states?" } @@ -136,8 +138,11 @@ * because they may kill the TBF when the CONTROL ACK is * received, thus preventing the others from being processed. */ - - if (tbf == ul_ass_tbf && tbf->direction == GPRS_RLCMAC_DL_TBF) + if (tbf == ul_ass_tbf && tbf->ul_ass_state == + GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ) + msg = ul_ass_tbf->create_packet_access_reject(); + else if (tbf == ul_ass_tbf && tbf->direction == + GPRS_RLCMAC_DL_TBF) if (tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ) msg = ul_ass_tbf->create_packet_access_reject(); diff --git a/src/tbf.cpp b/src/tbf.cpp index 60fba68..de4977c 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1110,6 +1110,10 @@ bitvec_free(packet_access_rej); ul_ass_state = GPRS_RLCMAC_UL_ASS_NONE; + /* Start Tmr only if it is UL TBF */ + if (direction == GPRS_RLCMAC_UL_TBF) + tbf_timer_start(this, 0, Treject_pacch); + return msg; } @@ -1339,3 +1343,35 @@ { return ts == control_ts; } + +struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts, + GprsMs *ms, uint32_t tlli, uint8_t trx_no, uint8_t ts) +{ + struct gprs_rlcmac_ul_tbf *ul_tbf = NULL; + struct gprs_rlcmac_trx *trx = &bts->trx[trx_no]; + + ul_tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf); + if (!ul_tbf) + return ul_tbf; + + talloc_set_destructor(ul_tbf, ul_tbf_dtor); + new (ul_tbf) gprs_rlcmac_ul_tbf(bts->bts); + if (!ms) + ms = bts->bts->ms_alloc(0, 0); + + ms->set_tlli(tlli); + + llist_add(&ul_tbf->list(), &bts->bts->ul_tbfs()); + ul_tbf->bts->tbf_ul_created(); + ul_tbf->set_state(GPRS_RLCMAC_ASSIGN); + ul_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH); + + ul_tbf->set_ms(ms); + ul_tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF); + ul_tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ; + ul_tbf->control_ts = ts; + ul_tbf->trx = trx; + ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, &tbf_ctrg_desc, 0); + + return ul_tbf; +} diff --git a/src/tbf.h b/src/tbf.h index 5017d3e..66a8a14 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -40,6 +40,7 @@ #define Tassign_agch 0,200000 /* waiting after IMM.ASS confirm */ #define Tassign_pacch 2,0 /* timeout for pacch assigment */ +#define Treject_pacch 0,2000 /* timeout for tbf reject for PRR*/ enum gprs_rlcmac_tbf_state { GPRS_RLCMAC_NULL = 0, /* new created TBF */ @@ -290,6 +291,9 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf); +struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts, + GprsMs *ms, uint32_t tlli, uint8_t trx_no, uint8_t ts_no); + int tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf); void tbf_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int T, diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index bebb6ef..17e0eb3 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -2833,6 +2833,114 @@ ARRAY_SIZE(default_categories), }; +static void test_packet_access_rej_prr_no_other_tbfs() +{ + BTS the_bts; + uint32_t fn = 2654218; + int ts_no = 7; + uint8_t trx_no = 0; + uint32_t tlli = 0xffeeddcc; + struct gprs_rlcmac_ul_tbf *ul_tbf = NULL; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, ts_no, 4); + + int rc = 0; + + ul_tbf = handle_tbf_reject(the_bts.bts_data(), NULL, tlli, + trx_no, ts_no); + + OSMO_ASSERT(ul_tbf != 0); + + /* trigger packet access reject */ + uint8_t bn = fn2bn(fn); + + rc = gprs_rlcmac_rcv_rts_block(the_bts.bts_data(), + trx_no, ts_no, fn, bn); + + OSMO_ASSERT(rc == 0); + + ul_tbf->handle_timeout(); + + printf("=== end %s ===\n", __func__); +} + +static void test_packet_access_rej_prr() +{ + BTS the_bts; + uint32_t fn = 2654218; + uint16_t qta = 31; + int ts_no = 7; + uint8_t trx_no = 0; + RlcMacUplink_t ulreq = {0}; + Packet_Resource_Request_t *presreq = NULL; + uint8_t ms_class = 11; + uint8_t egprs_ms_class = 11; + uint32_t rach_fn = fn - 51; + uint32_t sba_fn = fn + 52; + uint32_t tlli = 0xffeeddcc; + MS_Radio_Access_capability_t *pmsradiocap = NULL; + Multislot_capability_t *pmultislotcap = NULL; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, ts_no, 4); + + int rc = 0; + + /* + * Trigger rach till resources(USF) exhaust + */ + rc = the_bts.rcv_rach(0x78, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + rc = the_bts.rcv_rach(0x79, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + rc = the_bts.rcv_rach(0x7a, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + rc = the_bts.rcv_rach(0x7b, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + rc = the_bts.rcv_rach(0x7c, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + rc = the_bts.rcv_rach(0x7d, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + rc = the_bts.rcv_rach(0x7e, rach_fn, qta, 0, + GSM_L1_BURST_TYPE_ACCESS_0); + + /* fake a resource request */ + ulreq.u.MESSAGE_TYPE = MT_PACKET_RESOURCE_REQUEST; + presreq = &ulreq.u.Packet_Resource_Request; + presreq->PayloadType = GPRS_RLCMAC_CONTROL_BLOCK; + presreq->ID.UnionType = 1; /* != 0 */ + presreq->ID.u.TLLI = tlli; + presreq->Exist_MS_Radio_Access_capability = 1; + pmsradiocap = &presreq->MS_Radio_Access_capability; + pmsradiocap->Count_MS_RA_capability_value = 1; + pmsradiocap->MS_RA_capability_value[0].u.Content. + Exist_Multislot_capability = 1; + pmultislotcap = &pmsradiocap->MS_RA_capability_value[0]. + u.Content.Multislot_capability; + + pmultislotcap->Exist_GPRS_multislot_class = 1; + pmultislotcap->GPRS_multislot_class = ms_class; + if (egprs_ms_class) { + pmultislotcap->Exist_EGPRS_multislot_class = 1; + pmultislotcap->EGPRS_multislot_class = egprs_ms_class; + } + + send_ul_mac_block(&the_bts, trx_no, ts_no, &ulreq, sba_fn); + + /* trigger packet access reject */ + uint8_t bn = fn2bn(fn); + + rc = gprs_rlcmac_rcv_rts_block(the_bts.bts_data(), + trx_no, ts_no, fn, bn); + + OSMO_ASSERT(rc == 0); + + printf("=== end %s ===\n", __func__); +} + void test_packet_access_rej_epdan() { BTS the_bts; @@ -2900,6 +3008,8 @@ test_tbf_epdan_out_of_rx_window(); test_immediate_assign_rej(); test_packet_access_rej_epdan(); + test_packet_access_rej_prr(); + test_packet_access_rej_prr_no_other_tbfs(); if (getenv("TALLOC_REPORT_FULL")) talloc_report_full(tall_pcu_ctx, stderr); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 2647551..4683915 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -6871,3 +6871,230 @@ TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to FLOW The MS object cannot fully confirm an unexpected TLLI: 0xffeeddcc, partly confirmed TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) append +MS requests UL TBF on RACH, so we provide one +ra=0x78 Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=0 USF=0 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL), 1 TBFs, USFs = 01, TFIs = 00000001. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x78, Fn=2654167 (17,25,9) +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=0 USF=0 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 78 8b 29 07 00 c8 00 70 0b 2b 2b 2b 2b 2b 2b 2b +MS requests UL TBF on RACH, so we provide one +ra=0x79 Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=1 USF=1 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL), 2 TBFs, USFs = 03, TFIs = 00000003. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x79, Fn=2654167 (17,25,9) +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=1 USF=1 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 79 8b 29 07 00 c8 42 70 0b 2b 2b 2b 2b 2b 2b 2b +MS requests UL TBF on RACH, so we provide one +ra=0x7a Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=2 USF=2 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=NULL), 3 TBFs, USFs = 07, TFIs = 00000007. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x7a, Fn=2654167 (17,25,9) +TBF(TFI=2 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=2 USF=2 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 7a 8b 29 07 00 c8 84 70 0b 2b 2b 2b 2b 2b 2b 2b +MS requests UL TBF on RACH, so we provide one +ra=0x7b Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=3 USF=3 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=NULL), 4 TBFs, USFs = 0f, TFIs = 0000000f. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x7b, Fn=2654167 (17,25,9) +TBF(TFI=3 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=3 USF=3 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 7b 8b 29 07 00 c8 c6 70 0b 2b 2b 2b 2b 2b 2b 2b +MS requests UL TBF on RACH, so we provide one +ra=0x7c Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=4 USF=4 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=NULL), 5 TBFs, USFs = 1f, TFIs = 0000001f. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x7c, Fn=2654167 (17,25,9) +TBF(TFI=4 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=4 USF=4 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 7c 8b 29 07 00 c9 08 70 0b 2b 2b 2b 2b 2b 2b 2b +MS requests UL TBF on RACH, so we provide one +ra=0x7d Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=5 USF=5 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=NULL), 6 TBFs, USFs = 3f, TFIs = 0000003f. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x7d, Fn=2654167 (17,25,9) +TBF(TFI=5 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=5 USF=5 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 7d 8b 29 07 00 c9 4a 70 0b 2b 2b 2b 2b 2b 2b 2b +MS requests UL TBF on RACH, so we provide one +ra=0x7e Fn=2654167 qta=31 is_11bit=0: +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=0/0 +Creating MS object, TLLI = 0x00000000 +Slot Allocation (Algorithm A) for class 0 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Assign uplink TS=7 TFI=6 USF=6 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=NULL), 7 TBFs, USFs = 7f, TFIs = 0000007f. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 00 +Modifying MS object, TLLI = 0x00000000, TA 220 -> 7 +TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to FLOW +TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=FLOW) starting timer 3169. +TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=FLOW) [UPLINK] START +TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x7e, Fn=2654167 (17,25,9) +TBF(TFI=6 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) + - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=6 USF=6 +Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 7e 8b 29 07 00 c9 8c 70 0b 2b 2b 2b 2b 2b 2b 2b +Got RLC block, coding scheme: CS-1, length: 23 (23)) ++++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++ +------------------------- RX : Uplink Control Block ------------------------- +MS requests UL TBF in packet resource request of single block, so we provide one: +MS requests UL TBF in packet resource request of single block, but there is no resource request scheduled! +MS supports EGPRS multislot class 11. +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=11/11 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 11 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 11 +Slot Allocation (Algorithm A) for class 11 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because no USF available +- Failed to allocate a TS, no USF available +No PDCH resource +Creating MS object, TLLI = 0x00000000 +Modifying MS object, UL TLLI: 0x00000000 -> 0xffeeddcc, not yet confirmed +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to ASSIGN +Attaching TBF to MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) +Received RTS for PDCH: TRX=0 TS=7 FN=2654218 block_nr=8 scheduling USF=0 for required uplink resource of UL TFI=0 +TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) starting timer 0. +Scheduling control message at RTS for TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) (TRX=0, TS=7) +Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654218 block=8 data=40 84 7f f7 6e e6 41 4b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +Destroying MS object, TLLI = 0x00000000 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, UL TLLI: 0x00000000 -> 0xffeeddcc, not yet confirmed +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to ASSIGN +Attaching TBF to MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) +TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) starting timer 0. +Scheduling control message at RTS for TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) (TRX=0, TS=7) +Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654218 block=8 data=47 84 7f f7 6e e6 41 4b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) timer 0 expired. +TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) releasing due to PACCH assignment timeout. +TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) free +TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) stopping timer 0. +Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=UL STATE=ASSIGN) +Destroying MS object, TLLI = 0xffeeddcc +********** TBF ends here ********** diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok index dc07fc7..aa3194c 100644 --- a/tests/tbf/TbfTest.ok +++ b/tests/tbf/TbfTest.ok @@ -75,3 +75,7 @@ === start test_packet_access_rej_epdan === packet reject: 40 84 7f f7 6e e6 41 4b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b === end test_packet_access_rej_epdan === +=== start test_packet_access_rej_prr === +=== end test_packet_access_rej_prr === +=== start test_packet_access_rej_prr_no_other_tbfs === +=== end test_packet_access_rej_prr_no_other_tbfs === -- To view, visit https://gerrit.osmocom.org/1216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I05ff25124b58905586caa0c0c37023d69724f121 Gerrit-PatchSet: 9 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:27:30 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 16 Dec 2016 11:27:30 +0000 Subject: osmo-pcu[master]: Handle packet access reject during packet resource request In-Reply-To: References: Message-ID: Patch Set 9: (3 comments) https://gerrit.osmocom.org/#/c/1216/9/src/tbf.cpp File src/tbf.cpp: Line 69: static const struct rate_ctr_group_desc tbf_ctrg_desc = { Because of this global static const varible, handle_tbf_reject is moved from tbf_ul.cpp to this file. Line 721: static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf) bringing this back to tbf.cpp, since there is a high dependency on the const variables defined as global in tbf.cpp for creation of TBF. Line 1347: struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts, bringing this back to tbf.cpp, since there is a high dependency on the const variables defined as global in tbf.cpp for creation of TBF. -- To view, visit https://gerrit.osmocom.org/1216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I05ff25124b58905586caa0c0c37023d69724f121 Gerrit-PatchSet: 9 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:29:56 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Fri, 16 Dec 2016 11:29:56 +0000 Subject: osmo-pcu[master]: Handle packet access reject during packet resource request In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+1 Verified+1 -- To view, visit https://gerrit.osmocom.org/1216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I05ff25124b58905586caa0c0c37023d69724f121 Gerrit-PatchSet: 9 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:32:13 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:32:13 +0000 Subject: libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 And paste the "warning" you are fixing. -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da Gerrit-PatchSet: 1 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: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:32:14 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 11:32:14 +0000 Subject: osmo-pcu[master]: Sanitizer build fix for invalid value of variable of type eg... In-Reply-To: References: Message-ID: Patch Set 3: > I would suggest not to jump into verdict before having proper > analysis of code. You're right that I had in fact not understood the code completely. Now that I'm reading it in more detail, I only find more problems. I will limit the comments here on the ones related to this patch: My point remains that in gprs_rlc_mcs_cps() the punct/punct2 are used in calculations directly without checking against INVALID items. By initializing both punct values to "INVALID" in create_dl_acked_block(), it is suggested that INVALID values may be passed on to gprs_rlc_mcs_cps() -- if that weren't the case, it would not be necessary to initialize to INVALID. So, gprs_rlc_mcs_cps() must check that it isn't using INVALID enum values in its bitfield calculations. Would it make more sense to set punct2 to INVALID explicitly in specific cases? Even though incidentally, the cases where one (or both??) args are INVALID might match the internal expectations of the switch() statement, this is bad coding style. Each function's API should make sense on its own. Thanks! -- To view, visit https://gerrit.osmocom.org/1411 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: arvind.sirsikar Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:33:08 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:33:08 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: I am not arguing about the arfcn_range_encode.c change, there is an error and it should propagate. What I am arguing is that apparently the error doesn't propagate into the SI generation? If the cells can't be encoded? Maybe SI generation should fail? -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:34:22 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:34:22 +0000 Subject: openbsc[master]: bsc_control.py: convert to python3 In-Reply-To: References: Message-ID: Patch Set 4: Does it still work with python2? -- To view, visit https://gerrit.osmocom.org/1358 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:35:41 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:35:41 +0000 Subject: openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Patch Set 10: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 10 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max 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 Fri Dec 16 11:36:43 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:36:43 +0000 Subject: openbsc[master]: bsc_control.py: style corrections In-Reply-To: References: Message-ID: Patch Set 10: In other projects churn like this is avoided but you already have support -- To view, visit https://gerrit.osmocom.org/1269 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib79fd4317d40ee4fd87b090b9faf8ebaf4bfca64 Gerrit-PatchSet: 10 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-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:37:48 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:37:48 +0000 Subject: osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Patch Set 2: Which platform did you test it on? We have so far omitted it out of performance concerns, so I wonder what you tested? -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:39:19 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:39:19 +0000 Subject: libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 Gerrit-PatchSet: 2 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 Fri Dec 16 11:39:51 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:39:51 +0000 Subject: openggsn[master]: gtp.c: Improve debug statements about GTP header flags In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1437 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:41:08 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:41:08 +0000 Subject: openbsc[master]: Cosmetic fixes around SI generation In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1372/2/openbsc/include/openbsc/arfcn_range_encode.h File openbsc/include/openbsc/arfcn_range_encode.h: Line 17: void range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); Didn't we just learn that this can fail? -- To view, visit https://gerrit.osmocom.org/1372 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e 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-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:42:17 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:42:17 +0000 Subject: osmo-pcu[master]: Fix uninitialized members in pcu_l1_meas() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1330 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I76a03c9f54be474ab9ece908ef782807d555c6ac Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte 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 Fri Dec 16 11:43:46 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:43:46 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 2: What is the minimal gcc version that supports these flags? -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:55:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:55:48 +0000 Subject: libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-2 > The part I don't get is: is it enough to just build the library > with -fno-strict-aliasing or the applications which link to the > library have to be built this way as well? I thought the original commit message made it clear. It is about how msgb->cb is type-casted to structures. Any reader should be able to see where that typecast happens. I even mentioned it is in header files in my previous comments. So? It is about the application, not teh library. why else would it be in the pkg_config cflags for the application ;) > The commit refers to > linux kernel as a source of inspiration - do you recall by any > chance some documentation chapter which I could read to understand > this? just look for the gcc manual on the compiler option used. -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da Gerrit-PatchSet: 1 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: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:56:42 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:56:42 +0000 Subject: osmo-pcu[master]: struct pcu_l1_meas_ts: initialize ms_i_level In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1329 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I93de7589d746b91ba26b1b36bf2690f125277cd0 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:56:45 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:56:45 +0000 Subject: [MERGED] osmo-pcu[master]: struct pcu_l1_meas_ts: initialize ms_i_level In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: struct pcu_l1_meas_ts: initialize ms_i_level ...................................................................... struct pcu_l1_meas_ts: initialize ms_i_level Change-Id: I93de7589d746b91ba26b1b36bf2690f125277cd0 Fixes: Coverity CID 57953 --- M src/pcu_l1_if.h 1 file changed, 2 insertions(+), 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/src/pcu_l1_if.h b/src/pcu_l1_if.h index d9d970d..9ab46a8 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -57,7 +57,8 @@ } pcu_l1_meas_ts() : - have_ms_i_level(0) + have_ms_i_level(0), + ms_i_level(0) {} #endif }; -- To view, visit https://gerrit.osmocom.org/1329 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I93de7589d746b91ba26b1b36bf2690f125277cd0 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:56:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:56:48 +0000 Subject: [MERGED] osmo-pcu[master]: Fix uninitialized members in pcu_l1_meas() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix uninitialized members in pcu_l1_meas() ...................................................................... Fix uninitialized members in pcu_l1_meas() Change-Id: I76a03c9f54be474ab9ece908ef782807d555c6ac Fixes: Coverity CID 57952 --- M src/pcu_l1_if.h 1 file changed, 8 insertions(+), 1 deletion(-) Approvals: Max: 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/pcu_l1_if.h b/src/pcu_l1_if.h index 9ab46a8..eaa0143 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -110,7 +110,14 @@ have_ms_rx_qual(0), have_ms_c_value(0), have_ms_sign_var(0), - have_ms_i_level(0) + have_ms_i_level(0), + rssi(0), + ber(0), + bto(0), + link_qual(0), + ms_rx_qual(0), + ms_c_value(0), + ms_sign_var(0) {} #endif }; -- To view, visit https://gerrit.osmocom.org/1330 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I76a03c9f54be474ab9ece908ef782807d555c6ac Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:58:17 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:58:17 +0000 Subject: openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Patch Set 7: (1 comment) https://gerrit.osmocom.org/#/c/1270/7/openbsc/contrib/bsc_control.py File openbsc/contrib/bsc_control.py: Line 32: if __name__ == '__main__': > removing the random seed but no mention nor explanation in the log message. This is still not adressed :/ -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 7 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:58:42 2016 From: gerrit-no-reply at lists.osmocom.org (Holger Freyther) Date: Fri, 16 Dec 2016 11:58:42 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: > No: the error was never checked before. I can add it but first I'd > like to check if it's possible to fix it. From the spec for si2q it > seems like having the same input to range1024 is a legitimate use > case. Spec for range1024 does not forbid it explicitly either. Well, the specification talks about "SET". A set by definition does not have duplicates (but wouldn't be sorted either). -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:59:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:59:06 +0000 Subject: osmo-pcu[master]: Add counter at BTS level And statistics at TBF/MS level. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1438 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 11:59:58 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 16 Dec 2016 11:59:58 +0000 Subject: libosmocore[master]: fsm: explicitly log removal from parent fsm In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1435 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idec6b7aa5344f1e903c9d2aa2a3640cab0d70fb0 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 Fri Dec 16 12:04:16 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 16 Dec 2016 12:04:16 +0000 Subject: libosmocore[master]: Add function to get uninterrupted bit run In-Reply-To: References: Message-ID: Patch Set 11: Code-Review+1 Verified+1 -- To view, visit https://gerrit.osmocom.org/415 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26 Gerrit-PatchSet: 11 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: prasadkg Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-Reviewer: prasadkg Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 12:09:48 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 12:09:48 +0000 Subject: openbsc[master]: bsc_control.py: convert to python3 In-Reply-To: References: Message-ID: Patch Set 4: I have not tested it yet. It probably will using some 'import from future' or alike. Or by work you mean command line use "python2 bsc_control.py" instead of programmatic "import bsc_control.py"? -- To view, visit https://gerrit.osmocom.org/1358 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I669be3e8731460d5d9229fd0459ef7dd60e8bd73 Gerrit-PatchSet: 4 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 Fri Dec 16 12:15:31 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 12:15:31 +0000 Subject: [PATCH] openbsc[master]: gtphub: fix possible NULL deref: don't print NULL tunnel Message-ID: Review at https://gerrit.osmocom.org/1439 gtphub: fix possible NULL deref: don't print NULL tunnel Fixes: coverity CID#158302 Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3 --- M openbsc/src/gprs/gtphub.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/39/1439/1 diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c index 58300ea..a0af42b 100644 --- a/openbsc/src/gprs/gtphub.c +++ b/openbsc/src/gprs/gtphub.c @@ -1039,6 +1039,9 @@ int left = sizeof(buf); int l; + if (!tun) + return "null-tunnel"; + APPEND("TEI=%x: ", tun->tei_repl); APPEND("%s", gtphub_tunnel_side_str(tun, GTPH_SIDE_SGSN)); APPEND(" <-> %s", gtphub_tunnel_side_str(tun, GTPH_SIDE_GGSN)); -- To view, visit https://gerrit.osmocom.org/1439 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 16 12:17:31 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Fri, 16 Dec 2016 12:17:31 +0000 Subject: osmo-pcu[master]: Handle packet access reject during packet resource request In-Reply-To: References: Message-ID: Patch Set 9: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I05ff25124b58905586caa0c0c37023d69724f121 Gerrit-PatchSet: 9 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: arvind.sirsikar Gerrit-Reviewer: pravin Gerrit-Reviewer: sivasankari Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 12:17:47 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 12:17:47 +0000 Subject: [ABANDON] libosmocore[master]: fsm: explicitly log attempt to transition to same state In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: fsm: explicitly log attempt to transition to same state ...................................................................... Abandoned hmm, that's right. I might like the commit log message to indicate that it is a transition back to the same state, but that hardly seems worth the effort. Thanks guys! -- To view, visit https://gerrit.osmocom.org/1434 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: Id4ba74ce54d10ebf42959d5f0d88ea5472cf95a3 Gerrit-PatchSet: 1 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 Fri Dec 16 12:38:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 12:38:53 +0000 Subject: [MERGED] libosmocore[master]: add value strings for enum osmo_fsm_term_cause and use for l... In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: add value strings for enum osmo_fsm_term_cause and use for logging ...................................................................... add value strings for enum osmo_fsm_term_cause and use for logging Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 20 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 77072ef..5a67961 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -30,6 +30,13 @@ OSMO_FSM_TERM_TIMEOUT, }; +extern const struct value_string osmo_fsm_term_cause_names[]; +static inline const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause cause) +{ + return get_value_string(osmo_fsm_term_cause_names, cause); +} + + /*! \brief description of a rule in the FSM */ struct osmo_fsm_state { /*! \brief bit-mask of permitted input events for this state */ diff --git a/src/fsm.c b/src/fsm.c index dc57e5e..d251cfd 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -431,7 +431,8 @@ struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; - LOGPFSMSRC(fi, file, line, "Terminating (cause = %u)\n", cause); + LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", + osmo_fsm_term_cause_name(cause)); /* iterate over all children */ llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { @@ -456,4 +457,15 @@ file, line); } +#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } + +const struct value_string osmo_fsm_term_cause_names[] = { + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + { 0, NULL } +}; + /*! @} */ -- To view, visit https://gerrit.osmocom.org/1433 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaf63d3cadb0d46bf454e3314ebb439240cafd834 Gerrit-PatchSet: 2 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 Fri Dec 16 12:45:08 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 12:45:08 +0000 Subject: [PATCH] libosmocore[master]: utils.h: add OSMO_ENUM_VAL_TO_VALUE_STRING macro Message-ID: Review at https://gerrit.osmocom.org/1440 utils.h: add OSMO_ENUM_VAL_TO_VALUE_STRING macro Replace a similar macro def in fsm.c Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c --- M include/osmocom/core/utils.h M src/fsm.c 2 files changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/1440/1 diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 3c6fc98..64ba381 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -15,6 +15,8 @@ #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b)) /*! \brief Return the minimum of two specified values */ #define OSMO_MIN(a, b) ((a) >= (b) ? (b) : (a)) +/*! \brief Make a value_string entry from an enum value name */ +#define OSMO_ENUM_VAL_TO_VALUE_STRING(x) { x, #x } #include diff --git a/src/fsm.c b/src/fsm.c index d251cfd..ed57fde 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -457,14 +457,12 @@ file, line); } -#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } - const struct value_string osmo_fsm_term_cause_names[] = { - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:01:19 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 13:01:19 +0000 Subject: libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1427/2/debian/changelog File debian/changelog: Line 1: libosmocore (0.9.6) yakkety; urgency=medium s/yakkety/unstable -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 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: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:05:29 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:05:29 +0000 Subject: [PATCH] libosmo-abis[master]: Enable adaptive jitter compensation 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/1436 to look at the new patch set (#2). Enable adaptive jitter compensation * check RTP socket parameter and enable necessary jitter buffering * return the status of requested jitter buffering instead of always returning 0 * document function parameters and return value Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 --- M src/trau/osmo_ortp.c 1 file changed, 16 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/36/1436/2 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 8171655..d4d4ff5 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -278,28 +278,35 @@ create_payload_types(); } +/*! \brief Set Osmocom RTP socket parameters + * \param[in] rs OsmoRTP socket + * \param[in] param defined which parameter to set + OSMO_RTP_P_JITBUF - enables regular jitter buffering + OSMO_RTP_P_JIT_ADAP - enables adaptive jitter buffering + * \param[in] val Size of jitter buffer (in ms), 0 means disable buffering + * \returns negative value on error, 0 or 1 otherwise + (depending on whether given jitter buffering is enabled) + */ int osmo_rtp_socket_set_param(struct osmo_rtp_socket *rs, enum osmo_rtp_param param, int val) { - int rc = 0; - switch (param) { + case OSMO_RTP_P_JIT_ADAP: + rtp_session_enable_adaptive_jitter_compensation(rs->sess, + (bool)val); + /* fall-through on-purpose - we have to set val anyway */ case OSMO_RTP_P_JITBUF: rtp_session_enable_jitter_buffer(rs->sess, (val) ? TRUE : FALSE); if (val) rtp_session_set_jitter_compensation(rs->sess, val); break; -#if 0 - case OSMO_RTP_P_JIT_ADAP: - rc = jitter_control_enable_adaptive(rs->sess, val); - break; -#endif default: return -EINVAL; } - - return rc; + if (param == OSMO_RTP_P_JIT_ADAP) + return rtp_session_adaptive_jitter_compensation_enabled(rs->sess); + return rtp_session_jitter_buffer_enabled(rs->sess); } /*! \brief Create a new RTP socket @@ -328,7 +335,6 @@ rtp_session_set_data(rs->sess, rs); rtp_session_set_profile(rs->sess, osmo_pt_profile); rtp_session_set_jitter_compensation(rs->sess, 100); - //jitter_control_enable_adaptive(rs->sess, 0); rtp_session_signal_connect(rs->sess, "ssrc_changed", (RtpCallback) ortp_sig_cb_ssrc, -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 16 13:05:30 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:05:30 +0000 Subject: [PATCH] libosmo-abis[master]: Remove obsolete compile-time conditional Message-ID: Review at https://gerrit.osmocom.org/1441 Remove obsolete compile-time conditional Change-Id: If8f87587227b09635361b758873f75d8b6aa3497 --- M src/trau/osmo_ortp.c 1 file changed, 0 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/41/1441/1 diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c index 0f0b9e5..8171655 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -106,11 +106,7 @@ static void ortp_sig_cb_ssrc(RtpSession *rs, void *data) { int port = rtp_session_get_local_port(rs); -#if 0 /* post 0.20.0 ORTP has this function */ uint32_t ssrc = rtp_session_get_recv_ssrc(rs); -#else - uint32_t ssrc = rs->rcv.ssrc; -#endif LOGP(DLMIB, LOGL_INFO, "osmo-ortp(%d): ssrc_changed to 0x%08x\n", port, ssrc); -- To view, visit https://gerrit.osmocom.org/1441 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If8f87587227b09635361b758873f75d8b6aa3497 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:05:40 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:05:40 +0000 Subject: [PATCH] osmo-bts[master]: Optionally use adaptive RTP jitter buffering Message-ID: Review at https://gerrit.osmocom.org/1442 Optionally use adaptive RTP jitter buffering * add vty option to manually enable adaptive RTP jitter buffering (disabled by default) on per-bts level * use this setting on per-lchan level when setting jitter parameters via vty at runtime * check and log result of osmo_rtp_socket_set_param() * note: older libosmo-abis will ignore this setting which will be properly detected via return value * if jitter buffer is disabled by configuring "rtp jitter-buffer 0" than adaptive buffering is disabled as well but it will be used if jitter buffer is set to different value for a givel lchan via vty Change-Id: I489f3c419039f40b57c2ef0641c176478b8d3566 --- M include/osmo-bts/gsm_data.h M src/common/bts.c M src/common/rsl.c M src/common/vty.c 4 files changed, 34 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/42/1442/1 diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index f1c9601..772a705 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -86,6 +86,7 @@ char *bsc_oml_host; struct llist_head oml_queue; unsigned int rtp_jitter_buf_ms; + bool rtp_jitter_adaptive; struct { uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */ } support; diff --git a/src/common/bts.c b/src/common/bts.c index 2005e42..9c2f0e0 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -109,6 +109,7 @@ /* configurable via VTY */ btsb->paging_state = paging_init(btsb, 200, 0); btsb->ul_power_target = -75; /* dBm default */ + btsb->rtp_jitter_adaptive = false; /* configurable via OML */ btsb->load.ccch.load_ind_period = 112; diff --git a/src/common/rsl.c b/src/common/rsl.c index 8d1175d..9e9cbb6 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1652,9 +1652,19 @@ return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL, inc_ip_port, dch->c.msg_type); } - osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, - OSMO_RTP_P_JITBUF, - btsb->rtp_jitter_buf_ms); + rc = osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, + btsb->rtp_jitter_adaptive ? + OSMO_RTP_P_JIT_ADAP : + OSMO_RTP_P_JITBUF, + btsb->rtp_jitter_buf_ms); + if (rc < 0) + LOGP(DRSL, LOGL_ERROR, + "%s IPAC Failed to set RTP socket parameters: %s\n", + gsm_lchan_name(lchan), strerror(-rc)); + else + LOGP(DRSL, LOGL_INFO, + "%s IPAC set RTP socket parameters: %d\n", + gsm_lchan_name(lchan), rc); lchan->abis_ip.rtp_socket->priv = lchan; lchan->abis_ip.rtp_socket->rx_cb = &l1sap_rtp_rx_cb; diff --git a/src/common/vty.c b/src/common/vty.c index 0fffca0..b48afa4 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -276,8 +276,10 @@ vty_out(vty, " ipa unit-id %u %u%s", bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); vty_out(vty, " oml remote-ip %s%s", btsb->bsc_oml_host, VTY_NEWLINE); - vty_out(vty, " rtp jitter-buffer %u%s", btsb->rtp_jitter_buf_ms, - VTY_NEWLINE); + vty_out(vty, " rtp jitter-buffer %u", btsb->rtp_jitter_buf_ms); + if (btsb->rtp_jitter_adaptive) + vty_out(vty, " adaptive"); + vty_out(vty, "%s", VTY_NEWLINE); vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(btsb->paging_state), VTY_NEWLINE); vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(btsb->paging_state), @@ -487,13 +489,15 @@ DEFUN(cfg_bts_rtp_jitbuf, cfg_bts_rtp_jitbuf_cmd, - "rtp jitter-buffer <0-10000>", + "rtp jitter-buffer <0-10000> [adaptive]", RTP_STR "RTP jitter buffer\n" "jitter buffer in ms\n") { struct gsm_bts *bts = vty->index; struct gsm_bts_role_bts *btsb = bts_role_bts(bts); btsb->rtp_jitter_buf_ms = atoi(argv[0]); + if (argc > 1) + btsb->rtp_jitter_adaptive = true; return CMD_SUCCESS; } @@ -1003,7 +1007,8 @@ { struct gsm_network *net = gsmnet_from_vty(vty); struct gsm_lchan *lchan; - int jitbuf_ms = atoi(argv[4]); + struct gsm_bts_role_bts *btsb; + int jitbuf_ms = atoi(argv[4]), rc; lchan = resolve_lchan(net, argv, 0); if (!lchan) { @@ -1015,8 +1020,16 @@ VTY_NEWLINE); return CMD_WARNING; } - osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, - OSMO_RTP_P_JITBUF, jitbuf_ms); + btsb = bts_role_bts(lchan->ts->trx->bts); + rc = osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, + btsb->rtp_jitter_adaptive ? + OSMO_RTP_P_JIT_ADAP : OSMO_RTP_P_JITBUF, + jitbuf_ms); + if (rc < 0) + vty_out(vty, "%% error setting jitter parameters: %s%s", + strerror(-rc), VTY_NEWLINE); + else + vty_out(vty, "%% jitter parameters set: %d%s", rc, VTY_NEWLINE); return CMD_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/1442 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I489f3c419039f40b57c2ef0641c176478b8d3566 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:12:33 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:12:33 +0000 Subject: [PATCH] openbsc[master]: bsc_control.py: remove unused -i 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/1270 to look at the new patch set (#11). bsc_control.py: remove unused -i option This option only served to demonstrate possibility of manually selecting field in CTRL protocol. Since the transition to generic ipa module this is no longer exposed so the option became no-op. Correspondingly there's no need to explicitly initialize RNG - Ctrl class handl this internally as well as random generation. Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded --- M openbsc/contrib/bsc_control.py 1 file changed, 0 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/70/1270/11 diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index cd2ba6d..66a41eb 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- -import random from optparse import OptionParser from ipa import Ctrl import socket @@ -44,8 +43,6 @@ return False if __name__ == '__main__': - random.seed() - parser = OptionParser("Usage: %prog [options] var [value]") parser.add_option("-d", "--host", dest="host", help="connect to HOST", metavar="HOST") @@ -55,8 +52,6 @@ dest="cmd_get", help="perform GET operation") parser.add_option("-s", "--set", action="store_true", dest="cmd_set", help="perform SET operation") - parser.add_option("-i", "--id", dest="op_id", default=random.randint(1, sys.maxint), - help="set id manually", metavar="ID") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="be verbose", default=False) parser.add_option("-m", "--monitor", action="store_true", -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 11 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:19:40 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 13:19:40 +0000 Subject: [PATCH] openbsc[master]: fix: missing terminator in two value_string arrays Message-ID: Review at https://gerrit.osmocom.org/1443 fix: missing terminator in two value_string arrays iu_event_type_names[] and auth_action_names[] lacked a { 0, NULL }. Change-Id: I2e3f271b887e711c8139fbaa32410c16e7fe9921 --- M openbsc/src/libiu/iu.c M openbsc/src/libmsc/auth.c 2 files changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/43/1443/1 diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index 87a02d8..c15c6c5 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -95,6 +95,7 @@ IU_EVT_STR(IU_EVENT_IU_RELEASE), IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), #undef IU_EVT_STR + { 0, NULL } }; struct ue_conn_ctx *ue_conn_ctx_alloc(struct osmo_sccp_link *link, uint32_t conn_id) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 9191ae8..3b1fd73 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -39,6 +39,7 @@ AUTH_ACTION_STR(AUTH_DO_CIPH), AUTH_ACTION_STR(AUTH_DO_AUTH), #undef AUTH_ACTION_STR + { 0, NULL } }; static int -- To view, visit https://gerrit.osmocom.org/1443 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e3f271b887e711c8139fbaa32410c16e7fe9921 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:19:40 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 13:19:40 +0000 Subject: [PATCH] openbsc[master]: use new OSMO_ENUM_VAL_TO_VALUE_STRING Message-ID: Review at https://gerrit.osmocom.org/1444 use new OSMO_ENUM_VAL_TO_VALUE_STRING libosmocore change-id I857af45ae602bb9a647ba26cf8b0d1b23403b54c adds OSMO_ENUM_VAL_TO_VALUE_STRING to compose value_string arrays with the exact enum names as entries. Use instead of identical local macros in two places. Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 --- M openbsc/src/libiu/iu.c M openbsc/src/libmsc/auth.c 2 files changed, 11 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/44/1444/1 diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index c15c6c5..43266d7 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -89,12 +90,10 @@ static LLIST_HEAD(rnc_list); const struct value_string iu_event_type_names[] = { -#define IU_EVT_STR(X) { X, #X } - IU_EVT_STR(IU_EVENT_RAB_ASSIGN), - IU_EVT_STR(IU_EVENT_SECURITY_MODE_COMPLETE), - IU_EVT_STR(IU_EVENT_IU_RELEASE), - IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), -#undef IU_EVT_STR + OSMO_ENUM_VAL_TO_VALUE_STRING(IU_EVENT_RAB_ASSIGN), + OSMO_ENUM_VAL_TO_VALUE_STRING(IU_EVENT_SECURITY_MODE_COMPLETE), + OSMO_ENUM_VAL_TO_VALUE_STRING(IU_EVENT_IU_RELEASE), + OSMO_ENUM_VAL_TO_VALUE_STRING(IU_EVENT_LINK_INVALIDATED), { 0, NULL } }; diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..d4ffc3e 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -26,19 +26,18 @@ #include #include +#include #include #include const struct value_string auth_action_names[] = { -#define AUTH_ACTION_STR(X) { X, #X } - AUTH_ACTION_STR(AUTH_ERROR), - AUTH_ACTION_STR(AUTH_NOT_AVAIL), - AUTH_ACTION_STR(AUTH_DO_AUTH_THEN_CIPH), - AUTH_ACTION_STR(AUTH_DO_CIPH), - AUTH_ACTION_STR(AUTH_DO_AUTH), -#undef AUTH_ACTION_STR + OSMO_ENUM_VAL_TO_VALUE_STRING(AUTH_ERROR), + OSMO_ENUM_VAL_TO_VALUE_STRING(AUTH_NOT_AVAIL), + OSMO_ENUM_VAL_TO_VALUE_STRING(AUTH_DO_AUTH_THEN_CIPH), + OSMO_ENUM_VAL_TO_VALUE_STRING(AUTH_DO_CIPH), + OSMO_ENUM_VAL_TO_VALUE_STRING(AUTH_DO_AUTH), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:22:56 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:22:56 +0000 Subject: [PATCH] libosmocore[master]: Catch-up with git version tags 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/1427 to look at the new patch set (#3). Catch-up with git version tags * update debian/changelog * update TODO-RELEASE * add comments to Makefile.am and TODO-RELEASE to simplify the process in future Related: OS#1861 Change-Id: I22c257e357f597519120232d742d6a61289db021 --- M TODO-RELEASE M debian/changelog R debian/libosmocore8.install R debian/libosmogsm7.install M src/Makefile.am M src/gsm/Makefile.am 6 files changed, 38 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/1427/3 diff --git a/TODO-RELEASE b/TODO-RELEASE index 17f6521..fb0bfea 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,7 +1,9 @@ +# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install +# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info +# In short: +# LIBVERSION=c:r:a +# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. +# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0. +# If any interfaces have been added since the last public release: c:r:a + 1. +# If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -libosmogsm internal API update Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths -libosmocore change major external talloc dependency / internal talloc removal -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information -libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker -libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/debian/changelog b/debian/changelog index 0877d27..a5ca3d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +libosmocore (0.9.6) unstable; urgency=medium + + * doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs + * New upstream release of libosmocore. + + -- Max Tue, 13 Dec 2016 18:23:56 +0100 + +libosmocore (0.9.5) unstable; urgency=medium + + * fix: DLGSUP logging category "unusable" + * New upstream release of libosmocore. + * ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information + * size of ph_tch_param struct changed / Extend with RTP Marker + * size of struct log_target changed / Extend with GSMTAP + + -- Max Tue, 13 Dec 2016 18:22:56 +0100 + +libosmocore (0.9.4) unstable; urgency=medium + + * New upstream release of libosmocore. + * Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths + * external talloc dependency / internal talloc removal + * size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information + + -- Max Tue, 13 Dec 2016 18:21:56 +0100 + libosmocore (0.9.3) unstable; urgency=medium * Send all stats values after re-configuration. diff --git a/debian/libosmocore7.install b/debian/libosmocore8.install similarity index 100% rename from debian/libosmocore7.install rename to debian/libosmocore8.install diff --git a/debian/libosmogsm5.install b/debian/libosmogsm7.install similarity index 100% rename from debian/libosmogsm5.install rename to debian/libosmogsm7.install diff --git a/src/Makefile.am b/src/Makefile.am index 6a9c675..937e324 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=7:0:0 +# Please read Chapter "Library interface versions" of the libtool documentation before making any modification: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=8:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall $(TALLOC_CFLAGS) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 4ea55e1..cae21b1 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -1,6 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=6:0:1 +# Please read Chapter "Library interface versions" of the libtool documentation before making any modification: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=7:0:1 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:23:39 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:23:39 +0000 Subject: openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Patch Set 11: I've updated commit log to include note on random.seed(). -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 11 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-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:25:22 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:25:22 +0000 Subject: [ABANDON] libosmocore[master]: Remove illegal pkg-config directive In-Reply-To: References: Message-ID: Max has abandoned this change. Change subject: Remove illegal pkg-config directive ...................................................................... Abandoned -- To view, visit https://gerrit.osmocom.org/1426 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I87083a74370b2da2e151f03ee06a9acf37f4b5da Gerrit-PatchSet: 1 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: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:26:53 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:26:53 +0000 Subject: libosmo-abis[master]: Enable adaptive jitter compensation In-Reply-To: References: Message-ID: Patch Set 2: The current behavior is preserved - see corresponding change for osmo-bts in gerrit #1442. -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 16 13:33:29 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:33:29 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 2: Good point. -Werror=null-dereference and -Werror=sizeof-array-argument are not supported by gcc 4.9.2. Is there particular gcc version we care about? -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:39:47 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:39:47 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 2: Somewhat related: http://lkml.iu.edu/hypermail/linux/kernel/1612.2/00176.html - recent discussion about support for kernel build by various gcc versions. -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 13:43:27 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:43:27 +0000 Subject: libosmocore[master]: utils.h: add OSMO_ENUM_VAL_TO_VALUE_STRING macro In-Reply-To: References: Message-ID: Patch Set 1: Given that macro have very narrow usecase where it'll be used a lot, can we have a shorter name? Smth like OSMO_ENUM2VS() perhaps? We can add clarifying comment next to it in case it's not immediately obvious what it does from the place where it's used. -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c 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 Dec 16 13:47:55 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 13:47:55 +0000 Subject: openbsc[master]: bsc_vty: Fix missing break statements in switch() In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1326 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 15:31:08 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 15:31:08 +0000 Subject: libosmocore[master]: utils.h: add OSMO_ENUM_VAL_TO_VALUE_STRING macro In-Reply-To: References: Message-ID: Patch Set 1: I prefer the long explicit version where you can just read what it does. Maybe OSMO_VALUE_STRING(X) ? -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c 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 Fri Dec 16 15:38:31 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 15:38:31 +0000 Subject: [PATCH] libosmocore[master]: utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1440 to look at the new patch set (#2). utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros OSMO_STRINGIFY particularly allows putting port numbers from a #define into VTY doc strings, like: #define FOO_PORT 2342 DEFUN(..., "Foo UDP port (default: " OSMO_STRINGIFY(FOO_PORT) ")\n") OSMO_VALUE_STRING creates value_string items with the string being exactly the enum value's name. Replaces a similar macro def in fsm.c Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c --- M include/osmocom/core/utils.h M src/fsm.c 2 files changed, 9 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/1440/2 diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 3c6fc98..41bbc27 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -15,6 +15,10 @@ #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b)) /*! \brief Return the minimum of two specified values */ #define OSMO_MIN(a, b) ((a) >= (b) ? (b) : (a)) +/*! \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) } #include diff --git a/src/fsm.c b/src/fsm.c index d251cfd..ed57fde 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -457,14 +457,12 @@ file, line); } -#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } - const struct value_string osmo_fsm_term_cause_names[] = { - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + OSMO_ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c 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 Fri Dec 16 15:39:25 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Fri, 16 Dec 2016 15:39:25 +0000 Subject: libosmocore[master]: Revert "Revert "gsm0408: add chreq_type for CHREQ_T_PDCH_ONE... In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1361/1//COMMIT_MSG Commit Message: Line 6: > what this is missing is _why_ the patch is reverted. 2 patches must be applied together in two projects. libosmo-core was finde. openbsc was broken, because of a static patch the second patch was also missing on gerrit. So Neels was just directly reverted this patch. basicly nothing was missing in this patch. coordination was the problem and the missing patch on gerrit. -- 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: 1 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: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 16 15:42:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 15:42:53 +0000 Subject: [PATCH] libosmocore[master]: utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1440 to look at the new patch set (#3). utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros OSMO_STRINGIFY particularly allows putting port numbers from a #define into VTY doc strings, like: #define FOO_PORT 2342 DEFUN(..., "Foo UDP port (default: " OSMO_STRINGIFY(FOO_PORT) ")\n") OSMO_VALUE_STRING creates value_string items with the string being exactly the enum value's name. Replaces a similar macro def in fsm.c Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c --- M include/osmocom/core/utils.h M src/fsm.c 2 files changed, 9 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/1440/3 diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 3c6fc98..41bbc27 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -15,6 +15,10 @@ #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b)) /*! \brief Return the minimum of two specified values */ #define OSMO_MIN(a, b) ((a) >= (b) ? (b) : (a)) +/*! \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) } #include diff --git a/src/fsm.c b/src/fsm.c index d251cfd..fdbc271 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -457,14 +457,12 @@ file, line); } -#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } - const struct value_string osmo_fsm_term_cause_names[] = { - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + OSMO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + OSMO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + OSMO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + OSMO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + OSMO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c 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 Fri Dec 16 15:43:34 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 15:43:34 +0000 Subject: openbsc[master]: fix: missing terminator in two value_string arrays In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1443 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e3f271b887e711c8139fbaa32410c16e7fe9921 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 Fri Dec 16 15:45:01 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 15:45:01 +0000 Subject: libosmocore[master]: utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c 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 Dec 16 15:49:01 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 16 Dec 2016 15:49:01 +0000 Subject: [PATCH] openbsc[master]: use new OSMO_ENUM_VAL_TO_VALUE_STRING In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1444 to look at the new patch set (#2). use new OSMO_ENUM_VAL_TO_VALUE_STRING libosmocore change-id I857af45ae602bb9a647ba26cf8b0d1b23403b54c adds OSMO_VALUE_STRING to compose value_string arrays with the exact enum names as entries. Use instead of identical local macros in two places. Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 --- M openbsc/src/libiu/iu.c M openbsc/src/libmsc/auth.c 2 files changed, 11 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/44/1444/2 diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index c15c6c5..8ba6fa4 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -89,12 +90,10 @@ static LLIST_HEAD(rnc_list); const struct value_string iu_event_type_names[] = { -#define IU_EVT_STR(X) { X, #X } - IU_EVT_STR(IU_EVENT_RAB_ASSIGN), - IU_EVT_STR(IU_EVENT_SECURITY_MODE_COMPLETE), - IU_EVT_STR(IU_EVENT_IU_RELEASE), - IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), -#undef IU_EVT_STR + OSMO_VALUE_STRING(IU_EVENT_RAB_ASSIGN), + OSMO_VALUE_STRING(IU_EVENT_SECURITY_MODE_COMPLETE), + OSMO_VALUE_STRING(IU_EVENT_IU_RELEASE), + OSMO_VALUE_STRING(IU_EVENT_LINK_INVALIDATED), { 0, NULL } }; diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..bf62d3c 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -26,19 +26,18 @@ #include #include +#include #include #include const struct value_string auth_action_names[] = { -#define AUTH_ACTION_STR(X) { X, #X } - AUTH_ACTION_STR(AUTH_ERROR), - AUTH_ACTION_STR(AUTH_NOT_AVAIL), - AUTH_ACTION_STR(AUTH_DO_AUTH_THEN_CIPH), - AUTH_ACTION_STR(AUTH_DO_CIPH), - AUTH_ACTION_STR(AUTH_DO_AUTH), -#undef AUTH_ACTION_STR + OSMO_VALUE_STRING(AUTH_ERROR), + OSMO_VALUE_STRING(AUTH_NOT_AVAIL), + OSMO_VALUE_STRING(AUTH_DO_AUTH_THEN_CIPH), + OSMO_VALUE_STRING(AUTH_DO_CIPH), + OSMO_VALUE_STRING(AUTH_DO_AUTH), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 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 Fri Dec 16 15:53:33 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Fri, 16 Dec 2016 15:53:33 +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 (#3). 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/3 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..89a6b36 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -45,6 +45,7 @@ GSM_CHREQ_REASON_PAG, GSM_CHREQ_REASON_CALL, GSM_CHREQ_REASON_LOCATION_UPD, + GSM_CHREQ_REASON_PDCH, GSM_CHREQ_REASON_OTHER, }; 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: 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: lynxis lazus From gerrit-no-reply at lists.osmocom.org Fri Dec 16 15:55:50 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Fri, 16 Dec 2016 15:55:50 +0000 Subject: openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/1360/2/openbsc/include/openbsc/gsm_data_shared.h File openbsc/include/openbsc/gsm_data_shared.h: Line 48: GSM_CHREQ_REASON_PBCH, > this is a typo, right? Shouldn't it be PDCH? What is a PBCH? I think so. The only reasonable reference about PBCH I've found is the Physical Broadcast Channel in LTE, but that doesn't make sense to me. Fixed it in next patchset. -- 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: 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: lynxis lazus Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 16 16:03:02 2016 From: gerrit-no-reply at lists.osmocom.org (lynxis lazus) Date: Fri, 16 Dec 2016 16:03:02 +0000 Subject: openbsc[master]: libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_... In-Reply-To: References: Message-ID: Patch Set 3: jenkins will fail until the libosmocom patch get's into master (again). -- 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: 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: lynxis lazus Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 16:34:05 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 16:34:05 +0000 Subject: openbsc[master]: Prevent segfault in range encoding In-Reply-To: References: Message-ID: Patch Set 2: I thought that it can but such sets are considered equal: {1, 319, 319} = {319, 1} = {319, 1, 319} etc. It's unclear which definition is used by spec authors. The only place where I've found assumption about distinct elements is in 3GPP TS 44.018 J.4 where it looks like an implementation detail rather than hard requirement. -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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: No From gerrit-no-reply at lists.osmocom.org Fri Dec 16 18:56:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 18:56:21 +0000 Subject: [PATCH] openbsc[master]: Prevent segfault in range encoding 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/1429 to look at the new patch set (#3). Prevent segfault in range encoding * Explicitly check when ARFCN array split is impossible and return gracefully instead of using negative index. * Separate range encoding into generic function and use it for all SI-related things. * Propagate the error into that function and to its callers. * Add separate test-case for the segfault previously triggered by this bug. Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Related: RT#7379 --- M openbsc/include/openbsc/system_information.h M openbsc/src/libbsc/arfcn_range_encode.c M openbsc/src/libbsc/rest_octets.c M openbsc/src/libbsc/system_information.c M openbsc/tests/gsm0408/gsm0408_test.c M openbsc/tests/gsm0408/gsm0408_test.ok 6 files changed, 78 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/29/1429/3 diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h index 7e3ceaa..280e9bd 100644 --- a/openbsc/include/openbsc/system_information.h +++ b/openbsc/include/openbsc/system_information.h @@ -3,6 +3,8 @@ #include +#include + struct gsm_bts; int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type); @@ -11,6 +13,8 @@ unsigned earfcn_size(const struct osmo_earfcn_si2q *e); unsigned range1024_p(unsigned n); unsigned range512_q(unsigned m); +int range_encode(enum gsm48_range r, int *arfcns, int arfcns_used, int *w, + int f0, uint8_t *chan_list); bool si2q_size_check(const struct gsm_bts *bts); int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble); int bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble, diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index 9918838..9ca4840 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -27,6 +27,8 @@ #include +#include + static inline int greatest_power_of_2_lesser_or_equal_to(int index) { int power_of_2 = 1; @@ -109,6 +111,8 @@ /* Now do the processing */ split_at = range_enc_find_index(range, arfcns, size); + if (split_at < 0) + return -EINVAL; /* we now know where to split */ out[index] = 1 + arfcns[split_at]; diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c index 1a5e435..fc0282e 100644 --- a/openbsc/src/libbsc/rest_octets.c +++ b/openbsc/src/libbsc/rest_octets.c @@ -180,10 +180,10 @@ bitvec_set_bit(bv, L); } -static inline void append_uarfcn(struct bitvec *bv, const uint16_t *u, +static inline int append_uarfcn(struct bitvec *bv, const uint16_t *u, const uint16_t *sc, size_t length) { - int f0_inc, i, arfcns_used, w[RANGE_ENC_MAX_ARFCNS], a[length]; + int f0_inc, i, w[RANGE_ENC_MAX_ARFCNS] = { 0 }, a[length]; uint8_t chan_list[16] = {0}; /* 3G Neighbour Cell Description */ @@ -211,9 +211,9 @@ /* Note: we do not support multiple UARFCN values ATM: */ bitvec_set_uint(bv, u[0], 14); - arfcns_used = range_enc_filter_arfcns(a, length, 0, &f0_inc); - range_enc_arfcns(ARFCN_RANGE_1024, a, arfcns_used, w, 0); - range_enc_range1024(chan_list, 0, f0_inc, w); + f0_inc = range_encode(ARFCN_RANGE_1024, a, length, w, 0, chan_list); + if (f0_inc < 0) + return f0_inc; /* FDD_Indic0: parameter value '0000000000' is not a member of the set */ bitvec_set_bit(bv, f0_inc); @@ -229,12 +229,15 @@ /* UTRAN TDD Description */ bitvec_set_bit(bv, 0); + + return 0; } /* generate SI2quater rest octets: 3GPP TS 44.018 ? 10.5.2.33b */ int rest_octets_si2quater(uint8_t *data, const struct osmo_earfcn_si2q *e, const uint16_t *u, const uint16_t *sc, size_t u_len) { + int rc; unsigned sz; struct bitvec bv; bv.data = data; @@ -279,7 +282,13 @@ SI2Q_MAX_LEN); return -ENOMEM; } - append_uarfcn(&bv, u, sc, u_len); + rc = append_uarfcn(&bv, u, sc, u_len); + if (rc < 0) { + LOGP(DRR, LOGL_ERROR, "SI2quater: failed to append %zu " + "UARFCNs due to range encoding failure: %s\n", + u_len, strerror(-rc)); + return rc; + } } else { /* No 3G Neighbour Cell Description */ bitvec_set_bit(&bv, 0); } diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 6c601e4..2c89007 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -316,6 +316,38 @@ return 0; } +int range_encode(enum gsm48_range r, int *arfcns, int arfcns_used, int *w, + int f0, uint8_t *chan_list) +{ + /* + * Manipulate the ARFCN list according to the rules in J4 depending + * on the selected range. + */ + int rc, f0_included; + + range_enc_filter_arfcns(arfcns, arfcns_used, f0, &f0_included); + + rc = range_enc_arfcns(r, arfcns, arfcns_used, w, 0); + if (rc < 0) + return rc; + + /* Select the range and the amount of bits needed */ + switch (r) { + case ARFCN_RANGE_128: + return range_enc_range128(chan_list, f0, w); + case ARFCN_RANGE_256: + return range_enc_range256(chan_list, f0, w); + case ARFCN_RANGE_512: + return range_enc_range512(chan_list, f0, w); + case ARFCN_RANGE_1024: + return range_enc_range1024(chan_list, f0, f0_included, w); + default: + return -ERANGE; + }; + + return f0_included; +} + /* generate a frequency list with the range 512 format */ static inline int enc_freq_lst_range(uint8_t *chan_list, struct bitvec *bv, const struct gsm_bts *bts, @@ -323,9 +355,8 @@ { int arfcns[RANGE_ENC_MAX_ARFCNS]; int w[RANGE_ENC_MAX_ARFCNS]; - int f0_included = 0; int arfcns_used = 0; - int i, rc, range, f0; + int i, range, f0; /* * Select ARFCNs according to the rules in bitvec2freq_list @@ -346,35 +377,8 @@ if (range == ARFCN_RANGE_INVALID) return -2; - /* - * Manipulate the ARFCN list according to the rules in J4 depending - * on the selected range. - */ - arfcns_used = range_enc_filter_arfcns(arfcns, arfcns_used, - f0, &f0_included); - memset(w, 0, sizeof(w)); - rc = range_enc_arfcns(range, arfcns, arfcns_used, w, 0); - if (rc != 0) - return -3; - - /* Select the range and the amount of bits needed */ - switch (range) { - case ARFCN_RANGE_128: - return range_enc_range128(chan_list, f0, w); - break; - case ARFCN_RANGE_256: - return range_enc_range256(chan_list, f0, w); - break; - case ARFCN_RANGE_512: - return range_enc_range512(chan_list, f0, w); - break; - case ARFCN_RANGE_1024: - return range_enc_range1024(chan_list, f0, f0_included, w); - break; - default: - return -4; - }; + return range_encode(range, arfcns, arfcns_used, w, f0, chan_list); } /* generate a cell channel list as per Section 10.5.2.1b of 04.08 */ @@ -447,7 +451,7 @@ /* Attempt to do the range encoding */ rc = enc_freq_lst_range(chan_list, bv, bts, bis, ter, pgsm); - if (rc == 0) + if (rc >= 0) return 0; LOGP(DRR, LOGL_ERROR, "min_arfcn=%u, max_arfcn=%u, arfcns=%d " diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index ae8cbdd..472c2ae 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -120,6 +120,21 @@ gen(bts); } +static inline void test_si2q_segfault(void) +{ + struct gsm_bts *bts; + struct gsm_network *network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); + printf("Test SI2quater UARFCN (same scrambling code and diversity):\n"); + + if (!network) + exit(1); + bts = gsm_bts_alloc(network); + + _bts_uarfcn_add(bts, 10564, 319, 0); + _bts_uarfcn_add(bts, 10612, 319, 0); + gen(bts); +} + static inline void test_si2q_u(void) { struct gsm_bts *bts; @@ -590,6 +605,7 @@ test_range_encoding(); test_gsm411_rp_ref_wrap(); + test_si2q_segfault(); test_si2q_e(); test_si2q_u(); printf("Done.\n"); diff --git a/openbsc/tests/gsm0408/gsm0408_test.ok b/openbsc/tests/gsm0408/gsm0408_test.ok index ebe9476..1118dd9 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.ok +++ b/openbsc/tests/gsm0408/gsm0408_test.ok @@ -62,6 +62,10 @@ Allocated reference: 255 Allocated reference: 0 Allocated reference: 1 +Test SI2quater UARFCN (same scrambling code and diversity): +generated valid SI2quater: [23] 59 06 07 c0 00 25 52 88 0a 7e 10 99 64 00 0b 2b 2b 2b 2b 2b 2b 2b 2b +failed to generate SI2quater: Invalid argument +failed to generate SI2quater: Invalid argument Testing SYSINFO_TYPE_2quater EARFCN generation: generated invalid SI2quater: [23] 59 06 07 c0 00 04 86 59 0a 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b added EARFCN 1917 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be c8 50 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b -- To view, visit https://gerrit.osmocom.org/1429 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 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 Fri Dec 16 18:56:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 16 Dec 2016 18:56:21 +0000 Subject: [PATCH] openbsc[master]: Cosmetic fixes around SI generation 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/1372 to look at the new patch set (#3). Cosmetic fixes around SI generation * add missing spaces after comma and minus * prevent useless recursion calls * mark static function as such * name and explicitly use enum for ARFCN range Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e --- M openbsc/include/openbsc/arfcn_range_encode.h M openbsc/src/libbsc/arfcn_range_encode.c M openbsc/src/libbsc/bsc_init.c 3 files changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/72/1372/3 diff --git a/openbsc/include/openbsc/arfcn_range_encode.h b/openbsc/include/openbsc/arfcn_range_encode.h index bd85d6a..7ec710c 100644 --- a/openbsc/include/openbsc/arfcn_range_encode.h +++ b/openbsc/include/openbsc/arfcn_range_encode.h @@ -3,7 +3,7 @@ #include -enum { +enum gsm48_range { ARFCN_RANGE_INVALID = -1, ARFCN_RANGE_128 = 127, ARFCN_RANGE_256 = 255, @@ -14,8 +14,8 @@ #define RANGE_ENC_MAX_ARFCNS 29 int range_enc_determine_range(const int *arfcns, int size, int *f0_out); -int range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); -int range_enc_find_index(const int rng, const int *arfcns, int size); +int range_enc_arfcns(enum gsm48_range rng, const int *arfcns, int sze, int *out, int idx); +int range_enc_find_index(enum gsm48_range rng, const int *arfcns, int size); int range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included); int range_enc_range128(uint8_t *chan_list, int f0, int *w); diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index e67bf0a..9918838 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -27,7 +27,7 @@ #include -int greatest_power_of_2_lesser_or_equal_to(int index) +static inline int greatest_power_of_2_lesser_or_equal_to(int index) { int power_of_2 = 1; @@ -52,7 +52,7 @@ * equally size partition for the given range. Return -1 if * no such partition exists. */ -int range_enc_find_index(const int range, const int *freqs, const int size) +int range_enc_find_index(enum gsm48_range range, const int *freqs, const int size) { int i, j, n; @@ -79,7 +79,7 @@ * \param size The size of the list of ARFCNs * \param out Place to store the W(i) output. */ -int range_enc_arfcns(const int range, +int range_enc_arfcns(enum gsm48_range range, const int *arfcns, int size, int *out, const int index) { @@ -127,9 +127,11 @@ * Now recurse and we need to make this iterative... but as the * tree is balanced the stack will not be too deep. */ - range_enc_arfcns(range / 2, arfcns_left, l_size, + if (l_size) + range_enc_arfcns(range / 2, arfcns_left, l_size, out, index + greatest_power_of_2_lesser_or_equal_to(index + 1)); - range_enc_arfcns((range -1 ) / 2, arfcns_right, r_size, + if (r_size) + range_enc_arfcns((range - 1) / 2, arfcns_right, r_size, out, index + (2 * greatest_power_of_2_lesser_or_equal_to(index + 1))); return 0; } diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 9e913d6..b17ff79 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -193,7 +193,7 @@ return 0; err_out: - LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>," + LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, " "most likely a problem with neighbor cell list generation\n", get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc)); return rc; -- To view, visit https://gerrit.osmocom.org/1372 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sun Dec 18 14:37:47 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 14:37:47 +0000 Subject: [PATCH] osmo-tetra[master]: Add simdemod2.py, a simple demodulator without GUI Message-ID: Review at https://gerrit.osmocom.org/1447 Add simdemod2.py, a simple demodulator without GUI Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de --- A src/demod/python/simdemod2.py A src/receiver1 A src/receiver2 3 files changed, 101 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/47/1447/1 diff --git a/src/demod/python/simdemod2.py b/src/demod/python/simdemod2.py new file mode 100755 index 0000000..6b6fe2b --- /dev/null +++ b/src/demod/python/simdemod2.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python + +# osmosdr-tetra_demod_fft.py Copyright 2012 Dimitri Stolnikov + +# simdemod.py (c) 2014 Jacek Lipkowski +# this is a modified osmosdr-tetra_demod_fft.py with all of the gui stuff +# removed. is is intended to be fed from a receiver program via a pipe +# +# mkfifo /tmp/fifo1 +# demod/python/simdemod.py -o /dev/stdout -i /tmp/fifo1 | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin +# + +import sys +import math +from gnuradio import gr, gru, eng_notation, blks2, optfir +from gnuradio.eng_option import eng_option +from optparse import OptionParser +import osmosdr + +try: + import cqpsk +except: + from tetra_demod import cqpsk + +# applies frequency translation, resampling and demodulation + +class top_block(gr.top_block): + def __init__(self): + gr.top_block.__init__(self, "Top Block") + + options = get_options() + self.input_file=options.input_file + self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, self.input_file, True) + + symbol_rate = 18000 + sps = 2 # output rate will be 36,000 + out_sample_rate = symbol_rate * sps + + options.low_pass = options.low_pass / 2.0 + + self.demod = cqpsk.cqpsk_demod( + samples_per_symbol = sps, + excess_bw=0.35, + costas_alpha=0.03, + gain_mu=0.05, + mu=0.05, + omega_relative_limit=0.05, + log=options.log, + verbose=options.verbose) + + self.output = gr.file_sink(gr.sizeof_float, options.output_file) + + self.connect(self.gr_file_source_0, self.demod, self.output) + + + + + + +def get_options(): + parser = OptionParser(option_class=eng_option) + + # demodulator related settings + parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") + parser.add_option("-i", "--input-file", type="string", default="in.float", help="specify the bit input file") + parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") + parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") + parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") + + (options, args) = parser.parse_args() + if len(args) != 0: + parser.print_help() + raise SystemExit, 1 + + return (options) + +if __name__ == '__main__': + tb = top_block() + tb.run() + #tb.run(True) diff --git a/src/receiver1 b/src/receiver1 new file mode 100755 index 0000000..9b585ca --- /dev/null +++ b/src/receiver1 @@ -0,0 +1,10 @@ +#!/bin/sh +# This is an example how to use simdemod.py --sq5bpf +export TETRA_HACK_PORT=7379 +export TETRA_HACK_RXID=$1 +FIFO=/tmp/fifo$1 +mkfifo $FIFO +ulimit -c unlimited +demod/python/simdemod2.py -o /dev/stdout -i $FIFO | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin + + diff --git a/src/receiver2 b/src/receiver2 new file mode 100755 index 0000000..5a153a5 --- /dev/null +++ b/src/receiver2 @@ -0,0 +1,11 @@ +#!/bin/sh +# This is an example how to use simdemod.py --sq5bpf +# this is receiver 1, only with the port changed, it will be used in the example documentation +export TETRA_HACK_PORT=7380 #i might as well have made this a command line parameter, oh well :) +export TETRA_HACK_RXID=$1 +FIFO=/tmp/fifo$1 +mkfifo $FIFO +ulimit -c unlimited +demod/python/simdemod2.py -o /dev/stdout -i $FIFO | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin + + -- To view, visit https://gerrit.osmocom.org/1447 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sun Dec 18 15:23:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:23:28 +0000 Subject: [PATCH] osmo-tetra[master]: Update the Codec Download instructions and include a shell s... Message-ID: Review at https://gerrit.osmocom.org/1448 Update the Codec Download instructions and include a shell script Change-Id: Ia943a38e422e23e70f73d9672554633c014f6da7 --- M etsi_codec-patches/README A etsi_codec-patches/download_and_patch.sh 2 files changed, 71 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/48/1448/1 diff --git a/etsi_codec-patches/README b/etsi_codec-patches/README index 7206947..1c95c83 100644 --- a/etsi_codec-patches/README +++ b/etsi_codec-patches/README @@ -2,5 +2,36 @@ source code as published by the ETSI at in the file named en_30039502v010301p0.zip +You can proceed two ways, a or b: + +a) Using the download_and_patch.sh script + +simply execute ./download_and_patch.sh which will download the +reference codec from the ETSI website and patch it accordingly. + + +b) Manually + +Modified instructions as of 20141118 (differs from the osmocom description, +the ETSI site looks different now): + +In order to obtain the codec, download it directly from +http://www.etsi.org/deliver/etsi_en/300300_300399/30039502/01.03.01_60/en_30039502v010301p0.zip +or use the following procedure: + + * go to http://pda.etsi.org/ + * enter "en 300 395-2" as search term + * execute the search, there should a result called "REN/TETRA-05059 " + * click on the 'Download icon' link (zip-vice symbol) + * you should now have a file called en_30039502v010301p0.zip + +Please also see https://osmocom.org/projects/tetra/wiki/Speech_Codec + +The en_30039502v010301p0.zip file has 361169 bytes, and has the md5sum: +a8115fe68ef8f8cc466f4192572a1e3e + Due to the use of uppercase file names in the zip file, you should use the "-L" flag to the unzip program, which ensures all files are completely lower-case. + +Please apply all of the patches foudn in this directory to the +resulting source code. diff --git a/etsi_codec-patches/download_and_patch.sh b/etsi_codec-patches/download_and_patch.sh new file mode 100755 index 0000000..d9e9674 --- /dev/null +++ b/etsi_codec-patches/download_and_patch.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +URL=http://www.etsi.org/deliver/etsi_en/300300_300399/30039502/01.03.01_60/en_30039502v010301p0.zip +MD5_EXP=a8115fe68ef8f8cc466f4192572a1e3e +LOCAL_FILE=etsi_tetra_codec.zip + +PATCHDIR=`pwd` +CODECDIR=`pwd`/../codec + +echo Deleting $CODECDIR ... +[ -e $CODECDIR ] && rm -rf $CODECDIR + +echo Creating $CODECDIR ... +mkdir $CODECDIR + +if [ ! -f $LOCAL_FILE ]; then + echo Downloading $URL ... + wget -O $LOCAL_FILE $URL +else + echo Skipping download, file $LOCAL_FILE exists +fi +MD5=`md5sum $LOCAL_FILE | awk '{ print $1 }'` + +echo Checking MD5SUM ... +if [ $MD5 != $MD5_EXP ]; then + print "MD5sum of ETSI reference codec file doesn't match" + exit 1 +fi + +echo Unpacking ZIP ... +cd $CODECDIR +unzip -L $PATCHDIR/etsi_tetra_codec.zip + +echo Applying Patches ... +for p in `cat "$PATCHDIR/series"`; do + echo "=> Applying patch '$p'..." + patch -p1 < "$PATCHDIR/$p" +done + +echo Done! -- To view, visit https://gerrit.osmocom.org/1448 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia943a38e422e23e70f73d9672554633c014f6da7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sun Dec 18 15:23:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:23:28 +0000 Subject: [PATCH] osmo-tetra[master]: Add patches for codec static linking and logging to stderr Message-ID: Review at https://gerrit.osmocom.org/1449 Add patches for codec static linking and logging to stderr Change-Id: I41b32e38c08152e608f20af44db4456ca59169eb --- A etsi_codec-patches/link_static.patch A etsi_codec-patches/log_stderr.patch M etsi_codec-patches/series 3 files changed, 177 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/49/1449/1 diff --git a/etsi_codec-patches/link_static.patch b/etsi_codec-patches/link_static.patch new file mode 100644 index 0000000..c553c5e --- /dev/null +++ b/etsi_codec-patches/link_static.patch @@ -0,0 +1,26 @@ +diff -Nruw codec.orig/amr-code/makefile codec/amr-code/makefile +--- codec.orig/amr-code/makefile 2016-12-18 15:57:20.737366601 +0100 ++++ codec/amr-code/makefile 2016-12-18 16:00:02.166031929 +0100 +@@ -21,7 +21,7 @@ + + CC=gcc + +-CFLAGS = -g -I. -Wall -m32 ++CFLAGS = -g -I. -Wall -m32 -static + + SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ + tetra_op.c +diff -Nruw codec.orig/c-code/makefile codec/c-code/makefile +--- codec.orig/c-code/makefile 2016-12-18 15:57:20.737366601 +0100 ++++ codec/c-code/makefile 2016-12-18 15:59:55.146002990 +0100 +@@ -23,7 +23,7 @@ + + CC=gcc + +-CFLAGS = -I. -Wall -m32 ++CFLAGS = -I. -Wall -m32 -static + + SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ + sub_dsp.c fbas_tet.c fexp_tet.c \ +Binary files codec.orig/c-code/scoder and codec/c-code/scoder differ +Binary files codec.orig/c-code/sdecoder and codec/c-code/sdecoder differ diff --git a/etsi_codec-patches/log_stderr.patch b/etsi_codec-patches/log_stderr.patch new file mode 100644 index 0000000..da551ef --- /dev/null +++ b/etsi_codec-patches/log_stderr.patch @@ -0,0 +1,149 @@ +diff -ur codec.orig/c-code/cdecoder.c codec.patched/c-code/cdecoder.c +--- codec.orig/c-code/cdecoder.c 1995-06-06 11:32:14.000000000 +0200 ++++ codec.patched/c-code/cdecoder.c 2014-11-18 22:53:06.000000000 +0100 +@@ -67,23 +67,23 @@ + /* Parse arguments */ + if ( argc != 3 ) + { +- puts( "usage : cdecoder input_file output_file" ); +- puts( "format for input_file : $6B21...114 bits"); +- puts( " ...$6B22...114..." ); +- puts( " ...$6B26...114...$6B21"); +- puts( "format for output_file : two 138 (BFI + 137) bit frames"); ++ fputs("usage : cdecoder input_file output_file",stderr ); ++ fputs("format for input_file : $6B21...114 bits",stderr); ++ fputs(" ...$6B22...114...",stderr ); ++ fputs(" ...$6B26...114...$6B21",stderr); ++ fputs("format for output_file : two 138 (BFI + 137) bit frames",stderr); + exit( 1 ); + } + + if ( (fin = fopen( argv[1], "rb" )) == NULL ) + { +- puts("cdecoder: can't open input_file" ); ++ fputs("cdecoder: can't open input_file" ,stderr); + exit( 1 ); + } + + if ( (fout = fopen( argv[2], "wb" )) == NULL ) + { +- puts("cdecoder: can't open output_file" ); ++ fputs("cdecoder: can't open output_file",stderr ); + exit( 1 ); + } + +@@ -93,7 +93,7 @@ + /* read Input_array (1 TETRA frame = 2 speech frames) from input file */ + if (Read_Tetra_File (fin, Interleaved_coded_array) == -1) + { +- puts ("cdecoder: reached end of input_file"); ++ fputs ("cdecoder: reached end of input_file",stderr); + break; + } + +@@ -116,7 +116,7 @@ + in "Coded_array" */ + + /* Message in case the Frame was stolen */ +- if (bfi1) printf("Frame Nb %ld was stolen\n",Loop_counter+1); ++ if (bfi1) fprintf(stderr,"Frame Nb %ld was stolen\n",Loop_counter+1); + + /* Channel Decoding */ + bfi2 = Channel_Decoding(first_pass,Frame_stealing, +@@ -126,35 +126,35 @@ + /* Increment Loop counter */ + Loop_counter++; + /* Message in case the Bad Frame Indicator was set */ +- if (bfi2) printf("Frame Nb %ld Bfi active\n\n",Loop_counter); ++ if (bfi2) fprintf(stderr,"Frame Nb %ld Bfi active\n\n",Loop_counter); + + /* writing Reordered_array to output file */ + /* bfi bit */ + if( fwrite( &bfi1, sizeof(short), 1, fout ) != 1 ) { +- puts( "cdecoder: can't write to output_file" ); ++ fputs( "cdecoder: can't write to output_file",stderr ); + break; + } + /* 1st speech frame */ + if( fwrite( Reordered_array, sizeof(short), 137, fout ) != 137 ) + { +- puts( "cdecoder: can't write to output_file" ); ++ fputs("cdecoder: can't write to output_file",stderr ); + break; + } + /* bfi bit */ + if( fwrite( &bfi2, sizeof(short), 1, fout ) != 1 ) { +- puts( "cdecoder: can't write to output_file" ); ++ fputs("cdecoder: can't write to output_file",stderr ); + break; + } + /* 2nd speech frame */ + if( fwrite( Reordered_array+137, sizeof(short), 137, fout ) + != 137 ) { +- puts( "cdecoder: can't write to output_file" ); ++ fputs("cdecoder: can't write to output_file",stderr ); + break; + } + } + +- printf("%ld Channel Frames processed\n",Loop_counter); +- printf("ie %ld Speech Frames\n",2*Loop_counter); ++ fprintf(stderr,"%ld Channel Frames processed\n",Loop_counter); ++ fprintf(stderr,"ie %ld Speech Frames\n",2*Loop_counter); + + /* closing files */ + fclose( fin ); +diff -ur codec.orig/c-code/sdecoder.c codec.patched/c-code/sdecoder.c +--- codec.orig/c-code/sdecoder.c 1995-06-06 10:55:28.000000000 +0200 ++++ codec.patched/c-code/sdecoder.c 2014-11-18 22:53:06.000000000 +0100 +@@ -58,15 +58,15 @@ + + if ( argc != 3 ) + { +- printf("Usage : sdecoder serial_file synth_file\n"); +- printf("\n"); +- printf("Format for serial_file:\n"); +- printf(" Serial stream input is read from a binary file\n"); +- printf(" where each 16-bit word represents 1 encoded bit.\n"); +- printf(" BFI + 137 bits by frame\n"); +- printf("\n"); +- printf("Format for synth_file:\n"); +- printf(" Synthesis is written to a binary file of 16 bits data.\n"); ++ fprintf(stderr,"Usage : sdecoder serial_file synth_file\n"); ++ fprintf(stderr,"\n"); ++ fprintf(stderr,"Format for serial_file:\n"); ++ fprintf(stderr," Serial stream input is read from a binary file\n"); ++ fprintf(stderr," where each 16-bit word represents 1 encoded bit.\n"); ++ fprintf(stderr," BFI + 137 bits by frame\n"); ++ fprintf(stderr,"\n"); ++ fprintf(stderr,"Format for synth_file:\n"); ++ fprintf(stderr," Synthesis is written to a binary file of 16 bits data.\n"); + exit( 1 ); + } + +@@ -74,13 +74,13 @@ + + if( (f_serial = fopen(argv[1],"rb") ) == NULL ) + { +- printf("Input file '%s' does not exist !!\n",argv[1]); ++ fprintf(stderr,"Input file '%s' does not exist !!\n",argv[1]); + exit(0); + } + + if( (f_syn = fopen(argv[2], "wb") ) == NULL ) + { +- printf("Cannot open file '%s' !!\n", argv[2]); ++ fprintf(stderr,"Cannot open file '%s' !!\n", argv[2]); + exit(0); + } + +@@ -95,7 +95,7 @@ + + while( fread(serial, sizeof(Word16), serial_size, f_serial) == serial_size) + { +- printf("frame=%d\n", ++frame); ++ fprintf(stderr,"frame=%d\n", ++frame); + + Bits2prm_Tetra(serial, parm); /* serial to parameters */ + + diff --git a/etsi_codec-patches/series b/etsi_codec-patches/series index a050008..a5d92be 100644 --- a/etsi_codec-patches/series +++ b/etsi_codec-patches/series @@ -1,4 +1,6 @@ makefile-cleanups.patch build_as_32bit.patch +link_static.patch round_private.patch filename-case.patch +log_stderr.patch -- To view, visit https://gerrit.osmocom.org/1449 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I41b32e38c08152e608f20af44db4456ca59169eb Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sun Dec 18 15:23:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:23:28 +0000 Subject: [PATCH] osmo-tetra[master]: Fix ETSI reference codec's patch for building on 64 bit arch... Message-ID: Review at https://gerrit.osmocom.org/1450 Fix ETSI reference codec's patch for building on 64 bit architectures. merged/ported to osmocom master by Harald Welte Change-Id: I6b16811d4a3030dfce0718f0b1d266ee1761bfef --- D etsi_codec-patches/build_as_32bit.patch A etsi_codec-patches/fix_64bit.patch D etsi_codec-patches/link_static.patch M etsi_codec-patches/makefile-cleanups.patch M etsi_codec-patches/series 5 files changed, 37 insertions(+), 56 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/50/1450/1 diff --git a/etsi_codec-patches/build_as_32bit.patch b/etsi_codec-patches/build_as_32bit.patch deleted file mode 100644 index 3613f0e..0000000 --- a/etsi_codec-patches/build_as_32bit.patch +++ /dev/null @@ -1,26 +0,0 @@ -Index: etsi/amr-code/makefile -=================================================================== ---- etsi.orig/amr-code/makefile 2011-05-29 11:40:11.000000000 +0200 -+++ etsi/amr-code/makefile 2011-05-29 11:40:17.000000000 +0200 -@@ -21,7 +21,7 @@ - - CC=gcc - --CFLAGS = -g -I. -Wall -+CFLAGS = -g -I. -Wall -m32 - - SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ - tetra_op.c -Index: etsi/c-code/makefile -=================================================================== ---- etsi.orig/c-code/makefile 2011-05-29 11:40:02.000000000 +0200 -+++ etsi/c-code/makefile 2011-05-29 11:40:07.000000000 +0200 -@@ -23,7 +23,7 @@ - - CC=gcc - --CFLAGS = -I. -Wall -+CFLAGS = -I. -Wall -m32 - - SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ - sub_dsp.c fbas_tet.c fexp_tet.c \ diff --git a/etsi_codec-patches/fix_64bit.patch b/etsi_codec-patches/fix_64bit.patch new file mode 100644 index 0000000..7c65ac7 --- /dev/null +++ b/etsi_codec-patches/fix_64bit.patch @@ -0,0 +1,34 @@ +diff -Nruw codec.orig/amr-code/source.h codec/amr-code/source.h +--- codec.orig/amr-code/source.h 2016-12-18 16:17:46.238404730 +0100 ++++ codec/amr-code/source.h 2016-12-18 16:18:21.358545740 +0100 +@@ -19,10 +19,11 @@ + + #ifndef TYPEDEF_H + #define TYPEDEF_H ++#include + + +-typedef short Word16; +-typedef long Word32; ++typedef int16_t Word16; ++typedef int32_t Word32; + typedef int Flag; + + #endif +diff -Nruw codec.orig/c-code/source.h codec/c-code/source.h +--- codec.orig/c-code/source.h 2016-12-18 16:17:46.242404746 +0100 ++++ codec/c-code/source.h 2016-12-18 16:18:54.494678813 +0100 +@@ -19,10 +19,11 @@ + + #ifndef TYPEDEF_H + #define TYPEDEF_H ++#include + + +-typedef short Word16; +-typedef long Word32; ++typedef int16_t Word16; ++typedef int32_t Word32; + typedef int Flag; + + #endif diff --git a/etsi_codec-patches/link_static.patch b/etsi_codec-patches/link_static.patch deleted file mode 100644 index c553c5e..0000000 --- a/etsi_codec-patches/link_static.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -Nruw codec.orig/amr-code/makefile codec/amr-code/makefile ---- codec.orig/amr-code/makefile 2016-12-18 15:57:20.737366601 +0100 -+++ codec/amr-code/makefile 2016-12-18 16:00:02.166031929 +0100 -@@ -21,7 +21,7 @@ - - CC=gcc - --CFLAGS = -g -I. -Wall -m32 -+CFLAGS = -g -I. -Wall -m32 -static - - SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ - tetra_op.c -diff -Nruw codec.orig/c-code/makefile codec/c-code/makefile ---- codec.orig/c-code/makefile 2016-12-18 15:57:20.737366601 +0100 -+++ codec/c-code/makefile 2016-12-18 15:59:55.146002990 +0100 -@@ -23,7 +23,7 @@ - - CC=gcc - --CFLAGS = -I. -Wall -m32 -+CFLAGS = -I. -Wall -m32 -static - - SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ - sub_dsp.c fbas_tet.c fexp_tet.c \ -Binary files codec.orig/c-code/scoder and codec/c-code/scoder differ -Binary files codec.orig/c-code/sdecoder and codec/c-code/sdecoder differ diff --git a/etsi_codec-patches/makefile-cleanups.patch b/etsi_codec-patches/makefile-cleanups.patch index 1120dce..ca78b24 100644 --- a/etsi_codec-patches/makefile-cleanups.patch +++ b/etsi_codec-patches/makefile-cleanups.patch @@ -7,7 +7,7 @@ CC=gcc -CFLAGS = -g -I. -+CFLAGS = -g -I. -Wall ++CFLAGS = -g -I. -Wall -O3 SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ tetra_op.c @@ -36,7 +36,7 @@ +CC=gcc -CFLAGS = -I. -+CFLAGS = -I. -Wall ++CFLAGS = -I. -Wall -O3 SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ sub_dsp.c fbas_tet.c fexp_tet.c \ diff --git a/etsi_codec-patches/series b/etsi_codec-patches/series index a5d92be..b69c84f 100644 --- a/etsi_codec-patches/series +++ b/etsi_codec-patches/series @@ -1,6 +1,5 @@ makefile-cleanups.patch -build_as_32bit.patch -link_static.patch +fix_64bit.patch round_private.patch filename-case.patch log_stderr.patch -- To view, visit https://gerrit.osmocom.org/1450 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6b16811d4a3030dfce0718f0b1d266ee1761bfef Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sun Dec 18 15:23:50 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:23:50 +0000 Subject: osmo-tetra[master]: Add simdemod2.py, a simple demodulator without GUI In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1447 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de 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 Sun Dec 18 15:23:55 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:23:55 +0000 Subject: osmo-tetra[master]: Update the Codec Download instructions and include a shell s... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1448 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia943a38e422e23e70f73d9672554633c014f6da7 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 Sun Dec 18 15:24:01 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:24:01 +0000 Subject: osmo-tetra[master]: Add patches for codec static linking and logging to stderr In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1449 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41b32e38c08152e608f20af44db4456ca59169eb 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 Sun Dec 18 15:24:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:24:07 +0000 Subject: osmo-tetra[master]: Fix ETSI reference codec's patch for building on 64 bit arch... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1450 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6b16811d4a3030dfce0718f0b1d266ee1761bfef 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 Sun Dec 18 15:24:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:24:24 +0000 Subject: osmo-tetra[master]: Fix ETSI reference codec's patch for building on 64 bit arch... In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1450 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6b16811d4a3030dfce0718f0b1d266ee1761bfef 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 Sun Dec 18 15:24:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:24:26 +0000 Subject: osmo-tetra[master]: Add simdemod2.py, a simple demodulator without GUI In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1447 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de 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 Sun Dec 18 15:24:27 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:24:27 +0000 Subject: osmo-tetra[master]: Update the Codec Download instructions and include a shell s... In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1448 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia943a38e422e23e70f73d9672554633c014f6da7 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 Sun Dec 18 15:24:29 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 15:24:29 +0000 Subject: osmo-tetra[master]: Add patches for codec static linking and logging to stderr In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1449 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I41b32e38c08152e608f20af44db4456ca59169eb 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 Sun Dec 18 16:07:48 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:07:48 +0000 Subject: openbsc[master]: fix: missing terminator in two value_string arrays In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1443 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2e3f271b887e711c8139fbaa32410c16e7fe9921 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 Sun Dec 18 16:07:51 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:07:51 +0000 Subject: [MERGED] openbsc[master]: fix: missing terminator in two value_string arrays In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fix: missing terminator in two value_string arrays ...................................................................... fix: missing terminator in two value_string arrays iu_event_type_names[] and auth_action_names[] lacked a { 0, NULL }. Change-Id: I2e3f271b887e711c8139fbaa32410c16e7fe9921 --- M openbsc/src/libiu/iu.c M openbsc/src/libmsc/auth.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/libiu/iu.c b/openbsc/src/libiu/iu.c index 87a02d8..c15c6c5 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -95,6 +95,7 @@ IU_EVT_STR(IU_EVENT_IU_RELEASE), IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), #undef IU_EVT_STR + { 0, NULL } }; struct ue_conn_ctx *ue_conn_ctx_alloc(struct osmo_sccp_link *link, uint32_t conn_id) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 9191ae8..3b1fd73 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -39,6 +39,7 @@ AUTH_ACTION_STR(AUTH_DO_CIPH), AUTH_ACTION_STR(AUTH_DO_AUTH), #undef AUTH_ACTION_STR + { 0, NULL } }; static int -- To view, visit https://gerrit.osmocom.org/1443 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2e3f271b887e711c8139fbaa32410c16e7fe9921 Gerrit-PatchSet: 1 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 Sun Dec 18 16:11:10 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:11:10 +0000 Subject: [PATCH] osmo-tetra[master]: demod: Import the new GR 3.7 code Message-ID: Hello tnt, I'd like you to do a code review. Please visit https://gerrit.osmocom.org/1451 to review the following change. demod: Import the new GR 3.7 code This adds demodulator code compatible with gnuradio 3.7 series. Change-Id: Ibaf7f9c552cc1625210a75f2e9ec142ab47ce8d6 Signed-off-by: Sylvain Munaut --- A src/demod/cqpsk.py A src/demod/osmosdr-tetra_demod_fft.py 2 files changed, 600 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/51/1451/1 diff --git a/src/demod/cqpsk.py b/src/demod/cqpsk.py new file mode 100644 index 0000000..6be6ee7 --- /dev/null +++ b/src/demod/cqpsk.py @@ -0,0 +1,345 @@ +# +# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# +# cqpsk.py (C) Copyright 2009, KA1RBI +# +# This file is part of GNU Radio +# +# GNU Radio 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, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# See gnuradio-examples/python/digital for examples + +""" +differential PI/4 CQPSK modulation and demodulation. +""" + +from gnuradio import gr, gru, analog, blocks, digital, filter +from math import pi, sqrt +import cmath +from pprint import pprint + +# default values (used in __init__ and add_options) +_def_samples_per_symbol = 10 +_def_excess_bw = 0.35 +_def_gray_code = True +_def_verbose = False +_def_log = False + +_def_costas_alpha = 0.15 +_def_gain_mu = None +_def_mu = 0.5 +_def_omega_relative_limit = 0.005 + + +# ///////////////////////////////////////////////////////////////////////////// +# CQPSK modulator +# ///////////////////////////////////////////////////////////////////////////// + +class cqpsk_mod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered QPSK modulation. + + The input is a byte stream (unsigned char) and the + output is the complex modulated signal at baseband. + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: integer + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "cqpsk_mod", + gr.io_signature(1, 1, gr.sizeof_char), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + + if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: + raise TypeError, ("sbp must be an integer >= 2, is %d" % samples_per_symbol) + + ntaps = 11 * samples_per_symbol + + arity = 8 + + # turn bytes into k-bit vectors + self.bytes2chunks = \ + gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) + + # 0 +45 1 [+1] + # 1 +135 3 [+3] + # 2 -45 7 [-1] + # 3 -135 5 [-3] + self.pi4map = [1, 3, 7, 5] + self.symbol_mapper = gr.map_bb(self.pi4map) + self.diffenc = gr.diff_encoder_bb(arity) + self.chunks2symbols = gr.chunks_to_symbols_bc(psk.constellation[arity]) + + # pulse shaping filter + self.rrc_taps = filter.firdes.root_raised_cosine( + self._samples_per_symbol, # gain (sps since we're interpolating by sps) + self._samples_per_symbol, # sampling rate + 1.0, # symbol rate + self._excess_bw, # excess bandwidth (roll-off factor) + ntaps) + + self.rrc_filter = filter.interp_fir_filter_ccf(self._samples_per_symbol, self.rrc_taps) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc, + self.chunks2symbols, self.rrc_filter, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + @staticmethod + def bits_per_symbol(): + return 2 + + def _print_verbage(self): + print "\nModulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRS roll-off factor: %f" % self._excess_bw + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.bytes2chunks, + gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat")) + self.connect(self.symbol_mapper, + gr.file_sink(gr.sizeof_char, "tx_graycoder.dat")) + self.connect(self.diffenc, + gr.file_sink(gr.sizeof_char, "tx_diffenc.dat")) + self.connect(self.chunks2symbols, + gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat")) + + @staticmethod + def add_options(parser): + """ + Adds QPSK modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + + @staticmethod + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options(dqpsk_mod.__init__, + ('self',), options) + + +# ///////////////////////////////////////////////////////////////////////////// +# CQPSK demodulator +# +# ///////////////////////////////////////////////////////////////////////////// + +class cqpsk_demod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + costas_alpha=_def_costas_alpha, + gain_mu=_def_gain_mu, + mu=_def_mu, + omega_relative_limit=_def_omega_relative_limit, + gray_code=_def_gray_code, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered CQPSK demodulation + + The input is the complex modulated signal at baseband. + The output is a stream of floats in [ -3 / -1 / +1 / +3 ] + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: float + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param costas_alpha: loop filter gain + @type costas_alphas: float + @param gain_mu: for M&M block + @type gain_mu: float + @param mu: for M&M block + @type mu: float + @param omega_relative_limit: for M&M block + @type omega_relative_limit: float + @param gray_code: Tell modulator to Gray code the bits + @type gray_code: bool + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "cqpsk_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_float)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + self._costas_alpha = costas_alpha + self._mm_gain_mu = gain_mu + self._mm_mu = mu + self._mm_omega_relative_limit = omega_relative_limit + self._gray_code = gray_code + + if samples_per_symbol < 2: + raise TypeError, "sbp must be >= 2, is %d" % samples_per_symbol + + arity = pow(2,self.bits_per_symbol()) + + # Automatic gain control + scale = (1.0/16384.0) + self.pre_scaler = blocks.multiply_const_cc(scale) # scale the signal from full-range to +-1 + #self.agc = analog.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) + self.agc = analog.feedforward_agc_cc(16, 2.0) + + # RRC data filter + ntaps = 11 * samples_per_symbol + self.rrc_taps = filter.firdes.root_raised_cosine( + 1.0, # gain + self._samples_per_symbol, # sampling rate + 1.0, # symbol rate + self._excess_bw, # excess bandwidth (roll-off factor) + ntaps) + self.rrc_filter=filter.interp_fir_filter_ccf(1, self.rrc_taps) + + if not self._mm_gain_mu: + sbs_to_mm = {2: 0.050, 3: 0.075, 4: 0.11, 5: 0.125, 6: 0.15, 7: 0.15} + self._mm_gain_mu = sbs_to_mm[samples_per_symbol] + + self._mm_omega = self._samples_per_symbol + self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu + self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha + fmin = -0.025 + fmax = 0.025 + + self.receiver=digital.mpsk_receiver_cc( + arity, pi/4.0, + 2*pi/150, + fmin, fmax, + self._mm_mu, self._mm_gain_mu, + self._mm_omega, self._mm_gain_omega, + self._mm_omega_relative_limit + ) + + self.receiver.set_alpha(self._costas_alpha) + self.receiver.set_beta(self._costas_beta) + + # Perform Differential decoding on the constellation + self.diffdec = digital.diff_phasor_cc() + + # take angle of the difference (in radians) + self.to_float = blocks.complex_to_arg() + + # convert from radians such that signal is in -3/-1/+1/+3 + self.rescale = blocks.multiply_const_ff( 1 / (pi / 4) ) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.pre_scaler, self.agc, self.rrc_filter, self.receiver, + self.diffdec, self.to_float, self.rescale, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + @staticmethod + def bits_per_symbol(): + return 2 + + def _print_verbage(self): + print "\nDemodulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRC roll-off factor: %.2f" % self._excess_bw + print "Costas Loop alpha: %.2e" % self._costas_alpha + print "Costas Loop beta: %.2e" % self._costas_beta + print "M&M mu: %.2f" % self._mm_mu + print "M&M mu gain: %.2e" % self._mm_gain_mu + print "M&M omega: %.2f" % self._mm_omega + print "M&M omega gain: %.2e" % self._mm_gain_omega + print "M&M omega limit: %.2f" % self._mm_omega_relative_limit + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.pre_scaler, + gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat")) + self.connect(self.agc, + gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat")) + self.connect(self.receiver, + gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat")) + self.connect(self.diffdec, + gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat")) + self.connect(self.to_float, + gr.file_sink(gr.sizeof_float, "rx_to_float.dat")) + self.connect(self.rescale, + gr.file_sink(gr.sizeof_float, "rx_rescale.dat")) + + @staticmethod + def add_options(parser): + """ + Adds modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + parser.add_option("", "--costas-alpha", type="float", default=_def_costas_alpha, + help="set Costas loop alpha value [default=%default] (PSK)") + parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, + help="set M&M symbol sync loop gain mu value [default=%default] (PSK)") + parser.add_option("", "--mu", type="float", default=_def_mu, + help="set M&M symbol sync loop mu value [default=%default] (PSK)") + + @staticmethod + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options( + cqpsk_demod.__init__, ('self',), options) diff --git a/src/demod/osmosdr-tetra_demod_fft.py b/src/demod/osmosdr-tetra_demod_fft.py new file mode 100755 index 0000000..81fbe9d --- /dev/null +++ b/src/demod/osmosdr-tetra_demod_fft.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python + +# Copyright 2012 Dimitri Stolnikov + +# Usage: +# src$ ./demod/python/osmosdr-tetra_demod_fft.py -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin +# +# Adjust the center frequency (-f) and gain (-g) according to your needs. +# Use left click in Wideband Spectrum window to roughly select a TETRA carrier. +# In Wideband Spectrum you can also tune by 1/4 of the bandwidth by clicking on the rightmost/leftmost spectrum side. +# Use left click in Channel Spectrum windows to fine tune the carrier by clicking on the left or right side of the spectrum. + + +import sys +import math +from gnuradio import gr, gru, eng_notation, blocks, filter +from gnuradio.filter import pfb +from gnuradio.eng_option import eng_option +from gnuradio.wxgui import fftsink2, scopesink2, forms, TRIG_MODE_AUTO +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import osmosdr +import wx + +try: + import cqpsk +except: + from tetra_demod import cqpsk + +# applies frequency translation, resampling and demodulation + +class top_block(grc_wxgui.top_block_gui): + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="Top Block") + + options = get_options() + + self.ifreq = options.frequency + self.rfgain = options.gain + + self.src = osmosdr.source(options.args) + self.src.set_center_freq(self.ifreq) + self.src.set_sample_rate(int(options.sample_rate)) + + if self.rfgain is None: + self.src.set_gain_mode(1) + self.iagc = 1 + self.rfgain = 0 + else: + self.iagc = 0 + self.src.set_gain_mode(0) + self.src.set_gain(self.rfgain) + + # may differ from the requested rate + sample_rate = self.src.get_sample_rate() + sys.stderr.write("sample rate: %d\n" % (sample_rate)) + + symbol_rate = 18000 + sps = 2 # output rate will be 36,000 + out_sample_rate = symbol_rate * sps + + options.low_pass = options.low_pass / 2.0 + + if sample_rate == 96000: # FunCube Dongle + first_decim = 2 + else: + first_decim = 10 + + self.offset = 0 + + taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.2, filter.firdes.WIN_HANN) + self.tuner = filter.freq_xlating_fir_filter_ccf(first_decim, taps, self.offset, sample_rate) + + self.demod = cqpsk.cqpsk_demod( + samples_per_symbol = sps, + excess_bw=0.35, + costas_alpha=0.03, + gain_mu=0.05, + mu=0.05, + omega_relative_limit=0.05, + log=options.log, + verbose=options.verbose) + + self.output = blocks.file_sink(gr.sizeof_float, options.output_file) + + rerate = float(sample_rate / float(first_decim)) / float(out_sample_rate) + sys.stderr.write("resampling factor: %f\n" % rerate) + + if rerate.is_integer(): + sys.stderr.write("using pfb decimator\n") + self.resamp = pfb.decimator_ccf(int(rerate)) + else: + sys.stderr.write("using pfb resampler\n") + self.resamp = pfb.arb_resampler_ccf(1 / rerate) + + self.connect(self.src, self.tuner, self.resamp, self.demod, self.output) + + self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.Main.AddPage(grc_wxgui.Panel(self.Main), "Wideband Spectrum") + self.Main.AddPage(grc_wxgui.Panel(self.Main), "Channel Spectrum") + self.Main.AddPage(grc_wxgui.Panel(self.Main), "Soft Bits") + + def set_ifreq(ifreq): + self.ifreq = ifreq + self._ifreq_text_box.set_value(self.ifreq) + self.src.set_center_freq(self.ifreq) + + self._ifreq_text_box = forms.text_box( + parent=self.GetWin(), + value=self.ifreq, + callback=set_ifreq, + label="Center Frequency", + converter=forms.float_converter(), + ) + self.Add(self._ifreq_text_box) + + def set_iagc(iagc): + self.iagc = iagc + self._agc_check_box.set_value(self.iagc) + self.src.set_gain_mode(self.iagc, 0) + self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) + + self._agc_check_box = forms.check_box( + parent=self.GetWin(), + value=self.iagc, + callback=set_iagc, + label="Automatic Gain", + true=1, + false=0, + ) + + self.Add(self._agc_check_box) + + def set_rfgain(rfgain): + self.rfgain = rfgain + self._rfgain_slider.set_value(self.rfgain) + self._rfgain_text_box.set_value(self.rfgain) + self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) + + _rfgain_sizer = wx.BoxSizer(wx.VERTICAL) + self._rfgain_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_rfgain_sizer, + value=self.rfgain, + callback=set_rfgain, + label="RF Gain", + converter=forms.float_converter(), + proportion=0, + ) + self._rfgain_slider = forms.slider( + parent=self.GetWin(), + sizer=_rfgain_sizer, + value=self.rfgain, + callback=set_rfgain, + minimum=0, + maximum=50, + num_steps=200, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + + self.Add(_rfgain_sizer) + + self.Add(self.Main) + + def fftsink2_callback(x, y): + if abs(x / (sample_rate / 2)) > 0.9: + set_ifreq(self.ifreq + x / 2) + else: + sys.stderr.write("coarse tuned to: %d Hz\n" % x) + self.offset = x + self.tuner.set_center_freq(self.offset) + + self.scope = fftsink2.fft_sink_c(self.Main.GetPage(0).GetWin(), + title="Wideband Spectrum (click to coarse tune)", + fft_size=1024, + sample_rate=sample_rate, + ref_scale=2.0, + ref_level=0, + y_divs=10, + fft_rate=10, + average=False, + avg_alpha=0.6) + + self.Main.GetPage(0).Add(self.scope.win) + self.scope.set_callback(fftsink2_callback) + + self.connect(self.src, self.scope) + + def fftsink2_callback2(x, y): + self.offset = self.offset - (x / 10) + sys.stderr.write("fine tuned to: %d Hz\n" % self.offset) + self.tuner.set_center_freq(self.offset) + + self.scope2 = fftsink2.fft_sink_c(self.Main.GetPage(1).GetWin(), + title="Channel Spectrum (click to fine tune)", + fft_size=1024, + sample_rate=out_sample_rate, + ref_scale=2.0, + ref_level=-20, + y_divs=10, + fft_rate=10, + average=False, + avg_alpha=0.6) + + self.Main.GetPage(1).Add(self.scope2.win) + self.scope2.set_callback(fftsink2_callback2) + + self.connect(self.resamp, self.scope2) + + self.scope3 = scopesink2.scope_sink_f( + self.Main.GetPage(2).GetWin(), + title="Soft Bits", + sample_rate=out_sample_rate, + v_scale=0, + v_offset=0, + t_scale=0.001, + ac_couple=False, + xy_mode=False, + num_inputs=1, + trig_mode=TRIG_MODE_AUTO, + y_axis_label="Counts", + ) + self.Main.GetPage(2).Add(self.scope3.win) + + self.connect(self.demod, self.scope3) + +def get_options(): + parser = OptionParser(option_class=eng_option) + + parser.add_option("-a", "--args", type="string", default="", + help="gr-osmosdr device arguments") + parser.add_option("-s", "--sample-rate", type="eng_float", default=1800000, + help="set receiver sample rate (default 1800000)") + parser.add_option("-f", "--frequency", type="eng_float", default=394.4e6, + help="set receiver center frequency") + parser.add_option("-g", "--gain", type="eng_float", default=None, + help="set receiver gain") + + # demodulator related settings + parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") + parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") + parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") + parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") + (options, args) = parser.parse_args() + if len(args) != 0: + parser.print_help() + raise SystemExit, 1 + + return (options) + +if __name__ == '__main__': + tb = top_block() + tb.Run(True) -- To view, visit https://gerrit.osmocom.org/1451 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibaf7f9c552cc1625210a75f2e9ec142ab47ce8d6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:11:13 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:11:13 +0000 Subject: [PATCH] osmo-tetra[master]: remove old gnuradio <= 3.6 demodulator code Message-ID: Review at https://gerrit.osmocom.org/1452 remove old gnuradio <= 3.6 demodulator code keeps some of the device specific scripts in addition to the (supposedly generic) osmosdr-tetra_demod_fft.py Also, update the README file to corresponding changes. Change-Id: Icae93bb9a6a7219e14931fb6e04a4c6fffa0779d --- M README D src/demod/Makefile.am D src/demod/Makefile.common D src/demod/apps/Makefile.am D src/demod/config/Makefile.am D src/demod/config/gr_standalone.m4 D src/demod/configure.ac R src/demod/fcdp-tetra_demod.py R src/demod/fcdp-tetra_demod_fft.py D src/demod/grc/Makefile.am D src/demod/grc/tetra_demod_qpsk.xml D src/demod/python/Makefile.am D src/demod/python/__init__.py D src/demod/python/cqpsk.py D src/demod/python/osmosdr-tetra_demod_fft.py D src/demod/python/py_run_tests.in D src/demod/python/tetra-demod.py D src/demod/python/uhd-tetra_demod.py D src/demod/python/usrp1-tetra_demod.py D src/demod/python/usrp2-tetra_demod.py R src/demod/simdemod2.py 21 files changed, 21 insertions(+), 1,535 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/52/1452/1 diff --git a/README b/README index 8c6712e..30188a2 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ TETRA MAC/PHY layer experimentation code -(C) 2010-2011 by Harald Welte +(C) 2010-2016 by Harald Welte and contributors ====================================================================== This code aims to implement the sending and receiving part of the @@ -19,12 +19,13 @@ src/demod/python/cpsk.py * contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI -src/demod/python/tetra-demod.py +src/demod/python/osmosdr-tetra_demod_fft.py + * 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 -src/demod/python/usrp1-tetra_demod.py - * use demodulator in realtime with a USRP1 SDR -src/demod/python/usrp2-tetra_demod.py - * use demodulator in realtime with a USRP2 SDR +src/demod/python/{uhd,fcdp}-tetra_demod.py + * 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. diff --git a/src/demod/Makefile.am b/src/demod/Makefile.am deleted file mode 100644 index d5f8d2b..0000000 --- a/src/demod/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2001,2006,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -ACLOCAL_AMFLAGS = -I config -AUTOMAKE_OPTIONS = foreign - -include $(top_srcdir)/Makefile.common - - -SUBDIRS = python apps config grc - -export pythondir - -install-data-hook: - @if ! python -c "import gnuradio" > /dev/null 2>&1; then\ - printf "\n*** Post-Install Message ***\ - \nWarning: python could not find the gnuradio module.\ - \nMake sure that $${pythondir} is in your PYTHONPATH\n\n";\ - fi - - diff --git a/src/demod/Makefile.common b/src/demod/Makefile.common deleted file mode 100644 index b4d35ae..0000000 --- a/src/demod/Makefile.common +++ /dev/null @@ -1,77 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 2004,2006,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# The name of this "out-of-tree" module -modname = tetra_demod - -# these flags are used when compiling non-SWIG-wrapper files -# when going in to non-SWIG libraries -AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ - -# Sets ABI version in SONAME and appends -LIBVER to filename -LTVERSIONFLAGS = -version-info 0:0:0 -release $(LIBVER) - -# these flags are used when compiling any CXX file -AM_CPPFLAGS = \ - $(STD_DEFINES_AND_INCLUDES) \ - $(PYTHON_CPPFLAGS) \ - $(CPPUNIT_INCLUDES) \ - $(GNURADIO_CORE_CPPFLAGS) - -# these are used by both SWIG and CXX -STD_DEFINES_AND_INCLUDES = \ - $(DEFINES) \ - -I$(abs_top_srcdir)/lib \ - -I$(GNURADIO_CORE_INCLUDEDIR) \ - -I$(GNURADIO_CORE_INCLUDEDIR)/swig - -# includes -modincludedir = $(includedir)/$(modname) - -# swig includes -swigincludedir = $(modincludedir)/swig - -# Install this stuff in the appropriate subdirectory -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/$(modname) - -modpythondir = $(pythondir)/$(modname) -modpyexecdir = $(pyexecdir)/$(modname) - -# Data directory for grc block wrappers -grc_blocksdir = $(prefix)/share/gnuradio/grc/blocks - -# Don't assume that make predefines $(RM), because BSD make does -# not. We define it now in configure.ac using AM_PATH_PROG, but now -# here have to add a -f to be like GNU make. -RM=$(RM_PROG) -f - -# Other common defines; use "+=" to add to these -STAMPS = -MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT - -# Don't distribute the files defined in the variable 'no_dist_files' -dist-hook: - @for file in $(no_dist_files); do \ - echo $(RM) $(distdir)/$$file; \ - $(RM) $(distdir)/$$file; \ - done; diff --git a/src/demod/apps/Makefile.am b/src/demod/apps/Makefile.am deleted file mode 100644 index e69de29..0000000 --- a/src/demod/apps/Makefile.am +++ /dev/null diff --git a/src/demod/config/Makefile.am b/src/demod/config/Makefile.am deleted file mode 100644 index fe4fc11..0000000 --- a/src/demod/config/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2001,2006,2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -# Install m4 macros in this directory -m4datadir = $(datadir)/aclocal - -# List your m4 macros here -m4macros = \ - gr_standalone.m4 - -EXTRA_DIST = $(m4macros) diff --git a/src/demod/config/gr_standalone.m4 b/src/demod/config/gr_standalone.m4 deleted file mode 100644 index 3f8ddf1..0000000 --- a/src/demod/config/gr_standalone.m4 +++ /dev/null @@ -1,135 +0,0 @@ -dnl -dnl Copyright 2008,2009 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License along -dnl with this program; if not, write to the Free Software Foundation, Inc., -dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -dnl - -dnl -dnl GR_STANDALONE([package],[version]) -dnl -dnl Handles the bulk of the configure.ac work for an out-of-tree build -dnl -dnl N.B., this is an m4_define because if it were an AC_DEFUN it would -dnl get called too late to be useful. - -m4_define([GR_STANDALONE], -[ - AC_CONFIG_SRCDIR([config/gr_standalone.m4]) - AM_CONFIG_HEADER(config.h) - - dnl Remember if the user explicity set CXXFLAGS - if test -n "${CXXFLAGS}"; then - user_set_cxxflags=yes - fi - - LF_CONFIGURE_CC - LF_CONFIGURE_CXX - GR_LIB64 dnl check for lib64 suffix after choosing compilers - - dnl The three macros above are known to override CXXFLAGS if the user - dnl didn't specify them. Though I'm sure somebody thought this was - dnl a good idea, it makes it hard to use other than -g -O2 when compiling - dnl selected files. Thus we "undo" the damage here... - dnl - dnl If the user specified CXXFLAGS, we use them. Otherwise when compiling - dnl the output of swig use use -O1 if we're using g++. - dnl See Makefile.common for the rest of the magic. - if test "$user_set_cxxflags" != yes; then - autoconf_default_CXXFLAGS="$CXXFLAGS" - if test "$GXX" = yes; then - case "$host_cpu" in - powerpc*) - dnl "-O1" is broken on the PPC for some reason - dnl (at least as of g++ 4.1.1) - swig_CXXFLAGS="-g1 -O2 -Wno-strict-aliasing -Wno-parentheses" - ;; - *) - swig_CXXFLAGS="-g -O1 -Wno-strict-aliasing -Wno-parentheses" - ;; - esac - fi - fi - AC_SUBST(autoconf_default_CXXFLAGS) - AC_SUBST(swig_CXXFLAGS) - - dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH - if test x${PKG_CONFIG_PATH} = x; then - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig - else - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH} - fi - export PKG_CONFIG_PATH - - LF_SET_WARNINGS - GR_SET_GPROF - GR_SET_PROF - AM_PROG_AS - AC_PROG_LN_S - AC_PROG_MAKE_SET - AC_PROG_INSTALL - AC_PATH_PROG([RM_PROG], [rm]) - - AC_LIBTOOL_WIN32_DLL - AC_ENABLE_SHARED dnl do build shared libraries - AC_DISABLE_STATIC dnl don't build static libraries - m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL]) - dnl GR_FORTRAN - - GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag - GR_SCRIPTING dnl Locate python, SWIG, etc - - dnl Checks for header files. - AC_HEADER_STDC - - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST - AC_C_INLINE - AC_TYPE_SIZE_T - AC_HEADER_TIME - AC_C_BIGENDIAN - - dnl Check for Mingw support - GR_PWIN32 - - AC_CHECK_PROG([XMLTO],[xmlto],[yes],[]) - AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes]) - - PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3) - LIBS="$LIBS $GNURADIO_CORE_LIBS" - - dnl Allow user to choose whether to generate SWIG/Python - dnl Default is enabled - AC_ARG_ENABLE([python], - [AS_HELP_STRING([--enable-python], - [generate SWIG/Python components (default is yes)])], - [case "${enableval}" in - yes) enable_python=yes ;; - no) enable_python=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; - esac], - [enable_python=yes] - ) - AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes]) - - dnl Define where to look for cppunit includes and libs - dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS - dnl Try using pkg-config first, then fall back to cppunit-config. - PKG_CHECK_EXISTS(cppunit, - [PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.9.14)], - [AM_PATH_CPPUNIT([1.9.14],[], - [AC_MSG_ERROR([GNU Radio requires cppunit. Stop])])]) -]) diff --git a/src/demod/configure.ac b/src/demod/configure.ac deleted file mode 100644 index f6bd751..0000000 --- a/src/demod/configure.ac +++ /dev/null @@ -1,55 +0,0 @@ -dnl -dnl Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. -dnl - - -AC_INIT([tetra-demod], [0.0.1]) -AC_PREREQ(2.57) -AC_CONFIG_AUX_DIR([.]) - -AC_CANONICAL_BUILD -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -GR_VERSION -dnl ustar required to have pathnames > 99 chars -_AM_SET_OPTION([tar-ustar]) -AM_INIT_AUTOMAKE([]) - -dnl This is kind of non-standard, but it sure shortens up this file :-) -m4_include([config/gr_standalone.m4]) -GR_STANDALONE -AM_PATH_PYTHON - - -AC_CONFIG_FILES([\ - Makefile \ - apps/Makefile \ - config/Makefile \ - grc/Makefile \ - python/Makefile \ - python/py_run_tests \ - ]) - -dnl run_tests is created from run_tests.in. Make it executable. -AC_CONFIG_COMMANDS([run_tests], [chmod +x python/py_run_tests]) - -AC_OUTPUT - diff --git a/src/demod/python/fcdp-tetra_demod.py b/src/demod/fcdp-tetra_demod.py similarity index 84% rename from src/demod/python/fcdp-tetra_demod.py rename to src/demod/fcdp-tetra_demod.py index a8c5a59..1074cff 100755 --- a/src/demod/python/fcdp-tetra_demod.py +++ b/src/demod/fcdp-tetra_demod.py @@ -2,7 +2,7 @@ import sys import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir +from gnuradio import gr, gru, audio, eng_notation, blocks, filter from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -22,7 +22,7 @@ self.asrc = audio.source(sample_rate, options.audio_device, True) - self.f2c = gr.float_to_complex(1) + self.f2c = blocks.float_to_complex(1) self.connect((self.asrc, 1), (self.f2c, 1)) self.connect((self.asrc, 0), (self.f2c, 0)) @@ -33,9 +33,9 @@ ntaps = 11 * sps new_sample_rate = symbol_rate * sps - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) + channel_taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, filter.firdes.WIN_HANN) - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) + FILTER = filter.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) sys.stderr.write("sample rate: %d\n" %(sample_rate)) @@ -48,11 +48,11 @@ log=options.log, verbose=options.verbose) - OUT = gr.file_sink(gr.sizeof_float, options.output_file) + OUT = blocks.file_sink(gr.sizeof_float, options.output_file) r = float(sample_rate) / float(new_sample_rate) - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) + INTERPOLATOR = filter.fractional_interpolator_cc(0, r) self.connect(self.f2c, FILTER, INTERPOLATOR, DEMOD, OUT) diff --git a/src/demod/python/fcdp-tetra_demod_fft.py b/src/demod/fcdp-tetra_demod_fft.py similarity index 86% rename from src/demod/python/fcdp-tetra_demod_fft.py rename to src/demod/fcdp-tetra_demod_fft.py index e191af2..b4def1e 100755 --- a/src/demod/python/fcdp-tetra_demod_fft.py +++ b/src/demod/fcdp-tetra_demod_fft.py @@ -2,7 +2,7 @@ import sys import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir +from gnuradio import gr, gru, audio, eng_notation, blocks, filter from gnuradio import audio from gnuradio.eng_option import eng_option from gnuradio.wxgui import stdgui2, fftsink2 @@ -28,7 +28,7 @@ self.asrc = audio.source(sample_rate, options.audio_device, True) - self.f2c = gr.float_to_complex(1) + self.f2c = blocks.float_to_complex(1) self.connect((self.asrc, 1), (self.f2c, 1)) self.connect((self.asrc, 0), (self.f2c, 0)) @@ -39,9 +39,9 @@ ntaps = 11 * sps new_sample_rate = symbol_rate * sps - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) + channel_taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, filter.firdes.WIN_HANN) - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) + FILTER = filter.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) sys.stderr.write("sample rate: %d\n" %(sample_rate)) @@ -54,11 +54,11 @@ log=options.log, verbose=options.verbose) - OUT = gr.file_sink(gr.sizeof_float, options.output_file) + OUT = blocks.file_sink(gr.sizeof_float, options.output_file) r = float(sample_rate) / float(new_sample_rate) - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) + INTERPOLATOR = filter.fractional_interpolator_cc(0, r) self.connect(self.f2c, FILTER, INTERPOLATOR, DEMOD, OUT) diff --git a/src/demod/grc/Makefile.am b/src/demod/grc/Makefile.am deleted file mode 100644 index 3f9ad4b..0000000 --- a/src/demod/grc/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# (C) 2011 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 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 $(top_srcdir)/Makefile.common - -grcblocksdir = $(grc_blocksdir) -dist_grcblocks_DATA = \ - tetra_demod_qpsk.xml diff --git a/src/demod/grc/tetra_demod_qpsk.xml b/src/demod/grc/tetra_demod_qpsk.xml deleted file mode 100644 index f247354..0000000 --- a/src/demod/grc/tetra_demod_qpsk.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - Tetra QPSK pi/4 demodulation - tetra_demod - Tetra - import tetra_demod - tetra_demod.demod() - - - in - complex - - - - out - float - - diff --git a/src/demod/python/Makefile.am b/src/demod/python/Makefile.am deleted file mode 100644 index 0d789fd..0000000 --- a/src/demod/python/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright 2001,2006,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# -# -include $(top_srcdir)/Makefile.common - -bin_SCRIPTS = \ - tetra-demod.py \ - usrp1-tetra_demod.py \ - usrp2-tetra_demod.py - -EXTRA_DIST = py_run_tests.in tetra-demod.py usrp1-tetra_demod.py usrp2-tetra_demod.py -TESTS = py_run_tests - -modpython_PYTHON = \ - __init__.py \ - cqpsk.py - -noinst_PYTHON = \ - qa_tetra.py diff --git a/src/demod/python/__init__.py b/src/demod/python/__init__.py deleted file mode 100644 index ccbf8b0..0000000 --- a/src/demod/python/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -""" - (C) 2011 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 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 . -""" - -import cqpsk - -def demod(): - return cqpsk.cqpsk_demod(samples_per_symbol = 2, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05) - diff --git a/src/demod/python/cqpsk.py b/src/demod/python/cqpsk.py deleted file mode 100644 index f9621b1..0000000 --- a/src/demod/python/cqpsk.py +++ /dev/null @@ -1,370 +0,0 @@ -# -# Copyright 2005,2006,2007 Free Software Foundation, Inc. -# -# cqpsk.py (C) Copyright 2009, KA1RBI -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# See gnuradio-examples/python/digital for examples - -""" -differential PI/4 CQPSK modulation and demodulation. -""" - -from gnuradio import gr, gru -from math import pi, sqrt -#import psk -import cmath -from pprint import pprint - -_def_has_gr_digital = False - -# address gnuradio 3.5.x changes -try: - from gnuradio import modulation_utils -except ImportError: - from gnuradio import digital - _def_has_gr_digital = True - -# default values (used in __init__ and add_options) -_def_samples_per_symbol = 10 -_def_excess_bw = 0.35 -_def_gray_code = True -_def_verbose = False -_def_log = False - -_def_costas_alpha = 0.15 -_def_gain_mu = None -_def_mu = 0.5 -_def_omega_relative_limit = 0.005 - - -# ///////////////////////////////////////////////////////////////////////////// -# CQPSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class cqpsk_mod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - excess_bw=_def_excess_bw, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for RRC-filtered QPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - @param samples_per_symbol: samples per symbol >= 2 - @type samples_per_symbol: integer - @param excess_bw: Root-raised cosine filter excess bandwidth - @type excess_bw: float - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "cqpsk_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._excess_bw = excess_bw - - if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: - raise TypeError, ("sbp must be an integer >= 2, is %d" % samples_per_symbol) - - ntaps = 11 * samples_per_symbol - - arity = 8 - - # turn bytes into k-bit vectors - self.bytes2chunks = \ - gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) - - # 0 +45 1 [+1] - # 1 +135 3 [+3] - # 2 -45 7 [-1] - # 3 -135 5 [-3] - self.pi4map = [1, 3, 7, 5] - self.symbol_mapper = gr.map_bb(self.pi4map) - self.diffenc = gr.diff_encoder_bb(arity) - self.chunks2symbols = gr.chunks_to_symbols_bc(psk.constellation[arity]) - - # pulse shaping filter - self.rrc_taps = gr.firdes.root_raised_cosine( - self._samples_per_symbol, # gain (sps since we're interpolating by sps) - self._samples_per_symbol, # sampling rate - 1.0, # symbol rate - self._excess_bw, # excess bandwidth (roll-off factor) - ntaps) - - self.rrc_filter = gr.interp_fir_filter_ccf(self._samples_per_symbol, self.rrc_taps) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc, - self.chunks2symbols, self.rrc_filter, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 2 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM - - def _print_verbage(self): - print "\nModulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "Gray code: %s" % self._gray_code - print "RRS roll-off factor: %f" % self._excess_bw - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.bytes2chunks, - gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat")) - self.connect(self.symbol_mapper, - gr.file_sink(gr.sizeof_char, "tx_graycoder.dat")) - self.connect(self.diffenc, - gr.file_sink(gr.sizeof_char, "tx_diffenc.dat")) - self.connect(self.chunks2symbols, - gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat")) - self.connect(self.rrc_filter, - gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat")) - - def add_options(parser): - """ - Adds QPSK modulation-specific options to the standard parser - """ - parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, - help="set RRC excess bandwith factor [default=%default] (PSK)") - parser.add_option("", "--no-gray-code", dest="gray_code", - action="store_false", default=_def_gray_code, - help="disable gray coding on modulated bits (PSK)") - add_options=staticmethod(add_options) - - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(dqpsk_mod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - -# ///////////////////////////////////////////////////////////////////////////// -# CQPSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class cqpsk_demod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - excess_bw=_def_excess_bw, - costas_alpha=_def_costas_alpha, - gain_mu=_def_gain_mu, - mu=_def_mu, - omega_relative_limit=_def_omega_relative_limit, - gray_code=_def_gray_code, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for RRC-filtered CQPSK demodulation - - The input is the complex modulated signal at baseband. - The output is a stream of floats in [ -3 / -1 / +1 / +3 ] - - @param samples_per_symbol: samples per symbol >= 2 - @type samples_per_symbol: float - @param excess_bw: Root-raised cosine filter excess bandwidth - @type excess_bw: float - @param costas_alpha: loop filter gain - @type costas_alphas: float - @param gain_mu: for M&M block - @type gain_mu: float - @param mu: for M&M block - @type mu: float - @param omega_relative_limit: for M&M block - @type omega_relative_limit: float - @param gray_code: Tell modulator to Gray code the bits - @type gray_code: bool - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "cqpsk_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._excess_bw = excess_bw - self._costas_alpha = costas_alpha - self._mm_gain_mu = gain_mu - self._mm_mu = mu - self._mm_omega_relative_limit = omega_relative_limit - self._gray_code = gray_code - - if samples_per_symbol < 2: - raise TypeError, "sbp must be >= 2, is %d" % samples_per_symbol - - arity = pow(2,self.bits_per_symbol()) - - # Automatic gain control - scale = (1.0/16384.0) - self.pre_scaler = gr.multiply_const_cc(scale) # scale the signal from full-range to +-1 - #self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) - self.agc = gr.feedforward_agc_cc(16, 2.0) - - # RRC data filter - ntaps = 11 * samples_per_symbol - self.rrc_taps = gr.firdes.root_raised_cosine( - 1.0, # gain - self._samples_per_symbol, # sampling rate - 1.0, # symbol rate - self._excess_bw, # excess bandwidth (roll-off factor) - ntaps) - self.rrc_filter=gr.interp_fir_filter_ccf(1, self.rrc_taps) - - if not self._mm_gain_mu: - sbs_to_mm = {2: 0.050, 3: 0.075, 4: 0.11, 5: 0.125, 6: 0.15, 7: 0.15} - self._mm_gain_mu = sbs_to_mm[samples_per_symbol] - - self._mm_omega = self._samples_per_symbol - self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu - self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha - fmin = -0.025 - fmax = 0.025 - - if not _def_has_gr_digital: - self.receiver=gr.mpsk_receiver_cc(arity, pi/4.0, - self._costas_alpha, self._costas_beta, - fmin, fmax, - self._mm_mu, self._mm_gain_mu, - self._mm_omega, self._mm_gain_omega, - self._mm_omega_relative_limit) - else: - self.receiver=digital.mpsk_receiver_cc(arity, pi/4.0, - 2*pi/150, - fmin, fmax, - self._mm_mu, self._mm_gain_mu, - self._mm_omega, self._mm_gain_omega, - self._mm_omega_relative_limit) - - self.receiver.set_alpha(self._costas_alpha) - self.receiver.set_beta(self._costas_beta) - - # Perform Differential decoding on the constellation - self.diffdec = gr.diff_phasor_cc() - - # take angle of the difference (in radians) - self.to_float = gr.complex_to_arg() - - # convert from radians such that signal is in -3/-1/+1/+3 - self.rescale = gr.multiply_const_ff( 1 / (pi / 4) ) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.pre_scaler, self.agc, self.rrc_filter, self.receiver, - self.diffdec, self.to_float, self.rescale, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 2 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM - - def _print_verbage(self): - print "\nDemodulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "Gray code: %s" % self._gray_code - print "RRC roll-off factor: %.2f" % self._excess_bw - print "Costas Loop alpha: %.2e" % self._costas_alpha - print "Costas Loop beta: %.2e" % self._costas_beta - print "M&M mu: %.2f" % self._mm_mu - print "M&M mu gain: %.2e" % self._mm_gain_mu - print "M&M omega: %.2f" % self._mm_omega - print "M&M omega gain: %.2e" % self._mm_gain_omega - print "M&M omega limit: %.2f" % self._mm_omega_relative_limit - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.pre_scaler, - gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat")) - self.connect(self.agc, - gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat")) - self.connect(self.rrc_filter, - gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat")) - self.connect(self.receiver, - gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat")) - self.connect(self.diffdec, - gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat")) - self.connect(self.to_float, - gr.file_sink(gr.sizeof_float, "rx_to_float.dat")) - self.connect(self.rescale, - gr.file_sink(gr.sizeof_float, "rx_rescale.dat")) - - def add_options(parser): - """ - Adds modulation-specific options to the standard parser - """ - parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, - help="set RRC excess bandwith factor [default=%default] (PSK)") - parser.add_option("", "--no-gray-code", dest="gray_code", - action="store_false", default=_def_gray_code, - help="disable gray coding on modulated bits (PSK)") - parser.add_option("", "--costas-alpha", type="float", default=_def_costas_alpha, - help="set Costas loop alpha value [default=%default] (PSK)") - parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, - help="set M&M symbol sync loop gain mu value [default=%default] (PSK)") - parser.add_option("", "--mu", type="float", default=_def_mu, - help="set M&M symbol sync loop mu value [default=%default] (PSK)") - add_options=staticmethod(add_options) - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options( - cqpsk_demod.__init__, ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - -# -# Add these to the mod/demod registry -# -#modulation_utils.add_type_1_mod('cqpsk', cqpsk_mod) -#modulation_utils.add_type_1_demod('cqpsk', cqpsk_demod) - diff --git a/src/demod/python/osmosdr-tetra_demod_fft.py b/src/demod/python/osmosdr-tetra_demod_fft.py deleted file mode 100755 index d1c941b..0000000 --- a/src/demod/python/osmosdr-tetra_demod_fft.py +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2012 Dimitri Stolnikov - -# Usage: -# src$ ./demod/python/osmosdr-tetra_demod_fft.py -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin -# -# Adjust the center frequency (-f) and gain (-g) according to your needs. -# Use left click in Wideband Spectrum window to roughly select a TETRA carrier. -# In Wideband Spectrum you can also tune by 1/4 of the bandwidth by clicking on the rightmost/leftmost spectrum side. -# Use left click in Channel Spectrum windows to fine tune the carrier by clicking on the left or right side of the spectrum. - - -import sys -import math -from gnuradio import gr, gru, eng_notation, blks2, optfir -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import scopesink2 -from gnuradio.wxgui import forms -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import osmosdr -import wx - -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# applies frequency translation, resampling and demodulation - -class top_block(grc_wxgui.top_block_gui): - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="Top Block") - - options = get_options() - - self.ifreq = options.frequency - self.rfgain = options.gain - self.offset = options.frequency_offset - - self.src = osmosdr.source_c(options.args) - self.src.set_center_freq(self.ifreq) - self.src.set_sample_rate(int(options.sample_rate)) - - if self.rfgain is None: - self.src.set_gain_mode(1) - self.iagc = 1 - self.rfgain = 0 - else: - self.iagc = 0 - self.src.set_gain_mode(0) - self.src.set_gain(self.rfgain) - - # may differ from the requested rate - sample_rate = self.src.get_sample_rate() - sys.stderr.write("sample rate: %d\n" % (sample_rate)) - - symbol_rate = 18000 - sps = 2 # output rate will be 36,000 - out_sample_rate = symbol_rate * sps - - options.low_pass = options.low_pass / 2.0 - - if sample_rate == 96000: # FunCube Dongle - first_decim = 2 - else: - first_decim = 10 - - self.offset = 0 - - taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.2, gr.firdes.WIN_HANN) - self.tuner = gr.freq_xlating_fir_filter_ccf(first_decim, taps, self.offset, sample_rate) - - self.demod = cqpsk.cqpsk_demod( - samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - self.output = gr.file_sink(gr.sizeof_float, options.output_file) - - rerate = float(sample_rate / float(first_decim)) / float(out_sample_rate) - sys.stderr.write("resampling factor: %f\n" % rerate) - - if rerate.is_integer(): - sys.stderr.write("using pfb decimator\n") - self.resamp = blks2.pfb_decimator_ccf(int(rerate)) - else: - sys.stderr.write("using pfb resampler\n") - self.resamp = blks2.pfb_arb_resampler_ccf(1 / rerate) - - self.connect(self.src, self.tuner, self.resamp, self.demod, self.output) - - self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.Main.AddPage(grc_wxgui.Panel(self.Main), "Wideband Spectrum") - self.Main.AddPage(grc_wxgui.Panel(self.Main), "Channel Spectrum") - self.Main.AddPage(grc_wxgui.Panel(self.Main), "Soft Bits") - - def set_ifreq(ifreq): - self.ifreq = ifreq - self._ifreq_text_box.set_value(self.ifreq) - self.src.set_center_freq(self.ifreq) - - self._ifreq_text_box = forms.text_box( - parent=self.GetWin(), - value=self.ifreq, - callback=set_ifreq, - label="Center Frequency", - converter=forms.float_converter(), - ) - self.Add(self._ifreq_text_box) - - def set_iagc(iagc): - self.iagc = iagc - self._agc_check_box.set_value(self.iagc) - self.src.set_gain_mode(self.iagc, 0) - self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) - - self._agc_check_box = forms.check_box( - parent=self.GetWin(), - value=self.iagc, - callback=set_iagc, - label="Automatic Gain", - true=1, - false=0, - ) - - self.Add(self._agc_check_box) - - def set_rfgain(rfgain): - self.rfgain = rfgain - self._rfgain_slider.set_value(self.rfgain) - self._rfgain_text_box.set_value(self.rfgain) - self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) - - _rfgain_sizer = wx.BoxSizer(wx.VERTICAL) - self._rfgain_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_rfgain_sizer, - value=self.rfgain, - callback=set_rfgain, - label="RF Gain", - converter=forms.float_converter(), - proportion=0, - ) - self._rfgain_slider = forms.slider( - parent=self.GetWin(), - sizer=_rfgain_sizer, - value=self.rfgain, - callback=set_rfgain, - minimum=0, - maximum=50, - num_steps=200, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - - self.Add(_rfgain_sizer) - - self.Add(self.Main) - - def fftsink2_callback(x, y): - if abs(x / (sample_rate / 2)) > 0.9: - set_ifreq(self.ifreq + x / 2) - else: - self.offset = -x - sys.stderr.write("coarse tuned to: %d Hz => %d Hz\n" % (self.offset, (self.ifreq + self.offset))) - self.tuner.set_center_freq(self.offset) - - self.scope = fftsink2.fft_sink_c(self.Main.GetPage(0).GetWin(), - title="Wideband Spectrum (click to coarse tune)", - fft_size=1024, - sample_rate=sample_rate, - ref_scale=2.0, - ref_level=0, - y_divs=10, - fft_rate=10, - average=False, - avg_alpha=0.6) - - self.Main.GetPage(0).Add(self.scope.win) - self.scope.set_callback(fftsink2_callback) - - self.connect(self.src, self.scope) - - def fftsink2_callback2(x, y): - self.offset = self.offset - (x / 10) - sys.stderr.write("fine tuned to: %d Hz => %d Hz\n" % (self.offset, (self.ifreq + self.offset))) - self.tuner.set_center_freq(self.offset) - - self.scope2 = fftsink2.fft_sink_c(self.Main.GetPage(1).GetWin(), - title="Channel Spectrum (click to fine tune)", - fft_size=1024, - sample_rate=out_sample_rate, - ref_scale=2.0, - ref_level=-20, - y_divs=10, - fft_rate=10, - average=False, - avg_alpha=0.6) - - self.Main.GetPage(1).Add(self.scope2.win) - self.scope2.set_callback(fftsink2_callback2) - - self.connect(self.resamp, self.scope2) - - self.scope3 = scopesink2.scope_sink_f( - self.Main.GetPage(2).GetWin(), - title="Soft Bits", - sample_rate=out_sample_rate, - v_scale=0, - v_offset=0, - t_scale=0.001, - ac_couple=False, - xy_mode=False, - num_inputs=1, - trig_mode=gr.gr_TRIG_MODE_AUTO, - y_axis_label="Counts", - ) - self.Main.GetPage(2).Add(self.scope3.win) - - self.connect(self.demod, self.scope3) - -def get_options(): - parser = OptionParser(option_class=eng_option) - - parser.add_option("-a", "--args", type="string", default="", - help="gr-osmosdr device arguments") - parser.add_option("-s", "--sample-rate", type="eng_float", default=1800000, - help="set receiver sample rate (default 1800000)") - parser.add_option("-f", "--frequency", type="eng_float", default=394.4e6, - help="set receiver center frequency") - parser.add_option("-F", "--frequency-offset", type="eng_float", default=0, - help="set receiver offset frequency") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set receiver gain") - - # demodulator related settings - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - return (options) - -if __name__ == '__main__': - tb = top_block() - tb.Run(True) diff --git a/src/demod/python/py_run_tests.in b/src/demod/python/py_run_tests.in deleted file mode 100644 index e69de29..0000000 --- a/src/demod/python/py_run_tests.in +++ /dev/null diff --git a/src/demod/python/tetra-demod.py b/src/demod/python/tetra-demod.py deleted file mode 100755 index d7d5c72..0000000 --- a/src/demod/python/tetra-demod.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# Load it locally or from the module -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# accepts an input file in complex format -# applies frequency translation, resampling (interpolation/decimation) - -class my_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - parser = OptionParser(option_class=eng_option) - - parser.add_option("-c", "--calibration", type="eng_float", default=0, help="freq offset") - parser.add_option("-i", "--input-file", type="string", default="in.dat", help="specify the input file") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.dat", help="specify the output file") - parser.add_option("-s", "--sample-rate", type="int", default=100000000/512, help="input sample rate") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - (options, args) = parser.parse_args() - - sample_rate = options.sample_rate - symbol_rate = 18000 - sps = 2 - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - IN = gr.file_source(gr.sizeof_gr_complex, options.input_file) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(IN, FILTER, INTERPOLATOR, DEMOD, OUT) - -if __name__ == "__main__": - try: - my_top_block().run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/uhd-tetra_demod.py b/src/demod/python/uhd-tetra_demod.py deleted file mode 100755 index ac49fb7..0000000 --- a/src/demod/python/uhd-tetra_demod.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# Load it locally or from the module -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# accepts an input file in complex format -# applies frequency translation, resampling (interpolation/decimation) - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - # Create a UHD source - self._u = uhd.usrp_source( - device_addr=options.args, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - # Set the subdevice spec - if(options.spec): - self._u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self._u.set_antenna(options.antenna, 0) - - # Pick the lowest possible value for the input rate - supported_rates = self._u.get_samp_rates() - self._u.set_samp_rate(supported_rates.start()) - - sample_rate = self._u.get_samp_rate() - symbol_rate = 18000 - sps = 2 - - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - # Set receive daughterboard gain - if options.gain is None: - g = self._u.get_gain_range() - options.gain = float(g.stop()+g.start())/2 - print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")" - self._u.set_gain(options.gain) - - # Set frequency (tune request takes lo_offset) - if(options.lo_offset is not None): - treq = uhd.tune_request(options.freq, options.lo_offset) - else: - treq = uhd.tune_request(options.freq) - tr = self._u.set_center_freq(treq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(self._u, FILTER, INTERPOLATOR, DEMOD, OUT) - -def get_options(): - parser = OptionParser(option_class=eng_option) - # usrp related settings - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args, [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - # demodulator related settings - parser.add_option("-c", "--calibration", type="int", default=0, help="freq offset") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - -if __name__ == "__main__": - (options) = get_options() - tb = my_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/usrp1-tetra_demod.py b/src/demod/python/usrp1-tetra_demod.py deleted file mode 100755 index 219594b..0000000 --- a/src/demod/python/usrp1-tetra_demod.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# applies frequency translation, resampling (interpolation/decimation) and cqpsk demodulation - - - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - fusb_block_size = gr.prefs().get_long('fusb', 'block_size', 4096) - fusb_nblocks = gr.prefs().get_long('fusb', 'nblocks', 16) - self._u = usrp.source_c(decim_rate=options.decim, fusb_block_size=fusb_block_size, fusb_nblocks=fusb_nblocks) - - # master clock - if options.fpga_freq is not None: - self._u.set_fpga_master_clock_freq(long(options.fpga_freq)) - - # default subdev if use didn't pick one - if options.rx_subdev_spec is None: - if u.db(0, 0).dbid() >= 0: - options.rx_subdev_spec = (0, 0) - elif u.db(1, 0).dbid() >= 0: - options.rx_subdev_spec = (1, 0) - else: - options.rx_subdev_spec = (0, 0) - - # configure usrp mux - self._u.set_mux(usrp.determine_rx_mux_value(self._u, options.rx_subdev_spec)) - - # determine the daughterboard subdevice - self.subdev = usrp.selected_subdev(self._u, options.rx_subdev_spec) - - # select antenna - if options.antenna is not None: - print "Selecting antenna %s" % (options.antenna,) - self.subdev.select_rx_antenna(options.antenna) - - # set initial values - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.subdev.gain_range() - options.gain = float(g[0]+g[1])/2 - - r = self._u.tune(0, self.subdev, options.freq) - self.subdev.set_gain(options.gain) - - #sample_rate = options.fpga_clock/options.decim - sample_rate = self._u.adc_freq() / self._u.decim_rate() - symbol_rate = 18000 - sps = 2 - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(self._u, FILTER, INTERPOLATOR, DEMOD, OUT) - -def get_options(): - parser = OptionParser(option_class=eng_option) - - # usrp related settings - parser.add_option("-d", "--decim", type="int", default=250, - help="Set USRP decimation rate to DECIM [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="Select USRP Rx side A or B (default=first one with a daughterboard)") - parser.add_option("-A", "--antenna", default=None, - help="select Rx Antenna") - parser.add_option("-F", "--fpga-freq", type="eng_float", default=None, - help="set USRP reference clock frequency to FPGA_FREQ", metavar="FPGA_FREQ") - - # demodulator related settings - parser.add_option("-c", "--calibration", type="int", default=0, help="freq offset") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - -if __name__ == "__main__": - (options) = get_options() - tb = my_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/usrp2-tetra_demod.py b/src/demod/python/usrp2-tetra_demod.py deleted file mode 100755 index 57e8017..0000000 --- a/src/demod/python/usrp2-tetra_demod.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio import usrp2 -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# Load it locally or from the module -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# accepts an input file in complex format -# applies frequency translation, resampling (interpolation/decimation) - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - # Create a USRP2 source and set decimation rate - self._u = usrp2.source_32fc(options.interface, options.mac_addr) - self._u.set_decim(512) - - # Set receive daughterboard gain - if options.gain is None: - g = self._u.gain_range() - options.gain = float(g[0]+g[1])/2 - print "Using mid-point gain of", options.gain, "(", g[0], "-", g[1], ")" - self._u.set_gain(options.gain) - - # Set receive frequency - if options.lo_offset is not None: - self._u.set_lo_offset(options.lo_offset) - - tr = self._u.set_center_freq(options.freq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - sample_rate = 100e6/512 - symbol_rate = 18000 - sps = 2 - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(self._u, FILTER, INTERPOLATOR, DEMOD, OUT) - -def get_options(): - parser = OptionParser(option_class=eng_option) - # usrp related settings - parser.add_option("-e", "--interface", type="string", default="eth0", - help="use specified Ethernet interface [default=%default]") - parser.add_option("-m", "--mac-addr", type="string", default="", - help="use USRP2 at specified MAC address [default=None]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - # demodulator related settings - parser.add_option("-c", "--calibration", type="int", default=0, help="freq offset") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - -if __name__ == "__main__": - (options) = get_options() - tb = my_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/simdemod2.py b/src/demod/simdemod2.py similarity index 93% rename from src/demod/python/simdemod2.py rename to src/demod/simdemod2.py index 6b6fe2b..359ba2b 100755 --- a/src/demod/python/simdemod2.py +++ b/src/demod/simdemod2.py @@ -12,7 +12,7 @@ import sys import math -from gnuradio import gr, gru, eng_notation, blks2, optfir +from gnuradio import gr, gru, eng_notation, blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import osmosdr @@ -30,7 +30,7 @@ options = get_options() self.input_file=options.input_file - self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, self.input_file, True) + self.gr_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, self.input_file, True) symbol_rate = 18000 sps = 2 # output rate will be 36,000 -- To view, visit https://gerrit.osmocom.org/1452 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icae93bb9a6a7219e14931fb6e04a4c6fffa0779d Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:11:45 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:11:45 +0000 Subject: osmo-tetra[master]: demod: Import the new GR 3.7 code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1451 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibaf7f9c552cc1625210a75f2e9ec142ab47ce8d6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:11:46 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:11:46 +0000 Subject: osmo-tetra[master]: demod: Import the new GR 3.7 code In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1451 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibaf7f9c552cc1625210a75f2e9ec142ab47ce8d6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:11:50 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:11:50 +0000 Subject: osmo-tetra[master]: remove old gnuradio <= 3.6 demodulator code In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1452 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icae93bb9a6a7219e14931fb6e04a4c6fffa0779d 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 Sun Dec 18 16:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:11:53 +0000 Subject: [MERGED] osmo-tetra[master]: Add simdemod2.py, a simple demodulator without GUI In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add simdemod2.py, a simple demodulator without GUI ...................................................................... Add simdemod2.py, a simple demodulator without GUI Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de --- A src/demod/python/simdemod2.py A src/receiver1 A src/receiver2 3 files changed, 101 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/src/demod/python/simdemod2.py b/src/demod/python/simdemod2.py new file mode 100755 index 0000000..6b6fe2b --- /dev/null +++ b/src/demod/python/simdemod2.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python + +# osmosdr-tetra_demod_fft.py Copyright 2012 Dimitri Stolnikov + +# simdemod.py (c) 2014 Jacek Lipkowski +# this is a modified osmosdr-tetra_demod_fft.py with all of the gui stuff +# removed. is is intended to be fed from a receiver program via a pipe +# +# mkfifo /tmp/fifo1 +# demod/python/simdemod.py -o /dev/stdout -i /tmp/fifo1 | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin +# + +import sys +import math +from gnuradio import gr, gru, eng_notation, blks2, optfir +from gnuradio.eng_option import eng_option +from optparse import OptionParser +import osmosdr + +try: + import cqpsk +except: + from tetra_demod import cqpsk + +# applies frequency translation, resampling and demodulation + +class top_block(gr.top_block): + def __init__(self): + gr.top_block.__init__(self, "Top Block") + + options = get_options() + self.input_file=options.input_file + self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, self.input_file, True) + + symbol_rate = 18000 + sps = 2 # output rate will be 36,000 + out_sample_rate = symbol_rate * sps + + options.low_pass = options.low_pass / 2.0 + + self.demod = cqpsk.cqpsk_demod( + samples_per_symbol = sps, + excess_bw=0.35, + costas_alpha=0.03, + gain_mu=0.05, + mu=0.05, + omega_relative_limit=0.05, + log=options.log, + verbose=options.verbose) + + self.output = gr.file_sink(gr.sizeof_float, options.output_file) + + self.connect(self.gr_file_source_0, self.demod, self.output) + + + + + + +def get_options(): + parser = OptionParser(option_class=eng_option) + + # demodulator related settings + parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") + parser.add_option("-i", "--input-file", type="string", default="in.float", help="specify the bit input file") + parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") + parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") + parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") + + (options, args) = parser.parse_args() + if len(args) != 0: + parser.print_help() + raise SystemExit, 1 + + return (options) + +if __name__ == '__main__': + tb = top_block() + tb.run() + #tb.run(True) diff --git a/src/receiver1 b/src/receiver1 new file mode 100755 index 0000000..9b585ca --- /dev/null +++ b/src/receiver1 @@ -0,0 +1,10 @@ +#!/bin/sh +# This is an example how to use simdemod.py --sq5bpf +export TETRA_HACK_PORT=7379 +export TETRA_HACK_RXID=$1 +FIFO=/tmp/fifo$1 +mkfifo $FIFO +ulimit -c unlimited +demod/python/simdemod2.py -o /dev/stdout -i $FIFO | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin + + diff --git a/src/receiver2 b/src/receiver2 new file mode 100755 index 0000000..5a153a5 --- /dev/null +++ b/src/receiver2 @@ -0,0 +1,11 @@ +#!/bin/sh +# This is an example how to use simdemod.py --sq5bpf +# this is receiver 1, only with the port changed, it will be used in the example documentation +export TETRA_HACK_PORT=7380 #i might as well have made this a command line parameter, oh well :) +export TETRA_HACK_RXID=$1 +FIFO=/tmp/fifo$1 +mkfifo $FIFO +ulimit -c unlimited +demod/python/simdemod2.py -o /dev/stdout -i $FIFO | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin + + -- To view, visit https://gerrit.osmocom.org/1447 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de 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 Sun Dec 18 16:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:11:53 +0000 Subject: [PATCH] openbsc[master]: bsc_control.py: remove unused -i option 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/1270 to look at the new patch set (#12). bsc_control.py: remove unused -i option This option only served to demonstrate possibility of manually selecting field in CTRL protocol. Since the transition to generic ipa module this is no longer exposed so the option became a no-op. Correspondingly there's no need to explicitly initialize the RNG - the Ctrl class handles random generation internally. Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded --- M openbsc/contrib/bsc_control.py 1 file changed, 0 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/70/1270/12 diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index cd2ba6d..66a41eb 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- -import random from optparse import OptionParser from ipa import Ctrl import socket @@ -44,8 +43,6 @@ return False if __name__ == '__main__': - random.seed() - parser = OptionParser("Usage: %prog [options] var [value]") parser.add_option("-d", "--host", dest="host", help="connect to HOST", metavar="HOST") @@ -55,8 +52,6 @@ dest="cmd_get", help="perform GET operation") parser.add_option("-s", "--set", action="store_true", dest="cmd_set", help="perform SET operation") - parser.add_option("-i", "--id", dest="op_id", default=random.randint(1, sys.maxint), - help="set id manually", metavar="ID") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="be verbose", default=False) parser.add_option("-m", "--monitor", action="store_true", -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 12 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-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:11:56 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:11:56 +0000 Subject: openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Patch Set 12: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 12 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-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:15:43 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:15:43 +0000 Subject: libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 (1 comment) all makes sense to me, but I'm not really familiar with this https://gerrit.osmocom.org/#/c/1427/3/src/gsm/Makefile.am File src/gsm/Makefile.am: Line 2: # Please read Chapter "Library interface versions" of the libtool documentation before making any modification: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html maybe break this onto two lines and mention in the commit log? -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:20:45 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:20:45 +0000 Subject: [MERGED] osmo-tetra[master]: Update the Codec Download instructions and include a shell s... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Update the Codec Download instructions and include a shell script ...................................................................... Update the Codec Download instructions and include a shell script Change-Id: Ia943a38e422e23e70f73d9672554633c014f6da7 --- M etsi_codec-patches/README A etsi_codec-patches/download_and_patch.sh 2 files changed, 71 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/etsi_codec-patches/README b/etsi_codec-patches/README index 7206947..1c95c83 100644 --- a/etsi_codec-patches/README +++ b/etsi_codec-patches/README @@ -2,5 +2,36 @@ source code as published by the ETSI at in the file named en_30039502v010301p0.zip +You can proceed two ways, a or b: + +a) Using the download_and_patch.sh script + +simply execute ./download_and_patch.sh which will download the +reference codec from the ETSI website and patch it accordingly. + + +b) Manually + +Modified instructions as of 20141118 (differs from the osmocom description, +the ETSI site looks different now): + +In order to obtain the codec, download it directly from +http://www.etsi.org/deliver/etsi_en/300300_300399/30039502/01.03.01_60/en_30039502v010301p0.zip +or use the following procedure: + + * go to http://pda.etsi.org/ + * enter "en 300 395-2" as search term + * execute the search, there should a result called "REN/TETRA-05059 " + * click on the 'Download icon' link (zip-vice symbol) + * you should now have a file called en_30039502v010301p0.zip + +Please also see https://osmocom.org/projects/tetra/wiki/Speech_Codec + +The en_30039502v010301p0.zip file has 361169 bytes, and has the md5sum: +a8115fe68ef8f8cc466f4192572a1e3e + Due to the use of uppercase file names in the zip file, you should use the "-L" flag to the unzip program, which ensures all files are completely lower-case. + +Please apply all of the patches foudn in this directory to the +resulting source code. diff --git a/etsi_codec-patches/download_and_patch.sh b/etsi_codec-patches/download_and_patch.sh new file mode 100755 index 0000000..d9e9674 --- /dev/null +++ b/etsi_codec-patches/download_and_patch.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +URL=http://www.etsi.org/deliver/etsi_en/300300_300399/30039502/01.03.01_60/en_30039502v010301p0.zip +MD5_EXP=a8115fe68ef8f8cc466f4192572a1e3e +LOCAL_FILE=etsi_tetra_codec.zip + +PATCHDIR=`pwd` +CODECDIR=`pwd`/../codec + +echo Deleting $CODECDIR ... +[ -e $CODECDIR ] && rm -rf $CODECDIR + +echo Creating $CODECDIR ... +mkdir $CODECDIR + +if [ ! -f $LOCAL_FILE ]; then + echo Downloading $URL ... + wget -O $LOCAL_FILE $URL +else + echo Skipping download, file $LOCAL_FILE exists +fi +MD5=`md5sum $LOCAL_FILE | awk '{ print $1 }'` + +echo Checking MD5SUM ... +if [ $MD5 != $MD5_EXP ]; then + print "MD5sum of ETSI reference codec file doesn't match" + exit 1 +fi + +echo Unpacking ZIP ... +cd $CODECDIR +unzip -L $PATCHDIR/etsi_tetra_codec.zip + +echo Applying Patches ... +for p in `cat "$PATCHDIR/series"`; do + echo "=> Applying patch '$p'..." + patch -p1 < "$PATCHDIR/$p" +done + +echo Done! -- To view, visit https://gerrit.osmocom.org/1448 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia943a38e422e23e70f73d9672554633c014f6da7 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 Sun Dec 18 16:24:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:24:19 +0000 Subject: osmo-tetra[master]: remove old gnuradio <= 3.6 demodulator code In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1452 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icae93bb9a6a7219e14931fb6e04a4c6fffa0779d 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 Sun Dec 18 16:24:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:24:22 +0000 Subject: [MERGED] osmo-tetra[master]: remove old gnuradio <= 3.6 demodulator code In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: remove old gnuradio <= 3.6 demodulator code ...................................................................... remove old gnuradio <= 3.6 demodulator code keeps some of the device specific scripts in addition to the (supposedly generic) osmosdr-tetra_demod_fft.py Also, update the README file to corresponding changes. Change-Id: Icae93bb9a6a7219e14931fb6e04a4c6fffa0779d --- M README D src/demod/Makefile.am D src/demod/Makefile.common D src/demod/apps/Makefile.am D src/demod/config/Makefile.am D src/demod/config/gr_standalone.m4 D src/demod/configure.ac R src/demod/fcdp-tetra_demod.py R src/demod/fcdp-tetra_demod_fft.py D src/demod/grc/Makefile.am D src/demod/grc/tetra_demod_qpsk.xml D src/demod/python/Makefile.am D src/demod/python/__init__.py D src/demod/python/cqpsk.py D src/demod/python/osmosdr-tetra_demod_fft.py D src/demod/python/py_run_tests.in D src/demod/python/tetra-demod.py D src/demod/python/uhd-tetra_demod.py D src/demod/python/usrp1-tetra_demod.py D src/demod/python/usrp2-tetra_demod.py R src/demod/simdemod2.py 21 files changed, 21 insertions(+), 1,535 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/README b/README index 8c6712e..30188a2 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ TETRA MAC/PHY layer experimentation code -(C) 2010-2011 by Harald Welte +(C) 2010-2016 by Harald Welte and contributors ====================================================================== This code aims to implement the sending and receiving part of the @@ -19,12 +19,13 @@ src/demod/python/cpsk.py * contains a gnuradio based pi4/DQPSK demodulator, courtesy of KA1RBI -src/demod/python/tetra-demod.py +src/demod/python/osmosdr-tetra_demod_fft.py + * 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 -src/demod/python/usrp1-tetra_demod.py - * use demodulator in realtime with a USRP1 SDR -src/demod/python/usrp2-tetra_demod.py - * use demodulator in realtime with a USRP2 SDR +src/demod/python/{uhd,fcdp}-tetra_demod.py + * 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. diff --git a/src/demod/Makefile.am b/src/demod/Makefile.am deleted file mode 100644 index d5f8d2b..0000000 --- a/src/demod/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2001,2006,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -ACLOCAL_AMFLAGS = -I config -AUTOMAKE_OPTIONS = foreign - -include $(top_srcdir)/Makefile.common - - -SUBDIRS = python apps config grc - -export pythondir - -install-data-hook: - @if ! python -c "import gnuradio" > /dev/null 2>&1; then\ - printf "\n*** Post-Install Message ***\ - \nWarning: python could not find the gnuradio module.\ - \nMake sure that $${pythondir} is in your PYTHONPATH\n\n";\ - fi - - diff --git a/src/demod/Makefile.common b/src/demod/Makefile.common deleted file mode 100644 index b4d35ae..0000000 --- a/src/demod/Makefile.common +++ /dev/null @@ -1,77 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 2004,2006,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# The name of this "out-of-tree" module -modname = tetra_demod - -# these flags are used when compiling non-SWIG-wrapper files -# when going in to non-SWIG libraries -AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ - -# Sets ABI version in SONAME and appends -LIBVER to filename -LTVERSIONFLAGS = -version-info 0:0:0 -release $(LIBVER) - -# these flags are used when compiling any CXX file -AM_CPPFLAGS = \ - $(STD_DEFINES_AND_INCLUDES) \ - $(PYTHON_CPPFLAGS) \ - $(CPPUNIT_INCLUDES) \ - $(GNURADIO_CORE_CPPFLAGS) - -# these are used by both SWIG and CXX -STD_DEFINES_AND_INCLUDES = \ - $(DEFINES) \ - -I$(abs_top_srcdir)/lib \ - -I$(GNURADIO_CORE_INCLUDEDIR) \ - -I$(GNURADIO_CORE_INCLUDEDIR)/swig - -# includes -modincludedir = $(includedir)/$(modname) - -# swig includes -swigincludedir = $(modincludedir)/swig - -# Install this stuff in the appropriate subdirectory -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/$(modname) - -modpythondir = $(pythondir)/$(modname) -modpyexecdir = $(pyexecdir)/$(modname) - -# Data directory for grc block wrappers -grc_blocksdir = $(prefix)/share/gnuradio/grc/blocks - -# Don't assume that make predefines $(RM), because BSD make does -# not. We define it now in configure.ac using AM_PATH_PROG, but now -# here have to add a -f to be like GNU make. -RM=$(RM_PROG) -f - -# Other common defines; use "+=" to add to these -STAMPS = -MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT - -# Don't distribute the files defined in the variable 'no_dist_files' -dist-hook: - @for file in $(no_dist_files); do \ - echo $(RM) $(distdir)/$$file; \ - $(RM) $(distdir)/$$file; \ - done; diff --git a/src/demod/apps/Makefile.am b/src/demod/apps/Makefile.am deleted file mode 100644 index e69de29..0000000 --- a/src/demod/apps/Makefile.am +++ /dev/null diff --git a/src/demod/config/Makefile.am b/src/demod/config/Makefile.am deleted file mode 100644 index fe4fc11..0000000 --- a/src/demod/config/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2001,2006,2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -# Install m4 macros in this directory -m4datadir = $(datadir)/aclocal - -# List your m4 macros here -m4macros = \ - gr_standalone.m4 - -EXTRA_DIST = $(m4macros) diff --git a/src/demod/config/gr_standalone.m4 b/src/demod/config/gr_standalone.m4 deleted file mode 100644 index 3f8ddf1..0000000 --- a/src/demod/config/gr_standalone.m4 +++ /dev/null @@ -1,135 +0,0 @@ -dnl -dnl Copyright 2008,2009 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License along -dnl with this program; if not, write to the Free Software Foundation, Inc., -dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -dnl - -dnl -dnl GR_STANDALONE([package],[version]) -dnl -dnl Handles the bulk of the configure.ac work for an out-of-tree build -dnl -dnl N.B., this is an m4_define because if it were an AC_DEFUN it would -dnl get called too late to be useful. - -m4_define([GR_STANDALONE], -[ - AC_CONFIG_SRCDIR([config/gr_standalone.m4]) - AM_CONFIG_HEADER(config.h) - - dnl Remember if the user explicity set CXXFLAGS - if test -n "${CXXFLAGS}"; then - user_set_cxxflags=yes - fi - - LF_CONFIGURE_CC - LF_CONFIGURE_CXX - GR_LIB64 dnl check for lib64 suffix after choosing compilers - - dnl The three macros above are known to override CXXFLAGS if the user - dnl didn't specify them. Though I'm sure somebody thought this was - dnl a good idea, it makes it hard to use other than -g -O2 when compiling - dnl selected files. Thus we "undo" the damage here... - dnl - dnl If the user specified CXXFLAGS, we use them. Otherwise when compiling - dnl the output of swig use use -O1 if we're using g++. - dnl See Makefile.common for the rest of the magic. - if test "$user_set_cxxflags" != yes; then - autoconf_default_CXXFLAGS="$CXXFLAGS" - if test "$GXX" = yes; then - case "$host_cpu" in - powerpc*) - dnl "-O1" is broken on the PPC for some reason - dnl (at least as of g++ 4.1.1) - swig_CXXFLAGS="-g1 -O2 -Wno-strict-aliasing -Wno-parentheses" - ;; - *) - swig_CXXFLAGS="-g -O1 -Wno-strict-aliasing -Wno-parentheses" - ;; - esac - fi - fi - AC_SUBST(autoconf_default_CXXFLAGS) - AC_SUBST(swig_CXXFLAGS) - - dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH - if test x${PKG_CONFIG_PATH} = x; then - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig - else - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH} - fi - export PKG_CONFIG_PATH - - LF_SET_WARNINGS - GR_SET_GPROF - GR_SET_PROF - AM_PROG_AS - AC_PROG_LN_S - AC_PROG_MAKE_SET - AC_PROG_INSTALL - AC_PATH_PROG([RM_PROG], [rm]) - - AC_LIBTOOL_WIN32_DLL - AC_ENABLE_SHARED dnl do build shared libraries - AC_DISABLE_STATIC dnl don't build static libraries - m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL]) - dnl GR_FORTRAN - - GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag - GR_SCRIPTING dnl Locate python, SWIG, etc - - dnl Checks for header files. - AC_HEADER_STDC - - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST - AC_C_INLINE - AC_TYPE_SIZE_T - AC_HEADER_TIME - AC_C_BIGENDIAN - - dnl Check for Mingw support - GR_PWIN32 - - AC_CHECK_PROG([XMLTO],[xmlto],[yes],[]) - AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes]) - - PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3) - LIBS="$LIBS $GNURADIO_CORE_LIBS" - - dnl Allow user to choose whether to generate SWIG/Python - dnl Default is enabled - AC_ARG_ENABLE([python], - [AS_HELP_STRING([--enable-python], - [generate SWIG/Python components (default is yes)])], - [case "${enableval}" in - yes) enable_python=yes ;; - no) enable_python=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; - esac], - [enable_python=yes] - ) - AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes]) - - dnl Define where to look for cppunit includes and libs - dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS - dnl Try using pkg-config first, then fall back to cppunit-config. - PKG_CHECK_EXISTS(cppunit, - [PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.9.14)], - [AM_PATH_CPPUNIT([1.9.14],[], - [AC_MSG_ERROR([GNU Radio requires cppunit. Stop])])]) -]) diff --git a/src/demod/configure.ac b/src/demod/configure.ac deleted file mode 100644 index f6bd751..0000000 --- a/src/demod/configure.ac +++ /dev/null @@ -1,55 +0,0 @@ -dnl -dnl Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. -dnl - - -AC_INIT([tetra-demod], [0.0.1]) -AC_PREREQ(2.57) -AC_CONFIG_AUX_DIR([.]) - -AC_CANONICAL_BUILD -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -GR_VERSION -dnl ustar required to have pathnames > 99 chars -_AM_SET_OPTION([tar-ustar]) -AM_INIT_AUTOMAKE([]) - -dnl This is kind of non-standard, but it sure shortens up this file :-) -m4_include([config/gr_standalone.m4]) -GR_STANDALONE -AM_PATH_PYTHON - - -AC_CONFIG_FILES([\ - Makefile \ - apps/Makefile \ - config/Makefile \ - grc/Makefile \ - python/Makefile \ - python/py_run_tests \ - ]) - -dnl run_tests is created from run_tests.in. Make it executable. -AC_CONFIG_COMMANDS([run_tests], [chmod +x python/py_run_tests]) - -AC_OUTPUT - diff --git a/src/demod/python/fcdp-tetra_demod.py b/src/demod/fcdp-tetra_demod.py similarity index 84% rename from src/demod/python/fcdp-tetra_demod.py rename to src/demod/fcdp-tetra_demod.py index a8c5a59..1074cff 100755 --- a/src/demod/python/fcdp-tetra_demod.py +++ b/src/demod/fcdp-tetra_demod.py @@ -2,7 +2,7 @@ import sys import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir +from gnuradio import gr, gru, audio, eng_notation, blocks, filter from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -22,7 +22,7 @@ self.asrc = audio.source(sample_rate, options.audio_device, True) - self.f2c = gr.float_to_complex(1) + self.f2c = blocks.float_to_complex(1) self.connect((self.asrc, 1), (self.f2c, 1)) self.connect((self.asrc, 0), (self.f2c, 0)) @@ -33,9 +33,9 @@ ntaps = 11 * sps new_sample_rate = symbol_rate * sps - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) + channel_taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, filter.firdes.WIN_HANN) - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) + FILTER = filter.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) sys.stderr.write("sample rate: %d\n" %(sample_rate)) @@ -48,11 +48,11 @@ log=options.log, verbose=options.verbose) - OUT = gr.file_sink(gr.sizeof_float, options.output_file) + OUT = blocks.file_sink(gr.sizeof_float, options.output_file) r = float(sample_rate) / float(new_sample_rate) - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) + INTERPOLATOR = filter.fractional_interpolator_cc(0, r) self.connect(self.f2c, FILTER, INTERPOLATOR, DEMOD, OUT) diff --git a/src/demod/python/fcdp-tetra_demod_fft.py b/src/demod/fcdp-tetra_demod_fft.py similarity index 86% rename from src/demod/python/fcdp-tetra_demod_fft.py rename to src/demod/fcdp-tetra_demod_fft.py index e191af2..b4def1e 100755 --- a/src/demod/python/fcdp-tetra_demod_fft.py +++ b/src/demod/fcdp-tetra_demod_fft.py @@ -2,7 +2,7 @@ import sys import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir +from gnuradio import gr, gru, audio, eng_notation, blocks, filter from gnuradio import audio from gnuradio.eng_option import eng_option from gnuradio.wxgui import stdgui2, fftsink2 @@ -28,7 +28,7 @@ self.asrc = audio.source(sample_rate, options.audio_device, True) - self.f2c = gr.float_to_complex(1) + self.f2c = blocks.float_to_complex(1) self.connect((self.asrc, 1), (self.f2c, 1)) self.connect((self.asrc, 0), (self.f2c, 0)) @@ -39,9 +39,9 @@ ntaps = 11 * sps new_sample_rate = symbol_rate * sps - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) + channel_taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, filter.firdes.WIN_HANN) - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) + FILTER = filter.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) sys.stderr.write("sample rate: %d\n" %(sample_rate)) @@ -54,11 +54,11 @@ log=options.log, verbose=options.verbose) - OUT = gr.file_sink(gr.sizeof_float, options.output_file) + OUT = blocks.file_sink(gr.sizeof_float, options.output_file) r = float(sample_rate) / float(new_sample_rate) - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) + INTERPOLATOR = filter.fractional_interpolator_cc(0, r) self.connect(self.f2c, FILTER, INTERPOLATOR, DEMOD, OUT) diff --git a/src/demod/grc/Makefile.am b/src/demod/grc/Makefile.am deleted file mode 100644 index 3f9ad4b..0000000 --- a/src/demod/grc/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# (C) 2011 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 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 $(top_srcdir)/Makefile.common - -grcblocksdir = $(grc_blocksdir) -dist_grcblocks_DATA = \ - tetra_demod_qpsk.xml diff --git a/src/demod/grc/tetra_demod_qpsk.xml b/src/demod/grc/tetra_demod_qpsk.xml deleted file mode 100644 index f247354..0000000 --- a/src/demod/grc/tetra_demod_qpsk.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - Tetra QPSK pi/4 demodulation - tetra_demod - Tetra - import tetra_demod - tetra_demod.demod() - - - in - complex - - - - out - float - - diff --git a/src/demod/python/Makefile.am b/src/demod/python/Makefile.am deleted file mode 100644 index 0d789fd..0000000 --- a/src/demod/python/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright 2001,2006,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# -# -include $(top_srcdir)/Makefile.common - -bin_SCRIPTS = \ - tetra-demod.py \ - usrp1-tetra_demod.py \ - usrp2-tetra_demod.py - -EXTRA_DIST = py_run_tests.in tetra-demod.py usrp1-tetra_demod.py usrp2-tetra_demod.py -TESTS = py_run_tests - -modpython_PYTHON = \ - __init__.py \ - cqpsk.py - -noinst_PYTHON = \ - qa_tetra.py diff --git a/src/demod/python/__init__.py b/src/demod/python/__init__.py deleted file mode 100644 index ccbf8b0..0000000 --- a/src/demod/python/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -""" - (C) 2011 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 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 . -""" - -import cqpsk - -def demod(): - return cqpsk.cqpsk_demod(samples_per_symbol = 2, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05) - diff --git a/src/demod/python/cqpsk.py b/src/demod/python/cqpsk.py deleted file mode 100644 index f9621b1..0000000 --- a/src/demod/python/cqpsk.py +++ /dev/null @@ -1,370 +0,0 @@ -# -# Copyright 2005,2006,2007 Free Software Foundation, Inc. -# -# cqpsk.py (C) Copyright 2009, KA1RBI -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# See gnuradio-examples/python/digital for examples - -""" -differential PI/4 CQPSK modulation and demodulation. -""" - -from gnuradio import gr, gru -from math import pi, sqrt -#import psk -import cmath -from pprint import pprint - -_def_has_gr_digital = False - -# address gnuradio 3.5.x changes -try: - from gnuradio import modulation_utils -except ImportError: - from gnuradio import digital - _def_has_gr_digital = True - -# default values (used in __init__ and add_options) -_def_samples_per_symbol = 10 -_def_excess_bw = 0.35 -_def_gray_code = True -_def_verbose = False -_def_log = False - -_def_costas_alpha = 0.15 -_def_gain_mu = None -_def_mu = 0.5 -_def_omega_relative_limit = 0.005 - - -# ///////////////////////////////////////////////////////////////////////////// -# CQPSK modulator -# ///////////////////////////////////////////////////////////////////////////// - -class cqpsk_mod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - excess_bw=_def_excess_bw, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for RRC-filtered QPSK modulation. - - The input is a byte stream (unsigned char) and the - output is the complex modulated signal at baseband. - - @param samples_per_symbol: samples per symbol >= 2 - @type samples_per_symbol: integer - @param excess_bw: Root-raised cosine filter excess bandwidth - @type excess_bw: float - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "cqpsk_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._excess_bw = excess_bw - - if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: - raise TypeError, ("sbp must be an integer >= 2, is %d" % samples_per_symbol) - - ntaps = 11 * samples_per_symbol - - arity = 8 - - # turn bytes into k-bit vectors - self.bytes2chunks = \ - gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) - - # 0 +45 1 [+1] - # 1 +135 3 [+3] - # 2 -45 7 [-1] - # 3 -135 5 [-3] - self.pi4map = [1, 3, 7, 5] - self.symbol_mapper = gr.map_bb(self.pi4map) - self.diffenc = gr.diff_encoder_bb(arity) - self.chunks2symbols = gr.chunks_to_symbols_bc(psk.constellation[arity]) - - # pulse shaping filter - self.rrc_taps = gr.firdes.root_raised_cosine( - self._samples_per_symbol, # gain (sps since we're interpolating by sps) - self._samples_per_symbol, # sampling rate - 1.0, # symbol rate - self._excess_bw, # excess bandwidth (roll-off factor) - ntaps) - - self.rrc_filter = gr.interp_fir_filter_ccf(self._samples_per_symbol, self.rrc_taps) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc, - self.chunks2symbols, self.rrc_filter, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 2 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM - - def _print_verbage(self): - print "\nModulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "Gray code: %s" % self._gray_code - print "RRS roll-off factor: %f" % self._excess_bw - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.bytes2chunks, - gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat")) - self.connect(self.symbol_mapper, - gr.file_sink(gr.sizeof_char, "tx_graycoder.dat")) - self.connect(self.diffenc, - gr.file_sink(gr.sizeof_char, "tx_diffenc.dat")) - self.connect(self.chunks2symbols, - gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat")) - self.connect(self.rrc_filter, - gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat")) - - def add_options(parser): - """ - Adds QPSK modulation-specific options to the standard parser - """ - parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, - help="set RRC excess bandwith factor [default=%default] (PSK)") - parser.add_option("", "--no-gray-code", dest="gray_code", - action="store_false", default=_def_gray_code, - help="disable gray coding on modulated bits (PSK)") - add_options=staticmethod(add_options) - - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options(dqpsk_mod.__init__, - ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - -# ///////////////////////////////////////////////////////////////////////////// -# CQPSK demodulator -# -# ///////////////////////////////////////////////////////////////////////////// - -class cqpsk_demod(gr.hier_block2): - - def __init__(self, - samples_per_symbol=_def_samples_per_symbol, - excess_bw=_def_excess_bw, - costas_alpha=_def_costas_alpha, - gain_mu=_def_gain_mu, - mu=_def_mu, - omega_relative_limit=_def_omega_relative_limit, - gray_code=_def_gray_code, - verbose=_def_verbose, - log=_def_log): - """ - Hierarchical block for RRC-filtered CQPSK demodulation - - The input is the complex modulated signal at baseband. - The output is a stream of floats in [ -3 / -1 / +1 / +3 ] - - @param samples_per_symbol: samples per symbol >= 2 - @type samples_per_symbol: float - @param excess_bw: Root-raised cosine filter excess bandwidth - @type excess_bw: float - @param costas_alpha: loop filter gain - @type costas_alphas: float - @param gain_mu: for M&M block - @type gain_mu: float - @param mu: for M&M block - @type mu: float - @param omega_relative_limit: for M&M block - @type omega_relative_limit: float - @param gray_code: Tell modulator to Gray code the bits - @type gray_code: bool - @param verbose: Print information about modulator? - @type verbose: bool - @param debug: Print modualtion data to files? - @type debug: bool - """ - - gr.hier_block2.__init__(self, "cqpsk_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - self._samples_per_symbol = samples_per_symbol - self._excess_bw = excess_bw - self._costas_alpha = costas_alpha - self._mm_gain_mu = gain_mu - self._mm_mu = mu - self._mm_omega_relative_limit = omega_relative_limit - self._gray_code = gray_code - - if samples_per_symbol < 2: - raise TypeError, "sbp must be >= 2, is %d" % samples_per_symbol - - arity = pow(2,self.bits_per_symbol()) - - # Automatic gain control - scale = (1.0/16384.0) - self.pre_scaler = gr.multiply_const_cc(scale) # scale the signal from full-range to +-1 - #self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) - self.agc = gr.feedforward_agc_cc(16, 2.0) - - # RRC data filter - ntaps = 11 * samples_per_symbol - self.rrc_taps = gr.firdes.root_raised_cosine( - 1.0, # gain - self._samples_per_symbol, # sampling rate - 1.0, # symbol rate - self._excess_bw, # excess bandwidth (roll-off factor) - ntaps) - self.rrc_filter=gr.interp_fir_filter_ccf(1, self.rrc_taps) - - if not self._mm_gain_mu: - sbs_to_mm = {2: 0.050, 3: 0.075, 4: 0.11, 5: 0.125, 6: 0.15, 7: 0.15} - self._mm_gain_mu = sbs_to_mm[samples_per_symbol] - - self._mm_omega = self._samples_per_symbol - self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu - self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha - fmin = -0.025 - fmax = 0.025 - - if not _def_has_gr_digital: - self.receiver=gr.mpsk_receiver_cc(arity, pi/4.0, - self._costas_alpha, self._costas_beta, - fmin, fmax, - self._mm_mu, self._mm_gain_mu, - self._mm_omega, self._mm_gain_omega, - self._mm_omega_relative_limit) - else: - self.receiver=digital.mpsk_receiver_cc(arity, pi/4.0, - 2*pi/150, - fmin, fmax, - self._mm_mu, self._mm_gain_mu, - self._mm_omega, self._mm_gain_omega, - self._mm_omega_relative_limit) - - self.receiver.set_alpha(self._costas_alpha) - self.receiver.set_beta(self._costas_beta) - - # Perform Differential decoding on the constellation - self.diffdec = gr.diff_phasor_cc() - - # take angle of the difference (in radians) - self.to_float = gr.complex_to_arg() - - # convert from radians such that signal is in -3/-1/+1/+3 - self.rescale = gr.multiply_const_ff( 1 / (pi / 4) ) - - if verbose: - self._print_verbage() - - if log: - self._setup_logging() - - # Connect & Initialize base class - self.connect(self, self.pre_scaler, self.agc, self.rrc_filter, self.receiver, - self.diffdec, self.to_float, self.rescale, self) - - def samples_per_symbol(self): - return self._samples_per_symbol - - def bits_per_symbol(self=None): # staticmethod that's also callable on an instance - return 2 - bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM - - def _print_verbage(self): - print "\nDemodulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "Gray code: %s" % self._gray_code - print "RRC roll-off factor: %.2f" % self._excess_bw - print "Costas Loop alpha: %.2e" % self._costas_alpha - print "Costas Loop beta: %.2e" % self._costas_beta - print "M&M mu: %.2f" % self._mm_mu - print "M&M mu gain: %.2e" % self._mm_gain_mu - print "M&M omega: %.2f" % self._mm_omega - print "M&M omega gain: %.2e" % self._mm_gain_omega - print "M&M omega limit: %.2f" % self._mm_omega_relative_limit - - def _setup_logging(self): - print "Modulation logging turned on." - self.connect(self.pre_scaler, - gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat")) - self.connect(self.agc, - gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat")) - self.connect(self.rrc_filter, - gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat")) - self.connect(self.receiver, - gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat")) - self.connect(self.diffdec, - gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat")) - self.connect(self.to_float, - gr.file_sink(gr.sizeof_float, "rx_to_float.dat")) - self.connect(self.rescale, - gr.file_sink(gr.sizeof_float, "rx_rescale.dat")) - - def add_options(parser): - """ - Adds modulation-specific options to the standard parser - """ - parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, - help="set RRC excess bandwith factor [default=%default] (PSK)") - parser.add_option("", "--no-gray-code", dest="gray_code", - action="store_false", default=_def_gray_code, - help="disable gray coding on modulated bits (PSK)") - parser.add_option("", "--costas-alpha", type="float", default=_def_costas_alpha, - help="set Costas loop alpha value [default=%default] (PSK)") - parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, - help="set M&M symbol sync loop gain mu value [default=%default] (PSK)") - parser.add_option("", "--mu", type="float", default=_def_mu, - help="set M&M symbol sync loop mu value [default=%default] (PSK)") - add_options=staticmethod(add_options) - - def extract_kwargs_from_options(options): - """ - Given command line options, create dictionary suitable for passing to __init__ - """ - return modulation_utils.extract_kwargs_from_options( - cqpsk_demod.__init__, ('self',), options) - extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) - - -# -# Add these to the mod/demod registry -# -#modulation_utils.add_type_1_mod('cqpsk', cqpsk_mod) -#modulation_utils.add_type_1_demod('cqpsk', cqpsk_demod) - diff --git a/src/demod/python/osmosdr-tetra_demod_fft.py b/src/demod/python/osmosdr-tetra_demod_fft.py deleted file mode 100755 index d1c941b..0000000 --- a/src/demod/python/osmosdr-tetra_demod_fft.py +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2012 Dimitri Stolnikov - -# Usage: -# src$ ./demod/python/osmosdr-tetra_demod_fft.py -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin -# -# Adjust the center frequency (-f) and gain (-g) according to your needs. -# Use left click in Wideband Spectrum window to roughly select a TETRA carrier. -# In Wideband Spectrum you can also tune by 1/4 of the bandwidth by clicking on the rightmost/leftmost spectrum side. -# Use left click in Channel Spectrum windows to fine tune the carrier by clicking on the left or right side of the spectrum. - - -import sys -import math -from gnuradio import gr, gru, eng_notation, blks2, optfir -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import fftsink2 -from gnuradio.wxgui import scopesink2 -from gnuradio.wxgui import forms -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser -import osmosdr -import wx - -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# applies frequency translation, resampling and demodulation - -class top_block(grc_wxgui.top_block_gui): - def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="Top Block") - - options = get_options() - - self.ifreq = options.frequency - self.rfgain = options.gain - self.offset = options.frequency_offset - - self.src = osmosdr.source_c(options.args) - self.src.set_center_freq(self.ifreq) - self.src.set_sample_rate(int(options.sample_rate)) - - if self.rfgain is None: - self.src.set_gain_mode(1) - self.iagc = 1 - self.rfgain = 0 - else: - self.iagc = 0 - self.src.set_gain_mode(0) - self.src.set_gain(self.rfgain) - - # may differ from the requested rate - sample_rate = self.src.get_sample_rate() - sys.stderr.write("sample rate: %d\n" % (sample_rate)) - - symbol_rate = 18000 - sps = 2 # output rate will be 36,000 - out_sample_rate = symbol_rate * sps - - options.low_pass = options.low_pass / 2.0 - - if sample_rate == 96000: # FunCube Dongle - first_decim = 2 - else: - first_decim = 10 - - self.offset = 0 - - taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.2, gr.firdes.WIN_HANN) - self.tuner = gr.freq_xlating_fir_filter_ccf(first_decim, taps, self.offset, sample_rate) - - self.demod = cqpsk.cqpsk_demod( - samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - self.output = gr.file_sink(gr.sizeof_float, options.output_file) - - rerate = float(sample_rate / float(first_decim)) / float(out_sample_rate) - sys.stderr.write("resampling factor: %f\n" % rerate) - - if rerate.is_integer(): - sys.stderr.write("using pfb decimator\n") - self.resamp = blks2.pfb_decimator_ccf(int(rerate)) - else: - sys.stderr.write("using pfb resampler\n") - self.resamp = blks2.pfb_arb_resampler_ccf(1 / rerate) - - self.connect(self.src, self.tuner, self.resamp, self.demod, self.output) - - self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP) - self.Main.AddPage(grc_wxgui.Panel(self.Main), "Wideband Spectrum") - self.Main.AddPage(grc_wxgui.Panel(self.Main), "Channel Spectrum") - self.Main.AddPage(grc_wxgui.Panel(self.Main), "Soft Bits") - - def set_ifreq(ifreq): - self.ifreq = ifreq - self._ifreq_text_box.set_value(self.ifreq) - self.src.set_center_freq(self.ifreq) - - self._ifreq_text_box = forms.text_box( - parent=self.GetWin(), - value=self.ifreq, - callback=set_ifreq, - label="Center Frequency", - converter=forms.float_converter(), - ) - self.Add(self._ifreq_text_box) - - def set_iagc(iagc): - self.iagc = iagc - self._agc_check_box.set_value(self.iagc) - self.src.set_gain_mode(self.iagc, 0) - self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) - - self._agc_check_box = forms.check_box( - parent=self.GetWin(), - value=self.iagc, - callback=set_iagc, - label="Automatic Gain", - true=1, - false=0, - ) - - self.Add(self._agc_check_box) - - def set_rfgain(rfgain): - self.rfgain = rfgain - self._rfgain_slider.set_value(self.rfgain) - self._rfgain_text_box.set_value(self.rfgain) - self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) - - _rfgain_sizer = wx.BoxSizer(wx.VERTICAL) - self._rfgain_text_box = forms.text_box( - parent=self.GetWin(), - sizer=_rfgain_sizer, - value=self.rfgain, - callback=set_rfgain, - label="RF Gain", - converter=forms.float_converter(), - proportion=0, - ) - self._rfgain_slider = forms.slider( - parent=self.GetWin(), - sizer=_rfgain_sizer, - value=self.rfgain, - callback=set_rfgain, - minimum=0, - maximum=50, - num_steps=200, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - - self.Add(_rfgain_sizer) - - self.Add(self.Main) - - def fftsink2_callback(x, y): - if abs(x / (sample_rate / 2)) > 0.9: - set_ifreq(self.ifreq + x / 2) - else: - self.offset = -x - sys.stderr.write("coarse tuned to: %d Hz => %d Hz\n" % (self.offset, (self.ifreq + self.offset))) - self.tuner.set_center_freq(self.offset) - - self.scope = fftsink2.fft_sink_c(self.Main.GetPage(0).GetWin(), - title="Wideband Spectrum (click to coarse tune)", - fft_size=1024, - sample_rate=sample_rate, - ref_scale=2.0, - ref_level=0, - y_divs=10, - fft_rate=10, - average=False, - avg_alpha=0.6) - - self.Main.GetPage(0).Add(self.scope.win) - self.scope.set_callback(fftsink2_callback) - - self.connect(self.src, self.scope) - - def fftsink2_callback2(x, y): - self.offset = self.offset - (x / 10) - sys.stderr.write("fine tuned to: %d Hz => %d Hz\n" % (self.offset, (self.ifreq + self.offset))) - self.tuner.set_center_freq(self.offset) - - self.scope2 = fftsink2.fft_sink_c(self.Main.GetPage(1).GetWin(), - title="Channel Spectrum (click to fine tune)", - fft_size=1024, - sample_rate=out_sample_rate, - ref_scale=2.0, - ref_level=-20, - y_divs=10, - fft_rate=10, - average=False, - avg_alpha=0.6) - - self.Main.GetPage(1).Add(self.scope2.win) - self.scope2.set_callback(fftsink2_callback2) - - self.connect(self.resamp, self.scope2) - - self.scope3 = scopesink2.scope_sink_f( - self.Main.GetPage(2).GetWin(), - title="Soft Bits", - sample_rate=out_sample_rate, - v_scale=0, - v_offset=0, - t_scale=0.001, - ac_couple=False, - xy_mode=False, - num_inputs=1, - trig_mode=gr.gr_TRIG_MODE_AUTO, - y_axis_label="Counts", - ) - self.Main.GetPage(2).Add(self.scope3.win) - - self.connect(self.demod, self.scope3) - -def get_options(): - parser = OptionParser(option_class=eng_option) - - parser.add_option("-a", "--args", type="string", default="", - help="gr-osmosdr device arguments") - parser.add_option("-s", "--sample-rate", type="eng_float", default=1800000, - help="set receiver sample rate (default 1800000)") - parser.add_option("-f", "--frequency", type="eng_float", default=394.4e6, - help="set receiver center frequency") - parser.add_option("-F", "--frequency-offset", type="eng_float", default=0, - help="set receiver offset frequency") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set receiver gain") - - # demodulator related settings - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - return (options) - -if __name__ == '__main__': - tb = top_block() - tb.Run(True) diff --git a/src/demod/python/py_run_tests.in b/src/demod/python/py_run_tests.in deleted file mode 100644 index e69de29..0000000 --- a/src/demod/python/py_run_tests.in +++ /dev/null diff --git a/src/demod/python/tetra-demod.py b/src/demod/python/tetra-demod.py deleted file mode 100755 index d7d5c72..0000000 --- a/src/demod/python/tetra-demod.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# Load it locally or from the module -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# accepts an input file in complex format -# applies frequency translation, resampling (interpolation/decimation) - -class my_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - parser = OptionParser(option_class=eng_option) - - parser.add_option("-c", "--calibration", type="eng_float", default=0, help="freq offset") - parser.add_option("-i", "--input-file", type="string", default="in.dat", help="specify the input file") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.dat", help="specify the output file") - parser.add_option("-s", "--sample-rate", type="int", default=100000000/512, help="input sample rate") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - (options, args) = parser.parse_args() - - sample_rate = options.sample_rate - symbol_rate = 18000 - sps = 2 - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - IN = gr.file_source(gr.sizeof_gr_complex, options.input_file) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(IN, FILTER, INTERPOLATOR, DEMOD, OUT) - -if __name__ == "__main__": - try: - my_top_block().run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/uhd-tetra_demod.py b/src/demod/python/uhd-tetra_demod.py deleted file mode 100755 index ac49fb7..0000000 --- a/src/demod/python/uhd-tetra_demod.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio import uhd -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# Load it locally or from the module -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# accepts an input file in complex format -# applies frequency translation, resampling (interpolation/decimation) - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - # Create a UHD source - self._u = uhd.usrp_source( - device_addr=options.args, - io_type=uhd.io_type.COMPLEX_FLOAT32, - num_channels=1) - - # Set the subdevice spec - if(options.spec): - self._u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self._u.set_antenna(options.antenna, 0) - - # Pick the lowest possible value for the input rate - supported_rates = self._u.get_samp_rates() - self._u.set_samp_rate(supported_rates.start()) - - sample_rate = self._u.get_samp_rate() - symbol_rate = 18000 - sps = 2 - - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - # Set receive daughterboard gain - if options.gain is None: - g = self._u.get_gain_range() - options.gain = float(g.stop()+g.start())/2 - print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")" - self._u.set_gain(options.gain) - - # Set frequency (tune request takes lo_offset) - if(options.lo_offset is not None): - treq = uhd.tune_request(options.freq, options.lo_offset) - else: - treq = uhd.tune_request(options.freq) - tr = self._u.set_center_freq(treq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(self._u, FILTER, INTERPOLATOR, DEMOD, OUT) - -def get_options(): - parser = OptionParser(option_class=eng_option) - # usrp related settings - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args, [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - # demodulator related settings - parser.add_option("-c", "--calibration", type="int", default=0, help="freq offset") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - -if __name__ == "__main__": - (options) = get_options() - tb = my_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/usrp1-tetra_demod.py b/src/demod/python/usrp1-tetra_demod.py deleted file mode 100755 index 219594b..0000000 --- a/src/demod/python/usrp1-tetra_demod.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# applies frequency translation, resampling (interpolation/decimation) and cqpsk demodulation - - - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - fusb_block_size = gr.prefs().get_long('fusb', 'block_size', 4096) - fusb_nblocks = gr.prefs().get_long('fusb', 'nblocks', 16) - self._u = usrp.source_c(decim_rate=options.decim, fusb_block_size=fusb_block_size, fusb_nblocks=fusb_nblocks) - - # master clock - if options.fpga_freq is not None: - self._u.set_fpga_master_clock_freq(long(options.fpga_freq)) - - # default subdev if use didn't pick one - if options.rx_subdev_spec is None: - if u.db(0, 0).dbid() >= 0: - options.rx_subdev_spec = (0, 0) - elif u.db(1, 0).dbid() >= 0: - options.rx_subdev_spec = (1, 0) - else: - options.rx_subdev_spec = (0, 0) - - # configure usrp mux - self._u.set_mux(usrp.determine_rx_mux_value(self._u, options.rx_subdev_spec)) - - # determine the daughterboard subdevice - self.subdev = usrp.selected_subdev(self._u, options.rx_subdev_spec) - - # select antenna - if options.antenna is not None: - print "Selecting antenna %s" % (options.antenna,) - self.subdev.select_rx_antenna(options.antenna) - - # set initial values - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.subdev.gain_range() - options.gain = float(g[0]+g[1])/2 - - r = self._u.tune(0, self.subdev, options.freq) - self.subdev.set_gain(options.gain) - - #sample_rate = options.fpga_clock/options.decim - sample_rate = self._u.adc_freq() / self._u.decim_rate() - symbol_rate = 18000 - sps = 2 - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(self._u, FILTER, INTERPOLATOR, DEMOD, OUT) - -def get_options(): - parser = OptionParser(option_class=eng_option) - - # usrp related settings - parser.add_option("-d", "--decim", type="int", default=250, - help="Set USRP decimation rate to DECIM [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="Select USRP Rx side A or B (default=first one with a daughterboard)") - parser.add_option("-A", "--antenna", default=None, - help="select Rx Antenna") - parser.add_option("-F", "--fpga-freq", type="eng_float", default=None, - help="set USRP reference clock frequency to FPGA_FREQ", metavar="FPGA_FREQ") - - # demodulator related settings - parser.add_option("-c", "--calibration", type="int", default=0, help="freq offset") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - -if __name__ == "__main__": - (options) = get_options() - tb = my_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/usrp2-tetra_demod.py b/src/demod/python/usrp2-tetra_demod.py deleted file mode 100755 index 57e8017..0000000 --- a/src/demod/python/usrp2-tetra_demod.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -from gnuradio import gr, gru, audio, eng_notation, blks2, optfir -from gnuradio import usrp2 -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# Load it locally or from the module -try: - import cqpsk -except: - from tetra_demod import cqpsk - -# accepts an input file in complex format -# applies frequency translation, resampling (interpolation/decimation) - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - # Create a USRP2 source and set decimation rate - self._u = usrp2.source_32fc(options.interface, options.mac_addr) - self._u.set_decim(512) - - # Set receive daughterboard gain - if options.gain is None: - g = self._u.gain_range() - options.gain = float(g[0]+g[1])/2 - print "Using mid-point gain of", options.gain, "(", g[0], "-", g[1], ")" - self._u.set_gain(options.gain) - - # Set receive frequency - if options.lo_offset is not None: - self._u.set_lo_offset(options.lo_offset) - - tr = self._u.set_center_freq(options.freq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - sample_rate = 100e6/512 - symbol_rate = 18000 - sps = 2 - # output rate will be 36,000 - ntaps = 11 * sps - new_sample_rate = symbol_rate * sps - - channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.1, gr.firdes.WIN_HANN) - - FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration, sample_rate) - - sys.stderr.write("sample rate: %d\n" %(sample_rate)) - - DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps, - excess_bw=0.35, - costas_alpha=0.03, - gain_mu=0.05, - mu=0.05, - omega_relative_limit=0.05, - log=options.log, - verbose=options.verbose) - - OUT = gr.file_sink(gr.sizeof_float, options.output_file) - - r = float(sample_rate) / float(new_sample_rate) - - INTERPOLATOR = gr.fractional_interpolator_cc(0, r) - - self.connect(self._u, FILTER, INTERPOLATOR, DEMOD, OUT) - -def get_options(): - parser = OptionParser(option_class=eng_option) - # usrp related settings - parser.add_option("-e", "--interface", type="string", default="eth0", - help="use specified Ethernet interface [default=%default]") - parser.add_option("-m", "--mac-addr", type="string", default="", - help="use USRP2 at specified MAC address [default=None]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - # demodulator related settings - parser.add_option("-c", "--calibration", type="int", default=0, help="freq offset") - parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") - parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") - parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") - parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options) - -if __name__ == "__main__": - (options) = get_options() - tb = my_top_block(options) - try: - tb.run() - except KeyboardInterrupt: - tb.stop() diff --git a/src/demod/python/simdemod2.py b/src/demod/simdemod2.py similarity index 93% rename from src/demod/python/simdemod2.py rename to src/demod/simdemod2.py index 6b6fe2b..359ba2b 100755 --- a/src/demod/python/simdemod2.py +++ b/src/demod/simdemod2.py @@ -12,7 +12,7 @@ import sys import math -from gnuradio import gr, gru, eng_notation, blks2, optfir +from gnuradio import gr, gru, eng_notation, blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import osmosdr @@ -30,7 +30,7 @@ options = get_options() self.input_file=options.input_file - self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, self.input_file, True) + self.gr_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, self.input_file, True) symbol_rate = 18000 sps = 2 # output rate will be 36,000 -- To view, visit https://gerrit.osmocom.org/1452 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icae93bb9a6a7219e14931fb6e04a4c6fffa0779d 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 Sun Dec 18 16:24:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:24:22 +0000 Subject: [MERGED] osmo-tetra[master]: demod: Import the new GR 3.7 code In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: demod: Import the new GR 3.7 code ...................................................................... demod: Import the new GR 3.7 code This adds demodulator code compatible with gnuradio 3.7 series. Change-Id: Ibaf7f9c552cc1625210a75f2e9ec142ab47ce8d6 Signed-off-by: Sylvain Munaut --- A src/demod/cqpsk.py A src/demod/osmosdr-tetra_demod_fft.py 2 files changed, 600 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/src/demod/cqpsk.py b/src/demod/cqpsk.py new file mode 100644 index 0000000..6be6ee7 --- /dev/null +++ b/src/demod/cqpsk.py @@ -0,0 +1,345 @@ +# +# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# +# cqpsk.py (C) Copyright 2009, KA1RBI +# +# This file is part of GNU Radio +# +# GNU Radio 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, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# See gnuradio-examples/python/digital for examples + +""" +differential PI/4 CQPSK modulation and demodulation. +""" + +from gnuradio import gr, gru, analog, blocks, digital, filter +from math import pi, sqrt +import cmath +from pprint import pprint + +# default values (used in __init__ and add_options) +_def_samples_per_symbol = 10 +_def_excess_bw = 0.35 +_def_gray_code = True +_def_verbose = False +_def_log = False + +_def_costas_alpha = 0.15 +_def_gain_mu = None +_def_mu = 0.5 +_def_omega_relative_limit = 0.005 + + +# ///////////////////////////////////////////////////////////////////////////// +# CQPSK modulator +# ///////////////////////////////////////////////////////////////////////////// + +class cqpsk_mod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered QPSK modulation. + + The input is a byte stream (unsigned char) and the + output is the complex modulated signal at baseband. + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: integer + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "cqpsk_mod", + gr.io_signature(1, 1, gr.sizeof_char), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + + if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: + raise TypeError, ("sbp must be an integer >= 2, is %d" % samples_per_symbol) + + ntaps = 11 * samples_per_symbol + + arity = 8 + + # turn bytes into k-bit vectors + self.bytes2chunks = \ + gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) + + # 0 +45 1 [+1] + # 1 +135 3 [+3] + # 2 -45 7 [-1] + # 3 -135 5 [-3] + self.pi4map = [1, 3, 7, 5] + self.symbol_mapper = gr.map_bb(self.pi4map) + self.diffenc = gr.diff_encoder_bb(arity) + self.chunks2symbols = gr.chunks_to_symbols_bc(psk.constellation[arity]) + + # pulse shaping filter + self.rrc_taps = filter.firdes.root_raised_cosine( + self._samples_per_symbol, # gain (sps since we're interpolating by sps) + self._samples_per_symbol, # sampling rate + 1.0, # symbol rate + self._excess_bw, # excess bandwidth (roll-off factor) + ntaps) + + self.rrc_filter = filter.interp_fir_filter_ccf(self._samples_per_symbol, self.rrc_taps) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc, + self.chunks2symbols, self.rrc_filter, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + @staticmethod + def bits_per_symbol(): + return 2 + + def _print_verbage(self): + print "\nModulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRS roll-off factor: %f" % self._excess_bw + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.bytes2chunks, + gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat")) + self.connect(self.symbol_mapper, + gr.file_sink(gr.sizeof_char, "tx_graycoder.dat")) + self.connect(self.diffenc, + gr.file_sink(gr.sizeof_char, "tx_diffenc.dat")) + self.connect(self.chunks2symbols, + gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat")) + + @staticmethod + def add_options(parser): + """ + Adds QPSK modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + + @staticmethod + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options(dqpsk_mod.__init__, + ('self',), options) + + +# ///////////////////////////////////////////////////////////////////////////// +# CQPSK demodulator +# +# ///////////////////////////////////////////////////////////////////////////// + +class cqpsk_demod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + costas_alpha=_def_costas_alpha, + gain_mu=_def_gain_mu, + mu=_def_mu, + omega_relative_limit=_def_omega_relative_limit, + gray_code=_def_gray_code, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered CQPSK demodulation + + The input is the complex modulated signal at baseband. + The output is a stream of floats in [ -3 / -1 / +1 / +3 ] + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: float + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param costas_alpha: loop filter gain + @type costas_alphas: float + @param gain_mu: for M&M block + @type gain_mu: float + @param mu: for M&M block + @type mu: float + @param omega_relative_limit: for M&M block + @type omega_relative_limit: float + @param gray_code: Tell modulator to Gray code the bits + @type gray_code: bool + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "cqpsk_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_float)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + self._costas_alpha = costas_alpha + self._mm_gain_mu = gain_mu + self._mm_mu = mu + self._mm_omega_relative_limit = omega_relative_limit + self._gray_code = gray_code + + if samples_per_symbol < 2: + raise TypeError, "sbp must be >= 2, is %d" % samples_per_symbol + + arity = pow(2,self.bits_per_symbol()) + + # Automatic gain control + scale = (1.0/16384.0) + self.pre_scaler = blocks.multiply_const_cc(scale) # scale the signal from full-range to +-1 + #self.agc = analog.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) + self.agc = analog.feedforward_agc_cc(16, 2.0) + + # RRC data filter + ntaps = 11 * samples_per_symbol + self.rrc_taps = filter.firdes.root_raised_cosine( + 1.0, # gain + self._samples_per_symbol, # sampling rate + 1.0, # symbol rate + self._excess_bw, # excess bandwidth (roll-off factor) + ntaps) + self.rrc_filter=filter.interp_fir_filter_ccf(1, self.rrc_taps) + + if not self._mm_gain_mu: + sbs_to_mm = {2: 0.050, 3: 0.075, 4: 0.11, 5: 0.125, 6: 0.15, 7: 0.15} + self._mm_gain_mu = sbs_to_mm[samples_per_symbol] + + self._mm_omega = self._samples_per_symbol + self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu + self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha + fmin = -0.025 + fmax = 0.025 + + self.receiver=digital.mpsk_receiver_cc( + arity, pi/4.0, + 2*pi/150, + fmin, fmax, + self._mm_mu, self._mm_gain_mu, + self._mm_omega, self._mm_gain_omega, + self._mm_omega_relative_limit + ) + + self.receiver.set_alpha(self._costas_alpha) + self.receiver.set_beta(self._costas_beta) + + # Perform Differential decoding on the constellation + self.diffdec = digital.diff_phasor_cc() + + # take angle of the difference (in radians) + self.to_float = blocks.complex_to_arg() + + # convert from radians such that signal is in -3/-1/+1/+3 + self.rescale = blocks.multiply_const_ff( 1 / (pi / 4) ) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.pre_scaler, self.agc, self.rrc_filter, self.receiver, + self.diffdec, self.to_float, self.rescale, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + @staticmethod + def bits_per_symbol(): + return 2 + + def _print_verbage(self): + print "\nDemodulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRC roll-off factor: %.2f" % self._excess_bw + print "Costas Loop alpha: %.2e" % self._costas_alpha + print "Costas Loop beta: %.2e" % self._costas_beta + print "M&M mu: %.2f" % self._mm_mu + print "M&M mu gain: %.2e" % self._mm_gain_mu + print "M&M omega: %.2f" % self._mm_omega + print "M&M omega gain: %.2e" % self._mm_gain_omega + print "M&M omega limit: %.2f" % self._mm_omega_relative_limit + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.pre_scaler, + gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat")) + self.connect(self.agc, + gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat")) + self.connect(self.receiver, + gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat")) + self.connect(self.diffdec, + gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat")) + self.connect(self.to_float, + gr.file_sink(gr.sizeof_float, "rx_to_float.dat")) + self.connect(self.rescale, + gr.file_sink(gr.sizeof_float, "rx_rescale.dat")) + + @staticmethod + def add_options(parser): + """ + Adds modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + parser.add_option("", "--costas-alpha", type="float", default=_def_costas_alpha, + help="set Costas loop alpha value [default=%default] (PSK)") + parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, + help="set M&M symbol sync loop gain mu value [default=%default] (PSK)") + parser.add_option("", "--mu", type="float", default=_def_mu, + help="set M&M symbol sync loop mu value [default=%default] (PSK)") + + @staticmethod + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options( + cqpsk_demod.__init__, ('self',), options) diff --git a/src/demod/osmosdr-tetra_demod_fft.py b/src/demod/osmosdr-tetra_demod_fft.py new file mode 100755 index 0000000..81fbe9d --- /dev/null +++ b/src/demod/osmosdr-tetra_demod_fft.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python + +# Copyright 2012 Dimitri Stolnikov + +# Usage: +# src$ ./demod/python/osmosdr-tetra_demod_fft.py -o /dev/stdout | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin +# +# Adjust the center frequency (-f) and gain (-g) according to your needs. +# Use left click in Wideband Spectrum window to roughly select a TETRA carrier. +# In Wideband Spectrum you can also tune by 1/4 of the bandwidth by clicking on the rightmost/leftmost spectrum side. +# Use left click in Channel Spectrum windows to fine tune the carrier by clicking on the left or right side of the spectrum. + + +import sys +import math +from gnuradio import gr, gru, eng_notation, blocks, filter +from gnuradio.filter import pfb +from gnuradio.eng_option import eng_option +from gnuradio.wxgui import fftsink2, scopesink2, forms, TRIG_MODE_AUTO +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import osmosdr +import wx + +try: + import cqpsk +except: + from tetra_demod import cqpsk + +# applies frequency translation, resampling and demodulation + +class top_block(grc_wxgui.top_block_gui): + def __init__(self): + grc_wxgui.top_block_gui.__init__(self, title="Top Block") + + options = get_options() + + self.ifreq = options.frequency + self.rfgain = options.gain + + self.src = osmosdr.source(options.args) + self.src.set_center_freq(self.ifreq) + self.src.set_sample_rate(int(options.sample_rate)) + + if self.rfgain is None: + self.src.set_gain_mode(1) + self.iagc = 1 + self.rfgain = 0 + else: + self.iagc = 0 + self.src.set_gain_mode(0) + self.src.set_gain(self.rfgain) + + # may differ from the requested rate + sample_rate = self.src.get_sample_rate() + sys.stderr.write("sample rate: %d\n" % (sample_rate)) + + symbol_rate = 18000 + sps = 2 # output rate will be 36,000 + out_sample_rate = symbol_rate * sps + + options.low_pass = options.low_pass / 2.0 + + if sample_rate == 96000: # FunCube Dongle + first_decim = 2 + else: + first_decim = 10 + + self.offset = 0 + + taps = filter.firdes.low_pass(1.0, sample_rate, options.low_pass, options.low_pass * 0.2, filter.firdes.WIN_HANN) + self.tuner = filter.freq_xlating_fir_filter_ccf(first_decim, taps, self.offset, sample_rate) + + self.demod = cqpsk.cqpsk_demod( + samples_per_symbol = sps, + excess_bw=0.35, + costas_alpha=0.03, + gain_mu=0.05, + mu=0.05, + omega_relative_limit=0.05, + log=options.log, + verbose=options.verbose) + + self.output = blocks.file_sink(gr.sizeof_float, options.output_file) + + rerate = float(sample_rate / float(first_decim)) / float(out_sample_rate) + sys.stderr.write("resampling factor: %f\n" % rerate) + + if rerate.is_integer(): + sys.stderr.write("using pfb decimator\n") + self.resamp = pfb.decimator_ccf(int(rerate)) + else: + sys.stderr.write("using pfb resampler\n") + self.resamp = pfb.arb_resampler_ccf(1 / rerate) + + self.connect(self.src, self.tuner, self.resamp, self.demod, self.output) + + self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.Main.AddPage(grc_wxgui.Panel(self.Main), "Wideband Spectrum") + self.Main.AddPage(grc_wxgui.Panel(self.Main), "Channel Spectrum") + self.Main.AddPage(grc_wxgui.Panel(self.Main), "Soft Bits") + + def set_ifreq(ifreq): + self.ifreq = ifreq + self._ifreq_text_box.set_value(self.ifreq) + self.src.set_center_freq(self.ifreq) + + self._ifreq_text_box = forms.text_box( + parent=self.GetWin(), + value=self.ifreq, + callback=set_ifreq, + label="Center Frequency", + converter=forms.float_converter(), + ) + self.Add(self._ifreq_text_box) + + def set_iagc(iagc): + self.iagc = iagc + self._agc_check_box.set_value(self.iagc) + self.src.set_gain_mode(self.iagc, 0) + self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) + + self._agc_check_box = forms.check_box( + parent=self.GetWin(), + value=self.iagc, + callback=set_iagc, + label="Automatic Gain", + true=1, + false=0, + ) + + self.Add(self._agc_check_box) + + def set_rfgain(rfgain): + self.rfgain = rfgain + self._rfgain_slider.set_value(self.rfgain) + self._rfgain_text_box.set_value(self.rfgain) + self.src.set_gain(0 if self.iagc == 1 else self.rfgain, 0) + + _rfgain_sizer = wx.BoxSizer(wx.VERTICAL) + self._rfgain_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_rfgain_sizer, + value=self.rfgain, + callback=set_rfgain, + label="RF Gain", + converter=forms.float_converter(), + proportion=0, + ) + self._rfgain_slider = forms.slider( + parent=self.GetWin(), + sizer=_rfgain_sizer, + value=self.rfgain, + callback=set_rfgain, + minimum=0, + maximum=50, + num_steps=200, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + + self.Add(_rfgain_sizer) + + self.Add(self.Main) + + def fftsink2_callback(x, y): + if abs(x / (sample_rate / 2)) > 0.9: + set_ifreq(self.ifreq + x / 2) + else: + sys.stderr.write("coarse tuned to: %d Hz\n" % x) + self.offset = x + self.tuner.set_center_freq(self.offset) + + self.scope = fftsink2.fft_sink_c(self.Main.GetPage(0).GetWin(), + title="Wideband Spectrum (click to coarse tune)", + fft_size=1024, + sample_rate=sample_rate, + ref_scale=2.0, + ref_level=0, + y_divs=10, + fft_rate=10, + average=False, + avg_alpha=0.6) + + self.Main.GetPage(0).Add(self.scope.win) + self.scope.set_callback(fftsink2_callback) + + self.connect(self.src, self.scope) + + def fftsink2_callback2(x, y): + self.offset = self.offset - (x / 10) + sys.stderr.write("fine tuned to: %d Hz\n" % self.offset) + self.tuner.set_center_freq(self.offset) + + self.scope2 = fftsink2.fft_sink_c(self.Main.GetPage(1).GetWin(), + title="Channel Spectrum (click to fine tune)", + fft_size=1024, + sample_rate=out_sample_rate, + ref_scale=2.0, + ref_level=-20, + y_divs=10, + fft_rate=10, + average=False, + avg_alpha=0.6) + + self.Main.GetPage(1).Add(self.scope2.win) + self.scope2.set_callback(fftsink2_callback2) + + self.connect(self.resamp, self.scope2) + + self.scope3 = scopesink2.scope_sink_f( + self.Main.GetPage(2).GetWin(), + title="Soft Bits", + sample_rate=out_sample_rate, + v_scale=0, + v_offset=0, + t_scale=0.001, + ac_couple=False, + xy_mode=False, + num_inputs=1, + trig_mode=TRIG_MODE_AUTO, + y_axis_label="Counts", + ) + self.Main.GetPage(2).Add(self.scope3.win) + + self.connect(self.demod, self.scope3) + +def get_options(): + parser = OptionParser(option_class=eng_option) + + parser.add_option("-a", "--args", type="string", default="", + help="gr-osmosdr device arguments") + parser.add_option("-s", "--sample-rate", type="eng_float", default=1800000, + help="set receiver sample rate (default 1800000)") + parser.add_option("-f", "--frequency", type="eng_float", default=394.4e6, + help="set receiver center frequency") + parser.add_option("-g", "--gain", type="eng_float", default=None, + help="set receiver gain") + + # demodulator related settings + parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files") + parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz") + parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file") + parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data") + (options, args) = parser.parse_args() + if len(args) != 0: + parser.print_help() + raise SystemExit, 1 + + return (options) + +if __name__ == '__main__': + tb = top_block() + tb.Run(True) -- To view, visit https://gerrit.osmocom.org/1451 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibaf7f9c552cc1625210a75f2e9ec142ab47ce8d6 Gerrit-PatchSet: 1 Gerrit-Project: osmo-tetra Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:24:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:24:22 +0000 Subject: [MERGED] osmo-tetra[master]: Add patches for codec static linking and logging to stderr In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add patches for codec static linking and logging to stderr ...................................................................... Add patches for codec static linking and logging to stderr Change-Id: I41b32e38c08152e608f20af44db4456ca59169eb --- A etsi_codec-patches/link_static.patch A etsi_codec-patches/log_stderr.patch M etsi_codec-patches/series 3 files changed, 177 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/etsi_codec-patches/link_static.patch b/etsi_codec-patches/link_static.patch new file mode 100644 index 0000000..c553c5e --- /dev/null +++ b/etsi_codec-patches/link_static.patch @@ -0,0 +1,26 @@ +diff -Nruw codec.orig/amr-code/makefile codec/amr-code/makefile +--- codec.orig/amr-code/makefile 2016-12-18 15:57:20.737366601 +0100 ++++ codec/amr-code/makefile 2016-12-18 16:00:02.166031929 +0100 +@@ -21,7 +21,7 @@ + + CC=gcc + +-CFLAGS = -g -I. -Wall -m32 ++CFLAGS = -g -I. -Wall -m32 -static + + SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ + tetra_op.c +diff -Nruw codec.orig/c-code/makefile codec/c-code/makefile +--- codec.orig/c-code/makefile 2016-12-18 15:57:20.737366601 +0100 ++++ codec/c-code/makefile 2016-12-18 15:59:55.146002990 +0100 +@@ -23,7 +23,7 @@ + + CC=gcc + +-CFLAGS = -I. -Wall -m32 ++CFLAGS = -I. -Wall -m32 -static + + SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ + sub_dsp.c fbas_tet.c fexp_tet.c \ +Binary files codec.orig/c-code/scoder and codec/c-code/scoder differ +Binary files codec.orig/c-code/sdecoder and codec/c-code/sdecoder differ diff --git a/etsi_codec-patches/log_stderr.patch b/etsi_codec-patches/log_stderr.patch new file mode 100644 index 0000000..da551ef --- /dev/null +++ b/etsi_codec-patches/log_stderr.patch @@ -0,0 +1,149 @@ +diff -ur codec.orig/c-code/cdecoder.c codec.patched/c-code/cdecoder.c +--- codec.orig/c-code/cdecoder.c 1995-06-06 11:32:14.000000000 +0200 ++++ codec.patched/c-code/cdecoder.c 2014-11-18 22:53:06.000000000 +0100 +@@ -67,23 +67,23 @@ + /* Parse arguments */ + if ( argc != 3 ) + { +- puts( "usage : cdecoder input_file output_file" ); +- puts( "format for input_file : $6B21...114 bits"); +- puts( " ...$6B22...114..." ); +- puts( " ...$6B26...114...$6B21"); +- puts( "format for output_file : two 138 (BFI + 137) bit frames"); ++ fputs("usage : cdecoder input_file output_file",stderr ); ++ fputs("format for input_file : $6B21...114 bits",stderr); ++ fputs(" ...$6B22...114...",stderr ); ++ fputs(" ...$6B26...114...$6B21",stderr); ++ fputs("format for output_file : two 138 (BFI + 137) bit frames",stderr); + exit( 1 ); + } + + if ( (fin = fopen( argv[1], "rb" )) == NULL ) + { +- puts("cdecoder: can't open input_file" ); ++ fputs("cdecoder: can't open input_file" ,stderr); + exit( 1 ); + } + + if ( (fout = fopen( argv[2], "wb" )) == NULL ) + { +- puts("cdecoder: can't open output_file" ); ++ fputs("cdecoder: can't open output_file",stderr ); + exit( 1 ); + } + +@@ -93,7 +93,7 @@ + /* read Input_array (1 TETRA frame = 2 speech frames) from input file */ + if (Read_Tetra_File (fin, Interleaved_coded_array) == -1) + { +- puts ("cdecoder: reached end of input_file"); ++ fputs ("cdecoder: reached end of input_file",stderr); + break; + } + +@@ -116,7 +116,7 @@ + in "Coded_array" */ + + /* Message in case the Frame was stolen */ +- if (bfi1) printf("Frame Nb %ld was stolen\n",Loop_counter+1); ++ if (bfi1) fprintf(stderr,"Frame Nb %ld was stolen\n",Loop_counter+1); + + /* Channel Decoding */ + bfi2 = Channel_Decoding(first_pass,Frame_stealing, +@@ -126,35 +126,35 @@ + /* Increment Loop counter */ + Loop_counter++; + /* Message in case the Bad Frame Indicator was set */ +- if (bfi2) printf("Frame Nb %ld Bfi active\n\n",Loop_counter); ++ if (bfi2) fprintf(stderr,"Frame Nb %ld Bfi active\n\n",Loop_counter); + + /* writing Reordered_array to output file */ + /* bfi bit */ + if( fwrite( &bfi1, sizeof(short), 1, fout ) != 1 ) { +- puts( "cdecoder: can't write to output_file" ); ++ fputs( "cdecoder: can't write to output_file",stderr ); + break; + } + /* 1st speech frame */ + if( fwrite( Reordered_array, sizeof(short), 137, fout ) != 137 ) + { +- puts( "cdecoder: can't write to output_file" ); ++ fputs("cdecoder: can't write to output_file",stderr ); + break; + } + /* bfi bit */ + if( fwrite( &bfi2, sizeof(short), 1, fout ) != 1 ) { +- puts( "cdecoder: can't write to output_file" ); ++ fputs("cdecoder: can't write to output_file",stderr ); + break; + } + /* 2nd speech frame */ + if( fwrite( Reordered_array+137, sizeof(short), 137, fout ) + != 137 ) { +- puts( "cdecoder: can't write to output_file" ); ++ fputs("cdecoder: can't write to output_file",stderr ); + break; + } + } + +- printf("%ld Channel Frames processed\n",Loop_counter); +- printf("ie %ld Speech Frames\n",2*Loop_counter); ++ fprintf(stderr,"%ld Channel Frames processed\n",Loop_counter); ++ fprintf(stderr,"ie %ld Speech Frames\n",2*Loop_counter); + + /* closing files */ + fclose( fin ); +diff -ur codec.orig/c-code/sdecoder.c codec.patched/c-code/sdecoder.c +--- codec.orig/c-code/sdecoder.c 1995-06-06 10:55:28.000000000 +0200 ++++ codec.patched/c-code/sdecoder.c 2014-11-18 22:53:06.000000000 +0100 +@@ -58,15 +58,15 @@ + + if ( argc != 3 ) + { +- printf("Usage : sdecoder serial_file synth_file\n"); +- printf("\n"); +- printf("Format for serial_file:\n"); +- printf(" Serial stream input is read from a binary file\n"); +- printf(" where each 16-bit word represents 1 encoded bit.\n"); +- printf(" BFI + 137 bits by frame\n"); +- printf("\n"); +- printf("Format for synth_file:\n"); +- printf(" Synthesis is written to a binary file of 16 bits data.\n"); ++ fprintf(stderr,"Usage : sdecoder serial_file synth_file\n"); ++ fprintf(stderr,"\n"); ++ fprintf(stderr,"Format for serial_file:\n"); ++ fprintf(stderr," Serial stream input is read from a binary file\n"); ++ fprintf(stderr," where each 16-bit word represents 1 encoded bit.\n"); ++ fprintf(stderr," BFI + 137 bits by frame\n"); ++ fprintf(stderr,"\n"); ++ fprintf(stderr,"Format for synth_file:\n"); ++ fprintf(stderr," Synthesis is written to a binary file of 16 bits data.\n"); + exit( 1 ); + } + +@@ -74,13 +74,13 @@ + + if( (f_serial = fopen(argv[1],"rb") ) == NULL ) + { +- printf("Input file '%s' does not exist !!\n",argv[1]); ++ fprintf(stderr,"Input file '%s' does not exist !!\n",argv[1]); + exit(0); + } + + if( (f_syn = fopen(argv[2], "wb") ) == NULL ) + { +- printf("Cannot open file '%s' !!\n", argv[2]); ++ fprintf(stderr,"Cannot open file '%s' !!\n", argv[2]); + exit(0); + } + +@@ -95,7 +95,7 @@ + + while( fread(serial, sizeof(Word16), serial_size, f_serial) == serial_size) + { +- printf("frame=%d\n", ++frame); ++ fprintf(stderr,"frame=%d\n", ++frame); + + Bits2prm_Tetra(serial, parm); /* serial to parameters */ + + diff --git a/etsi_codec-patches/series b/etsi_codec-patches/series index a050008..a5d92be 100644 --- a/etsi_codec-patches/series +++ b/etsi_codec-patches/series @@ -1,4 +1,6 @@ makefile-cleanups.patch build_as_32bit.patch +link_static.patch round_private.patch filename-case.patch +log_stderr.patch -- To view, visit https://gerrit.osmocom.org/1449 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I41b32e38c08152e608f20af44db4456ca59169eb 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 Sun Dec 18 16:24:23 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sun, 18 Dec 2016 16:24:23 +0000 Subject: [MERGED] osmo-tetra[master]: Fix ETSI reference codec's patch for building on 64 bit arch... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix ETSI reference codec's patch for building on 64 bit architectures. ...................................................................... Fix ETSI reference codec's patch for building on 64 bit architectures. merged/ported to osmocom master by Harald Welte Change-Id: I6b16811d4a3030dfce0718f0b1d266ee1761bfef --- D etsi_codec-patches/build_as_32bit.patch A etsi_codec-patches/fix_64bit.patch D etsi_codec-patches/link_static.patch M etsi_codec-patches/makefile-cleanups.patch M etsi_codec-patches/series 5 files changed, 37 insertions(+), 56 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/etsi_codec-patches/build_as_32bit.patch b/etsi_codec-patches/build_as_32bit.patch deleted file mode 100644 index 3613f0e..0000000 --- a/etsi_codec-patches/build_as_32bit.patch +++ /dev/null @@ -1,26 +0,0 @@ -Index: etsi/amr-code/makefile -=================================================================== ---- etsi.orig/amr-code/makefile 2011-05-29 11:40:11.000000000 +0200 -+++ etsi/amr-code/makefile 2011-05-29 11:40:17.000000000 +0200 -@@ -21,7 +21,7 @@ - - CC=gcc - --CFLAGS = -g -I. -Wall -+CFLAGS = -g -I. -Wall -m32 - - SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ - tetra_op.c -Index: etsi/c-code/makefile -=================================================================== ---- etsi.orig/c-code/makefile 2011-05-29 11:40:02.000000000 +0200 -+++ etsi/c-code/makefile 2011-05-29 11:40:07.000000000 +0200 -@@ -23,7 +23,7 @@ - - CC=gcc - --CFLAGS = -I. -Wall -+CFLAGS = -I. -Wall -m32 - - SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ - sub_dsp.c fbas_tet.c fexp_tet.c \ diff --git a/etsi_codec-patches/fix_64bit.patch b/etsi_codec-patches/fix_64bit.patch new file mode 100644 index 0000000..7c65ac7 --- /dev/null +++ b/etsi_codec-patches/fix_64bit.patch @@ -0,0 +1,34 @@ +diff -Nruw codec.orig/amr-code/source.h codec/amr-code/source.h +--- codec.orig/amr-code/source.h 2016-12-18 16:17:46.238404730 +0100 ++++ codec/amr-code/source.h 2016-12-18 16:18:21.358545740 +0100 +@@ -19,10 +19,11 @@ + + #ifndef TYPEDEF_H + #define TYPEDEF_H ++#include + + +-typedef short Word16; +-typedef long Word32; ++typedef int16_t Word16; ++typedef int32_t Word32; + typedef int Flag; + + #endif +diff -Nruw codec.orig/c-code/source.h codec/c-code/source.h +--- codec.orig/c-code/source.h 2016-12-18 16:17:46.242404746 +0100 ++++ codec/c-code/source.h 2016-12-18 16:18:54.494678813 +0100 +@@ -19,10 +19,11 @@ + + #ifndef TYPEDEF_H + #define TYPEDEF_H ++#include + + +-typedef short Word16; +-typedef long Word32; ++typedef int16_t Word16; ++typedef int32_t Word32; + typedef int Flag; + + #endif diff --git a/etsi_codec-patches/link_static.patch b/etsi_codec-patches/link_static.patch deleted file mode 100644 index c553c5e..0000000 --- a/etsi_codec-patches/link_static.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -Nruw codec.orig/amr-code/makefile codec/amr-code/makefile ---- codec.orig/amr-code/makefile 2016-12-18 15:57:20.737366601 +0100 -+++ codec/amr-code/makefile 2016-12-18 16:00:02.166031929 +0100 -@@ -21,7 +21,7 @@ - - CC=gcc - --CFLAGS = -g -I. -Wall -m32 -+CFLAGS = -g -I. -Wall -m32 -static - - SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ - tetra_op.c -diff -Nruw codec.orig/c-code/makefile codec/c-code/makefile ---- codec.orig/c-code/makefile 2016-12-18 15:57:20.737366601 +0100 -+++ codec/c-code/makefile 2016-12-18 15:59:55.146002990 +0100 -@@ -23,7 +23,7 @@ - - CC=gcc - --CFLAGS = -I. -Wall -m32 -+CFLAGS = -I. -Wall -m32 -static - - SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ - sub_dsp.c fbas_tet.c fexp_tet.c \ -Binary files codec.orig/c-code/scoder and codec/c-code/scoder differ -Binary files codec.orig/c-code/sdecoder and codec/c-code/sdecoder differ diff --git a/etsi_codec-patches/makefile-cleanups.patch b/etsi_codec-patches/makefile-cleanups.patch index 1120dce..ca78b24 100644 --- a/etsi_codec-patches/makefile-cleanups.patch +++ b/etsi_codec-patches/makefile-cleanups.patch @@ -7,7 +7,7 @@ CC=gcc -CFLAGS = -g -I. -+CFLAGS = -g -I. -Wall ++CFLAGS = -g -I. -Wall -O3 SRCS1 = ccoder.c ccod_tet.c init_params.c sub_cc.c \ tetra_op.c @@ -36,7 +36,7 @@ +CC=gcc -CFLAGS = -I. -+CFLAGS = -I. -Wall ++CFLAGS = -I. -Wall -O3 SRCS1 = scoder.c scod_tet.c sub_sc_d.c \ sub_dsp.c fbas_tet.c fexp_tet.c \ diff --git a/etsi_codec-patches/series b/etsi_codec-patches/series index a5d92be..b69c84f 100644 --- a/etsi_codec-patches/series +++ b/etsi_codec-patches/series @@ -1,6 +1,5 @@ makefile-cleanups.patch -build_as_32bit.patch -link_static.patch +fix_64bit.patch round_private.patch filename-case.patch log_stderr.patch -- To view, visit https://gerrit.osmocom.org/1450 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6b16811d4a3030dfce0718f0b1d266ee1761bfef 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 Sun Dec 18 16:58:08 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:58:08 +0000 Subject: [PATCH] openbsc[master]: use new OSMO_VALUE_STRING In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1444 to look at the new patch set (#3). use new OSMO_VALUE_STRING libosmocore change-id I857af45ae602bb9a647ba26cf8b0d1b23403b54c adds OSMO_VALUE_STRING to compose value_string arrays with the exact enum names as entries. Use instead of identical local macros in two places. Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 --- M openbsc/src/libiu/iu.c M openbsc/src/libmsc/auth.c 2 files changed, 11 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/44/1444/3 diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index c15c6c5..8ba6fa4 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -89,12 +90,10 @@ static LLIST_HEAD(rnc_list); const struct value_string iu_event_type_names[] = { -#define IU_EVT_STR(X) { X, #X } - IU_EVT_STR(IU_EVENT_RAB_ASSIGN), - IU_EVT_STR(IU_EVENT_SECURITY_MODE_COMPLETE), - IU_EVT_STR(IU_EVENT_IU_RELEASE), - IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), -#undef IU_EVT_STR + OSMO_VALUE_STRING(IU_EVENT_RAB_ASSIGN), + OSMO_VALUE_STRING(IU_EVENT_SECURITY_MODE_COMPLETE), + OSMO_VALUE_STRING(IU_EVENT_IU_RELEASE), + OSMO_VALUE_STRING(IU_EVENT_LINK_INVALIDATED), { 0, NULL } }; diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..bf62d3c 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -26,19 +26,18 @@ #include #include +#include #include #include const struct value_string auth_action_names[] = { -#define AUTH_ACTION_STR(X) { X, #X } - AUTH_ACTION_STR(AUTH_ERROR), - AUTH_ACTION_STR(AUTH_NOT_AVAIL), - AUTH_ACTION_STR(AUTH_DO_AUTH_THEN_CIPH), - AUTH_ACTION_STR(AUTH_DO_CIPH), - AUTH_ACTION_STR(AUTH_DO_AUTH), -#undef AUTH_ACTION_STR + OSMO_VALUE_STRING(AUTH_ERROR), + OSMO_VALUE_STRING(AUTH_NOT_AVAIL), + OSMO_VALUE_STRING(AUTH_DO_AUTH_THEN_CIPH), + OSMO_VALUE_STRING(AUTH_DO_CIPH), + OSMO_VALUE_STRING(AUTH_DO_AUTH), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sun Dec 18 16:58:39 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:58:39 +0000 Subject: openbsc[master]: gtphub: fix possible NULL deref: don't print NULL tunnel In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1439 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3 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 Sun Dec 18 16:58:41 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:58:41 +0000 Subject: [MERGED] openbsc[master]: gtphub: fix possible NULL deref: don't print NULL tunnel In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: gtphub: fix possible NULL deref: don't print NULL tunnel ...................................................................... gtphub: fix possible NULL deref: don't print NULL tunnel Fixes: coverity CID#158302 Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3 --- M openbsc/src/gprs/gtphub.c 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c index 58300ea..a0af42b 100644 --- a/openbsc/src/gprs/gtphub.c +++ b/openbsc/src/gprs/gtphub.c @@ -1039,6 +1039,9 @@ int left = sizeof(buf); int l; + if (!tun) + return "null-tunnel"; + APPEND("TEI=%x: ", tun->tei_repl); APPEND("%s", gtphub_tunnel_side_str(tun, GTPH_SIDE_SGSN)); APPEND(" <-> %s", gtphub_tunnel_side_str(tun, GTPH_SIDE_GGSN)); -- To view, visit https://gerrit.osmocom.org/1439 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3 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 Sun Dec 18 16:59:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 18 Dec 2016 16:59:24 +0000 Subject: [MERGED] libosmocore[master]: fsm: explicitly log removal from parent fsm In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fsm: explicitly log removal from parent fsm ...................................................................... fsm: explicitly log removal from parent fsm Since removing an FSM from its parent twice causes a segfault, it is very interesting to see when that is attempted. Removing could be made more robust, but logging is interesting for investigating why an FSM is being removed twice in the first place (currently the case in openbsc's vlr_lu_fsm). Change-Id: Idec6b7aa5344f1e903c9d2aa2a3640cab0d70fb0 --- M src/fsm.c 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index d251cfd..6717538 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -442,6 +442,9 @@ } /* delete ourselves from the parent */ + if (parent) + LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", + osmo_fsm_inst_name(parent)); llist_del(&fi->proc.child); /* call destructor / clean-up function */ -- To view, visit https://gerrit.osmocom.org/1435 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idec6b7aa5344f1e903c9d2aa2a3640cab0d70fb0 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 Mon Dec 19 08:57:44 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 08:57:44 +0000 Subject: [MERGED] openbsc[master]: bsc_control.py: remove unused -i option In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: bsc_control.py: remove unused -i option ...................................................................... bsc_control.py: remove unused -i option This option only served to demonstrate possibility of manually selecting field in CTRL protocol. Since the transition to generic ipa module this is no longer exposed so the option became a no-op. Correspondingly there's no need to explicitly initialize the RNG - the Ctrl class handles random generation internally. Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded --- M openbsc/contrib/bsc_control.py 1 file changed, 0 insertions(+), 5 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py index cd2ba6d..66a41eb 100755 --- a/openbsc/contrib/bsc_control.py +++ b/openbsc/contrib/bsc_control.py @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- mode: python-mode; py-indent-tabs-mode: nil -*- -import random from optparse import OptionParser from ipa import Ctrl import socket @@ -44,8 +43,6 @@ return False if __name__ == '__main__': - random.seed() - parser = OptionParser("Usage: %prog [options] var [value]") parser.add_option("-d", "--host", dest="host", help="connect to HOST", metavar="HOST") @@ -55,8 +52,6 @@ dest="cmd_get", help="perform GET operation") parser.add_option("-s", "--set", action="store_true", dest="cmd_set", help="perform SET operation") - parser.add_option("-i", "--id", dest="op_id", default=random.randint(1, sys.maxint), - help="set id manually", metavar="ID") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="be verbose", default=False) parser.add_option("-m", "--monitor", action="store_true", -- To view, visit https://gerrit.osmocom.org/1270 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I10cc7c069354cced2bba84fe67c69c28b8596ded Gerrit-PatchSet: 13 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-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 19 09:07:51 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 09:07:51 +0000 Subject: [PATCH] libosmocore[master]: Catch-up with git version tags 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/1427 to look at the new patch set (#4). Catch-up with git version tags * update debian/changelog * update TODO-RELEASE * add comments to Makefile.am and TODO-RELEASE to simplify the process in future * add link to libtool docs to Makefile.am to simplify LIBVERSION maintenance Related: OS#1861 Change-Id: I22c257e357f597519120232d742d6a61289db021 --- M TODO-RELEASE M debian/changelog R debian/libosmocore8.install R debian/libosmogsm7.install M src/Makefile.am M src/codec/Makefile.am M src/ctrl/Makefile.am M src/gsm/Makefile.am M src/sim/Makefile.am M src/vty/Makefile.am 10 files changed, 48 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/1427/4 diff --git a/TODO-RELEASE b/TODO-RELEASE index 17f6521..fb0bfea 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,7 +1,9 @@ +# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install +# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info +# In short: +# LIBVERSION=c:r:a +# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. +# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0. +# If any interfaces have been added since the last public release: c:r:a + 1. +# If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -libosmogsm internal API update Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths -libosmocore change major external talloc dependency / internal talloc removal -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information -libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker -libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/debian/changelog b/debian/changelog index 0877d27..a5ca3d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +libosmocore (0.9.6) unstable; urgency=medium + + * doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs + * New upstream release of libosmocore. + + -- Max Tue, 13 Dec 2016 18:23:56 +0100 + +libosmocore (0.9.5) unstable; urgency=medium + + * fix: DLGSUP logging category "unusable" + * New upstream release of libosmocore. + * ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information + * size of ph_tch_param struct changed / Extend with RTP Marker + * size of struct log_target changed / Extend with GSMTAP + + -- Max Tue, 13 Dec 2016 18:22:56 +0100 + +libosmocore (0.9.4) unstable; urgency=medium + + * New upstream release of libosmocore. + * Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths + * external talloc dependency / internal talloc removal + * size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information + + -- Max Tue, 13 Dec 2016 18:21:56 +0100 + libosmocore (0.9.3) unstable; urgency=medium * Send all stats values after re-configuration. diff --git a/debian/libosmocore7.install b/debian/libosmocore8.install similarity index 100% rename from debian/libosmocore7.install rename to debian/libosmocore8.install diff --git a/debian/libosmogsm5.install b/debian/libosmogsm7.install similarity index 100% rename from debian/libosmogsm5.install rename to debian/libosmogsm7.install diff --git a/src/Makefile.am b/src/Makefile.am index 6a9c675..0cf2665 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=7:0:0 +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=8:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall $(TALLOC_CFLAGS) diff --git a/src/codec/Makefile.am b/src/codec/Makefile.am index 5c69c28..f61d2fe 100644 --- a/src/codec/Makefile.am +++ b/src/codec/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include $(TALLOC_CFLAGS) diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am index b4a3da4..8bf3442 100644 --- a/src/ctrl/Makefile.am +++ b/src/ctrl/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 4ea55e1..4ec441f 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -1,6 +1,7 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=6:0:1 +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=7:0:1 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am index bcdaf21..4d21f2a 100644 --- a/src/sim/Makefile.am +++ b/src/sim/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include diff --git a/src/vty/Makefile.am b/src/vty/Makefile.am index 620a8cb..52cdc8e 100644 --- a/src/vty/Makefile.am +++ b/src/vty/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=3:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max 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 Dec 19 09:11:12 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 09:11:12 +0000 Subject: openbsc[master]: use new OSMO_VALUE_STRING In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+1 It's better to update commit log with git commit hash instead of change-id before final submission. -- To view, visit https://gerrit.osmocom.org/1444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 Gerrit-PatchSet: 3 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 Mon Dec 19 10:05:39 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Mon, 19 Dec 2016 10:05:39 +0000 Subject: [PATCH] openbsc[master]: Support Deactivate PDP Context Request from network Message-ID: Review at https://gerrit.osmocom.org/1453 Support Deactivate PDP Context Request from network Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Iecf41db2f3b7350befd991e1c9776f10dec8bb1a --- M openbsc/include/openbsc/gprs_sgsn.h M openbsc/src/gprs/gprs_sgsn.c M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sgsn/sgsn_test.ok 4 files changed, 174 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/53/1453/1 diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 24e286c..b3f250d 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -369,6 +369,8 @@ * ottherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); +void drop_gmm_ctx_for_ms(const char *imsi); + char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); /* diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..7d8d5c3 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -667,6 +667,42 @@ } } +/* + * High-level function to be called for PDP deactivation initiated from SGSN VTY. + * When there are PDP contexts present for a MM context, PDP context will be + * deactivated along with GMM Detach(MM context deletion). + * If there are no PDP present, MM context will be deleted to avoid further + * PDP context activation for that MS. + */ +void drop_gmm_ctx_for_ms(const char *imsi) +{ + OSMO_ASSERT(imsi != NULL); + struct sgsn_mm_ctx *mm; + struct sgsn_pdp_ctx *pdp; + + /* Search the MM context subscriber */ + mm = sgsn_mm_ctx_by_imsi(imsi); + LOGMMCTXP(LOGL_INFO, mm, "SGSN intiated Deactivate PDP request\n"); + if (mm) { + /* Search the PDP for this subscriber */ + if (llist_empty(&mm->pdp_list)) { + /* + * Deleting mm context for the subscriber when no PDP + * context is present. + */ + LOGMMCTXP(LOGL_NOTICE, mm, "No PDP context to deactivate\n"); + gsm0408_gprs_access_cancelled(mm, GMM_CAUSE_GPRS_NOTALLOWED); + } else { + llist_for_each_entry(pdp, &mm->pdp_list, list) { + gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_DEACT_REGULAR); + LOGPDPCTXP(LOGL_INFO, pdp, "PDP Deactivation " + "Successful\n"); + } + } + } else + LOGMMCTXP(LOGL_NOTICE, mm, "No MM context to deactivate\n"); +} + /* High-level function to be called in case a GGSN has disappeared or * otherwise lost state (recovery procedure) */ int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn) diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index b4bcaf6..f8bf186 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -38,14 +38,17 @@ #include #include +#include void *tall_bsc_ctx; +struct gsn_t gsn_ctx; static struct sgsn_instance sgsn_inst = { .config_file = "osmo_sgsn.cfg", .cfg = { .gtp_statedir = "./", .auth_policy = SGSN_AUTH_POLICY_CLOSED, }, + .gsn = &gsn_ctx, }; struct sgsn_instance *sgsn = &sgsn_inst; unsigned sgsn_tx_counter = 0; @@ -2363,6 +2366,134 @@ cleanup_test(); } +static void test_pdp_deactivation_with_pdp_ctx(void) +{ + struct apn_ctx *actxs[4]; + struct sgsn_ggsn_ctx *ggc, *ggcs[3]; + struct gsm_subscriber *s1; + const char *imsi1 = "12345678901"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + enum gsm48_gsm_cause gsm_cause; + struct tlv_parsed tp; + uint8_t apn_enc[GSM_APN_LENGTH + 10]; + struct sgsn_subscriber_pdp_data *pdp_data; + char apn_str[GSM_APN_LENGTH]; + + printf("Testing Pdp deactivation for MS with pdp ctx\n"); + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + struct sgsn_pdp_ctx *pdp; + + tp.lv[GSM48_IE_GSM_APN].len = 0; + tp.lv[GSM48_IE_GSM_APN].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].len = 2; + tp.lv[OSMO_IE_GSM_REQ_PDP_ADDR].val = apn_enc; + + tp.lv[OSMO_IE_GSM_REQ_QOS].len = 14; + tp.lv[OSMO_IE_GSM_REQ_QOS].val = apn_enc; + + ggcs[0] = sgsn_ggsn_ctx_find_alloc(0); + + actxs[0] = sgsn_apn_ctx_find_alloc("test.apn", "123456"); + actxs[0]->ggsn = ggcs[0]; + + pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data); + pdp_data->context_id = 1; + pdp_data->pdp_type = 0x0121; + strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1); + + /* Resolve GGSNs */ + tp.lv[GSM48_IE_GSM_APN].len = + gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn"); + + ggc = sgsn_mm_ctx_find_ggsn_ctx(ctx, &tp, &gsm_cause, apn_str); + + OSMO_ASSERT(ggc != NULL); + OSMO_ASSERT(ggc->id == 0); + + ggc = sgsn_ggsn_ctx_alloc(ggc->id); + /* Create a pdp context */ + pdp = sgsn_create_pdp_ctx(ggc, ctx, 5, &tp); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + gsm48_tx_gsm_deact_pdp_acc(pdp); + gsm0408_gprs_access_cancelled(ctx, GMM_CAUSE_GPRS_NOTALLOWED); + + /* Cleanup */ + + subscr_put(s1); + + sgsn_apn_ctx_free(actxs[0]); + sgsn_ggsn_ctx_free(ggcs[0]); + sgsn_ggsn_ctx_free(ggc); + talloc_free(pdp); + + cleanup_test(); +} + +static void test_pdp_deactivation_with_only_mm_ctx(void) +{ + struct gsm_subscriber *s1; + const char *imsi1 = "1234567890"; + struct sgsn_mm_ctx *ctx; + struct gprs_ra_id raid = { 0, }; + uint32_t local_tlli = 0xffeeddcc; + + printf("Testing Pdp deactivation for MS with only MM ctx\n"); + + /* Check for emptiness */ + OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); + + /* Create a context */ + OSMO_ASSERT(count(gprs_llme_list()) == 0); + ctx = alloc_mm_ctx(local_tlli, &raid); + strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1); + + /* Allocate and attach a subscriber */ + s1 = gprs_subscr_get_or_create_by_mmctx(ctx); + assert_subscr(s1, imsi1); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation_without_mm_ctx(void) +{ + const char *imsi1 = "1234567890"; + + printf("Testing Pdp deactivation for MS without MM ctx\n"); + + /* Intiate PDP deactivation for imsi1 */ + drop_gmm_ctx_for_ms(imsi1); + + cleanup_test(); +} + +static void test_pdp_deactivation(void) +{ + printf("Testing pdp deactivation\n"); + + test_pdp_deactivation_with_only_mm_ctx(); + test_pdp_deactivation_with_pdp_ctx(); + test_pdp_deactivation_without_mm_ctx(); +} static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2454,6 +2585,7 @@ test_gmm_routing_areas(); test_apn_matching(); test_ggsn_selection(); + test_pdp_deactivation(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index c7a53b9..6159bc9 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -34,4 +34,8 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection +Testing pdp deactivation +Testing Pdp deactivation for MS with only MM ctx +Testing Pdp deactivation for MS with pdp ctx +Testing Pdp deactivation for MS without MM ctx Done -- To view, visit https://gerrit.osmocom.org/1453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iecf41db2f3b7350befd991e1c9776f10dec8bb1a Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin From gerrit-no-reply at lists.osmocom.org Mon Dec 19 10:21:04 2016 From: gerrit-no-reply at lists.osmocom.org (pravin) Date: Mon, 19 Dec 2016 10:21:04 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 1: This patch is already reviewed in https://gerrit.osmocom.org/#/c/1262. Resubmitting it because of sanitizer issue :ERROR: AddressSanitizer: heap-use-after-free. This patch contains fix for the sanitizer issues. -- To view, visit https://gerrit.osmocom.org/1453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iecf41db2f3b7350befd991e1c9776f10dec8bb1a Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 19 12:16:34 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 19 Dec 2016 12:16:34 +0000 Subject: [PATCH] osmo-hlr[master]: gsup: send subscriber MSISDN Message-ID: Review at https://gerrit.osmocom.org/1454 gsup: send subscriber MSISDN Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 --- M src/hlr.c 1 file changed, 16 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/54/1454/1 diff --git a/src/hlr.c b/src/hlr.c index d7d97b1..cfb05b6 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "db.h" #include "logging.h" @@ -264,6 +265,8 @@ void lu_op_tx_insert_subscr_data(struct lu_operation *luop) { struct osmo_gsup_message gsup; + uint8_t msisdn_enc[43]; /* TODO use constant; TS 24.008 10.5.4.7 */ + int len; OSMO_ASSERT(luop->state == LU_S_LU_RECEIVED || luop->state == LU_S_CANCEL_ACK_RECEIVED); @@ -271,8 +274,20 @@ memset(&gsup, 0, sizeof(gsup)); gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_REQUEST; strncpy(gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)-1); + + len = gsm48_encode_bcd_number(msisdn_enc, sizeof(msisdn_enc), 0, + luop->subscr.msisdn); + if (len < 1) { + LOGP(DMAIN, LOGL_ERROR, + "%s: Error: cannot encode MSISDN '%s'\n", + luop->subscr.imsi, luop->subscr.msisdn); + lu_op_tx_error(luop, GMM_CAUSE_PROTO_ERR_UNSPEC); + return; + } + gsup.msisdn_enc = msisdn_enc; + gsup.msisdn_enc_len = len; + /* FIXME: deal with encoding the following data */ - gsup.msisdn_enc; gsup.hlr_enc; if (luop->is_ps) { -- To view, visit https://gerrit.osmocom.org/1454 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Mon Dec 19 12:23:02 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Mon, 19 Dec 2016 12:23:02 +0000 Subject: openbsc[master]: Support Deactivate PDP Context Request from network In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-2 Verified-1 I'm sorry, I'm still getting: <0002> ../../../src/gprs/gprs_gmm.c:332 <- GPRS MM DETACH REQ (type: re-attach not required, cause: GPRS services not allowed) <0012> ../../../src/gprs/gprs_llc_parse.c:74 LLC SAPI=1 C FCS=0xc4d242CMD=UI DATA_ <0012> ../../../src/gprs/gprs_gb_parse.c:409 Got LLC message, CRC: c4d242 (computed c4d242) Got DL LLC message: DETACH_REQ <0002> ../../../src/gprs/gprs_gmm.c:273 MM(1234567890/00000000) Cleaning MM context due to auth lost <0012> ../../../src/gprs/gprs_llc.c:470 LLC: unknown TLLI 0xffeeddcc, creating LLME on the fly <0002> ../../../src/gprs/gprs_sgsn.c:868 MM(12345678901/00000000) Found GGSN 0 for APN 'Test.Apn' (requested 'Test.Apn') <000f> ../../../src/gprs/sgsn_libgtp.c:148 Create PDP Context ASAN:SIGSEGV ================================================================= ==9224==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000002 (pc 0x7f34ebf823c0 sp 0x7ffd96bb84b8 bp 0x7ffd96bb8d20 T0) #0 0x7f34ebf823bf (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5f3bf) #1 0x7f34ebf5173a (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x2e73a) #2 0x456810 in sgsn_create_pdp_ctx (/n/s/osmo/git/openbsc/openbsc/build-2G/tests/sgsn/sgsn_test+0x456810) #3 0x415eaf in test_pdp_deactivation_with_pdp_ctx ../../../tests/sgsn/sgsn_test.c:2430 #4 0x41626b in test_pdp_deactivation ../../../tests/sgsn/sgsn_test.c:2494 #5 0x416375 in main ../../../tests/sgsn/sgsn_test.c:2588 #6 0x7f34e8bf1b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44) #7 0x404258 (/n/s/osmo/git/openbsc/openbsc/build-2G/tests/sgsn/sgsn_test+0x404258) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ??:0 ?? ==9224==ABORTING --- expout 2016-12-19 13:20:41.577174409 +0100 +++ /n/s/osmo/git/openbsc/openbsc/build-2G/tests/testsuite.dir/at-groups/15/stdout 2016-12-19 13:20:41.589174409 +0100 @@ -34,8 +34,3 @@ - RA Update Request (RA 2 -> RA 2) Testing APN matching Testing GGSN selection -Testing pdp deactivation -Testing Pdp deactivation for MS with only MM ctx -Testing Pdp deactivation for MS with pdp ctx -Testing Pdp deactivation for MS without MM ctx -Done ../../tests/testsuite.at:104: exit code was 1, expected 0 15. testsuite.at:100: 15. sgsn (testsuite.at:100): FAILED (testsuite.at:104) -- To view, visit https://gerrit.osmocom.org/1453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iecf41db2f3b7350befd991e1c9776f10dec8bb1a Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: pravin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: pravin Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Mon Dec 19 16:00:14 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 16:00:14 +0000 Subject: [PATCH] openbsc[master]: Cosmetic fixes around SI generation 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/1372 to look at the new patch set (#4). Cosmetic fixes around SI generation * add missing spaces after comma and minus * prevent useless recursion calls * mark static functions as such * name and explicitly use enum for ARFCN range Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e --- M openbsc/include/openbsc/arfcn_range_encode.h M openbsc/include/openbsc/system_information.h M openbsc/src/libbsc/arfcn_range_encode.c M openbsc/src/libbsc/bsc_init.c M openbsc/src/libbsc/system_information.c 5 files changed, 12 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/72/1372/4 diff --git a/openbsc/include/openbsc/arfcn_range_encode.h b/openbsc/include/openbsc/arfcn_range_encode.h index bd85d6a..7ec710c 100644 --- a/openbsc/include/openbsc/arfcn_range_encode.h +++ b/openbsc/include/openbsc/arfcn_range_encode.h @@ -3,7 +3,7 @@ #include -enum { +enum gsm48_range { ARFCN_RANGE_INVALID = -1, ARFCN_RANGE_128 = 127, ARFCN_RANGE_256 = 255, @@ -14,8 +14,8 @@ #define RANGE_ENC_MAX_ARFCNS 29 int range_enc_determine_range(const int *arfcns, int size, int *f0_out); -int range_enc_arfcns(const int rng, const int *arfcns, int sze, int *out, int idx); -int range_enc_find_index(const int rng, const int *arfcns, int size); +int range_enc_arfcns(enum gsm48_range rng, const int *arfcns, int sze, int *out, int idx); +int range_enc_find_index(enum gsm48_range rng, const int *arfcns, int size); int range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included); int range_enc_range128(uint8_t *chan_list, int f0, int *w); diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h index 7e3ceaa..ebc3afd 100644 --- a/openbsc/include/openbsc/system_information.h +++ b/openbsc/include/openbsc/system_information.h @@ -6,7 +6,6 @@ struct gsm_bts; int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type); -uint16_t encode_fdd(uint16_t scramble, bool diversity); unsigned uarfcn_size(const uint16_t *u, const uint16_t *sc, size_t u_len); unsigned earfcn_size(const struct osmo_earfcn_si2q *e); unsigned range1024_p(unsigned n); diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index e67bf0a..9918838 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -27,7 +27,7 @@ #include -int greatest_power_of_2_lesser_or_equal_to(int index) +static inline int greatest_power_of_2_lesser_or_equal_to(int index) { int power_of_2 = 1; @@ -52,7 +52,7 @@ * equally size partition for the given range. Return -1 if * no such partition exists. */ -int range_enc_find_index(const int range, const int *freqs, const int size) +int range_enc_find_index(enum gsm48_range range, const int *freqs, const int size) { int i, j, n; @@ -79,7 +79,7 @@ * \param size The size of the list of ARFCNs * \param out Place to store the W(i) output. */ -int range_enc_arfcns(const int range, +int range_enc_arfcns(enum gsm48_range range, const int *arfcns, int size, int *out, const int index) { @@ -127,9 +127,11 @@ * Now recurse and we need to make this iterative... but as the * tree is balanced the stack will not be too deep. */ - range_enc_arfcns(range / 2, arfcns_left, l_size, + if (l_size) + range_enc_arfcns(range / 2, arfcns_left, l_size, out, index + greatest_power_of_2_lesser_or_equal_to(index + 1)); - range_enc_arfcns((range -1 ) / 2, arfcns_right, r_size, + if (r_size) + range_enc_arfcns((range - 1) / 2, arfcns_right, r_size, out, index + (2 * greatest_power_of_2_lesser_or_equal_to(index + 1))); return 0; } diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 9e913d6..b17ff79 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -193,7 +193,7 @@ return 0; err_out: - LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>," + LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, " "most likely a problem with neighbor cell list generation\n", get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc)); return rc; diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 6c601e4..3d55d1a 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -149,7 +149,7 @@ } /* 3GPP TS 44.018, Table 9.1.54.1 - prepend diversity bit to scrambling code */ -uint16_t encode_fdd(uint16_t scramble, bool diversity) +static inline uint16_t encode_fdd(uint16_t scramble, bool diversity) { if (diversity) return scramble | (1 << 9); -- To view, visit https://gerrit.osmocom.org/1372 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 19 16:23:46 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 16:23:46 +0000 Subject: [PATCH] libosmocore[master]: Catch-up with git version tags 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/1427 to look at the new patch set (#5). Catch-up with git version tags * update debian/changelog * update TODO-RELEASE * add comments to Makefile.am and TODO-RELEASE to simplify the process in future * add link to libtool docs to Makefile.am to simplify LIBVERSION maintenance Related: OS#1861 Change-Id: I22c257e357f597519120232d742d6a61289db021 --- M TODO-RELEASE M debian/changelog M debian/control R debian/libosmocore8.install R debian/libosmogsm7.install M src/Makefile.am M src/codec/Makefile.am M src/ctrl/Makefile.am M src/gsm/Makefile.am M src/sim/Makefile.am M src/vty/Makefile.am 11 files changed, 51 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/1427/5 diff --git a/TODO-RELEASE b/TODO-RELEASE index 17f6521..fb0bfea 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,7 +1,9 @@ +# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install +# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info +# In short: +# LIBVERSION=c:r:a +# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. +# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0. +# If any interfaces have been added since the last public release: c:r:a + 1. +# If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -libosmogsm internal API update Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths -libosmocore change major external talloc dependency / internal talloc removal -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information -libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker -libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/debian/changelog b/debian/changelog index 0877d27..a5ca3d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +libosmocore (0.9.6) unstable; urgency=medium + + * doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs + * New upstream release of libosmocore. + + -- Max Tue, 13 Dec 2016 18:23:56 +0100 + +libosmocore (0.9.5) unstable; urgency=medium + + * fix: DLGSUP logging category "unusable" + * New upstream release of libosmocore. + * ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information + * size of ph_tch_param struct changed / Extend with RTP Marker + * size of struct log_target changed / Extend with GSMTAP + + -- Max Tue, 13 Dec 2016 18:22:56 +0100 + +libosmocore (0.9.4) unstable; urgency=medium + + * New upstream release of libosmocore. + * Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths + * external talloc dependency / internal talloc removal + * size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information + + -- Max Tue, 13 Dec 2016 18:21:56 +0100 + libosmocore (0.9.3) unstable; urgency=medium * Send all stats values after re-configuration. diff --git a/debian/control b/debian/control index 468bd07..c91ce77 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Package: libosmocore Section: libs Architecture: any -Depends: libosmocodec0, libosmocore7, libosmogb4, libosmogsm5, libosmovty3, libosmoctrl0, ${misc:Depends} +Depends: libosmocodec0, libosmocore8, libosmogb4, libosmogsm7, libosmovty3, libosmoctrl0, ${misc:Depends} Multi-Arch: foreign Description: Open Source MObile COMmunications CORE library @@ -22,7 +22,7 @@ Multi-Arch: same Description: Osmo codec library -Package: libosmocore7 +Package: libosmocore8 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} @@ -36,7 +36,7 @@ Multi-Arch: same Description: Osmo GPRS GB library -Package: libosmogsm5 +Package: libosmogsm7 Section: libs Architecture: any Build-Depends: python (>= 2.7.6) diff --git a/debian/libosmocore7.install b/debian/libosmocore8.install similarity index 100% rename from debian/libosmocore7.install rename to debian/libosmocore8.install diff --git a/debian/libosmogsm5.install b/debian/libosmogsm7.install similarity index 100% rename from debian/libosmogsm5.install rename to debian/libosmogsm7.install diff --git a/src/Makefile.am b/src/Makefile.am index 6a9c675..0cf2665 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=7:0:0 +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=8:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall $(TALLOC_CFLAGS) diff --git a/src/codec/Makefile.am b/src/codec/Makefile.am index 5c69c28..f61d2fe 100644 --- a/src/codec/Makefile.am +++ b/src/codec/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include $(TALLOC_CFLAGS) diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am index b4a3da4..8bf3442 100644 --- a/src/ctrl/Makefile.am +++ b/src/ctrl/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 4ea55e1..4ec441f 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -1,6 +1,7 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=6:0:1 +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=7:0:1 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am index bcdaf21..4d21f2a 100644 --- a/src/sim/Makefile.am +++ b/src/sim/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include diff --git a/src/vty/Makefile.am b/src/vty/Makefile.am index 620a8cb..52cdc8e 100644 --- a/src/vty/Makefile.am +++ b/src/vty/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=3:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max 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 Dec 19 17:08:33 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 17:08:33 +0000 Subject: [PATCH] libosmocore[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1455 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * strip linker option without explicit shell invocation * remove useless comment * add extra cleanup debian/docs: remove empty file debian/coryright: update to match Debian format Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Related: OS#1694 --- M debian/control M debian/copyright D debian/docs M debian/rules 4 files changed, 414 insertions(+), 67 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/1455/1 diff --git a/debian/control b/debian/control index 468bd07..4e88ea4 100644 --- a/debian/control +++ b/debian/control @@ -1,87 +1,260 @@ Source: libosmocore +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev, python-minimal -Standards-Version: 3.9.6 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + doxygen, + libpcsclite-dev, + pkg-config, + libtalloc-dev, + python-minimal +Standards-Version: 3.9.8 Vcs-Git: git://git.osmocom.org/libosmocore.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmocore Package: libosmocore Section: libs Architecture: any -Depends: libosmocodec0, libosmocore7, libosmogb4, libosmogsm5, libosmovty3, libosmoctrl0, ${misc:Depends} Multi-Arch: foreign -Description: Open Source MObile COMmunications CORE library +Depends: libosmocodec0 (= ${binary:Version}), + libosmocore7 (= ${binary:Version}), + libosmogb4 (= ${binary:Version}), + libosmogsm5 (= ${binary:Version}), + libosmovty3 (= ${binary:Version}), + libosmoctrl0 (= ${binary:Version}), + ${misc:Depends} +Description: Open Source MObile COMmunications CORE library (metapackage) + The libraries provided by this package contain various utility functions. + These were originally developed as part of the + OpenBSC project but are of a more generic nature and thus useful to (at + least) other programs that are developed in the sphere of Free Software / Open + Source mobile communication. Package: libosmocodec0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo codec library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocodec library in particular contains the implementation of multiple + GSM codecs: + . + - GSM 06.10 - GSM FR Codec + - GSM 06.20 - GSM HR Codec + - GSM 06.60 - GSM EFR Codec + - GSM 06.90 - GSM AMR Codec Package: libosmocore7 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocore6 library in particular is a collection of common code used in + various sub-projects inside the Osmocom family of projects. + +Package: libosmocore-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmocore6, + libjs-jquery, + libosmocodec-doc, + libosmogsm-doc, + libosmovty-doc +Description: Documentation for the Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmocore library. Package: libosmogb4 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GPRS GB library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogb library in particular contains a GPRS BSSGP protocol + implementation. Package: libosmogsm5 Section: libs Architecture: any Build-Depends: python (>= 2.7.6) -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogsm library in particular is a collection of common code used in + various GSM related sub-projects inside the Osmocom family of projects. It + includes A5/1 and A5/2 ciphers, COMP128v1, a LAPDm implementation, a GSM TLV + parser, SMS utility routines as well as protocol definitions for a series of + protocols. + +Package: libosmogsm-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmogsm5, + libjs-jquery +Description: Documentation for the Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmogsm library. Package: libosmovty3 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmovty library in particular implements the interactive command-line + on the VTY (Virtual TTY) as well as configuration file parsing. + +Package: libosmovty-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmovty3, + libjs-jquery +Description: Documentation for the Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmovty library. Package: libosmoctrl0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo control library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmoctrl library in particular contains an SNMP-like status interface. Package: libosmosim0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo SIM library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmosim library in particular contains routines for SIM card access. Package: libosmocore-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmocore, libtalloc-dev Multi-Arch: same +Section: libdevel +Depends: libosmocore, + libtalloc-dev, + ${misc:Depends} Description: Development headers for Open Source MObile COMmunications CORE library + The header files provided by this package may be used to develop + with any of the libosmocore libraries. + . + Also static libraries are installed with this package. Package: libosmocore-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore +Section: utils +Depends: ${shlibs:Depends}, + libosmocore, + ${misc:Depends} Multi-Arch: same Description: Utilities for gsm + This package contains a program for frequency calculation for GSM called + 'osmo-arfcn' and a program called 'osmo-auc-gen' that is used for testing GSM + authentication. + . + They use the libosmocore library. The libosmocore library contain various + utility functions that were originally developed as part of the OpenBSC + project, but which are of a more generic nature and thus useful to (at least) + other programs that are developed in the sphere of Free Software / Open Source + mobile communication. Package: libosmocore-dbg Architecture: any +Multi-Arch: same Section: debug Priority: extra -Depends: libosmocore (= ${binary:Version}), ${misc:Depends} -Multi-Arch: same +Depends: libosmocore (= ${binary:Version}), + ${misc:Depends} Description: Debug symbols for Open Source MObile COMmunications CORE library + This proackage contains debug symbols for all the libraries that are part of + libosmocore. + . + The libosmocore library contain various utility functions that + were originally developed as part of the OpenBSC project, but which are of a + more generic nature and thus useful to (at least) other programs that are + developed in the sphere of Free Software / Open Source mobile communication. diff --git a/debian/copyright b/debian/copyright index c450be5..2991c85 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,54 +1,211 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmocore.git - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2008 Daniel Willmann + 2008-2010 Harald Welte + 2008-2010 Holger Hans Peter Freyther + 2009-2010 Sylvain Munaut + 2009-2010 On-Waves + 2010 Nico Golde +License: GPL-2+ -It was downloaded from: +Files: src/talloc.c include/osmocom/core/talloc.h +Copyright: 2004 Andrew Tridgell + 2006 Stefan Metzmacher +License: LGPL-3+ - git://git.osmocom.org/libosmocore.git +Files: include/osmocom/core/loggingrb.h + include/osmocom/core/strrb.h + src/strrb.c + src/loggingrb.c +Copyright: 2012-2013 Katerina Barone-Adesi +License: GPL-2+ -Upstream Author(s): +Files: include/osmocom/core/linuxrbtree.h + src/rbtree.c +Copyright: 1999 Andrea Arcangeli + 2002 David Woodhouse +License: GPL-2+ - Harald Welte - Holger Hans Peter Freyther - Sylvain Munaut - Daniel Willmann - Golde - For src/talloc.c and include/osmocore/talloc.h: - Andrew Tridgell - Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Kunihiro Ishiguro +Files: include/osmocom/core/crc16.h +Copyright: 2005 Ben Gardner +License: GPL-2+ -Copyright: +Files: src/utils.c +Copyright: 2011 Harald Welte + 2011 Sylvain Munaut + 2014 Nils O. Sel?sdal +License: GPL-2+ - Copyright (C) 2008-2010 Harald Welte - Copyright (C) 2008-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 Sylvain Munaut - Copyright (C) 2009-2010 On-Waves - Copyright (C) 2008 Daniel Willmann - Copyright (C) 2010 Nico Golde - For src/talloc.c and include/osmocore/talloc.h: - Copyright (C) 2004 Andrew Tridgell - Copyright (C) 2006 Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Copyright (C) 1998 Kunihiro Ishiguro +Files: src/gsm/gsm48_ie.c + src/gsm/lapd_core.c + src/gsm/lapdm.c +Copyright: 2008,2010-2011 Harald Welte + 2009-2011 Andreas Eversberg +License: GPL-2+ -License: +Files: src/gsm/gsm0411_smc.c + src/gsm/gsm0411_smr.c + src/gsm/gsm0411_utils.c +Copyright: 2008 Daniel Willmann + 2009 Harald Welte + 2010-2013 Holger Hans Peter Freyther + 2010 On-Waves + 2011 Andreas Eversberg +License: GPL-2+ - GNU General Public License, Version 2 or later +Files: src/gsm/gsm0480.c +Copyright: 2009 Mike Haben + 2010 Holger Hans Peter Freyther +License: GPL-2+ -The Debian packaging is: +Files: src/gsm/milenage/aes-internal.c + src/gsm/milenage/aes-encblock.c + src/gsm/milenage/aes.h + src/gsm/milenage/milenage.c + src/gsm/milenage/aes_wrap.h + src/gsm/milenage/aes-internal-enc.c + src/gsm/milenage/aes_i.h +Copyright: 2003-2007 Jouni Malinen +License: GPL-2 +Comment: Most of the file aes-internal.c is public_domain - Copyright (C) 2010 Harald Welte +Files: include/osmocom/core/bitXXgen.h.tpl + src/gsm/kasumi.c +Copyright: 2013-2014 Max +License: GPL-2+ -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. +Files: src/gsm/auth_comp128v23.c +Copyright: 2010-2011 Harald Welte + 2013 K?vin Redon +License: GPL-2+ -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +Files: src/gsm/comp128v23.c +Copyright: 2013 K?vin Redon +License: GPL-2+ -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +Files: tests/fr/fr_test.c + tests/logging/logging_test.c + tests/loggingrb/loggingrb_test.c +Copyright: 2008,2009,2012 Holger Hans Peter Freyther + 2012-2013 Katerina Barone-Adesi +License: AGPL-3+ + +Files: tests/strrb/strrb_test.c + tests/vty/vty_test.c +Copyright: 2012-2013 Katerina Barone-Adesi + 2013 Jacob Erlbeck +License: GPL-3+ + +Files: src/vty/* include/osmocom/vty/* +Copyright: 1997,1998 Kunihiro Ishiguro +License: GPL-2+ + +Files: include/osmocom/core/stats.h + src/stat_item.c + src/stats.c + src/vty/stats_vty.c + tests/stats/stats_test.c +Copyright: 2009-2010 by Harald Welte + 2009-2014 by Holger Hans Peter Freyther + 2015 Sysmocom s.f.m.c. GmbH +License: GPL-2+ + +Files: tests/gb/gprs_ns_test.c + tests/gb/gprs_bssgp_test.c +Copyright: 2013-2014 sysmocom s.f.m.c. GmbH +License: GPL-2+ +Comment: No license is listed in these files, but it is assumed that + the project specific license GPL-2+ applies since contributions by + sysmocom people to other files in this package are GPL licensed. + +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2014-2015 Ruben Undheim +License: GPL-3+ + + +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-2 + This package 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, version 2 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-3+ + 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 3 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 3 can be found in "/usr/share/common-licenses/LGPL-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 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/docs b/debian/docs deleted file mode 100644 index e69de29..0000000 --- a/debian/docs +++ /dev/null diff --git a/debian/rules b/debian/rules index 3cce05e..e173510 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -13,10 +7,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -# Our tests want to override symbols, make it possible on Ubuntu -export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS | sed -e 's/-Wl,-Bsymbolic-functions//') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all -export DEB_BUILD_HARDENING=1 +export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions %: dh $@ --with autoreconf --fail-missing @@ -38,3 +31,27 @@ override_dh_auto_configure: dh_auto_configure -- --enable-static + +override_dh_clean: + dh_clean + $(RM) .version + $(RM) debian/man/osmo-arfcn.1 + $(RM) debian/man/osmo-auc-gen.1 + $(RM) include/osmocom/core/bit16gen.h + $(RM) include/osmocom/core/bit32gen.h + $(RM) include/osmocom/core/bit64gen.h + $(RM) include/osmocom/core/crc16gen.h + $(RM) include/osmocom/core/crc32gen.h + $(RM) include/osmocom/core/crc64gen.h + $(RM) include/osmocom/core/crc8gen.h + $(RM) src/crc16gen.c + $(RM) src/crc32gen.c + $(RM) src/crc64gen.c + $(RM) src/crc8gen.c + $(RM) tests/package.m4 + $(RM) tests/testsuite + $(RM) -r doc/codec/ + $(RM) -r doc/core/ + $(RM) -r doc/gsm/ + $(RM) -r doc/vty/html/ + $(RM) -r doc/vty/latex/ -- To view, visit https://gerrit.osmocom.org/1455 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Mon Dec 19 17:23:04 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 17:23:04 +0000 Subject: [PATCH] libosmocore[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1455 to look at the new patch set (#2). Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * move build-depends to a proper place * update project URL debian/rules: * use proper hardening syntax * strip linker option without explicit shell invocation * remove useless comment * add extra cleanup debian/docs: remove empty file debian/coryright: update to match Debian format Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Related: OS#1694 --- M debian/control M debian/copyright D debian/docs M debian/rules 4 files changed, 414 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/1455/2 diff --git a/debian/control b/debian/control index 468bd07..82e6319 100644 --- a/debian/control +++ b/debian/control @@ -1,87 +1,259 @@ Source: libosmocore +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev, python-minimal -Standards-Version: 3.9.6 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + doxygen, + libpcsclite-dev, + pkg-config, + libtalloc-dev, + python (>= 2.7.6) +Standards-Version: 3.9.8 Vcs-Git: git://git.osmocom.org/libosmocore.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmocore Package: libosmocore Section: libs Architecture: any -Depends: libosmocodec0, libosmocore7, libosmogb4, libosmogsm5, libosmovty3, libosmoctrl0, ${misc:Depends} Multi-Arch: foreign -Description: Open Source MObile COMmunications CORE library +Depends: libosmocodec0 (= ${binary:Version}), + libosmocore7 (= ${binary:Version}), + libosmogb4 (= ${binary:Version}), + libosmogsm5 (= ${binary:Version}), + libosmovty3 (= ${binary:Version}), + libosmoctrl0 (= ${binary:Version}), + ${misc:Depends} +Description: Open Source MObile COMmunications CORE library (metapackage) + The libraries provided by this package contain various utility functions. + These were originally developed as part of the + OpenBSC project but are of a more generic nature and thus useful to (at + least) other programs that are developed in the sphere of Free Software / Open + Source mobile communication. Package: libosmocodec0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo codec library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocodec library in particular contains the implementation of multiple + GSM codecs: + . + - GSM 06.10 - GSM FR Codec + - GSM 06.20 - GSM HR Codec + - GSM 06.60 - GSM EFR Codec + - GSM 06.90 - GSM AMR Codec Package: libosmocore7 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocore6 library in particular is a collection of common code used in + various sub-projects inside the Osmocom family of projects. + +Package: libosmocore-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmocore6, + libjs-jquery, + libosmocodec-doc, + libosmogsm-doc, + libosmovty-doc +Description: Documentation for the Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmocore library. Package: libosmogb4 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GPRS GB library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogb library in particular contains a GPRS BSSGP protocol + implementation. Package: libosmogsm5 Section: libs Architecture: any -Build-Depends: python (>= 2.7.6) -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogsm library in particular is a collection of common code used in + various GSM related sub-projects inside the Osmocom family of projects. It + includes A5/1 and A5/2 ciphers, COMP128v1, a LAPDm implementation, a GSM TLV + parser, SMS utility routines as well as protocol definitions for a series of + protocols. + +Package: libosmogsm-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmogsm5, + libjs-jquery +Description: Documentation for the Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmogsm library. Package: libosmovty3 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmovty library in particular implements the interactive command-line + on the VTY (Virtual TTY) as well as configuration file parsing. + +Package: libosmovty-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmovty3, + libjs-jquery +Description: Documentation for the Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmovty library. Package: libosmoctrl0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo control library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmoctrl library in particular contains an SNMP-like status interface. Package: libosmosim0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo SIM library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmosim library in particular contains routines for SIM card access. Package: libosmocore-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmocore, libtalloc-dev Multi-Arch: same +Section: libdevel +Depends: libosmocore, + libtalloc-dev, + ${misc:Depends} Description: Development headers for Open Source MObile COMmunications CORE library + The header files provided by this package may be used to develop + with any of the libosmocore libraries. + . + Also static libraries are installed with this package. Package: libosmocore-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore +Section: utils +Depends: ${shlibs:Depends}, + libosmocore, + ${misc:Depends} Multi-Arch: same Description: Utilities for gsm + This package contains a program for frequency calculation for GSM called + 'osmo-arfcn' and a program called 'osmo-auc-gen' that is used for testing GSM + authentication. + . + They use the libosmocore library. The libosmocore library contain various + utility functions that were originally developed as part of the OpenBSC + project, but which are of a more generic nature and thus useful to (at least) + other programs that are developed in the sphere of Free Software / Open Source + mobile communication. Package: libosmocore-dbg Architecture: any +Multi-Arch: same Section: debug Priority: extra -Depends: libosmocore (= ${binary:Version}), ${misc:Depends} -Multi-Arch: same +Depends: libosmocore (= ${binary:Version}), + ${misc:Depends} Description: Debug symbols for Open Source MObile COMmunications CORE library + This proackage contains debug symbols for all the libraries that are part of + libosmocore. + . + The libosmocore library contain various utility functions that + were originally developed as part of the OpenBSC project, but which are of a + more generic nature and thus useful to (at least) other programs that are + developed in the sphere of Free Software / Open Source mobile communication. diff --git a/debian/copyright b/debian/copyright index c450be5..2991c85 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,54 +1,211 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmocore.git - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2008 Daniel Willmann + 2008-2010 Harald Welte + 2008-2010 Holger Hans Peter Freyther + 2009-2010 Sylvain Munaut + 2009-2010 On-Waves + 2010 Nico Golde +License: GPL-2+ -It was downloaded from: +Files: src/talloc.c include/osmocom/core/talloc.h +Copyright: 2004 Andrew Tridgell + 2006 Stefan Metzmacher +License: LGPL-3+ - git://git.osmocom.org/libosmocore.git +Files: include/osmocom/core/loggingrb.h + include/osmocom/core/strrb.h + src/strrb.c + src/loggingrb.c +Copyright: 2012-2013 Katerina Barone-Adesi +License: GPL-2+ -Upstream Author(s): +Files: include/osmocom/core/linuxrbtree.h + src/rbtree.c +Copyright: 1999 Andrea Arcangeli + 2002 David Woodhouse +License: GPL-2+ - Harald Welte - Holger Hans Peter Freyther - Sylvain Munaut - Daniel Willmann - Golde - For src/talloc.c and include/osmocore/talloc.h: - Andrew Tridgell - Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Kunihiro Ishiguro +Files: include/osmocom/core/crc16.h +Copyright: 2005 Ben Gardner +License: GPL-2+ -Copyright: +Files: src/utils.c +Copyright: 2011 Harald Welte + 2011 Sylvain Munaut + 2014 Nils O. Sel?sdal +License: GPL-2+ - Copyright (C) 2008-2010 Harald Welte - Copyright (C) 2008-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 Sylvain Munaut - Copyright (C) 2009-2010 On-Waves - Copyright (C) 2008 Daniel Willmann - Copyright (C) 2010 Nico Golde - For src/talloc.c and include/osmocore/talloc.h: - Copyright (C) 2004 Andrew Tridgell - Copyright (C) 2006 Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Copyright (C) 1998 Kunihiro Ishiguro +Files: src/gsm/gsm48_ie.c + src/gsm/lapd_core.c + src/gsm/lapdm.c +Copyright: 2008,2010-2011 Harald Welte + 2009-2011 Andreas Eversberg +License: GPL-2+ -License: +Files: src/gsm/gsm0411_smc.c + src/gsm/gsm0411_smr.c + src/gsm/gsm0411_utils.c +Copyright: 2008 Daniel Willmann + 2009 Harald Welte + 2010-2013 Holger Hans Peter Freyther + 2010 On-Waves + 2011 Andreas Eversberg +License: GPL-2+ - GNU General Public License, Version 2 or later +Files: src/gsm/gsm0480.c +Copyright: 2009 Mike Haben + 2010 Holger Hans Peter Freyther +License: GPL-2+ -The Debian packaging is: +Files: src/gsm/milenage/aes-internal.c + src/gsm/milenage/aes-encblock.c + src/gsm/milenage/aes.h + src/gsm/milenage/milenage.c + src/gsm/milenage/aes_wrap.h + src/gsm/milenage/aes-internal-enc.c + src/gsm/milenage/aes_i.h +Copyright: 2003-2007 Jouni Malinen +License: GPL-2 +Comment: Most of the file aes-internal.c is public_domain - Copyright (C) 2010 Harald Welte +Files: include/osmocom/core/bitXXgen.h.tpl + src/gsm/kasumi.c +Copyright: 2013-2014 Max +License: GPL-2+ -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. +Files: src/gsm/auth_comp128v23.c +Copyright: 2010-2011 Harald Welte + 2013 K?vin Redon +License: GPL-2+ -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +Files: src/gsm/comp128v23.c +Copyright: 2013 K?vin Redon +License: GPL-2+ -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +Files: tests/fr/fr_test.c + tests/logging/logging_test.c + tests/loggingrb/loggingrb_test.c +Copyright: 2008,2009,2012 Holger Hans Peter Freyther + 2012-2013 Katerina Barone-Adesi +License: AGPL-3+ + +Files: tests/strrb/strrb_test.c + tests/vty/vty_test.c +Copyright: 2012-2013 Katerina Barone-Adesi + 2013 Jacob Erlbeck +License: GPL-3+ + +Files: src/vty/* include/osmocom/vty/* +Copyright: 1997,1998 Kunihiro Ishiguro +License: GPL-2+ + +Files: include/osmocom/core/stats.h + src/stat_item.c + src/stats.c + src/vty/stats_vty.c + tests/stats/stats_test.c +Copyright: 2009-2010 by Harald Welte + 2009-2014 by Holger Hans Peter Freyther + 2015 Sysmocom s.f.m.c. GmbH +License: GPL-2+ + +Files: tests/gb/gprs_ns_test.c + tests/gb/gprs_bssgp_test.c +Copyright: 2013-2014 sysmocom s.f.m.c. GmbH +License: GPL-2+ +Comment: No license is listed in these files, but it is assumed that + the project specific license GPL-2+ applies since contributions by + sysmocom people to other files in this package are GPL licensed. + +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2014-2015 Ruben Undheim +License: GPL-3+ + + +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-2 + This package 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, version 2 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-3+ + 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 3 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 3 can be found in "/usr/share/common-licenses/LGPL-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 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/docs b/debian/docs deleted file mode 100644 index e69de29..0000000 --- a/debian/docs +++ /dev/null diff --git a/debian/rules b/debian/rules index 3cce05e..e173510 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -13,10 +7,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -# Our tests want to override symbols, make it possible on Ubuntu -export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS | sed -e 's/-Wl,-Bsymbolic-functions//') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all -export DEB_BUILD_HARDENING=1 +export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions %: dh $@ --with autoreconf --fail-missing @@ -38,3 +31,27 @@ override_dh_auto_configure: dh_auto_configure -- --enable-static + +override_dh_clean: + dh_clean + $(RM) .version + $(RM) debian/man/osmo-arfcn.1 + $(RM) debian/man/osmo-auc-gen.1 + $(RM) include/osmocom/core/bit16gen.h + $(RM) include/osmocom/core/bit32gen.h + $(RM) include/osmocom/core/bit64gen.h + $(RM) include/osmocom/core/crc16gen.h + $(RM) include/osmocom/core/crc32gen.h + $(RM) include/osmocom/core/crc64gen.h + $(RM) include/osmocom/core/crc8gen.h + $(RM) src/crc16gen.c + $(RM) src/crc32gen.c + $(RM) src/crc64gen.c + $(RM) src/crc8gen.c + $(RM) tests/package.m4 + $(RM) tests/testsuite + $(RM) -r doc/codec/ + $(RM) -r doc/core/ + $(RM) -r doc/gsm/ + $(RM) -r doc/vty/html/ + $(RM) -r doc/vty/latex/ -- To view, visit https://gerrit.osmocom.org/1455 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Mon Dec 19 17:46:04 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Mon, 19 Dec 2016 17:46:04 +0000 Subject: [PATCH] openbsc[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1456 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment debian/compat: update compatibility version debian/coryright: update to match Debian format Change-Id: I49cc9239b15dc77d782914ca2547e601d049acdc Related: OS#1694 --- M debian/compat M debian/control M debian/copyright M debian/rules 4 files changed, 194 insertions(+), 66 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/56/1456/1 diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index c37a5ca..79f18df 100644 --- a/debian/control +++ b/debian/control @@ -1,54 +1,102 @@ Source: openbsc +Maintainer: Harald Welte Section: net Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libssl-dev, libc-ares-dev, libsmpp34-dev -Standards-Version: 3.8.4 -Homepage: http://openbsc.osmocom.org/ +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libgtp0-dev, + libosmocore-dev, + libosmo-sccp-dev, + libdbi0-dev, + dh-autoreconf, + libosmo-abis-dev, + libosmo-netif-dev, + libdbd-sqlite3, + libpcap-dev, + libssl-dev, + libc-ares-dev, + libsmpp34-dev +Standards-Version: 3.9.8 Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git Vcs-Browser: http://openbsc.osmocom.org/trac/browser +Homepage: https://projects.osmocom.org/projects/openbsc Package: osmocom-bsc Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: GSM Base Station Controller; BSC-only version of OpenBSC. Needs a real MSC! - Classical BSC which requires MSC to operate. +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: GSM Base Station Controller + This is the BSC-only version of OpenBSC. It requires a Mobile Switching Center + (MSC) to operate. + . + You might rather prefer to use osmocom-nitb which is considered a + "GSM Network-in-a-Box" and does not depend on a MSC. Package: osmocom-nitb Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3 +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libdbd-sqlite3 Description: GSM Network-in-a-Box, implements BSC, MSC, SMSC, HLR, VLR - All the GSM network components bundled together. + This is the Network-in-a-Box version of OpenBSC. It has all the GSM network + components bundled together. When using osmocom-nitb, there is no need for a + Mobile Switching Center (MSC) which is needed when using osmocom-bsc. Package: osmocom-ipaccess-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: Command line utilities for ip.access nanoBTS - Utilities specific for ip.access unit. + This package contains utilities that are specific for nanoBTS when being used + together with OpenBSC. It contains mainly three tools: ipaccess-find, + ipaccess-config and ipaccess-proxy. Package: osmocom-bs11-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: Command line utilities for Siemens BS-11 BTS - Utilities specific for BS-11 unit. + There is a tool in this package for configuring the Siemens BS-11 BTS. + Additionally, it contains one tool for making use of an ISDN-card and the + public telephone network as frequency standard for the E1 line. Package: osmocom-sgsn Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} +Suggests: osmocom-bsc Description: Osmocom Serving GPRS Support Node - SGSN implementation. + This is an implementation of the GPRS Serving GPRS Support Node (SGSN). As + such it implements the GPRS Mobility Management (GMM) and SM (Session + Management). + . + The SGSN connects via the Gb-interface to the BSS (like the osmo-pcu or an + ip.access nanoBTS), and it connects via the GTP protocol to a Gateway GPRS + Support Node (GGSN) like openggsn. Package: osmocom-gbproxy Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} +Recommends: osmocom-sgsn Description: Osmocom GPRS Gb Interface Proxy - Proxy for Gb interface. + The purpose of the Gb proxy is to aggregate the Gb links of multiple + BSS's and present them in one Gb link to the SGSN. + . + This package is part of OpenBSC and closely related to osmocom-sgsn. Package: osmocom-bsc-nat Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} +Recommends: osmocom-bsc Description: Osmocom Base Station Controller Network Address Translation - Network address translation for BSC. + This NAT is useful for masquerading multiple BSCs behind one. It listens + for incoming BSCs on port 5000 and connects to a specified Mobile Switching + Center (MSC). + . + This package is part of OpenBSC and closely related to osmocom-bsc. Package: osmo-gtphub Architecture: any diff --git a/debian/copyright b/debian/copyright index fbac90c..1e4dee1 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,47 +1,137 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: OpenBSC +Source: http://openbsc.osmocom.org/ - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2008-2015 Harald Welte + 2008-2015 Holger Hans Peter Freyther + 2009-2015 On-Waves + 2008 Jan Luebbe + 2008,2010-2011 Daniel Willmann + 2009,2011,2013 Andreas Eversberg + 2009,2011 Dieter Spaar + 2009 Mike Haben + 2010 Sylvain Munaut <246tnt at gmail.com> + 2012-2013 Pablo Neira Ayuso + 2013-2015 Sysmocom s.f.m.c. GmbH (Jacob Erlbeck) + 2014 Alexander Chemeris +License: AGPL-3+ +Comment: Contributions by Stefan Schmidt as well -It was downloaded from: +Files: wireshark/0001-abis_oml.patch + wireshark/0002-ericsson_rbs2409.patch + wireshark/0003-lucent-hnb.patch + wireshark/0005-rsl-hsl.patch +Copyright: 1998 Gerald Combs + 2007,2011 Anders Broman + 2009 Holger Hans Peter Freyther + 2009-2011 Harald Welte +License: GPL-2+ - git://bs11-abis.gnumonks.org/openbsc.git +Files: openbsc/include/mISDNif.h +Copyright: 2008 Karsten Keil +License: LGPL-2.1 -Upstream Authors: +Files: openbsc/src/libmgcp/g711common.h +Copyright: 2009 Abramo Bagnara +License: GPL-2+ - Harald Welte - Dieter Spaar - Holger Hans Peter Freyther - Sylvain Munaut - Daniel Willmann - Jan Luebbe - Mike Haben - Andreas Eversberg +Files: openbsc/git-version-gen +Copyright: 2007-2010 Free Software Foundation +License: GPL-3+ -Copyright: +Files: openbsc/osmoappdesc.py + openbsc/tests/smpp_test_runner.py + openbsc/tests/ctrl_test_runner.py + openbsc/tests/vty_test_runner.py +Copyright: 2013 Katerina Barone-Adesi + 2013 Jacob Erlbeck + 2013-2014 Holger Hans Peter Freyther +License: GPL-3+ - Copyright (C) 2008-2010 Harald Welte - Copyright (C) 2008-2009 Dieter Spaar - Copyright (C) 2008-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 Sylvain Munaut - Copyright (C) 2009-2010 On-Waves - Copyright (C) 2008 Daniel Willmann - Copyright (C) 2008 Jan Luebbe - Copyright (C) 2009 by Mike Haben - Copyright (C) 2009 Andreas Eversberg +Files: openbsc/src/libbsc/bsc_ctrl_lookup.c +Copyright: 2010-2011 Daniel Willmann + 2010-2011 On-Waves +License: GPL-2+ -License: +Files: openbsc/src/libmsc/mncc_sock.c + openbsc/src/libmsc/mncc_builtin.c +Copyright: 2008-2010 Harald Welte + 2009 Andreas Eversberg + 2012 Holger Hans Peter Freyther +License: GPL-2+ - GNU General Public License, Version 2 or later +Files: debian/* +Copyright: 2012-2015 Holger Hans Peter Freyther + 2016 Ruben Undheim +License: GPL-2+ -The Debian packaging is: - Copyright (C) 2010 Harald Welte +License: AGPL-3+ + This package 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 . -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +License: GPL-3+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-2.1 + 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; version + 2.1 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in + "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index ee632a2..4e187a6 100755 --- a/debian/rules +++ b/debian/rules @@ -1,14 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. -# -# Modified to make a template file for a multi-binary package with separated -# build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -17,10 +7,10 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -export DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: - dh --sourcedirectory=openbsc --with autoreconf $@ + dh $@ --sourcedirectory=openbsc --with autoreconf # This is needed for debian stable (squeeze) override_dh_autoreconf: -- To view, visit https://gerrit.osmocom.org/1456 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I49cc9239b15dc77d782914ca2547e601d049acdc Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 20 11:07:21 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 11:07:21 +0000 Subject: [PATCH] libosmocore[master]: fsm: term: safer iteration to remove all child FSMs Message-ID: Review at https://gerrit.osmocom.org/1457 fsm: term: safer iteration to remove all child FSMs When terminating child FSMs, restart iteration after every child, to make sure that we don't terminate a child twice. Terminating one child may emit events that in turn terminates other children. I created this patch because at first it looked like the cause of a bug, which turned out not to be the case. So I have no actual use case of this situation, but it does generally make sense to me, so submitting this. Change-Id: I00990b47e42eeb43707a9a42abcd9df52fe5f483 --- M src/fsm.c 1 file changed, 20 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/1457/1 diff --git a/src/fsm.c b/src/fsm.c index 6717538..16699fa 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -427,17 +427,33 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line) { - struct osmo_fsm_inst *child, *child2; + struct osmo_fsm_inst *first_child, *last_seen_first_child; struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", osmo_fsm_term_cause_name(cause)); - /* iterate over all children */ - llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { + /* iterate over all children, starting from the beginning every time: + * terminating an FSM may emit events that cause other FSMs to also + * terminate and remove themselves from this list. */ + last_seen_first_child = NULL; + while (!llist_empty(&fi->proc.children)) { + first_child = llist_entry(fi->proc.children.next, + typeof(*first_child), + proc.child); + + /* paranoia: do not loop forever */ + if (first_child == last_seen_first_child) { + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "Internal error while terminating child" + " FSMs: a child FSM is stuck\n"); + break; + } + last_seen_first_child = first_child; + /* terminate child */ - _osmo_fsm_inst_term(child, OSMO_FSM_TERM_PARENT, NULL, + _osmo_fsm_inst_term(first_child, OSMO_FSM_TERM_PARENT, NULL, file, line); } -- To view, visit https://gerrit.osmocom.org/1457 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I00990b47e42eeb43707a9a42abcd9df52fe5f483 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 20 11:07:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 11:07:23 +0000 Subject: [PATCH] libosmocore[master]: fsm api doc: fix typo in doxygen marker '\breif' Message-ID: Review at https://gerrit.osmocom.org/1458 fsm api doc: fix typo in doxygen marker '\breif' Change-Id: I5c57e35b29d50cb409becada6b9b120ce5210ae0 --- M include/osmocom/core/fsm.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/1458/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 5a67961..57d9a76 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -69,7 +69,7 @@ uint32_t allstate_event_mask; /*! \brief function pointer to be called for allstate events */ void (*allstate_action)(struct osmo_fsm_inst *fi, uint32_t event, void *data); - /*! \breif clean-up function, called during termination */ + /*! \brief clean-up function, called during termination */ void (*cleanup)(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause); /*! \brief timer call-back for states with time-out. * \returns 1 to request termination, 0 to keep running. */ -- To view, visit https://gerrit.osmocom.org/1458 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c57e35b29d50cb409becada6b9b120ce5210ae0 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Tue Dec 20 11:39:15 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 11:39:15 +0000 Subject: libosmocore[master]: fsm api doc: fix typo in doxygen marker '\breif' In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1458 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5c57e35b29d50cb409becada6b9b120ce5210ae0 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 Tue Dec 20 15:51:50 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 15:51:50 +0000 Subject: [PATCH] osmo-hlr[master]: Add hardcoded APN Message-ID: Review at https://gerrit.osmocom.org/1459 Add hardcoded APN Add APN '*' to PDP info part of GSUP response to make it possible to test SGSN 'auth-policy remote'. Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Related: OS#1794 --- M src/hlr.c 1 file changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/59/1459/1 diff --git a/src/hlr.c b/src/hlr.c index d7d97b1..27a0ec2 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "db.h" #include "logging.h" @@ -264,6 +265,7 @@ void lu_op_tx_insert_subscr_data(struct lu_operation *luop) { struct osmo_gsup_message gsup; + uint8_t apn[APN_MAXLEN]; OSMO_ASSERT(luop->state == LU_S_LU_RECEIVED || luop->state == LU_S_CANCEL_ACK_RECEIVED); @@ -276,7 +278,14 @@ gsup.hlr_enc; if (luop->is_ps) { - /* FIXME: PDP infos */ + /* FIXME: PDP infos - use more fine-grained access control + instead of wildcard */ + gsup.pdp_infos[0].have_info = 1; + gsup.pdp_infos[0].context_id = 1; // FIXME: use real value + gsup.pdp_infos[0].apn_enc = apn; + gsup.pdp_infos[0].apn_enc_len = + osmo_apn_from_str(gsup.pdp_infos[0].apn_enc, 2, "*"); + gsup.num_pdp_infos = 1; } /* Send ISD to new VLR/SGSN */ -- To view, visit https://gerrit.osmocom.org/1459 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 20 15:51:50 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 15:51:50 +0000 Subject: [PATCH] osmo-hlr[master]: Add gerrit settings Message-ID: Review at https://gerrit.osmocom.org/1460 Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: Ic03e19e2bab46ae2383504cf26e3d7e29d361f05 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/60/1460/1 diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..afddc7b --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=osmo-hlr -- To view, visit https://gerrit.osmocom.org/1460 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic03e19e2bab46ae2383504cf26e3d7e29d361f05 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 20 15:58:06 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 15:58:06 +0000 Subject: [PATCH] openbsc[master]: Improve GPRS logging Message-ID: Review at https://gerrit.osmocom.org/1461 Improve GPRS logging * log xid type as string instead of int * log packet encryption status, algorithm and IOV-UI in debug mode * print encryption parameters when dumping llme via vty * log key propagation from MM to LLC Related: OS#1794 Change-Id: I30c38fdeb0b88bb39bdb9928851300bc79e6aec6 --- M openbsc/include/openbsc/gprs_llc.h M openbsc/src/gprs/gprs_gb_parse.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_llc_parse.c M openbsc/src/gprs/gprs_llc_vty.c M openbsc/src/gprs/gprs_llc_xid.c M openbsc/src/gprs/gprs_sgsn.c 7 files changed, 63 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/61/1461/1 diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h index 8b01467..8bc2267 100644 --- a/openbsc/include/openbsc/gprs_llc.h +++ b/openbsc/include/openbsc/gprs_llc.h @@ -46,6 +46,8 @@ GPRS_LLC_XID_T_RESET = 12, }; +extern const struct value_string gprs_llc_xid_type_names[]; + /* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */ /* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */ enum gprs_llc_primitive { @@ -270,7 +272,7 @@ /* parse a GPRS LLC header, also check for invalid frames */ int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp, uint8_t *llc_hdr, int len); -void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph); +void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle); int gprs_llc_fcs(uint8_t *data, unsigned int len); diff --git a/openbsc/src/gprs/gprs_gb_parse.c b/openbsc/src/gprs/gprs_gb_parse.c index f11d93a..9befa39 100644 --- a/openbsc/src/gprs/gprs_gb_parse.c +++ b/openbsc/src/gprs/gprs_gb_parse.c @@ -398,7 +398,7 @@ /* parse LLC */ rc = gprs_llc_hdr_parse(ghp, llc, llc_len); - gprs_llc_hdr_dump(ghp); + gprs_llc_hdr_dump(ghp, NULL); if (rc != 0) { LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n"); return 0; diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index 0215029..c2c3900 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -178,8 +179,10 @@ * inquiry. There is a remainig risk of * malfunction! */ LOGP(DLLC, LOGL_NOTICE, - "Ignoring XID-Field: XID: type=%d, data_len=%d, data=%s\n", - xid_field->type, xid_field->data_len, + "Ignoring XID-Field: XID: type %s, data_len=%d, data=%s\n", + get_value_string(gprs_llc_xid_type_names, + xid_field->type), + xid_field->data_len, osmo_hexdump_nospc(xid_field->data, xid_field->data_len)); } @@ -232,8 +235,10 @@ * when a phone submits values which defer from * the default! */ LOGP(DLLC, LOGL_NOTICE, - "Echoing XID-Field: XID: type=%d, data_len=%d, data=%s\n", - xid_field->type, xid_field->data_len, + "Echoing XID-Field: XID: type %s, data_len=%d, data=%s\n", + get_value_string(gprs_llc_xid_type_names, + xid_field->type), + xid_field->data_len, osmo_hexdump_nospc(xid_field->data, xid_field->data_len)); xid_field_response = @@ -308,7 +313,6 @@ } } - /* Set of LL-XID negotiation (See also: TS 101 351, Section 7.2.2.4) */ int gprs_ll_xid_req(struct gprs_llc_lle *lle, struct gprs_llc_xid_field *l3_xid_field) @@ -319,6 +323,7 @@ int xid_bytes_len; uint8_t *xid; struct msgb *msg; + const char *ftype; /* Generate XID */ xid_bytes_len = @@ -331,7 +336,13 @@ msg = msgb_alloc_headroom(4096, 1024, "LLC_XID"); xid = msgb_put(msg, xid_bytes_len); memcpy(xid, xid_bytes, xid_bytes_len); - LOGP(DLLC, LOGL_NOTICE, "Sending XID request to phone...\n"); + if (l3_xid_field) + ftype = get_value_string(gprs_llc_xid_type_names, + l3_xid_field->type); + else + ftype = "NULL"; + LOGP(DLLC, LOGL_NOTICE, "Sending XID type %s (%d bytes) request" + " to phone...\n", ftype, xid_bytes_len); gprs_llc_tx_xid(lle, msg, 1); } else { LOGP(DLLC, LOGL_ERROR, @@ -858,7 +869,7 @@ { struct gprs_llc_hdr *lh = (struct gprs_llc_hdr *) msgb_llch(msg); struct gprs_llc_hdr_parsed llhp; - struct gprs_llc_lle *lle; + struct gprs_llc_lle *lle = NULL; bool drop_cipherable = false; int rc = 0; @@ -866,7 +877,6 @@ memset(&llhp, 0, sizeof(llhp)); rc = gprs_llc_hdr_parse(&llhp, (uint8_t *) lh, TLVP_LEN(tv, BSSGP_IE_LLC_PDU)); - gprs_llc_hdr_dump(&llhp); if (rc < 0) { LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n"); return rc; @@ -899,7 +909,7 @@ } return 0; } - + gprs_llc_hdr_dump(&llhp, lle); /* reset age computation */ lle->llme->age_timestamp = GPRS_LLME_RESET_AGE; diff --git a/openbsc/src/gprs/gprs_llc_parse.c b/openbsc/src/gprs/gprs_llc_parse.c index b1f1a56..a5a7a71 100644 --- a/openbsc/src/gprs/gprs_llc_parse.c +++ b/openbsc/src/gprs/gprs_llc_parse.c @@ -67,11 +67,19 @@ return fcs_calc; } -void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph) +void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle) { - DEBUGP(DLLC, "LLC SAPI=%u %c %c FCS=0x%06x", - gph->sapi, gph->is_cmd ? 'C' : 'R', gph->ack_req ? 'A' : ' ', - gph->fcs); + const char *gea; + uint32_t iov_ui = 0; + if (lle) { + gea = get_value_string(gprs_cipher_names, lle->llme->algo); + iov_ui = lle->llme->iov_ui; + } else + gea = "GEA?"; + DEBUGP(DLLC, "LLC SAPI=%u %c %c %c %s IOV-UI=0x%06x FCS=0x%06x ", + gph->sapi, gph->is_cmd ? 'C' : 'R', gph->ack_req ? 'A' : ' ', + gph->is_encrypted ? 'E' : 'U', + gea, iov_ui, gph->fcs); if (gph->cmd) DEBUGPC(DLLC, "CMD=%s ", get_value_string(llc_cmd_strs, gph->cmd)); diff --git a/openbsc/src/gprs/gprs_llc_vty.c b/openbsc/src/gprs/gprs_llc_vty.c index f399b27..e97416b 100644 --- a/openbsc/src/gprs/gprs_llc_vty.c +++ b/openbsc/src/gprs/gprs_llc_vty.c @@ -73,9 +73,11 @@ struct timespec now_tp = {0}; clock_gettime(CLOCK_MONOTONIC, &now_tp); - vty_out(vty, "TLLI %08x (Old TLLI %08x) BVCI=%u NSEI=%u Age=%d: State %s%s", - llme->tlli, llme->old_tlli, llme->bvci, llme->nsei, - llme->age_timestamp == GPRS_LLME_RESET_AGE ? 0 : + vty_out(vty, "TLLI %08x (Old TLLI %08x) BVCI=%u NSEI=%u %s: " + "IOV-UI=0x%06x CKSN=%d Age=%d: State %s%s", llme->tlli, + llme->old_tlli, llme->bvci, llme->nsei, + get_value_string(gprs_cipher_names, llme->algo), llme->iov_ui, + llme->cksn, llme->age_timestamp == GPRS_LLME_RESET_AGE ? 0 : (int)(now_tp.tv_sec - (time_t)llme->age_timestamp), get_value_string(gprs_llc_state_strs, llme->state), VTY_NEWLINE); diff --git a/openbsc/src/gprs/gprs_llc_xid.c b/openbsc/src/gprs/gprs_llc_xid.c index 4b1685e..fe63171 100644 --- a/openbsc/src/gprs/gprs_llc_xid.c +++ b/openbsc/src/gprs/gprs_llc_xid.c @@ -35,6 +35,23 @@ #include #include +const struct value_string gprs_llc_xid_type_names[] = { + { GPRS_LLC_XID_T_VERSION, "VERSION"}, + { GPRS_LLC_XID_T_IOV_UI, "IOV_UI"}, + { GPRS_LLC_XID_T_IOV_I, "IOV_I"}, + { GPRS_LLC_XID_T_T200, "T200"}, + { GPRS_LLC_XID_T_N200, "N200"}, + { GPRS_LLC_XID_T_N201_U, "N201_"}, + { GPRS_LLC_XID_T_N201_I, "N201_I"}, + { GPRS_LLC_XID_T_mD, "mD"}, + { GPRS_LLC_XID_T_mU, "mU"}, + { GPRS_LLC_XID_T_kD, "kD"}, + { GPRS_LLC_XID_T_kU, "kU"}, + { GPRS_LLC_XID_T_L3_PAR, "L3_PAR"}, + { GPRS_LLC_XID_T_RESET, "RESET"}, + { 0, NULL }, +}; + /* Parse XID parameter field */ static int decode_xid_field(struct gprs_llc_xid_field *xid_field, const uint8_t *src, uint8_t src_len) @@ -249,8 +266,10 @@ if (xid_field->data_len) { OSMO_ASSERT(xid_field->data); LOGP(DLLC, logl, - "XID: type=%d, data_len=%d, data=%s\n", - xid_field->type, xid_field->data_len, + "XID: type %s, data_len=%d, data=%s\n", + get_value_string(gprs_llc_xid_type_names, + xid_field->type), + xid_field->data_len, osmo_hexdump_nospc(xid_field->data, xid_field->data_len)); } else { diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..e85e1a9 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -225,6 +225,8 @@ ctx->mm_state = GMM_DEREGISTERED; ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL; ctx->ciph_algo = sgsn->cfg.cipher; + LOGMMCTXP(LOGL_DEBUG, ctx, "Allocated with %s cipher.\n", + get_value_string(gprs_cipher_names, ctx->ciph_algo)); ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, tlli); INIT_LLIST_HEAD(&ctx->pdp_list); -- To view, visit https://gerrit.osmocom.org/1461 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I30c38fdeb0b88bb39bdb9928851300bc79e6aec6 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 20 16:21:52 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 16:21:52 +0000 Subject: [PATCH] openbsc[master]: Generate random IOV-UI and send it via XID Message-ID: Review at https://gerrit.osmocom.org/1462 Generate random IOV-UI and send it via XID This ensures that encryption is using random IV value as per-spec instead of hard-coded 0. Fixes: OS#1794 Change-Id: Ia71d6ac668a629d0377dd5c685e1dcd166def1a4 --- M openbsc/include/openbsc/gprs_llc.h M openbsc/src/gprs/gprs_llc.c 2 files changed, 25 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/62/1462/1 diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h index 8bc2267..ef3c66e 100644 --- a/openbsc/include/openbsc/gprs_llc.h +++ b/openbsc/include/openbsc/gprs_llc.h @@ -237,6 +237,7 @@ int gprs_llgmm_reset(struct gprs_llc_llme *llme); int gprs_llgmm_reset_oldmsg(struct msgb* oldmsg, uint8_t sapi, struct gprs_llc_llme *llme); +bool gprs_llgmm_gen_iov_ui(struct gprs_llc_llme *llme); /* Set of LL-XID negotiation (See also: TS 101 351, Section 7.2.2.4) */ int gprs_ll_xid_req(struct gprs_llc_lle *lle, diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index c2c3900..8e8ad65 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -61,9 +61,15 @@ LLIST_HEAD(xid_fields); + struct gprs_llc_xid_field xid_iov_ui; struct gprs_llc_xid_field xid_version; struct gprs_llc_xid_field xid_n201u; struct gprs_llc_xid_field xid_n201i; + + bool iov = gprs_llgmm_gen_iov_ui(llme); + xid_iov_ui.type = GPRS_LLC_XID_T_IOV_UI; + xid_iov_ui.data = (uint8_t *) &llme->iov_ui; + xid_iov_ui.data_len = 4; xid_version.type = GPRS_LLC_XID_T_VERSION; xid_version.data = (uint8_t *) "\x00"; @@ -78,6 +84,9 @@ xid_n201i.data_len = 2; /* Add locally managed XID Fields */ + if (iov) + llist_add(&xid_iov_ui.list, &xid_fields); + LOGP(DLLC, LOGL_NOTICE, "XID gen with iov %d\n", iov); llist_add(&xid_version.list, &xid_fields); llist_add(&xid_n201u.list, &xid_fields); llist_add(&xid_n201i.list, &xid_fields); @@ -1060,6 +1069,19 @@ return gprs_llgmm_assign(llme, llme->tlli, 0xffffffff); } +bool gprs_llgmm_gen_iov_ui(struct gprs_llc_llme *llme) +{ + if (llme->algo != GPRS_ALGO_GEA0) { + if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { + LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for IOV-UI, " + "falling back to rand()\n"); + llme->iov_ui = rand(); + } + return true; + } + return false; +} + /* Chapter 7.2.1.2 LLGMM-RESET.req */ int gprs_llgmm_reset(struct gprs_llc_llme *llme) { @@ -1070,11 +1092,7 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " - "falling back to rand()\n"); - llme->iov_ui = rand(); - } + gprs_llgmm_gen_iov_ui(llme); /* Generate XID message */ xid_bytes_len = gprs_llc_generate_xid_for_gmm_reset(xid_bytes, @@ -1103,11 +1121,7 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " - "falling back to rand()\n"); - llme->iov_ui = rand(); - } + gprs_llgmm_gen_iov_ui(llme); /* Generate XID message */ xid_bytes_len = gprs_llc_generate_xid_for_gmm_reset(xid_bytes, -- To view, visit https://gerrit.osmocom.org/1462 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia71d6ac668a629d0377dd5c685e1dcd166def1a4 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 20 16:22:25 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 16:22:25 +0000 Subject: openbsc[master]: Generate random IOV-UI and send it via XID In-Reply-To: References: Message-ID: Patch Set 1: Verified-1 -- To view, visit https://gerrit.osmocom.org/1462 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia71d6ac668a629d0377dd5c685e1dcd166def1a4 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 20 16:53:18 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 16:53:18 +0000 Subject: [PATCH] openbsc[master]: Fix some typos in stdout output Message-ID: Review at https://gerrit.osmocom.org/1463 Fix some typos in stdout output Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Related: OS#1694 --- M openbsc/src/ipaccess/ipaccess-config.c M openbsc/src/libbsc/abis_om2000_vty.c M openbsc/src/libbsc/bsc_api.c M openbsc/src/libmsc/smpp_smsc.c M openbsc/src/libmsc/smpp_vty.c M openbsc/src/osmo-bsc/osmo_bsc_vty.c 6 files changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/63/1463/1 diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 0a9dfc8..0c3f888 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -802,11 +802,11 @@ static void print_help(void) { #if 0 - printf("Commmands for reading from the BTS:\n"); + printf("Commands for reading from the BTS:\n"); printf(" -D --dump\t\t\tDump the BTS configuration\n"); printf("\n"); #endif - printf("Commmands for writing to the BTS:\n"); + printf("Commands for writing to the BTS:\n"); printf(" -u --unit-id UNIT_ID\t\tSet the Unit ID of the BTS\n"); printf(" -o --oml-ip IP\t\tSet primary OML IP (IP of your BSC)\n"); printf(" -i --ip-address IP/MASK\tSet static IP address + netmask of BTS\n"); diff --git a/openbsc/src/libbsc/abis_om2000_vty.c b/openbsc/src/libbsc/abis_om2000_vty.c index 27b1947..adad479 100644 --- a/openbsc/src/libbsc/abis_om2000_vty.c +++ b/openbsc/src/libbsc/abis_om2000_vty.c @@ -394,7 +394,7 @@ 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 Connnection List\n" + "Interface Switch Connection List\n" "Add to IS list\n" "Delete from IS list\n" "ICP1\n" "ICP2\n" "Contiguity Index\n") { diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 395002a..8a4c85f 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -136,7 +136,7 @@ struct gsm_subscriber_connection *conn = (struct gsm_subscriber_connection *) _conn; - LOGP(DMSC, LOGL_ERROR, "Assigment T10 timeout on %p\n", conn); + LOGP(DMSC, LOGL_ERROR, "Assignment T10 timeout on %p\n", conn); /* * normal release on the secondary channel but only if the @@ -478,7 +478,7 @@ gh = msgb_l3(msg); if (msgb_l3len(msg) - sizeof(*gh) != 1) { - LOGP(DMSC, LOGL_ERROR, "assignemnt failure unhandled: %zu\n", + LOGP(DMSC, LOGL_ERROR, "assignment failure unhandled: %zu\n", msgb_l3len(msg) - sizeof(*gh)); rr_failure = NULL; } else { diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c index ef4277a..e537490 100644 --- a/openbsc/src/libmsc/smpp_smsc.c +++ b/openbsc/src/libmsc/smpp_smsc.c @@ -756,7 +756,7 @@ case QUERY_SM: case REPLACE_SM: case SUBMIT_MULTI: - LOGP(DSMPP, LOGL_NOTICE, "[%s] Unimplemented PDU Commmand " + LOGP(DSMPP, LOGL_NOTICE, "[%s] Unimplemented PDU Command " "0x%08x\n", esme->system_id, cmd_id); break; default: diff --git a/openbsc/src/libmsc/smpp_vty.c b/openbsc/src/libmsc/smpp_vty.c index 351e8be..13467f1 100644 --- a/openbsc/src/libmsc/smpp_vty.c +++ b/openbsc/src/libmsc/smpp_vty.c @@ -435,7 +435,7 @@ DEFUN(cfg_esme_del_src_imsi, cfg_esme_del_src_imsi_cmd, "deliver-src-imsi", - "Enable the use of IMSI as source addres in DELIVER") + "Enable the use of IMSI as source address in DELIVER") { struct osmo_smpp_acl *acl = vty->index; @@ -446,7 +446,7 @@ DEFUN(cfg_esme_no_del_src_imsi, cfg_esme_no_del_src_imsi_cmd, "no deliver-src-imsi", NO_STR - "Disable the use of IMSI as source addres in DELIVER") + "Disable the use of IMSI as source address in DELIVER") { struct osmo_smpp_acl *acl = vty->index; diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c index e623c9c..86ccec4 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c @@ -688,7 +688,7 @@ DEFUN(cfg_net_bsc_mid_call_text, cfg_net_bsc_mid_call_text_cmd, "mid-call-text .TEXT", - "Set the USSD notifcation to be send.\n" "Text to be sent\n") + "Set the USSD notification to be send.\n" "Text to be sent\n") { struct osmo_bsc_data *data = osmo_bsc_data(vty); char *txt = argv_concat(argv, argc, 0); -- To view, visit https://gerrit.osmocom.org/1463 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Tue Dec 20 17:45:58 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 20 Dec 2016 17:45:58 +0000 Subject: [PATCH] openbsc[master]: Migrate from OpenSSL to GnuTLS Message-ID: Review at https://gerrit.osmocom.org/1464 Migrate from OpenSSL to GnuTLS This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Related: OS#1694 --- M debian/control M openbsc/configure.ac M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gb_proxy.c M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_sgsn.c M openbsc/src/libiu/Makefile.am M openbsc/src/libmsc/Makefile.am M openbsc/src/libmsc/auth.c M openbsc/src/libmsc/db.c M openbsc/src/osmo-bsc_nat/Makefile.am M openbsc/src/osmo-bsc_nat/bsc_nat.c M openbsc/src/osmo-nitb/Makefile.am M openbsc/tests/channel/Makefile.am M openbsc/tests/db/Makefile.am M openbsc/tests/gbproxy/Makefile.am M openbsc/tests/gbproxy/gbproxy_test.c M openbsc/tests/mm_auth/Makefile.am M openbsc/tests/mm_auth/mm_auth_test.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sndcp_xid/Makefile.am M openbsc/tests/xid/Makefile.am 24 files changed, 77 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/1464/1 diff --git a/debian/control b/debian/control index c37a5ca..5ef4266 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Section: net Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libssl-dev, libc-ares-dev, libsmpp34-dev +Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libgnutls28-dev, libc-ares-dev, libsmpp34-dev Standards-Version: 3.8.4 Homepage: http://openbsc.osmocom.org/ Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 0753834..3bf497d 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -37,7 +37,10 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5) +PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 3.3.0) + +AC_SUBST(LIBGNUTLS_CFLAGS) +AC_SUBST(LIBGNUTLS_LIBS) # Enabke/disable the NAT? AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])], diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index cff17dd..40e7feb 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -15,7 +15,7 @@ $(LIBOSMOGB_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(LIBCARES_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBGTP_CFLAGS) \ $(NULL) if BUILD_IU @@ -63,7 +63,7 @@ osmo_gbproxy_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ $(OSMO_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) @@ -98,7 +98,7 @@ $(OSMO_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ -lgtp \ -lm \ diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index d95139f..b1e67e4 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -51,7 +51,7 @@ #include #include -#include +#include static const struct rate_ctr_desc global_ctr_description[] = { { "inv-bvci", "Invalid BVC Identifier " }, @@ -236,7 +236,8 @@ bss_ptmsi = sgsn_ptmsi; } else { do { - if (RAND_bytes((uint8_t *) &bss_ptmsi, sizeof(bss_ptmsi)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &bss_ptmsi, + sizeof(bss_ptmsi)) < 0) { bss_ptmsi = GSM_RESERVED_TMSI; break; } @@ -273,7 +274,8 @@ } else { do { /* create random TLLI, 0b01111xxx... */ - if (RAND_bytes((uint8_t *) &sgsn_tlli, sizeof(sgsn_tlli)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &sgsn_tlli, + sizeof(sgsn_tlli)) < 0) { sgsn_tlli = 0; break; } diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 363b457..6e319ee 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -31,7 +31,7 @@ #include #include -#include +#include #include "bscconfig.h" @@ -551,9 +551,9 @@ /* ? 10.5.5.7: */ acreq->force_stby = force_standby; /* 3GPP TS 24.008 ? 10.5.5.19: */ - if (RAND_bytes(&rbyte, 1) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed for A&C ref, falling " - "back to rand()\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, &rbyte, 1) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed for A&C ref, falling" + " back to rand()\n"); acreq->ac_ref_nr = rand(); } else acreq->ac_ref_nr = rbyte; @@ -1195,8 +1195,8 @@ }; /* XXX: Hack to make 3G auth work with special SIM card */ ctx->auth_state = SGSN_AUTH_AUTHENTICATE; - - RAND_bytes(tmp_rand, 16); + /* FIXME: check return value and propagate error */ + gnutls_rnd(GNUTLS_RND_NONCE, tmp_rand, 16); memset(&ctx->auth_triplet.vec, 0, sizeof(ctx->auth_triplet.vec)); osmo_auth_gen_vec(&ctx->auth_triplet.vec, &auth, tmp_rand); diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index 0215029..bdc9033 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -1060,8 +1060,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } @@ -1093,8 +1093,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..086ae48 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -45,7 +45,7 @@ #include -#include +#include #define GPRS_LLME_CHECK_TICK 30 @@ -612,7 +612,7 @@ int max_retries = 100; restart: - if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &ptmsi, sizeof(ptmsi)) < 0) goto failed; /* Enforce that the 2 MSB are set without loosing the distance between diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am index e5f9e27..0070679 100644 --- a/openbsc/src/libiu/Makefile.am +++ b/openbsc/src/libiu/Makefile.am @@ -7,7 +7,7 @@ AM_CFLAGS = \ -Wall \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBASN1C_CFLAGS) \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index 9d966db..20a0876 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -10,7 +10,7 @@ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ $(NULL) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..81521ff 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -27,7 +27,7 @@ #include -#include +#include #include @@ -123,8 +123,10 @@ } atuple->use_count = 1; - if (RAND_bytes(atuple->vec.rand, sizeof(atuple->vec.rand)) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, atuple->vec.rand, + sizeof(atuple->vec.rand)) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed, can't generate new" + " auth tuple\n"); return AUTH_ERROR; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..a705a17 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -40,7 +40,7 @@ #include #include -#include +#include /* Semi-Private-Interface (SPI) for the subscriber code */ void subscr_direct_free(struct gsm_subscriber *subscr); @@ -1223,8 +1223,9 @@ char *tmsi_quoted; for (;;) { - if (RAND_bytes((uint8_t *) &subscriber->tmsi, sizeof(subscriber->tmsi)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &subscriber->tmsi, + sizeof(subscriber->tmsi)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (subscriber->tmsi == GSM_RESERVED_TMSI) @@ -1303,8 +1304,9 @@ uint32_t try; for (;;) { - if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &try, + sizeof(try)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (!try) /* 0 is an invalid token */ diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am index be33d28..af99d11 100644 --- a/openbsc/src/osmo-bsc_nat/Makefile.am +++ b/openbsc/src/osmo-bsc_nat/Makefile.am @@ -13,7 +13,7 @@ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMONETIF_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) @@ -53,6 +53,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBOSMONETIF_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index a4dd679..04af181 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -74,7 +74,7 @@ #include -#include +#include #include "../../bscconfig.h" @@ -223,7 +223,7 @@ buf = v_put(buf, 0x23); mrand = bsc->last_rand; - if (RAND_bytes(mrand, 16) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, mrand, 16) != 1) goto failed_random; memcpy(buf, mrand, 16); diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index 2a6d2fc..2d2f89d 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -40,6 +40,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBSMPP34_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 5e9583f..0663b64 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -30,6 +30,6 @@ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am index 0eed5cd..332bf09 100644 --- a/openbsc/tests/db/Makefile.am +++ b/openbsc/tests/db/Makefile.am @@ -43,6 +43,6 @@ $(LIBOSMOGSM_LIBS) \ $(LIBSMPP34_LIBS) \ $(LIBOSMOVTY_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am index 2dd66df..8fdefb5 100644 --- a/openbsc/tests/gbproxy/Makefile.am +++ b/openbsc/tests/gbproxy/Makefile.am @@ -28,7 +28,7 @@ $(NULL) gbproxy_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ $(NULL) gbproxy_test_LDADD = \ @@ -49,6 +49,6 @@ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBRARY_DL) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 577daa9..2209d67 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -37,7 +37,7 @@ #include #include -#include +#include #define REMOTE_BSS_ADDR 0x01020304 #define REMOTE_SGSN_ADDR 0x05060708 @@ -53,30 +53,30 @@ struct llist_head *received_messages = NULL; -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, data, len); } static int rand_seq_num = 0; -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { uint32_t val; - OSMO_ASSERT(num == sizeof(val)); - OSMO_ASSERT(__real_RAND_bytes(buf, num) == 1); + OSMO_ASSERT(len == sizeof(val)); + OSMO_ASSERT(__real_gnutls_rnd(level, data, len) == 1); val = 0x00dead00 + rand_seq_num; rand_seq_num++; - memcpy(buf, &val, num); + memcpy(data, &val, len); return 1; } diff --git a/openbsc/tests/mm_auth/Makefile.am b/openbsc/tests/mm_auth/Makefile.am index cb35198..ea6f516 100644 --- a/openbsc/tests/mm_auth/Makefile.am +++ b/openbsc/tests/mm_auth/Makefile.am @@ -8,7 +8,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(NULL) noinst_PROGRAMS = \ diff --git a/openbsc/tests/mm_auth/mm_auth_test.c b/openbsc/tests/mm_auth/mm_auth_test.c index b8777a8..819ff19 100644 --- a/openbsc/tests/mm_auth/mm_auth_test.c +++ b/openbsc/tests/mm_auth/mm_auth_test.c @@ -120,8 +120,8 @@ return auth_action; } -/* override libssl RAND_bytes() to get testable crypto results */ -int RAND_bytes(uint8_t *rand, int len) +/* override GnuTLS' gnutls_rnd() to get testable crypto results */ +int gnutls_rnd(gnutls_rnd_level_t level, void *rand, size_t len) { memset(rand, 23, len); return 1; diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index f1606cb..0925995 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -32,7 +32,7 @@ $(NULL) sgsn_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ @@ -66,7 +66,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index b4bcaf6..f30e245 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -99,21 +99,21 @@ return 0; } -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *buf, size_t num) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, buf, num); } /* make results of A&C ref predictable */ -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *buf, size_t num) { if (num > 1) - return __real_RAND_bytes(buf, num); + return __real_gnutls_rnd(level, buf, num); buf[0] = 0; return 1; } diff --git a/openbsc/tests/sndcp_xid/Makefile.am b/openbsc/tests/sndcp_xid/Makefile.am index 99b9d1a..e9e5d6f 100644 --- a/openbsc/tests/sndcp_xid/Makefile.am +++ b/openbsc/tests/sndcp_xid/Makefile.am @@ -14,7 +14,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lgtp -lrt -lm diff --git a/openbsc/tests/xid/Makefile.am b/openbsc/tests/xid/Makefile.am index aaf17ed..512dade 100644 --- a/openbsc/tests/xid/Makefile.am +++ b/openbsc/tests/xid/Makefile.am @@ -31,7 +31,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Tue Dec 20 21:44:29 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 21:44:29 +0000 Subject: osmo-hlr[master]: Add gerrit settings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1460 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic03e19e2bab46ae2383504cf26e3d7e29d361f05 Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr 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 Tue Dec 20 21:55:51 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 21:55:51 +0000 Subject: osmo-hlr[master]: Add hardcoded APN In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1459/1/src/hlr.c File src/hlr.c: Line 287: osmo_apn_from_str(gsup.pdp_infos[0].apn_enc, 2, "*"); I guess it would be easier to read, and also you should validate l, and rather pass the size of apn, with something like this: l = osmo_apn_from_str(apn, sizeof(apn), "*"); if (l < 1) $ERROR; gsup.pdp_infos[0].apn_enc = apn; gsup.pdp_infos[0].apn_enc_len = l; Also I'm curious / not familiar: how does the asterisk do access control? osmo_apn_from_str() simply encodes the "*", right? -- To view, visit https://gerrit.osmocom.org/1459 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr 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 Dec 20 22:05:28 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 22:05:28 +0000 Subject: openbsc[master]: Fix some typos in stdout output In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1463 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Tue Dec 20 22:05:31 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Tue, 20 Dec 2016 22:05:31 +0000 Subject: [MERGED] openbsc[master]: Fix some typos in stdout output In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: Fix some typos in stdout output ...................................................................... Fix some typos in stdout output Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Related: OS#1694 --- M openbsc/src/ipaccess/ipaccess-config.c M openbsc/src/libbsc/abis_om2000_vty.c M openbsc/src/libbsc/bsc_api.c M openbsc/src/libmsc/smpp_smsc.c M openbsc/src/libmsc/smpp_vty.c M openbsc/src/osmo-bsc/osmo_bsc_vty.c 6 files changed, 9 insertions(+), 9 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 0a9dfc8..0c3f888 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -802,11 +802,11 @@ static void print_help(void) { #if 0 - printf("Commmands for reading from the BTS:\n"); + printf("Commands for reading from the BTS:\n"); printf(" -D --dump\t\t\tDump the BTS configuration\n"); printf("\n"); #endif - printf("Commmands for writing to the BTS:\n"); + printf("Commands for writing to the BTS:\n"); printf(" -u --unit-id UNIT_ID\t\tSet the Unit ID of the BTS\n"); printf(" -o --oml-ip IP\t\tSet primary OML IP (IP of your BSC)\n"); printf(" -i --ip-address IP/MASK\tSet static IP address + netmask of BTS\n"); diff --git a/openbsc/src/libbsc/abis_om2000_vty.c b/openbsc/src/libbsc/abis_om2000_vty.c index 27b1947..adad479 100644 --- a/openbsc/src/libbsc/abis_om2000_vty.c +++ b/openbsc/src/libbsc/abis_om2000_vty.c @@ -394,7 +394,7 @@ 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 Connnection List\n" + "Interface Switch Connection List\n" "Add to IS list\n" "Delete from IS list\n" "ICP1\n" "ICP2\n" "Contiguity Index\n") { diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 395002a..8a4c85f 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -136,7 +136,7 @@ struct gsm_subscriber_connection *conn = (struct gsm_subscriber_connection *) _conn; - LOGP(DMSC, LOGL_ERROR, "Assigment T10 timeout on %p\n", conn); + LOGP(DMSC, LOGL_ERROR, "Assignment T10 timeout on %p\n", conn); /* * normal release on the secondary channel but only if the @@ -478,7 +478,7 @@ gh = msgb_l3(msg); if (msgb_l3len(msg) - sizeof(*gh) != 1) { - LOGP(DMSC, LOGL_ERROR, "assignemnt failure unhandled: %zu\n", + LOGP(DMSC, LOGL_ERROR, "assignment failure unhandled: %zu\n", msgb_l3len(msg) - sizeof(*gh)); rr_failure = NULL; } else { diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c index ef4277a..e537490 100644 --- a/openbsc/src/libmsc/smpp_smsc.c +++ b/openbsc/src/libmsc/smpp_smsc.c @@ -756,7 +756,7 @@ case QUERY_SM: case REPLACE_SM: case SUBMIT_MULTI: - LOGP(DSMPP, LOGL_NOTICE, "[%s] Unimplemented PDU Commmand " + LOGP(DSMPP, LOGL_NOTICE, "[%s] Unimplemented PDU Command " "0x%08x\n", esme->system_id, cmd_id); break; default: diff --git a/openbsc/src/libmsc/smpp_vty.c b/openbsc/src/libmsc/smpp_vty.c index 351e8be..13467f1 100644 --- a/openbsc/src/libmsc/smpp_vty.c +++ b/openbsc/src/libmsc/smpp_vty.c @@ -435,7 +435,7 @@ DEFUN(cfg_esme_del_src_imsi, cfg_esme_del_src_imsi_cmd, "deliver-src-imsi", - "Enable the use of IMSI as source addres in DELIVER") + "Enable the use of IMSI as source address in DELIVER") { struct osmo_smpp_acl *acl = vty->index; @@ -446,7 +446,7 @@ DEFUN(cfg_esme_no_del_src_imsi, cfg_esme_no_del_src_imsi_cmd, "no deliver-src-imsi", NO_STR - "Disable the use of IMSI as source addres in DELIVER") + "Disable the use of IMSI as source address in DELIVER") { struct osmo_smpp_acl *acl = vty->index; diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c index e623c9c..86ccec4 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c @@ -688,7 +688,7 @@ DEFUN(cfg_net_bsc_mid_call_text, cfg_net_bsc_mid_call_text_cmd, "mid-call-text .TEXT", - "Set the USSD notifcation to be send.\n" "Text to be sent\n") + "Set the USSD notification to be send.\n" "Text to be sent\n") { struct osmo_bsc_data *data = osmo_bsc_data(vty); char *txt = argv_concat(argv, argc, 0); -- To view, visit https://gerrit.osmocom.org/1463 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Wed Dec 21 01:15:05 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 01:15:05 +0000 Subject: [PATCH] openbsc[master]: build: osmo-nitb: fix missing LIBCRYPTO_FLAGS Message-ID: Review at https://gerrit.osmocom.org/1465 build: osmo-nitb: fix missing LIBCRYPTO_FLAGS Change-Id: I6268d0b8782ee03b42ab8bbda7aa9650c26e11ad --- M openbsc/src/osmo-nitb/Makefile.am 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/1465/1 diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index 2a6d2fc..b91490b 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -13,6 +13,7 @@ $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ + $(LIBCRYPTO_CFLAGS) \ $(NULL) AM_LDFLAGS = \ -- To view, visit https://gerrit.osmocom.org/1465 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6268d0b8782ee03b42ab8bbda7aa9650c26e11ad Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 01:15:05 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 01:15:05 +0000 Subject: [PATCH] openbsc[master]: build: remove obsolete $LIBCRYPT in two places Message-ID: Review at https://gerrit.osmocom.org/1466 build: remove obsolete $LIBCRYPT in two places It should be $LIBCRYPTO_LIBS if at all. Change-Id: I191dfe0901a10a25dffa3bbfdb9ea319fcebe254 --- M openbsc/src/ipaccess/Makefile.am M openbsc/src/osmo-nitb/Makefile.am 2 files changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/1466/1 diff --git a/openbsc/src/ipaccess/Makefile.am b/openbsc/src/ipaccess/Makefile.am index 6c4d95c..4dfe247 100644 --- a/openbsc/src/ipaccess/Makefile.am +++ b/openbsc/src/ipaccess/Makefile.am @@ -51,7 +51,6 @@ $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ $(top_builddir)/src/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBCRYPT) \ $(OSMO_LIBS) \ $(NULL) diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index b91490b..f4ef487 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -34,7 +34,6 @@ $(top_builddir)/src/libmsc/libmsc.a \ $(top_builddir)/src/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBCRYPT) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOCORE_LIBS) \ -- To view, visit https://gerrit.osmocom.org/1466 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I191dfe0901a10a25dffa3bbfdb9ea319fcebe254 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 01:18:26 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 01:18:26 +0000 Subject: [MERGED] libosmocore[master]: fsm api doc: fix typo in doxygen marker '\breif' In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fsm api doc: fix typo in doxygen marker '\breif' ...................................................................... fsm api doc: fix typo in doxygen marker '\breif' Change-Id: I5c57e35b29d50cb409becada6b9b120ce5210ae0 --- M include/osmocom/core/fsm.h 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 5a67961..57d9a76 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -69,7 +69,7 @@ uint32_t allstate_event_mask; /*! \brief function pointer to be called for allstate events */ void (*allstate_action)(struct osmo_fsm_inst *fi, uint32_t event, void *data); - /*! \breif clean-up function, called during termination */ + /*! \brief clean-up function, called during termination */ void (*cleanup)(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause); /*! \brief timer call-back for states with time-out. * \returns 1 to request termination, 0 to keep running. */ -- To view, visit https://gerrit.osmocom.org/1458 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5c57e35b29d50cb409becada6b9b120ce5210ae0 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 Dec 21 01:50:38 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 01:50:38 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1464/1/openbsc/configure.ac File openbsc/configure.ac: Line 40: PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 3.3.0) It seems that gnutls of such a recent version is only available on debian unstable and testing, hence I cannot easily install this on the build slave. There is some confusion about version numbers ... the package libgnutls28-dev is available on debian stable; the package info website shows "3.3.8-6" for libgnutls28-dev, so I gave it a shot. This patch still fails after installing libgnutls28-dev though. https://packages.debian.org/search?keywords=gnutls&searchon=names&suite=stable§ion=all https://packages.debian.org/jessie/libgnutls28-dev If it's not in debian stable, I guess we shouldn't depend on it yet? Is going back to 2.8 an option? (whichever stable's version is) -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb 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 Wed Dec 21 09:54:30 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 09:54:30 +0000 Subject: [PATCH] osmo-hlr[master]: Add hardcoded APN 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/1459 to look at the new patch set (#2). Add hardcoded APN Add APN '*' to PDP info part of GSUP response to make it possible to test SGSN 'auth-policy remote'. Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Related: OS#1794 --- M src/hlr.c 1 file changed, 14 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/59/1459/2 diff --git a/src/hlr.c b/src/hlr.c index d7d97b1..3101403 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "db.h" #include "logging.h" @@ -264,6 +265,8 @@ void lu_op_tx_insert_subscr_data(struct lu_operation *luop) { struct osmo_gsup_message gsup; + uint8_t apn[APN_MAXLEN]; + int l; OSMO_ASSERT(luop->state == LU_S_LU_RECEIVED || luop->state == LU_S_CANCEL_ACK_RECEIVED); @@ -276,7 +279,17 @@ gsup.hlr_enc; if (luop->is_ps) { - /* FIXME: PDP infos */ + /* FIXME: PDP infos - use more fine-grained access control + instead of wildcard APN */ + l = osmo_apn_from_str(apn, sizeof(apn), "*"); + if (l > 0) { + gsup.pdp_infos[0].apn_enc = apn; + gsup.pdp_infos[0].apn_enc_len = l; + gsup.pdp_infos[0].have_info = 1; + gsup.num_pdp_infos = 1; + /* FIXME: use real value: */ + gsup.pdp_infos[0].context_id = 1; + } } /* Send ISD to new VLR/SGSN */ -- To view, visit https://gerrit.osmocom.org/1459 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 09:56:24 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 09:56:24 +0000 Subject: osmo-hlr[master]: Add hardcoded APN In-Reply-To: References: Message-ID: Patch Set 1: * is a wildcard: means accept any APN. If not APN given at all it means don't accept any APN which breaks GPRS encryption and is a clear regression compared to HLR from osmo-auc. Ideally we might want it to be configurable - accept only particular APN or set of APNs. -- To view, visit https://gerrit.osmocom.org/1459 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Gerrit-PatchSet: 1 Gerrit-Project: osmo-hlr 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 Dec 21 09:59:08 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 09:59:08 +0000 Subject: [MERGED] osmo-hlr[master]: Add gerrit settings In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Add gerrit settings ...................................................................... Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: Ic03e19e2bab46ae2383504cf26e3d7e29d361f05 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..afddc7b --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=osmo-hlr -- To view, visit https://gerrit.osmocom.org/1460 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic03e19e2bab46ae2383504cf26e3d7e29d361f05 Gerrit-PatchSet: 2 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 Dec 21 10:04:47 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 10:04:47 +0000 Subject: openbsc[master]: add gsup_test_client program In-Reply-To: References: Message-ID: Patch Set 4: This adds openbsc/src/libcommon/gsup_test_client without adding corresponding entry to .gitignore - please correct. -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Dec 21 10:05:50 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 10:05:50 +0000 Subject: openbsc[master]: oap_test.c: rename to avoid clash with libosmocore oap_test.c In-Reply-To: References: Message-ID: Patch Set 3: This adds openbsc/tests/oap/oap_client_test without adding corresponding entry to .gitignore - please correct. -- To view, visit https://gerrit.osmocom.org/1391 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3ca333141a15940df07a1ae77a30bc54885db41f 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-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Dec 21 10:22:47 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:22:47 +0000 Subject: osmo-hlr[master]: Add hardcoded APN In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 > * is a wildcard: means accept any APN. If not APN given at all it > means don't accept any APN which breaks GPRS encryption and is a > clear regression compared to HLR from osmo-auc. Ideally we might > want it to be configurable - accept only particular APN or set of > APNs. The fault is mine. I seem to have missed to push a commot on November 11 that removes osmo-gsup-hlr from osmo-auc.git :/ -- To view, visit https://gerrit.osmocom.org/1459 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Gerrit-PatchSet: 2 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 Wed Dec 21 10:22:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:22:52 +0000 Subject: [MERGED] osmo-hlr[master]: Add hardcoded APN In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add hardcoded APN ...................................................................... Add hardcoded APN Add APN '*' to PDP info part of GSUP response to make it possible to test SGSN 'auth-policy remote'. Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Related: OS#1794 --- M src/hlr.c 1 file changed, 14 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/hlr.c b/src/hlr.c index d7d97b1..3101403 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "db.h" #include "logging.h" @@ -264,6 +265,8 @@ void lu_op_tx_insert_subscr_data(struct lu_operation *luop) { struct osmo_gsup_message gsup; + uint8_t apn[APN_MAXLEN]; + int l; OSMO_ASSERT(luop->state == LU_S_LU_RECEIVED || luop->state == LU_S_CANCEL_ACK_RECEIVED); @@ -276,7 +279,17 @@ gsup.hlr_enc; if (luop->is_ps) { - /* FIXME: PDP infos */ + /* FIXME: PDP infos - use more fine-grained access control + instead of wildcard APN */ + l = osmo_apn_from_str(apn, sizeof(apn), "*"); + if (l > 0) { + gsup.pdp_infos[0].apn_enc = apn; + gsup.pdp_infos[0].apn_enc_len = l; + gsup.pdp_infos[0].have_info = 1; + gsup.num_pdp_infos = 1; + /* FIXME: use real value: */ + gsup.pdp_infos[0].context_id = 1; + } } /* Send ISD to new VLR/SGSN */ -- To view, visit https://gerrit.osmocom.org/1459 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I95d69508aafc13e82f5f51fc6fe8f56cd7f45e2b Gerrit-PatchSet: 2 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 Dec 21 10:26:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:26:09 +0000 Subject: openbsc[master]: build: remove obsolete $LIBCRYPT in two places In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1466 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I191dfe0901a10a25dffa3bbfdb9ea319fcebe254 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 Wed Dec 21 10:26:11 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:26:11 +0000 Subject: openbsc[master]: build: osmo-nitb: fix missing LIBCRYPTO_FLAGS In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1465 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6268d0b8782ee03b42ab8bbda7aa9650c26e11ad 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 Wed Dec 21 10:26:15 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:26:15 +0000 Subject: [MERGED] openbsc[master]: build: osmo-nitb: fix missing LIBCRYPTO_FLAGS In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: build: osmo-nitb: fix missing LIBCRYPTO_FLAGS ...................................................................... build: osmo-nitb: fix missing LIBCRYPTO_FLAGS Change-Id: I6268d0b8782ee03b42ab8bbda7aa9650c26e11ad --- M openbsc/src/osmo-nitb/Makefile.am 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index 2a6d2fc..b91490b 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -13,6 +13,7 @@ $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ + $(LIBCRYPTO_CFLAGS) \ $(NULL) AM_LDFLAGS = \ -- To view, visit https://gerrit.osmocom.org/1465 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6268d0b8782ee03b42ab8bbda7aa9650c26e11ad 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 Wed Dec 21 10:26:15 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:26:15 +0000 Subject: [MERGED] openbsc[master]: build: remove obsolete $LIBCRYPT in two places In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: build: remove obsolete $LIBCRYPT in two places ...................................................................... build: remove obsolete $LIBCRYPT in two places It should be $LIBCRYPTO_LIBS if at all. Change-Id: I191dfe0901a10a25dffa3bbfdb9ea319fcebe254 --- M openbsc/src/ipaccess/Makefile.am M openbsc/src/osmo-nitb/Makefile.am 2 files changed, 0 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/ipaccess/Makefile.am b/openbsc/src/ipaccess/Makefile.am index 6c4d95c..4dfe247 100644 --- a/openbsc/src/ipaccess/Makefile.am +++ b/openbsc/src/ipaccess/Makefile.am @@ -51,7 +51,6 @@ $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ $(top_builddir)/src/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBCRYPT) \ $(OSMO_LIBS) \ $(NULL) diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index b91490b..f4ef487 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -34,7 +34,6 @@ $(top_builddir)/src/libmsc/libmsc.a \ $(top_builddir)/src/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ - $(LIBCRYPT) \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOCORE_LIBS) \ -- To view, visit https://gerrit.osmocom.org/1466 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I191dfe0901a10a25dffa3bbfdb9ea319fcebe254 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 Wed Dec 21 10:27:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:27:22 +0000 Subject: openbsc[master]: Improve GPRS logging In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1461 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I30c38fdeb0b88bb39bdb9928851300bc79e6aec6 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 Dec 21 10:27:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:27:24 +0000 Subject: [MERGED] openbsc[master]: Improve GPRS logging In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Improve GPRS logging ...................................................................... Improve GPRS logging * log xid type as string instead of int * log packet encryption status, algorithm and IOV-UI in debug mode * print encryption parameters when dumping llme via vty * log key propagation from MM to LLC Related: OS#1794 Change-Id: I30c38fdeb0b88bb39bdb9928851300bc79e6aec6 --- M openbsc/include/openbsc/gprs_llc.h M openbsc/src/gprs/gprs_gb_parse.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_llc_parse.c M openbsc/src/gprs/gprs_llc_vty.c M openbsc/src/gprs/gprs_llc_xid.c M openbsc/src/gprs/gprs_sgsn.c 7 files changed, 63 insertions(+), 20 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h index 8b01467..8bc2267 100644 --- a/openbsc/include/openbsc/gprs_llc.h +++ b/openbsc/include/openbsc/gprs_llc.h @@ -46,6 +46,8 @@ GPRS_LLC_XID_T_RESET = 12, }; +extern const struct value_string gprs_llc_xid_type_names[]; + /* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */ /* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */ enum gprs_llc_primitive { @@ -270,7 +272,7 @@ /* parse a GPRS LLC header, also check for invalid frames */ int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp, uint8_t *llc_hdr, int len); -void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph); +void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle); int gprs_llc_fcs(uint8_t *data, unsigned int len); diff --git a/openbsc/src/gprs/gprs_gb_parse.c b/openbsc/src/gprs/gprs_gb_parse.c index f11d93a..9befa39 100644 --- a/openbsc/src/gprs/gprs_gb_parse.c +++ b/openbsc/src/gprs/gprs_gb_parse.c @@ -398,7 +398,7 @@ /* parse LLC */ rc = gprs_llc_hdr_parse(ghp, llc, llc_len); - gprs_llc_hdr_dump(ghp); + gprs_llc_hdr_dump(ghp, NULL); if (rc != 0) { LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n"); return 0; diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index 0215029..c2c3900 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -178,8 +179,10 @@ * inquiry. There is a remainig risk of * malfunction! */ LOGP(DLLC, LOGL_NOTICE, - "Ignoring XID-Field: XID: type=%d, data_len=%d, data=%s\n", - xid_field->type, xid_field->data_len, + "Ignoring XID-Field: XID: type %s, data_len=%d, data=%s\n", + get_value_string(gprs_llc_xid_type_names, + xid_field->type), + xid_field->data_len, osmo_hexdump_nospc(xid_field->data, xid_field->data_len)); } @@ -232,8 +235,10 @@ * when a phone submits values which defer from * the default! */ LOGP(DLLC, LOGL_NOTICE, - "Echoing XID-Field: XID: type=%d, data_len=%d, data=%s\n", - xid_field->type, xid_field->data_len, + "Echoing XID-Field: XID: type %s, data_len=%d, data=%s\n", + get_value_string(gprs_llc_xid_type_names, + xid_field->type), + xid_field->data_len, osmo_hexdump_nospc(xid_field->data, xid_field->data_len)); xid_field_response = @@ -308,7 +313,6 @@ } } - /* Set of LL-XID negotiation (See also: TS 101 351, Section 7.2.2.4) */ int gprs_ll_xid_req(struct gprs_llc_lle *lle, struct gprs_llc_xid_field *l3_xid_field) @@ -319,6 +323,7 @@ int xid_bytes_len; uint8_t *xid; struct msgb *msg; + const char *ftype; /* Generate XID */ xid_bytes_len = @@ -331,7 +336,13 @@ msg = msgb_alloc_headroom(4096, 1024, "LLC_XID"); xid = msgb_put(msg, xid_bytes_len); memcpy(xid, xid_bytes, xid_bytes_len); - LOGP(DLLC, LOGL_NOTICE, "Sending XID request to phone...\n"); + if (l3_xid_field) + ftype = get_value_string(gprs_llc_xid_type_names, + l3_xid_field->type); + else + ftype = "NULL"; + LOGP(DLLC, LOGL_NOTICE, "Sending XID type %s (%d bytes) request" + " to phone...\n", ftype, xid_bytes_len); gprs_llc_tx_xid(lle, msg, 1); } else { LOGP(DLLC, LOGL_ERROR, @@ -858,7 +869,7 @@ { struct gprs_llc_hdr *lh = (struct gprs_llc_hdr *) msgb_llch(msg); struct gprs_llc_hdr_parsed llhp; - struct gprs_llc_lle *lle; + struct gprs_llc_lle *lle = NULL; bool drop_cipherable = false; int rc = 0; @@ -866,7 +877,6 @@ memset(&llhp, 0, sizeof(llhp)); rc = gprs_llc_hdr_parse(&llhp, (uint8_t *) lh, TLVP_LEN(tv, BSSGP_IE_LLC_PDU)); - gprs_llc_hdr_dump(&llhp); if (rc < 0) { LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n"); return rc; @@ -899,7 +909,7 @@ } return 0; } - + gprs_llc_hdr_dump(&llhp, lle); /* reset age computation */ lle->llme->age_timestamp = GPRS_LLME_RESET_AGE; diff --git a/openbsc/src/gprs/gprs_llc_parse.c b/openbsc/src/gprs/gprs_llc_parse.c index b1f1a56..a5a7a71 100644 --- a/openbsc/src/gprs/gprs_llc_parse.c +++ b/openbsc/src/gprs/gprs_llc_parse.c @@ -67,11 +67,19 @@ return fcs_calc; } -void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph) +void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle) { - DEBUGP(DLLC, "LLC SAPI=%u %c %c FCS=0x%06x", - gph->sapi, gph->is_cmd ? 'C' : 'R', gph->ack_req ? 'A' : ' ', - gph->fcs); + const char *gea; + uint32_t iov_ui = 0; + if (lle) { + gea = get_value_string(gprs_cipher_names, lle->llme->algo); + iov_ui = lle->llme->iov_ui; + } else + gea = "GEA?"; + DEBUGP(DLLC, "LLC SAPI=%u %c %c %c %s IOV-UI=0x%06x FCS=0x%06x ", + gph->sapi, gph->is_cmd ? 'C' : 'R', gph->ack_req ? 'A' : ' ', + gph->is_encrypted ? 'E' : 'U', + gea, iov_ui, gph->fcs); if (gph->cmd) DEBUGPC(DLLC, "CMD=%s ", get_value_string(llc_cmd_strs, gph->cmd)); diff --git a/openbsc/src/gprs/gprs_llc_vty.c b/openbsc/src/gprs/gprs_llc_vty.c index f399b27..e97416b 100644 --- a/openbsc/src/gprs/gprs_llc_vty.c +++ b/openbsc/src/gprs/gprs_llc_vty.c @@ -73,9 +73,11 @@ struct timespec now_tp = {0}; clock_gettime(CLOCK_MONOTONIC, &now_tp); - vty_out(vty, "TLLI %08x (Old TLLI %08x) BVCI=%u NSEI=%u Age=%d: State %s%s", - llme->tlli, llme->old_tlli, llme->bvci, llme->nsei, - llme->age_timestamp == GPRS_LLME_RESET_AGE ? 0 : + vty_out(vty, "TLLI %08x (Old TLLI %08x) BVCI=%u NSEI=%u %s: " + "IOV-UI=0x%06x CKSN=%d Age=%d: State %s%s", llme->tlli, + llme->old_tlli, llme->bvci, llme->nsei, + get_value_string(gprs_cipher_names, llme->algo), llme->iov_ui, + llme->cksn, llme->age_timestamp == GPRS_LLME_RESET_AGE ? 0 : (int)(now_tp.tv_sec - (time_t)llme->age_timestamp), get_value_string(gprs_llc_state_strs, llme->state), VTY_NEWLINE); diff --git a/openbsc/src/gprs/gprs_llc_xid.c b/openbsc/src/gprs/gprs_llc_xid.c index 4b1685e..fe63171 100644 --- a/openbsc/src/gprs/gprs_llc_xid.c +++ b/openbsc/src/gprs/gprs_llc_xid.c @@ -35,6 +35,23 @@ #include #include +const struct value_string gprs_llc_xid_type_names[] = { + { GPRS_LLC_XID_T_VERSION, "VERSION"}, + { GPRS_LLC_XID_T_IOV_UI, "IOV_UI"}, + { GPRS_LLC_XID_T_IOV_I, "IOV_I"}, + { GPRS_LLC_XID_T_T200, "T200"}, + { GPRS_LLC_XID_T_N200, "N200"}, + { GPRS_LLC_XID_T_N201_U, "N201_"}, + { GPRS_LLC_XID_T_N201_I, "N201_I"}, + { GPRS_LLC_XID_T_mD, "mD"}, + { GPRS_LLC_XID_T_mU, "mU"}, + { GPRS_LLC_XID_T_kD, "kD"}, + { GPRS_LLC_XID_T_kU, "kU"}, + { GPRS_LLC_XID_T_L3_PAR, "L3_PAR"}, + { GPRS_LLC_XID_T_RESET, "RESET"}, + { 0, NULL }, +}; + /* Parse XID parameter field */ static int decode_xid_field(struct gprs_llc_xid_field *xid_field, const uint8_t *src, uint8_t src_len) @@ -249,8 +266,10 @@ if (xid_field->data_len) { OSMO_ASSERT(xid_field->data); LOGP(DLLC, logl, - "XID: type=%d, data_len=%d, data=%s\n", - xid_field->type, xid_field->data_len, + "XID: type %s, data_len=%d, data=%s\n", + get_value_string(gprs_llc_xid_type_names, + xid_field->type), + xid_field->data_len, osmo_hexdump_nospc(xid_field->data, xid_field->data_len)); } else { diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..e85e1a9 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -225,6 +225,8 @@ ctx->mm_state = GMM_DEREGISTERED; ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL; ctx->ciph_algo = sgsn->cfg.cipher; + LOGMMCTXP(LOGL_DEBUG, ctx, "Allocated with %s cipher.\n", + get_value_string(gprs_cipher_names, ctx->ciph_algo)); ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, tlli); INIT_LLIST_HEAD(&ctx->pdp_list); -- To view, visit https://gerrit.osmocom.org/1461 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I30c38fdeb0b88bb39bdb9928851300bc79e6aec6 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 Dec 21 10:28:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:28:02 +0000 Subject: libosmocore[master]: fsm: term: safer iteration to remove all child FSMs In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1457 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I00990b47e42eeb43707a9a42abcd9df52fe5f483 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 Dec 21 10:28:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:28:08 +0000 Subject: [MERGED] libosmocore[master]: fsm: term: safer iteration to remove all child FSMs In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: term: safer iteration to remove all child FSMs ...................................................................... fsm: term: safer iteration to remove all child FSMs When terminating child FSMs, restart iteration after every child, to make sure that we don't terminate a child twice. Terminating one child may emit events that in turn terminates other children. I created this patch because at first it looked like the cause of a bug, which turned out not to be the case. So I have no actual use case of this situation, but it does generally make sense to me, so submitting this. Change-Id: I00990b47e42eeb43707a9a42abcd9df52fe5f483 --- M src/fsm.c 1 file changed, 20 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index 6717538..16699fa 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -427,17 +427,33 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line) { - struct osmo_fsm_inst *child, *child2; + struct osmo_fsm_inst *first_child, *last_seen_first_child; struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", osmo_fsm_term_cause_name(cause)); - /* iterate over all children */ - llist_for_each_entry_safe(child, child2, &fi->proc.children, proc.child) { + /* iterate over all children, starting from the beginning every time: + * terminating an FSM may emit events that cause other FSMs to also + * terminate and remove themselves from this list. */ + last_seen_first_child = NULL; + while (!llist_empty(&fi->proc.children)) { + first_child = llist_entry(fi->proc.children.next, + typeof(*first_child), + proc.child); + + /* paranoia: do not loop forever */ + if (first_child == last_seen_first_child) { + LOGPFSMLSRC(fi, LOGL_ERROR, file, line, + "Internal error while terminating child" + " FSMs: a child FSM is stuck\n"); + break; + } + last_seen_first_child = first_child; + /* terminate child */ - _osmo_fsm_inst_term(child, OSMO_FSM_TERM_PARENT, NULL, + _osmo_fsm_inst_term(first_child, OSMO_FSM_TERM_PARENT, NULL, file, line); } -- To view, visit https://gerrit.osmocom.org/1457 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I00990b47e42eeb43707a9a42abcd9df52fe5f483 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 Dec 21 10:29:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:29:05 +0000 Subject: libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max 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 Wed Dec 21 10:30:40 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 10:30:40 +0000 Subject: [PATCH] openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1464 to look at the new patch set (#2). Migrate from OpenSSL to GnuTLS This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Related: OS#1694 --- M debian/control M openbsc/configure.ac M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gb_proxy.c M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_sgsn.c M openbsc/src/libiu/Makefile.am M openbsc/src/libmsc/Makefile.am M openbsc/src/libmsc/auth.c M openbsc/src/libmsc/db.c M openbsc/src/osmo-bsc_nat/Makefile.am M openbsc/src/osmo-bsc_nat/bsc_nat.c M openbsc/src/osmo-nitb/Makefile.am M openbsc/tests/channel/Makefile.am M openbsc/tests/db/Makefile.am M openbsc/tests/gbproxy/Makefile.am M openbsc/tests/gbproxy/gbproxy_test.c M openbsc/tests/mm_auth/Makefile.am M openbsc/tests/mm_auth/mm_auth_test.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sndcp_xid/Makefile.am M openbsc/tests/xid/Makefile.am 24 files changed, 91 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/1464/2 diff --git a/debian/control b/debian/control index c37a5ca..5ef4266 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Section: net Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libssl-dev, libc-ares-dev, libsmpp34-dev +Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libgnutls28-dev, libc-ares-dev, libsmpp34-dev Standards-Version: 3.8.4 Homepage: http://openbsc.osmocom.org/ Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 0753834..3bf497d 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -37,7 +37,10 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5) +PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 3.3.0) + +AC_SUBST(LIBGNUTLS_CFLAGS) +AC_SUBST(LIBGNUTLS_LIBS) # Enabke/disable the NAT? AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])], diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index cff17dd..40e7feb 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -15,7 +15,7 @@ $(LIBOSMOGB_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(LIBCARES_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBGTP_CFLAGS) \ $(NULL) if BUILD_IU @@ -63,7 +63,7 @@ osmo_gbproxy_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ $(OSMO_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) @@ -98,7 +98,7 @@ $(OSMO_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ -lgtp \ -lm \ diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index d95139f..c16124a 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -51,7 +51,8 @@ #include #include -#include +#include +#include static const struct rate_ctr_desc global_ctr_description[] = { { "inv-bvci", "Invalid BVC Identifier " }, @@ -236,7 +237,8 @@ bss_ptmsi = sgsn_ptmsi; } else { do { - if (RAND_bytes((uint8_t *) &bss_ptmsi, sizeof(bss_ptmsi)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &bss_ptmsi, + sizeof(bss_ptmsi)) < 0) { bss_ptmsi = GSM_RESERVED_TMSI; break; } @@ -273,7 +275,8 @@ } else { do { /* create random TLLI, 0b01111xxx... */ - if (RAND_bytes((uint8_t *) &sgsn_tlli, sizeof(sgsn_tlli)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &sgsn_tlli, + sizeof(sgsn_tlli)) < 0) { sgsn_tlli = 0; break; } diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 363b457..1a1338a 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -31,7 +31,8 @@ #include #include -#include +#include +#include #include "bscconfig.h" @@ -551,9 +552,9 @@ /* ? 10.5.5.7: */ acreq->force_stby = force_standby; /* 3GPP TS 24.008 ? 10.5.5.19: */ - if (RAND_bytes(&rbyte, 1) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed for A&C ref, falling " - "back to rand()\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, &rbyte, 1) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed for A&C ref, falling" + " back to rand()\n"); acreq->ac_ref_nr = rand(); } else acreq->ac_ref_nr = rbyte; @@ -1195,8 +1196,8 @@ }; /* XXX: Hack to make 3G auth work with special SIM card */ ctx->auth_state = SGSN_AUTH_AUTHENTICATE; - - RAND_bytes(tmp_rand, 16); + /* FIXME: check return value and propagate error */ + gnutls_rnd(GNUTLS_RND_NONCE, tmp_rand, 16); memset(&ctx->auth_triplet.vec, 0, sizeof(ctx->auth_triplet.vec)); osmo_auth_gen_vec(&ctx->auth_triplet.vec, &auth, tmp_rand); diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index 0215029..aa9ba30 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include @@ -1060,8 +1061,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } @@ -1093,8 +1094,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e5a54d9..b4662ae 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -45,7 +45,8 @@ #include -#include +#include +#include #define GPRS_LLME_CHECK_TICK 30 @@ -612,7 +613,7 @@ int max_retries = 100; restart: - if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &ptmsi, sizeof(ptmsi)) < 0) goto failed; /* Enforce that the 2 MSB are set without loosing the distance between diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am index e5f9e27..0070679 100644 --- a/openbsc/src/libiu/Makefile.am +++ b/openbsc/src/libiu/Makefile.am @@ -7,7 +7,7 @@ AM_CFLAGS = \ -Wall \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBASN1C_CFLAGS) \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index 9d966db..20a0876 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -10,7 +10,7 @@ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ $(NULL) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..f1f468f 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -27,7 +27,8 @@ #include -#include +#include +#include #include @@ -123,8 +124,10 @@ } atuple->use_count = 1; - if (RAND_bytes(atuple->vec.rand, sizeof(atuple->vec.rand)) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, atuple->vec.rand, + sizeof(atuple->vec.rand)) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed, can't generate new" + " auth tuple\n"); return AUTH_ERROR; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..ccd4762 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -40,7 +40,8 @@ #include #include -#include +#include +#include /* Semi-Private-Interface (SPI) for the subscriber code */ void subscr_direct_free(struct gsm_subscriber *subscr); @@ -1223,8 +1224,9 @@ char *tmsi_quoted; for (;;) { - if (RAND_bytes((uint8_t *) &subscriber->tmsi, sizeof(subscriber->tmsi)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &subscriber->tmsi, + sizeof(subscriber->tmsi)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (subscriber->tmsi == GSM_RESERVED_TMSI) @@ -1303,8 +1305,9 @@ uint32_t try; for (;;) { - if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &try, + sizeof(try)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (!try) /* 0 is an invalid token */ diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am index be33d28..af99d11 100644 --- a/openbsc/src/osmo-bsc_nat/Makefile.am +++ b/openbsc/src/osmo-bsc_nat/Makefile.am @@ -13,7 +13,7 @@ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMONETIF_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) @@ -53,6 +53,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBOSMONETIF_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index a4dd679..04af181 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -74,7 +74,7 @@ #include -#include +#include #include "../../bscconfig.h" @@ -223,7 +223,7 @@ buf = v_put(buf, 0x23); mrand = bsc->last_rand; - if (RAND_bytes(mrand, 16) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, mrand, 16) != 1) goto failed_random; memcpy(buf, mrand, 16); diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index 2a6d2fc..2d2f89d 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -40,6 +40,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBSMPP34_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 5e9583f..0663b64 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -30,6 +30,6 @@ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am index 0eed5cd..332bf09 100644 --- a/openbsc/tests/db/Makefile.am +++ b/openbsc/tests/db/Makefile.am @@ -43,6 +43,6 @@ $(LIBOSMOGSM_LIBS) \ $(LIBSMPP34_LIBS) \ $(LIBOSMOVTY_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am index 2dd66df..8fdefb5 100644 --- a/openbsc/tests/gbproxy/Makefile.am +++ b/openbsc/tests/gbproxy/Makefile.am @@ -28,7 +28,7 @@ $(NULL) gbproxy_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ $(NULL) gbproxy_test_LDADD = \ @@ -49,6 +49,6 @@ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBRARY_DL) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 577daa9..97a0ba9 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -37,7 +37,8 @@ #include #include -#include +#include +#include #define REMOTE_BSS_ADDR 0x01020304 #define REMOTE_SGSN_ADDR 0x05060708 @@ -53,30 +54,30 @@ struct llist_head *received_messages = NULL; -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, data, len); } static int rand_seq_num = 0; -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { uint32_t val; - OSMO_ASSERT(num == sizeof(val)); - OSMO_ASSERT(__real_RAND_bytes(buf, num) == 1); + OSMO_ASSERT(len == sizeof(val)); + OSMO_ASSERT(__real_gnutls_rnd(level, data, len) == 0); val = 0x00dead00 + rand_seq_num; rand_seq_num++; - memcpy(buf, &val, num); + memcpy(data, &val, len); return 1; } diff --git a/openbsc/tests/mm_auth/Makefile.am b/openbsc/tests/mm_auth/Makefile.am index cb35198..ea6f516 100644 --- a/openbsc/tests/mm_auth/Makefile.am +++ b/openbsc/tests/mm_auth/Makefile.am @@ -8,7 +8,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(NULL) noinst_PROGRAMS = \ diff --git a/openbsc/tests/mm_auth/mm_auth_test.c b/openbsc/tests/mm_auth/mm_auth_test.c index b8777a8..0e3817b 100644 --- a/openbsc/tests/mm_auth/mm_auth_test.c +++ b/openbsc/tests/mm_auth/mm_auth_test.c @@ -8,6 +8,9 @@ #include #include +#include +#include + #define min(A,B) ((A)>(B)? (B) : (A)) static char *auth_tuple_str(struct gsm_auth_tuple *atuple) @@ -120,8 +123,8 @@ return auth_action; } -/* override libssl RAND_bytes() to get testable crypto results */ -int RAND_bytes(uint8_t *rand, int len) +/* override GnuTLS' gnutls_rnd() to get testable crypto results */ +int gnutls_rnd(gnutls_rnd_level_t level, void *rand, size_t len) { memset(rand, 23, len); return 1; diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index f1606cb..0925995 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -32,7 +32,7 @@ $(NULL) sgsn_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ @@ -66,7 +66,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index b4bcaf6..843a924 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -37,6 +37,9 @@ #include #include +#include +#include + #include void *tall_bsc_ctx; @@ -99,21 +102,22 @@ return 0; } -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *buf, size_t num) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, buf, num); } /* make results of A&C ref predictable */ -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t num) { + uint8_t *buf = (uint8_t *)data; if (num > 1) - return __real_RAND_bytes(buf, num); + return __real_gnutls_rnd(level, data, num); buf[0] = 0; return 1; } diff --git a/openbsc/tests/sndcp_xid/Makefile.am b/openbsc/tests/sndcp_xid/Makefile.am index 99b9d1a..e9e5d6f 100644 --- a/openbsc/tests/sndcp_xid/Makefile.am +++ b/openbsc/tests/sndcp_xid/Makefile.am @@ -14,7 +14,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lgtp -lrt -lm diff --git a/openbsc/tests/xid/Makefile.am b/openbsc/tests/xid/Makefile.am index aaf17ed..512dade 100644 --- a/openbsc/tests/xid/Makefile.am +++ b/openbsc/tests/xid/Makefile.am @@ -31,7 +31,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb 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 Wed Dec 21 10:31:00 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:31:00 +0000 Subject: openbsc[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1456 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I49cc9239b15dc77d782914ca2547e601d049acdc 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 Dec 21 10:31:12 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:31:12 +0000 Subject: libosmocore[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1455 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 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 Dec 21 10:31:17 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:31:17 +0000 Subject: [MERGED] libosmocore[master]: Catch-up with git version tags In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Catch-up with git version tags ...................................................................... Catch-up with git version tags * update debian/changelog * update TODO-RELEASE * add comments to Makefile.am and TODO-RELEASE to simplify the process in future * add link to libtool docs to Makefile.am to simplify LIBVERSION maintenance Related: OS#1861 Change-Id: I22c257e357f597519120232d742d6a61289db021 --- M TODO-RELEASE M debian/changelog M debian/control R debian/libosmocore8.install R debian/libosmogsm7.install M src/Makefile.am M src/codec/Makefile.am M src/ctrl/Makefile.am M src/gsm/Makefile.am M src/sim/Makefile.am M src/vty/Makefile.am 11 files changed, 51 insertions(+), 17 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/TODO-RELEASE b/TODO-RELEASE index 17f6521..fb0bfea 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,7 +1,9 @@ +# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install +# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info +# In short: +# LIBVERSION=c:r:a +# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. +# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0. +# If any interfaces have been added since the last public release: c:r:a + 1. +# If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -libosmogsm internal API update Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths -libosmocore change major external talloc dependency / internal talloc removal -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information -libosmocore change major size of ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information -libosmocore change major size of ph_tch_param struct changed / Extend with RTP Marker -libosmocore change major size of struct log_target changed / Extend with GSMTAP diff --git a/debian/changelog b/debian/changelog index 0877d27..a5ca3d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +libosmocore (0.9.6) unstable; urgency=medium + + * doc: osmocom-authn-protocol.txt: fix numbering, mark unused sync msgs + * New upstream release of libosmocore. + + -- Max Tue, 13 Dec 2016 18:23:56 +0100 + +libosmocore (0.9.5) unstable; urgency=medium + + * fix: DLGSUP logging category "unusable" + * New upstream release of libosmocore. + * ph_data_param struct changed / Extend L1SAP PH-DATA with measurement information + * size of ph_tch_param struct changed / Extend with RTP Marker + * size of struct log_target changed / Extend with GSMTAP + + -- Max Tue, 13 Dec 2016 18:22:56 +0100 + +libosmocore (0.9.4) unstable; urgency=medium + + * New upstream release of libosmocore. + * Internal API for GPRS cipher implementors updated to accommodate for arbitrary key lengths + * external talloc dependency / internal talloc removal + * size of ph_data_param struct changed / Extend L1SAP PH-DATA with presence information + + -- Max Tue, 13 Dec 2016 18:21:56 +0100 + libosmocore (0.9.3) unstable; urgency=medium * Send all stats values after re-configuration. diff --git a/debian/control b/debian/control index 468bd07..c91ce77 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Package: libosmocore Section: libs Architecture: any -Depends: libosmocodec0, libosmocore7, libosmogb4, libosmogsm5, libosmovty3, libosmoctrl0, ${misc:Depends} +Depends: libosmocodec0, libosmocore8, libosmogb4, libosmogsm7, libosmovty3, libosmoctrl0, ${misc:Depends} Multi-Arch: foreign Description: Open Source MObile COMmunications CORE library @@ -22,7 +22,7 @@ Multi-Arch: same Description: Osmo codec library -Package: libosmocore7 +Package: libosmocore8 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} @@ -36,7 +36,7 @@ Multi-Arch: same Description: Osmo GPRS GB library -Package: libosmogsm5 +Package: libosmogsm7 Section: libs Architecture: any Build-Depends: python (>= 2.7.6) diff --git a/debian/libosmocore7.install b/debian/libosmocore8.install similarity index 100% rename from debian/libosmocore7.install rename to debian/libosmocore8.install diff --git a/debian/libosmogsm5.install b/debian/libosmogsm7.install similarity index 100% rename from debian/libosmogsm5.install rename to debian/libosmogsm7.install diff --git a/src/Makefile.am b/src/Makefile.am index 6a9c675..0cf2665 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=7:0:0 +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=8:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall $(TALLOC_CFLAGS) diff --git a/src/codec/Makefile.am b/src/codec/Makefile.am index 5c69c28..f61d2fe 100644 --- a/src/codec/Makefile.am +++ b/src/codec/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include $(TALLOC_CFLAGS) diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am index b4a3da4..8bf3442 100644 --- a/src/ctrl/Makefile.am +++ b/src/ctrl/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index 4ea55e1..4ec441f 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -1,6 +1,7 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification -LIBVERSION=6:0:1 +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html +LIBVERSION=7:0:1 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am index bcdaf21..4d21f2a 100644 --- a/src/sim/Makefile.am +++ b/src/sim/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=0:0:0 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include diff --git a/src/vty/Makefile.am b/src/vty/Makefile.am index 620a8cb..52cdc8e 100644 --- a/src/vty/Makefile.am +++ b/src/vty/Makefile.am @@ -1,5 +1,6 @@ # This is _NOT_ the library release version, it's an API version. -# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification +# Please read chapter "Library interface versions" of the libtool documentation +# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html LIBVERSION=3:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -- To view, visit https://gerrit.osmocom.org/1427 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I22c257e357f597519120232d742d6a61289db021 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 10:31:19 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 10:31:19 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 1: libgnutls28-dev is the correct version - PS2 should work with it. -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb 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 Wed Dec 21 10:31:21 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:31:21 +0000 Subject: [MERGED] openbsc[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment debian/compat: update compatibility version debian/coryright: update to match Debian format Change-Id: I49cc9239b15dc77d782914ca2547e601d049acdc Related: OS#1694 --- M debian/compat M debian/control M debian/copyright M debian/rules 4 files changed, 194 insertions(+), 66 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index c37a5ca..79f18df 100644 --- a/debian/control +++ b/debian/control @@ -1,54 +1,102 @@ Source: openbsc +Maintainer: Harald Welte Section: net Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, libssl-dev, libc-ares-dev, libsmpp34-dev -Standards-Version: 3.8.4 -Homepage: http://openbsc.osmocom.org/ +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libgtp0-dev, + libosmocore-dev, + libosmo-sccp-dev, + libdbi0-dev, + dh-autoreconf, + libosmo-abis-dev, + libosmo-netif-dev, + libdbd-sqlite3, + libpcap-dev, + libssl-dev, + libc-ares-dev, + libsmpp34-dev +Standards-Version: 3.9.8 Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git Vcs-Browser: http://openbsc.osmocom.org/trac/browser +Homepage: https://projects.osmocom.org/projects/openbsc Package: osmocom-bsc Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: GSM Base Station Controller; BSC-only version of OpenBSC. Needs a real MSC! - Classical BSC which requires MSC to operate. +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: GSM Base Station Controller + This is the BSC-only version of OpenBSC. It requires a Mobile Switching Center + (MSC) to operate. + . + You might rather prefer to use osmocom-nitb which is considered a + "GSM Network-in-a-Box" and does not depend on a MSC. Package: osmocom-nitb Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3 +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libdbd-sqlite3 Description: GSM Network-in-a-Box, implements BSC, MSC, SMSC, HLR, VLR - All the GSM network components bundled together. + This is the Network-in-a-Box version of OpenBSC. It has all the GSM network + components bundled together. When using osmocom-nitb, there is no need for a + Mobile Switching Center (MSC) which is needed when using osmocom-bsc. Package: osmocom-ipaccess-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: Command line utilities for ip.access nanoBTS - Utilities specific for ip.access unit. + This package contains utilities that are specific for nanoBTS when being used + together with OpenBSC. It contains mainly three tools: ipaccess-find, + ipaccess-config and ipaccess-proxy. Package: osmocom-bs11-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: Command line utilities for Siemens BS-11 BTS - Utilities specific for BS-11 unit. + There is a tool in this package for configuring the Siemens BS-11 BTS. + Additionally, it contains one tool for making use of an ISDN-card and the + public telephone network as frequency standard for the E1 line. Package: osmocom-sgsn Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} +Suggests: osmocom-bsc Description: Osmocom Serving GPRS Support Node - SGSN implementation. + This is an implementation of the GPRS Serving GPRS Support Node (SGSN). As + such it implements the GPRS Mobility Management (GMM) and SM (Session + Management). + . + The SGSN connects via the Gb-interface to the BSS (like the osmo-pcu or an + ip.access nanoBTS), and it connects via the GTP protocol to a Gateway GPRS + Support Node (GGSN) like openggsn. Package: osmocom-gbproxy Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} +Recommends: osmocom-sgsn Description: Osmocom GPRS Gb Interface Proxy - Proxy for Gb interface. + The purpose of the Gb proxy is to aggregate the Gb links of multiple + BSS's and present them in one Gb link to the SGSN. + . + This package is part of OpenBSC and closely related to osmocom-sgsn. Package: osmocom-bsc-nat Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, + ${misc:Depends} +Recommends: osmocom-bsc Description: Osmocom Base Station Controller Network Address Translation - Network address translation for BSC. + This NAT is useful for masquerading multiple BSCs behind one. It listens + for incoming BSCs on port 5000 and connects to a specified Mobile Switching + Center (MSC). + . + This package is part of OpenBSC and closely related to osmocom-bsc. Package: osmo-gtphub Architecture: any diff --git a/debian/copyright b/debian/copyright index fbac90c..1e4dee1 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,47 +1,137 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: OpenBSC +Source: http://openbsc.osmocom.org/ - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2008-2015 Harald Welte + 2008-2015 Holger Hans Peter Freyther + 2009-2015 On-Waves + 2008 Jan Luebbe + 2008,2010-2011 Daniel Willmann + 2009,2011,2013 Andreas Eversberg + 2009,2011 Dieter Spaar + 2009 Mike Haben + 2010 Sylvain Munaut <246tnt at gmail.com> + 2012-2013 Pablo Neira Ayuso + 2013-2015 Sysmocom s.f.m.c. GmbH (Jacob Erlbeck) + 2014 Alexander Chemeris +License: AGPL-3+ +Comment: Contributions by Stefan Schmidt as well -It was downloaded from: +Files: wireshark/0001-abis_oml.patch + wireshark/0002-ericsson_rbs2409.patch + wireshark/0003-lucent-hnb.patch + wireshark/0005-rsl-hsl.patch +Copyright: 1998 Gerald Combs + 2007,2011 Anders Broman + 2009 Holger Hans Peter Freyther + 2009-2011 Harald Welte +License: GPL-2+ - git://bs11-abis.gnumonks.org/openbsc.git +Files: openbsc/include/mISDNif.h +Copyright: 2008 Karsten Keil +License: LGPL-2.1 -Upstream Authors: +Files: openbsc/src/libmgcp/g711common.h +Copyright: 2009 Abramo Bagnara +License: GPL-2+ - Harald Welte - Dieter Spaar - Holger Hans Peter Freyther - Sylvain Munaut - Daniel Willmann - Jan Luebbe - Mike Haben - Andreas Eversberg +Files: openbsc/git-version-gen +Copyright: 2007-2010 Free Software Foundation +License: GPL-3+ -Copyright: +Files: openbsc/osmoappdesc.py + openbsc/tests/smpp_test_runner.py + openbsc/tests/ctrl_test_runner.py + openbsc/tests/vty_test_runner.py +Copyright: 2013 Katerina Barone-Adesi + 2013 Jacob Erlbeck + 2013-2014 Holger Hans Peter Freyther +License: GPL-3+ - Copyright (C) 2008-2010 Harald Welte - Copyright (C) 2008-2009 Dieter Spaar - Copyright (C) 2008-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 Sylvain Munaut - Copyright (C) 2009-2010 On-Waves - Copyright (C) 2008 Daniel Willmann - Copyright (C) 2008 Jan Luebbe - Copyright (C) 2009 by Mike Haben - Copyright (C) 2009 Andreas Eversberg +Files: openbsc/src/libbsc/bsc_ctrl_lookup.c +Copyright: 2010-2011 Daniel Willmann + 2010-2011 On-Waves +License: GPL-2+ -License: +Files: openbsc/src/libmsc/mncc_sock.c + openbsc/src/libmsc/mncc_builtin.c +Copyright: 2008-2010 Harald Welte + 2009 Andreas Eversberg + 2012 Holger Hans Peter Freyther +License: GPL-2+ - GNU General Public License, Version 2 or later +Files: debian/* +Copyright: 2012-2015 Holger Hans Peter Freyther + 2016 Ruben Undheim +License: GPL-2+ -The Debian packaging is: - Copyright (C) 2010 Harald Welte +License: AGPL-3+ + This package 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 . -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +License: GPL-3+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-2.1 + 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; version + 2.1 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in + "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index ee632a2..4e187a6 100755 --- a/debian/rules +++ b/debian/rules @@ -1,14 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. -# -# Modified to make a template file for a multi-binary package with separated -# build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -17,10 +7,10 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -export DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: - dh --sourcedirectory=openbsc --with autoreconf $@ + dh $@ --sourcedirectory=openbsc --with autoreconf # This is needed for debian stable (squeeze) override_dh_autoreconf: -- To view, visit https://gerrit.osmocom.org/1456 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I49cc9239b15dc77d782914ca2547e601d049acdc 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 Dec 21 10:33:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:33:02 +0000 Subject: osmo-hlr[master]: gsup: send subscriber MSISDN In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1454 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 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 Dec 21 10:34:30 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:34:30 +0000 Subject: openbsc[master]: Turn some warnings into errors In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 > Good point. -Werror=null-dereference and -Werror=sizeof-array-argument > are not supported by gcc 4.9.2. Is there particular gcc version we > care about? I would say we shouldn't introduce arbitrary compiler dependencies without a good reason. at the very least we shuold go back to 4.7.x, but probably further. Why not use autoconf to check for those options and then conditionally enable them based on compiler support? -- To view, visit https://gerrit.osmocom.org/1368 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied9c950dafa65f324cf31298b13b590f56139700 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-Reviewer: Neels Hofmeyr Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Wed Dec 21 10:35:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:35:24 +0000 Subject: osmo-bts[master]: Optionally use adaptive RTP jitter buffering In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1442 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I489f3c419039f40b57c2ef0641c176478b8d3566 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 Wed Dec 21 10:35:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:35:35 +0000 Subject: [MERGED] osmo-bts[master]: Optionally use adaptive RTP jitter buffering In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Optionally use adaptive RTP jitter buffering ...................................................................... Optionally use adaptive RTP jitter buffering * add vty option to manually enable adaptive RTP jitter buffering (disabled by default) on per-bts level * use this setting on per-lchan level when setting jitter parameters via vty at runtime * check and log result of osmo_rtp_socket_set_param() * note: older libosmo-abis will ignore this setting which will be properly detected via return value * if jitter buffer is disabled by configuring "rtp jitter-buffer 0" than adaptive buffering is disabled as well but it will be used if jitter buffer is set to different value for a givel lchan via vty Change-Id: I489f3c419039f40b57c2ef0641c176478b8d3566 --- M include/osmo-bts/gsm_data.h M src/common/bts.c M src/common/rsl.c M src/common/vty.c 4 files changed, 34 insertions(+), 9 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index f1c9601..772a705 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -86,6 +86,7 @@ char *bsc_oml_host; struct llist_head oml_queue; unsigned int rtp_jitter_buf_ms; + bool rtp_jitter_adaptive; struct { uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */ } support; diff --git a/src/common/bts.c b/src/common/bts.c index 2005e42..9c2f0e0 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -109,6 +109,7 @@ /* configurable via VTY */ btsb->paging_state = paging_init(btsb, 200, 0); btsb->ul_power_target = -75; /* dBm default */ + btsb->rtp_jitter_adaptive = false; /* configurable via OML */ btsb->load.ccch.load_ind_period = 112; diff --git a/src/common/rsl.c b/src/common/rsl.c index 8d1175d..9e9cbb6 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1652,9 +1652,19 @@ return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL, inc_ip_port, dch->c.msg_type); } - osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, - OSMO_RTP_P_JITBUF, - btsb->rtp_jitter_buf_ms); + rc = osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, + btsb->rtp_jitter_adaptive ? + OSMO_RTP_P_JIT_ADAP : + OSMO_RTP_P_JITBUF, + btsb->rtp_jitter_buf_ms); + if (rc < 0) + LOGP(DRSL, LOGL_ERROR, + "%s IPAC Failed to set RTP socket parameters: %s\n", + gsm_lchan_name(lchan), strerror(-rc)); + else + LOGP(DRSL, LOGL_INFO, + "%s IPAC set RTP socket parameters: %d\n", + gsm_lchan_name(lchan), rc); lchan->abis_ip.rtp_socket->priv = lchan; lchan->abis_ip.rtp_socket->rx_cb = &l1sap_rtp_rx_cb; diff --git a/src/common/vty.c b/src/common/vty.c index 0fffca0..b48afa4 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -276,8 +276,10 @@ vty_out(vty, " ipa unit-id %u %u%s", bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); vty_out(vty, " oml remote-ip %s%s", btsb->bsc_oml_host, VTY_NEWLINE); - vty_out(vty, " rtp jitter-buffer %u%s", btsb->rtp_jitter_buf_ms, - VTY_NEWLINE); + vty_out(vty, " rtp jitter-buffer %u", btsb->rtp_jitter_buf_ms); + if (btsb->rtp_jitter_adaptive) + vty_out(vty, " adaptive"); + vty_out(vty, "%s", VTY_NEWLINE); vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(btsb->paging_state), VTY_NEWLINE); vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(btsb->paging_state), @@ -487,13 +489,15 @@ DEFUN(cfg_bts_rtp_jitbuf, cfg_bts_rtp_jitbuf_cmd, - "rtp jitter-buffer <0-10000>", + "rtp jitter-buffer <0-10000> [adaptive]", RTP_STR "RTP jitter buffer\n" "jitter buffer in ms\n") { struct gsm_bts *bts = vty->index; struct gsm_bts_role_bts *btsb = bts_role_bts(bts); btsb->rtp_jitter_buf_ms = atoi(argv[0]); + if (argc > 1) + btsb->rtp_jitter_adaptive = true; return CMD_SUCCESS; } @@ -1003,7 +1007,8 @@ { struct gsm_network *net = gsmnet_from_vty(vty); struct gsm_lchan *lchan; - int jitbuf_ms = atoi(argv[4]); + struct gsm_bts_role_bts *btsb; + int jitbuf_ms = atoi(argv[4]), rc; lchan = resolve_lchan(net, argv, 0); if (!lchan) { @@ -1015,8 +1020,16 @@ VTY_NEWLINE); return CMD_WARNING; } - osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, - OSMO_RTP_P_JITBUF, jitbuf_ms); + btsb = bts_role_bts(lchan->ts->trx->bts); + rc = osmo_rtp_socket_set_param(lchan->abis_ip.rtp_socket, + btsb->rtp_jitter_adaptive ? + OSMO_RTP_P_JIT_ADAP : OSMO_RTP_P_JITBUF, + jitbuf_ms); + if (rc < 0) + vty_out(vty, "%% error setting jitter parameters: %s%s", + strerror(-rc), VTY_NEWLINE); + else + vty_out(vty, "%% jitter parameters set: %d%s", rc, VTY_NEWLINE); return CMD_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/1442 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I489f3c419039f40b57c2ef0641c176478b8d3566 Gerrit-PatchSet: 1 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 Wed Dec 21 10:35:55 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:35:55 +0000 Subject: libosmo-abis[master]: Remove obsolete compile-time conditional In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1441 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If8f87587227b09635361b758873f75d8b6aa3497 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis 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 Dec 21 10:35:58 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:35:58 +0000 Subject: [MERGED] libosmo-abis[master]: Remove obsolete compile-time conditional In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Remove obsolete compile-time conditional ...................................................................... Remove obsolete compile-time conditional Change-Id: If8f87587227b09635361b758873f75d8b6aa3497 --- M src/trau/osmo_ortp.c 1 file changed, 0 insertions(+), 4 deletions(-) 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 0f0b9e5..8171655 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -106,11 +106,7 @@ static void ortp_sig_cb_ssrc(RtpSession *rs, void *data) { int port = rtp_session_get_local_port(rs); -#if 0 /* post 0.20.0 ORTP has this function */ uint32_t ssrc = rtp_session_get_recv_ssrc(rs); -#else - uint32_t ssrc = rs->rcv.ssrc; -#endif LOGP(DLMIB, LOGL_INFO, "osmo-ortp(%d): ssrc_changed to 0x%08x\n", port, ssrc); -- To view, visit https://gerrit.osmocom.org/1441 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If8f87587227b09635361b758873f75d8b6aa3497 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Dec 21 10:36:25 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:36:25 +0000 Subject: libosmo-abis[master]: Enable adaptive jitter compensation In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 21 10:36:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:36:26 +0000 Subject: [MERGED] libosmo-abis[master]: Enable adaptive jitter compensation In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Enable adaptive jitter compensation ...................................................................... Enable adaptive jitter compensation * check RTP socket parameter and enable necessary jitter buffering * return the status of requested jitter buffering instead of always returning 0 * document function parameters and return value Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 --- M src/trau/osmo_ortp.c 1 file changed, 16 insertions(+), 10 deletions(-) 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 8171655..d4d4ff5 100644 --- a/src/trau/osmo_ortp.c +++ b/src/trau/osmo_ortp.c @@ -278,28 +278,35 @@ create_payload_types(); } +/*! \brief Set Osmocom RTP socket parameters + * \param[in] rs OsmoRTP socket + * \param[in] param defined which parameter to set + OSMO_RTP_P_JITBUF - enables regular jitter buffering + OSMO_RTP_P_JIT_ADAP - enables adaptive jitter buffering + * \param[in] val Size of jitter buffer (in ms), 0 means disable buffering + * \returns negative value on error, 0 or 1 otherwise + (depending on whether given jitter buffering is enabled) + */ int osmo_rtp_socket_set_param(struct osmo_rtp_socket *rs, enum osmo_rtp_param param, int val) { - int rc = 0; - switch (param) { + case OSMO_RTP_P_JIT_ADAP: + rtp_session_enable_adaptive_jitter_compensation(rs->sess, + (bool)val); + /* fall-through on-purpose - we have to set val anyway */ case OSMO_RTP_P_JITBUF: rtp_session_enable_jitter_buffer(rs->sess, (val) ? TRUE : FALSE); if (val) rtp_session_set_jitter_compensation(rs->sess, val); break; -#if 0 - case OSMO_RTP_P_JIT_ADAP: - rc = jitter_control_enable_adaptive(rs->sess, val); - break; -#endif default: return -EINVAL; } - - return rc; + if (param == OSMO_RTP_P_JIT_ADAP) + return rtp_session_adaptive_jitter_compensation_enabled(rs->sess); + return rtp_session_jitter_buffer_enabled(rs->sess); } /*! \brief Create a new RTP socket @@ -328,7 +335,6 @@ rtp_session_set_data(rs->sess, rs); rtp_session_set_profile(rs->sess, osmo_pt_profile); rtp_session_set_jitter_compensation(rs->sess, 100); - //jitter_control_enable_adaptive(rs->sess, 0); rtp_session_signal_connect(rs->sess, "ssrc_changed", (RtpCallback) ortp_sig_cb_ssrc, -- To view, visit https://gerrit.osmocom.org/1436 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I87d4d9fe990683adbb02b64cb39b78de533d8046 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 21 10:37:09 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:37:09 +0000 Subject: libosmocore[master]: utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c Gerrit-PatchSet: 3 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 Wed Dec 21 10:37:13 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Wed, 21 Dec 2016 10:37:13 +0000 Subject: [MERGED] libosmocore[master]: utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros ...................................................................... utils.h: add OSMO_STRINGIFY and OSMO_VALUE_STRING macros OSMO_STRINGIFY particularly allows putting port numbers from a #define into VTY doc strings, like: #define FOO_PORT 2342 DEFUN(..., "Foo UDP port (default: " OSMO_STRINGIFY(FOO_PORT) ")\n") OSMO_VALUE_STRING creates value_string items with the string being exactly the enum value's name. Replaces a similar macro def in fsm.c Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c --- M include/osmocom/core/utils.h M src/fsm.c 2 files changed, 9 insertions(+), 7 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/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 3c6fc98..41bbc27 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -15,6 +15,10 @@ #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b)) /*! \brief Return the minimum of two specified values */ #define OSMO_MIN(a, b) ((a) >= (b) ? (b) : (a)) +/*! \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) } #include diff --git a/src/fsm.c b/src/fsm.c index 16699fa..842c766 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -476,14 +476,12 @@ file, line); } -#define ENUM_VAL_TO_VALUE_STRING(X) { X, #X } - const struct value_string osmo_fsm_term_cause_names[] = { - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_PARENT), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_ERROR), - ENUM_VAL_TO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), + OSMO_VALUE_STRING(OSMO_FSM_TERM_PARENT), + OSMO_VALUE_STRING(OSMO_FSM_TERM_REQUEST), + OSMO_VALUE_STRING(OSMO_FSM_TERM_REGULAR), + OSMO_VALUE_STRING(OSMO_FSM_TERM_ERROR), + OSMO_VALUE_STRING(OSMO_FSM_TERM_TIMEOUT), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1440 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I857af45ae602bb9a647ba26cf8b0d1b23403b54c 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 From gerrit-no-reply at lists.osmocom.org Wed Dec 21 11:38:42 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 11:38:42 +0000 Subject: [PATCH] libosmocore[master]: Integrate Debian packaging changes 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/1455 to look at the new patch set (#3). Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * move build-depends to a proper place * update project URL debian/rules: * use proper hardening syntax * strip linker option without explicit shell invocation * remove useless comment * add extra cleanup debian/: package documentation separately debian/docs: remove empty file debian/coryright: update to match Debian format Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Related: OS#1694 --- M debian/control M debian/copyright D debian/docs A debian/libosmocodec-doc.doc-base A debian/libosmocodec-doc.install D debian/libosmocore-dev.dirs M debian/libosmocore-dev.install A debian/libosmocore-doc.doc-base A debian/libosmocore-doc.install A debian/libosmogsm-doc.doc-base A debian/libosmogsm-doc.install A debian/libosmovty-doc.doc-base A debian/libosmovty-doc.install M debian/rules 14 files changed, 462 insertions(+), 77 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/1455/3 diff --git a/debian/control b/debian/control index c91ce77..4cdb672 100644 --- a/debian/control +++ b/debian/control @@ -1,87 +1,275 @@ Source: libosmocore +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev, python-minimal -Standards-Version: 3.9.6 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + doxygen, + libpcsclite-dev, + pkg-config, + libtalloc-dev, + python (>= 2.7.6) +Standards-Version: 3.9.8 Vcs-Git: git://git.osmocom.org/libosmocore.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmocore Package: libosmocore Section: libs Architecture: any -Depends: libosmocodec0, libosmocore8, libosmogb4, libosmogsm7, libosmovty3, libosmoctrl0, ${misc:Depends} Multi-Arch: foreign -Description: Open Source MObile COMmunications CORE library +Depends: libosmocodec0 (= ${binary:Version}), + libosmocore8 (= ${binary:Version}), + libosmogb4 (= ${binary:Version}), + libosmogsm7 (= ${binary:Version}), + libosmovty3 (= ${binary:Version}), + libosmoctrl0 (= ${binary:Version}), + libosmosim0 (= ${binary:Version}), + ${misc:Depends} +Description: Open Source MObile COMmunications CORE library (metapackage) + The libraries provided by this package contain various utility functions. + These were originally developed as part of the + OpenBSC project but are of a more generic nature and thus useful to (at + least) other programs that are developed in the sphere of Free Software / Open + Source mobile communication. Package: libosmocodec0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo codec library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocodec library in particular contains the implementation of multiple + GSM codecs: + . + - GSM 06.10 - GSM FR Codec + - GSM 06.20 - GSM HR Codec + - GSM 06.60 - GSM EFR Codec + - GSM 06.90 - GSM AMR Codec + +Package: libosmocodec-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmocodec0, + libjs-jquery +Description: Documentation for the osmo codec library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmocodec library. Package: libosmocore8 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocore8 library in particular is a collection of common code used in + various sub-projects inside the Osmocom family of projects. + +Package: libosmocore-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmocore8, + libjs-jquery, + libosmocodec-doc, + libosmogsm-doc, + libosmovty-doc +Description: Documentation for the Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmocore library. Package: libosmogb4 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GPRS GB library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogb library in particular contains a GPRS BSSGP protocol + implementation. Package: libosmogsm7 Section: libs Architecture: any -Build-Depends: python (>= 2.7.6) -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogsm library in particular is a collection of common code used in + various GSM related sub-projects inside the Osmocom family of projects. It + includes A5/1 and A5/2 ciphers, COMP128v1, a LAPDm implementation, a GSM TLV + parser, SMS utility routines as well as protocol definitions for a series of + protocols. + +Package: libosmogsm-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmogsm7, + libjs-jquery +Description: Documentation for the Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmogsm library. Package: libosmovty3 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmovty library in particular implements the interactive command-line + on the VTY (Virtual TTY) as well as configuration file parsing. + +Package: libosmovty-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmovty3, + libjs-jquery +Description: Documentation for the Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmovty library. Package: libosmoctrl0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo control library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmoctrl library in particular contains an SNMP-like status interface. Package: libosmosim0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo SIM library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmosim library in particular contains routines for SIM card access. Package: libosmocore-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmocore, libtalloc-dev Multi-Arch: same +Section: libdevel +Depends: libosmocore, + libtalloc-dev, + ${misc:Depends} Description: Development headers for Open Source MObile COMmunications CORE library + The header files provided by this package may be used to develop + with any of the libosmocore libraries. + . + Also static libraries are installed with this package. Package: libosmocore-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore +Section: utils +Depends: ${shlibs:Depends}, + libosmocore, + ${misc:Depends} Multi-Arch: same Description: Utilities for gsm + This package contains a program for frequency calculation for GSM called + 'osmo-arfcn' and a program called 'osmo-auc-gen' that is used for testing GSM + authentication. + . + They use the libosmocore library. The libosmocore library contain various + utility functions that were originally developed as part of the OpenBSC + project, but which are of a more generic nature and thus useful to (at least) + other programs that are developed in the sphere of Free Software / Open Source + mobile communication. Package: libosmocore-dbg Architecture: any +Multi-Arch: same Section: debug Priority: extra -Depends: libosmocore (= ${binary:Version}), ${misc:Depends} -Multi-Arch: same +Depends: libosmocore (= ${binary:Version}), + ${misc:Depends} Description: Debug symbols for Open Source MObile COMmunications CORE library + This proackage contains debug symbols for all the libraries that are part of + libosmocore. + . + The libosmocore library contain various utility functions that + were originally developed as part of the OpenBSC project, but which are of a + more generic nature and thus useful to (at least) other programs that are + developed in the sphere of Free Software / Open Source mobile communication. diff --git a/debian/copyright b/debian/copyright index c450be5..2991c85 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,54 +1,211 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmocore.git - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2008 Daniel Willmann + 2008-2010 Harald Welte + 2008-2010 Holger Hans Peter Freyther + 2009-2010 Sylvain Munaut + 2009-2010 On-Waves + 2010 Nico Golde +License: GPL-2+ -It was downloaded from: +Files: src/talloc.c include/osmocom/core/talloc.h +Copyright: 2004 Andrew Tridgell + 2006 Stefan Metzmacher +License: LGPL-3+ - git://git.osmocom.org/libosmocore.git +Files: include/osmocom/core/loggingrb.h + include/osmocom/core/strrb.h + src/strrb.c + src/loggingrb.c +Copyright: 2012-2013 Katerina Barone-Adesi +License: GPL-2+ -Upstream Author(s): +Files: include/osmocom/core/linuxrbtree.h + src/rbtree.c +Copyright: 1999 Andrea Arcangeli + 2002 David Woodhouse +License: GPL-2+ - Harald Welte - Holger Hans Peter Freyther - Sylvain Munaut - Daniel Willmann - Golde - For src/talloc.c and include/osmocore/talloc.h: - Andrew Tridgell - Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Kunihiro Ishiguro +Files: include/osmocom/core/crc16.h +Copyright: 2005 Ben Gardner +License: GPL-2+ -Copyright: +Files: src/utils.c +Copyright: 2011 Harald Welte + 2011 Sylvain Munaut + 2014 Nils O. Sel?sdal +License: GPL-2+ - Copyright (C) 2008-2010 Harald Welte - Copyright (C) 2008-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 Sylvain Munaut - Copyright (C) 2009-2010 On-Waves - Copyright (C) 2008 Daniel Willmann - Copyright (C) 2010 Nico Golde - For src/talloc.c and include/osmocore/talloc.h: - Copyright (C) 2004 Andrew Tridgell - Copyright (C) 2006 Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Copyright (C) 1998 Kunihiro Ishiguro +Files: src/gsm/gsm48_ie.c + src/gsm/lapd_core.c + src/gsm/lapdm.c +Copyright: 2008,2010-2011 Harald Welte + 2009-2011 Andreas Eversberg +License: GPL-2+ -License: +Files: src/gsm/gsm0411_smc.c + src/gsm/gsm0411_smr.c + src/gsm/gsm0411_utils.c +Copyright: 2008 Daniel Willmann + 2009 Harald Welte + 2010-2013 Holger Hans Peter Freyther + 2010 On-Waves + 2011 Andreas Eversberg +License: GPL-2+ - GNU General Public License, Version 2 or later +Files: src/gsm/gsm0480.c +Copyright: 2009 Mike Haben + 2010 Holger Hans Peter Freyther +License: GPL-2+ -The Debian packaging is: +Files: src/gsm/milenage/aes-internal.c + src/gsm/milenage/aes-encblock.c + src/gsm/milenage/aes.h + src/gsm/milenage/milenage.c + src/gsm/milenage/aes_wrap.h + src/gsm/milenage/aes-internal-enc.c + src/gsm/milenage/aes_i.h +Copyright: 2003-2007 Jouni Malinen +License: GPL-2 +Comment: Most of the file aes-internal.c is public_domain - Copyright (C) 2010 Harald Welte +Files: include/osmocom/core/bitXXgen.h.tpl + src/gsm/kasumi.c +Copyright: 2013-2014 Max +License: GPL-2+ -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. +Files: src/gsm/auth_comp128v23.c +Copyright: 2010-2011 Harald Welte + 2013 K?vin Redon +License: GPL-2+ -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +Files: src/gsm/comp128v23.c +Copyright: 2013 K?vin Redon +License: GPL-2+ -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +Files: tests/fr/fr_test.c + tests/logging/logging_test.c + tests/loggingrb/loggingrb_test.c +Copyright: 2008,2009,2012 Holger Hans Peter Freyther + 2012-2013 Katerina Barone-Adesi +License: AGPL-3+ + +Files: tests/strrb/strrb_test.c + tests/vty/vty_test.c +Copyright: 2012-2013 Katerina Barone-Adesi + 2013 Jacob Erlbeck +License: GPL-3+ + +Files: src/vty/* include/osmocom/vty/* +Copyright: 1997,1998 Kunihiro Ishiguro +License: GPL-2+ + +Files: include/osmocom/core/stats.h + src/stat_item.c + src/stats.c + src/vty/stats_vty.c + tests/stats/stats_test.c +Copyright: 2009-2010 by Harald Welte + 2009-2014 by Holger Hans Peter Freyther + 2015 Sysmocom s.f.m.c. GmbH +License: GPL-2+ + +Files: tests/gb/gprs_ns_test.c + tests/gb/gprs_bssgp_test.c +Copyright: 2013-2014 sysmocom s.f.m.c. GmbH +License: GPL-2+ +Comment: No license is listed in these files, but it is assumed that + the project specific license GPL-2+ applies since contributions by + sysmocom people to other files in this package are GPL licensed. + +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2014-2015 Ruben Undheim +License: GPL-3+ + + +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-2 + This package 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, version 2 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-3+ + 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 3 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 3 can be found in "/usr/share/common-licenses/LGPL-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 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/docs b/debian/docs deleted file mode 100644 index e69de29..0000000 --- a/debian/docs +++ /dev/null diff --git a/debian/libosmocodec-doc.doc-base b/debian/libosmocodec-doc.doc-base new file mode 100644 index 0000000..8480c73 --- /dev/null +++ b/debian/libosmocodec-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmocodec-doc +Title: Documentation for the libosmocodec library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/codec/html/index.html +Files: /usr/share/doc/libosmocore/codec/html/*.html diff --git a/debian/libosmocodec-doc.install b/debian/libosmocodec-doc.install new file mode 100644 index 0000000..be0255b --- /dev/null +++ b/debian/libosmocodec-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/codec/ diff --git a/debian/libosmocore-dev.dirs b/debian/libosmocore-dev.dirs deleted file mode 100644 index 94090a3..0000000 --- a/debian/libosmocore-dev.dirs +++ /dev/null @@ -1,8 +0,0 @@ -usr/lib -usr/include -usr/include/osmocom -usr/include/osmocom/codec -usr/include/osmocom/core -usr/include/osmocom/crypt -usr/include/osmocom/gsm -usr/include/osmocom/vty diff --git a/debian/libosmocore-dev.install b/debian/libosmocore-dev.install index 7c5a789..465f933 100644 --- a/debian/libosmocore-dev.install +++ b/debian/libosmocore-dev.install @@ -3,4 +3,3 @@ usr/lib/*/lib*.so usr/lib/*/lib*.la usr/lib/*/pkgconfig/* -usr/share/doc/libosmocore/* diff --git a/debian/libosmocore-doc.doc-base b/debian/libosmocore-doc.doc-base new file mode 100644 index 0000000..b13b82d --- /dev/null +++ b/debian/libosmocore-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmocore-doc +Title: Documentation for the libosmocore library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/core/html/index.html +Files: /usr/share/doc/libosmocore/core/html/*.html diff --git a/debian/libosmocore-doc.install b/debian/libosmocore-doc.install new file mode 100644 index 0000000..fe4cb26 --- /dev/null +++ b/debian/libosmocore-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/core/ diff --git a/debian/libosmogsm-doc.doc-base b/debian/libosmogsm-doc.doc-base new file mode 100644 index 0000000..6318c1d --- /dev/null +++ b/debian/libosmogsm-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmogsm-doc +Title: Documentation for the libosmogsm library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/gsm/html/index.html +Files: /usr/share/doc/libosmocore/gsm/html/*.html diff --git a/debian/libosmogsm-doc.install b/debian/libosmogsm-doc.install new file mode 100644 index 0000000..a4300bc --- /dev/null +++ b/debian/libosmogsm-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/gsm/ diff --git a/debian/libosmovty-doc.doc-base b/debian/libosmovty-doc.doc-base new file mode 100644 index 0000000..dde189c --- /dev/null +++ b/debian/libosmovty-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmovty-doc +Title: Documentation for the libosmovty library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/vty/html/index.html +Files: /usr/share/doc/libosmocore/vty/html/*.html diff --git a/debian/libosmovty-doc.install b/debian/libosmovty-doc.install new file mode 100644 index 0000000..634ba41 --- /dev/null +++ b/debian/libosmovty-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/vty/ diff --git a/debian/rules b/debian/rules index 3cce05e..e173510 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -13,10 +7,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -# Our tests want to override symbols, make it possible on Ubuntu -export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS | sed -e 's/-Wl,-Bsymbolic-functions//') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all -export DEB_BUILD_HARDENING=1 +export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions %: dh $@ --with autoreconf --fail-missing @@ -38,3 +31,27 @@ override_dh_auto_configure: dh_auto_configure -- --enable-static + +override_dh_clean: + dh_clean + $(RM) .version + $(RM) debian/man/osmo-arfcn.1 + $(RM) debian/man/osmo-auc-gen.1 + $(RM) include/osmocom/core/bit16gen.h + $(RM) include/osmocom/core/bit32gen.h + $(RM) include/osmocom/core/bit64gen.h + $(RM) include/osmocom/core/crc16gen.h + $(RM) include/osmocom/core/crc32gen.h + $(RM) include/osmocom/core/crc64gen.h + $(RM) include/osmocom/core/crc8gen.h + $(RM) src/crc16gen.c + $(RM) src/crc32gen.c + $(RM) src/crc64gen.c + $(RM) src/crc8gen.c + $(RM) tests/package.m4 + $(RM) tests/testsuite + $(RM) -r doc/codec/ + $(RM) -r doc/core/ + $(RM) -r doc/gsm/ + $(RM) -r doc/vty/html/ + $(RM) -r doc/vty/latex/ -- To view, visit https://gerrit.osmocom.org/1455 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Gerrit-PatchSet: 3 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 Dec 21 11:53:43 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 11:53:43 +0000 Subject: [PATCH] openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1464 to look at the new patch set (#3). Migrate from OpenSSL to GnuTLS This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Related: OS#1694 --- M debian/control M openbsc/configure.ac M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gb_proxy.c M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_sgsn.c M openbsc/src/libiu/Makefile.am M openbsc/src/libmsc/Makefile.am M openbsc/src/libmsc/auth.c M openbsc/src/libmsc/db.c M openbsc/src/osmo-bsc_nat/Makefile.am M openbsc/src/osmo-bsc_nat/bsc_nat.c M openbsc/src/osmo-nitb/Makefile.am M openbsc/tests/channel/Makefile.am M openbsc/tests/db/Makefile.am M openbsc/tests/gbproxy/Makefile.am M openbsc/tests/gbproxy/gbproxy_test.c M openbsc/tests/mm_auth/Makefile.am M openbsc/tests/mm_auth/mm_auth_test.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sndcp_xid/Makefile.am M openbsc/tests/xid/Makefile.am 24 files changed, 91 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/1464/3 diff --git a/debian/control b/debian/control index 79f18df..d4ee0c2 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, - libssl-dev, + libgnutls28-dev, libc-ares-dev, libsmpp34-dev Standards-Version: 3.9.8 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 0753834..3bf497d 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -37,7 +37,10 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5) +PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 3.3.0) + +AC_SUBST(LIBGNUTLS_CFLAGS) +AC_SUBST(LIBGNUTLS_LIBS) # Enabke/disable the NAT? AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])], diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index cff17dd..40e7feb 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -15,7 +15,7 @@ $(LIBOSMOGB_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(LIBCARES_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBGTP_CFLAGS) \ $(NULL) if BUILD_IU @@ -63,7 +63,7 @@ osmo_gbproxy_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ $(OSMO_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) @@ -98,7 +98,7 @@ $(OSMO_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ -lgtp \ -lm \ diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index d95139f..c16124a 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -51,7 +51,8 @@ #include #include -#include +#include +#include static const struct rate_ctr_desc global_ctr_description[] = { { "inv-bvci", "Invalid BVC Identifier " }, @@ -236,7 +237,8 @@ bss_ptmsi = sgsn_ptmsi; } else { do { - if (RAND_bytes((uint8_t *) &bss_ptmsi, sizeof(bss_ptmsi)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &bss_ptmsi, + sizeof(bss_ptmsi)) < 0) { bss_ptmsi = GSM_RESERVED_TMSI; break; } @@ -273,7 +275,8 @@ } else { do { /* create random TLLI, 0b01111xxx... */ - if (RAND_bytes((uint8_t *) &sgsn_tlli, sizeof(sgsn_tlli)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &sgsn_tlli, + sizeof(sgsn_tlli)) < 0) { sgsn_tlli = 0; break; } diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 363b457..1a1338a 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -31,7 +31,8 @@ #include #include -#include +#include +#include #include "bscconfig.h" @@ -551,9 +552,9 @@ /* ? 10.5.5.7: */ acreq->force_stby = force_standby; /* 3GPP TS 24.008 ? 10.5.5.19: */ - if (RAND_bytes(&rbyte, 1) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed for A&C ref, falling " - "back to rand()\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, &rbyte, 1) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed for A&C ref, falling" + " back to rand()\n"); acreq->ac_ref_nr = rand(); } else acreq->ac_ref_nr = rbyte; @@ -1195,8 +1196,8 @@ }; /* XXX: Hack to make 3G auth work with special SIM card */ ctx->auth_state = SGSN_AUTH_AUTHENTICATE; - - RAND_bytes(tmp_rand, 16); + /* FIXME: check return value and propagate error */ + gnutls_rnd(GNUTLS_RND_NONCE, tmp_rand, 16); memset(&ctx->auth_triplet.vec, 0, sizeof(ctx->auth_triplet.vec)); osmo_auth_gen_vec(&ctx->auth_triplet.vec, &auth, tmp_rand); diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index c2c3900..47f3996 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include @@ -1070,8 +1071,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } @@ -1103,8 +1104,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e85e1a9..a8f5e39 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -45,7 +45,8 @@ #include -#include +#include +#include #define GPRS_LLME_CHECK_TICK 30 @@ -614,7 +615,7 @@ int max_retries = 100; restart: - if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &ptmsi, sizeof(ptmsi)) < 0) goto failed; /* Enforce that the 2 MSB are set without loosing the distance between diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am index e5f9e27..0070679 100644 --- a/openbsc/src/libiu/Makefile.am +++ b/openbsc/src/libiu/Makefile.am @@ -7,7 +7,7 @@ AM_CFLAGS = \ -Wall \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBASN1C_CFLAGS) \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index 9d966db..20a0876 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -10,7 +10,7 @@ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ $(NULL) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..f1f468f 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -27,7 +27,8 @@ #include -#include +#include +#include #include @@ -123,8 +124,10 @@ } atuple->use_count = 1; - if (RAND_bytes(atuple->vec.rand, sizeof(atuple->vec.rand)) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, atuple->vec.rand, + sizeof(atuple->vec.rand)) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed, can't generate new" + " auth tuple\n"); return AUTH_ERROR; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..ccd4762 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -40,7 +40,8 @@ #include #include -#include +#include +#include /* Semi-Private-Interface (SPI) for the subscriber code */ void subscr_direct_free(struct gsm_subscriber *subscr); @@ -1223,8 +1224,9 @@ char *tmsi_quoted; for (;;) { - if (RAND_bytes((uint8_t *) &subscriber->tmsi, sizeof(subscriber->tmsi)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &subscriber->tmsi, + sizeof(subscriber->tmsi)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (subscriber->tmsi == GSM_RESERVED_TMSI) @@ -1303,8 +1305,9 @@ uint32_t try; for (;;) { - if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &try, + sizeof(try)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (!try) /* 0 is an invalid token */ diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am index be33d28..af99d11 100644 --- a/openbsc/src/osmo-bsc_nat/Makefile.am +++ b/openbsc/src/osmo-bsc_nat/Makefile.am @@ -13,7 +13,7 @@ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMONETIF_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) @@ -53,6 +53,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBOSMONETIF_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index a4dd679..04af181 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -74,7 +74,7 @@ #include -#include +#include #include "../../bscconfig.h" @@ -223,7 +223,7 @@ buf = v_put(buf, 0x23); mrand = bsc->last_rand; - if (RAND_bytes(mrand, 16) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, mrand, 16) != 1) goto failed_random; memcpy(buf, mrand, 16); diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index f4ef487..6474b27 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -40,6 +40,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBSMPP34_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 5e9583f..0663b64 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -30,6 +30,6 @@ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am index 0eed5cd..332bf09 100644 --- a/openbsc/tests/db/Makefile.am +++ b/openbsc/tests/db/Makefile.am @@ -43,6 +43,6 @@ $(LIBOSMOGSM_LIBS) \ $(LIBSMPP34_LIBS) \ $(LIBOSMOVTY_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am index 2dd66df..8fdefb5 100644 --- a/openbsc/tests/gbproxy/Makefile.am +++ b/openbsc/tests/gbproxy/Makefile.am @@ -28,7 +28,7 @@ $(NULL) gbproxy_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ $(NULL) gbproxy_test_LDADD = \ @@ -49,6 +49,6 @@ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBRARY_DL) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 577daa9..97a0ba9 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -37,7 +37,8 @@ #include #include -#include +#include +#include #define REMOTE_BSS_ADDR 0x01020304 #define REMOTE_SGSN_ADDR 0x05060708 @@ -53,30 +54,30 @@ struct llist_head *received_messages = NULL; -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, data, len); } static int rand_seq_num = 0; -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { uint32_t val; - OSMO_ASSERT(num == sizeof(val)); - OSMO_ASSERT(__real_RAND_bytes(buf, num) == 1); + OSMO_ASSERT(len == sizeof(val)); + OSMO_ASSERT(__real_gnutls_rnd(level, data, len) == 0); val = 0x00dead00 + rand_seq_num; rand_seq_num++; - memcpy(buf, &val, num); + memcpy(data, &val, len); return 1; } diff --git a/openbsc/tests/mm_auth/Makefile.am b/openbsc/tests/mm_auth/Makefile.am index cb35198..ea6f516 100644 --- a/openbsc/tests/mm_auth/Makefile.am +++ b/openbsc/tests/mm_auth/Makefile.am @@ -8,7 +8,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(NULL) noinst_PROGRAMS = \ diff --git a/openbsc/tests/mm_auth/mm_auth_test.c b/openbsc/tests/mm_auth/mm_auth_test.c index b8777a8..0e3817b 100644 --- a/openbsc/tests/mm_auth/mm_auth_test.c +++ b/openbsc/tests/mm_auth/mm_auth_test.c @@ -8,6 +8,9 @@ #include #include +#include +#include + #define min(A,B) ((A)>(B)? (B) : (A)) static char *auth_tuple_str(struct gsm_auth_tuple *atuple) @@ -120,8 +123,8 @@ return auth_action; } -/* override libssl RAND_bytes() to get testable crypto results */ -int RAND_bytes(uint8_t *rand, int len) +/* override GnuTLS' gnutls_rnd() to get testable crypto results */ +int gnutls_rnd(gnutls_rnd_level_t level, void *rand, size_t len) { memset(rand, 23, len); return 1; diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index f1606cb..0925995 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -32,7 +32,7 @@ $(NULL) sgsn_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ @@ -66,7 +66,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index b4bcaf6..843a924 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -37,6 +37,9 @@ #include #include +#include +#include + #include void *tall_bsc_ctx; @@ -99,21 +102,22 @@ return 0; } -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *buf, size_t num) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, buf, num); } /* make results of A&C ref predictable */ -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t num) { + uint8_t *buf = (uint8_t *)data; if (num > 1) - return __real_RAND_bytes(buf, num); + return __real_gnutls_rnd(level, data, num); buf[0] = 0; return 1; } diff --git a/openbsc/tests/sndcp_xid/Makefile.am b/openbsc/tests/sndcp_xid/Makefile.am index 99b9d1a..e9e5d6f 100644 --- a/openbsc/tests/sndcp_xid/Makefile.am +++ b/openbsc/tests/sndcp_xid/Makefile.am @@ -14,7 +14,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lgtp -lrt -lm diff --git a/openbsc/tests/xid/Makefile.am b/openbsc/tests/xid/Makefile.am index aaf17ed..512dade 100644 --- a/openbsc/tests/xid/Makefile.am +++ b/openbsc/tests/xid/Makefile.am @@ -31,7 +31,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 3 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 Dec 21 12:57:07 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 12:57:07 +0000 Subject: [PATCH] libosmo-sccp[master]: Add gerrit settings Message-ID: Review at https://gerrit.osmocom.org/1467 Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I1988dcb73d5401544ff23d668e7328deecf004d6 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/67/1467/1 diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..d9747f4 --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libosmo-sccp -- To view, visit https://gerrit.osmocom.org/1467 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1988dcb73d5401544ff23d668e7328deecf004d6 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 12:57:07 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 12:57:07 +0000 Subject: [PATCH] libosmo-sccp[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1468 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment debian/coryright: update to match Debian format Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Related: OS#1694 --- M debian/control M debian/copyright M debian/rules 3 files changed, 79 insertions(+), 43 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/68/1468/1 diff --git a/debian/control b/debian/control index aa2035a..60bef71 100644 --- a/debian/control +++ b/debian/control @@ -1,16 +1,33 @@ Source: libosmo-sccp -Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, pkg-config, libosmocore-dev, autoconf, automake, libtool, dh-autoreconf, git, libdpkg-perl, libosmo-netif-dev, libsctp-dev -Standards-Version: 3.9.6 Section: libs -#Homepage: +Priority: optional +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libosmocore-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + git, + libdpkg-perl, + libosmo-netif-dev, + libsctp-dev +Standards-Version: 3.9.7 Vcs-Git: git://git.osmocom.org/libosmo-sccp.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-sccp.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmo-sccp Package: libosmo-sccp-dev -Section: libdevel Architecture: any Depends: ${misc:Depends} Multi-Arch: same -Description: Development files for Osmcoom SCCP library +Section: libdevel +Description: Development files for libosmosccp, libosmomtp and libosmoxua + SCCP is a network layer protocol that provides extended routing, flow control, + segmentation, connection-orientation, and error correction facilities in + Signaling System 7 telecommunications networks. + It is heavily used in cellular networks such as GSM. + . + This package contains the development files for the library. diff --git a/debian/copyright b/debian/copyright index 97328f2..78c9f12 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,36 +1,53 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libopen-sccp +Source: http://cgit.osmocom.org/libosmo-sccp/ - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2009-2010,2013 On-Waves + 2009-2011,2013 Holger Hans Peter Freyther + 2010 Harald Welte +License: GPL-2+ -It was downloaded from: +Files: include/sigtran/xua_msg.h + src/xua_msg.c + tests/m2ua/m2ua_test.c +Copyright: 2011 Holger Hans Peter Freyther +License: AGPL-3+ - git://git.osmocom.org/libosmo-sccp.git +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2016 Ruben Undheim +License: GPL-2+ -Upstream Author(s): - Holger Hans Peter Freyther +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2.1 can be found in "/usr/share/common-licenses/GPL-2". -Copyright: - Copyright (C) 2009-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 On-Waves - -License: - - GNU General Public License, Version 2 or later - -The Debian packaging is: - - Copyright (C) 2010 Harald Welte - -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. - -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +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 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/rules b/debian/rules index 1895067..c42676a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,19 +1,12 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2) DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') - -export DEB_BUILD_HARDENING=1 %: dh $@ --with autoreconf @@ -21,3 +14,12 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf + +override_dh_clean: + dh_clean + rm -f .version tests/package.m4 tests/testsuite + +# Print test results in case of a failure +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) + -- To view, visit https://gerrit.osmocom.org/1468 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:20:53 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 13:20:53 +0000 Subject: [PATCH] libosmo-abis[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1469 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * add cleanup override debian/coryright: add file matching Debian format Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Related: OS#1694 --- M debian/control A debian/copyright M debian/rules 3 files changed, 135 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/69/1469/1 diff --git a/debian/control b/debian/control index eed3a4c..5df6c95 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,22 @@ Source: libosmo-abis +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libosmocore-dev (>= 0.6.4), pkg-config, libortp-dev -Standards-Version: 3.9.6 -Homepage: http://openbsc.osmocom.org/trac/wiki/libosmo-abis +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + libosmocore-dev (>= 0.6.4), + pkg-config, + libortp-dev +Standards-Version: 3.9.7 Vcs-Git: git://git.osmocom.org/libosmo-abis.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-abis.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmo-abis Package: libosmo-abis Section: oldlibs @@ -20,28 +30,51 @@ Package: libosmoabis5 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: GSM A-bis handling + This library contains common/shared code regarding the A-bis interface between + the GSM Base transceiver station (BTS) and the GSM Base station controller BSC. + . + It also implements drivers for mISDN and DAHDI based E1 cards, as well as some + A-bis/IP dialects. Package: libosmotrau1 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: GSM trau handling + This library implements the Transcoder and Rate Adaptation Unit (TRAU) for + GSM systems. It is closely related to the libosmo-abis library. + . + TRAU performs transcoding function for speech channels and rate adaptation (RA) + for data channels in the GSM network. Package: libosmo-abis-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmotrau1 (= ${binary:Version}), libosmoabis5 (= ${binary:Version}) Multi-Arch: same -Description: Development headers for A-bis interface. +Section: libdevel +Depends: ${misc:Depends}, + libosmotrau1 (= ${binary:Version}), + libosmoabis5 (= ${binary:Version}) +Description: Development headers for A-bis interface + The libosmo-abis library contains common/shared code regarding the A-bis + interface between GSM BTS and BSC. This package in particular contains the + development files needed to develop with the libosmoabis and libosmotrau + libraries. Package: libosmo-abis-dbg -Section: debug Architecture: any -Priority: extra -Depends: libosmoabis5 (= ${binary:Version}), libosmotrau1 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Debug symbols for A-bis interface. +Section: debug +Priority: extra +Depends: libosmoabis5 (= ${binary:Version}), + libosmotrau1 (= ${binary:Version}), + ${misc:Depends} +Description: Debug symbols for A-bis interface + The libosmo-abis library contains common/shared code regarding the A-bis + interface between GSM BTS and BSC. This package in particular contains the + debug symbols for the two libraries libosmoabis and libosmotrau. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..fdcf686 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,83 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmo-abis.git + +Files: * +Copyright: 2008 Daniel Willmann + 2008-2012 Harald Welte + 2009-2010 Holger Hans Peter Freyther + 2010,2014 On-Waves + 2011-2014 Pablo Neira Ayuso + 2012 Tobias Engel + 2014 Sysmocom s.f.m.c. GmBH +License: AGPL-3+ + +Files: src/input/lapd.c + src/trau/osmo_ortp.c + src/input/dahdi.c +Copyright: 2008-2011 Harald Welte + 2009 oystein at homelien.no + 2009 Holger Hans Peter Freyther + 2010 Digium and Matthew Fredrickson + 2011 Andreas Everberg +License: GPL-2+ + +Files: include/mISDNif.h +Copyright: 2008 Karsten Keil +License: LGPL-2.1 + +Files: debian/* +Copyright: 2012 Eric Butler + 2012-2015 Holger Hans Peter Freyther + 2015 Ruben Undheim +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 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 . + + +License: GPL-2+ + This package 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, 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: LGPL-2.1 + 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; + version 2.1 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index d3f1534..cec3c9f 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 + %: dh $@ --with autoreconf --fail-missing @@ -16,3 +17,7 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf + +override_dh_clean: + dh_clean + rm -f tests/package.m4 tests/testsuite .version .tarball-version -- To view, visit https://gerrit.osmocom.org/1469 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:25:05 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 13:25:05 +0000 Subject: [PATCH] libosmo-abis[master]: Add gerrit settings Message-ID: Review at https://gerrit.osmocom.org/1470 Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I04aeee90641555df19e969f925474ec6f9a23354 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/70/1470/1 diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..2e575db --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libosmo-abis -- To view, visit https://gerrit.osmocom.org/1470 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I04aeee90641555df19e969f925474ec6f9a23354 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:26:16 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 13:26:16 +0000 Subject: [PATCH] libosmo-netif[master]: Add gerrit settings Message-ID: Review at https://gerrit.osmocom.org/1471 Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I4fc8b17a0cbea16c7bdd7e50d106ef4aa35780e0 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/71/1471/1 diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..1ea007b --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libosmo-netif -- To view, visit https://gerrit.osmocom.org/1471 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4fc8b17a0cbea16c7bdd7e50d106ef4aa35780e0 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:30:55 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 13:30:55 +0000 Subject: [PATCH] openbsc[master]: gitignore: gsup_test_client binary Message-ID: Review at https://gerrit.osmocom.org/1472 gitignore: gsup_test_client binary gsup_test_client was added in 4f8e34b226aeae221119c1d5ea659c3f087132aa and moved to libcommon in 2c1f8c8cebe41b30deca29c55290fef7a61e5343, both of which forgot to adjust the .gitignore. Change-Id: Idd0d29a2f5c5b9b038103c955e0027d9ee9fee73 --- M openbsc/.gitignore 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/72/1472/1 diff --git a/openbsc/.gitignore b/openbsc/.gitignore index 3324069..e3f25cb 100644 --- a/openbsc/.gitignore +++ b/openbsc/.gitignore @@ -55,6 +55,7 @@ src/gprs/osmo-gbproxy src/gprs/osmo-gtphub src/osmo-bsc_nat/osmo-bsc_nat +src/libcommon/gsup_test_client #tests tests/testsuite.dir -- To view, visit https://gerrit.osmocom.org/1472 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd0d29a2f5c5b9b038103c955e0027d9ee9fee73 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:31:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 13:31:24 +0000 Subject: openbsc[master]: add gsup_test_client program In-Reply-To: References: Message-ID: Patch Set 4: > This adds openbsc/src/libcommon/gsup_test_client without adding > corresponding entry to .gitignore - please correct. Thanks! --> https://gerrit.osmocom.org/1472 -- To view, visit https://gerrit.osmocom.org/1382 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iafd844393dd90b899f84ed61c875c1eb533436d7 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 Wed Dec 21 13:31:45 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 13:31:45 +0000 Subject: openbsc[master]: gitignore: gsup_test_client binary In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1472 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idd0d29a2f5c5b9b038103c955e0027d9ee9fee73 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 Wed Dec 21 13:37:41 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 13:37:41 +0000 Subject: [PATCH] libosmo-netif[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1473 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * add cleanup override debian/coryright: add file matching Debian format Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Related: OS#1694 --- M debian/control A debian/copyright M debian/rules 3 files changed, 93 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/73/1473/1 diff --git a/debian/control b/debian/control index 3953414..f499728 100644 --- a/debian/control +++ b/debian/control @@ -2,24 +2,50 @@ Section: libs Priority: optional Maintainer: Holger Hans Peter Freyther -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libosmocore-dev, libosmo-abis-dev, pkg-config, libsctp-dev +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + libosmocore-dev, + libosmo-abis-dev, + pkg-config, + libsctp-dev, + libortp-dev Standards-Version: 3.9.6 -Vcs-Git: git://git.osmocom.org/libosmo-netif.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-netif.git;a=summary +Vcs-Git: git://git.osmocom.org/libosmo-netif.git +Homepage: https://projects.osmocom.org/projects/libosmo-netif Package: libosmonetif2 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same -Description: Library containing common/shared code regarding network interface +Description: Common/shared code regarding network interface for OpenBSC + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. Package: libosmo-netif-dev Section: libdevel Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore, libosmonetif2 (= ${binary:Version}) +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libosmocore-dev, + libosmocore, + libosmonetif3 (= ${binary:Version}) Multi-Arch: same Description: Development headers for Osmocom network interface + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. + . + This package contains the development files needed for developing with + the libosmo-netif library. Package: libosmo-netif-dbg Section: debug @@ -27,4 +53,9 @@ Priority: extra Depends: libosmonetif2 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Debug symbols for Osmocom network interface +Description: Debug symbols for Osmocom network interface library + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. + . + This package contains the debug symbols for the library. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..1c1eb91 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,51 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmo-netif.git + +Files: * +Copyright: 2012-2013 On-Waves + 2012-2013 Pablo Neira Ayuso +License: GPL-2+ + +Files: src/rs232.c +Copyright: 2008-2011 Harald Welte + Pablo Neira Ayuso +License: AGPL-3+ + +Files: debian/* +Copyright: 2013-2015 Holger Hans Peter Freyther + 2015 Ruben Undheim +License: GPL-2+ + + +License: GPL-2+ + This package 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, 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +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 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/rules b/debian/rules index a4ddfaa..f398831 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 %: @@ -21,3 +22,7 @@ override_dh_install: dh_install sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'` + +override_dh_clean: + dh_clean + rm -f tests/package.m4 tests/testsuite .version .tarball-version -- To view, visit https://gerrit.osmocom.org/1473 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:44:06 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 13:44:06 +0000 Subject: [PATCH] libosmocore[master]: doc: fix typo for osmo_hexparse Message-ID: Review at https://gerrit.osmocom.org/1474 doc: fix typo for osmo_hexparse Change-Id: Ifc2b499792fda378c807c678b8e06630cb64d273 --- M src/utils.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/1474/1 diff --git a/src/utils.c b/src/utils.c index 1bb2be8..02c2443 100644 --- a/src/utils.c +++ b/src/utils.c @@ -118,7 +118,7 @@ return c - 0x30; } -/*! \brief Parse a string ocntaining hexadecimal digits +/*! \brief Parse a string containing hexadecimal digits * \param[in] str string containing ASCII encoded hexadecimal digits * \param[out] b output buffer * \param[in] max_len maximum space in output buffer -- To view, visit https://gerrit.osmocom.org/1474 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifc2b499792fda378c807c678b8e06630cb64d273 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:44:11 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 13:44:11 +0000 Subject: [PATCH] libosmocore[master]: fsm: log tweak: upon free, say 'Freeing instance' Message-ID: Review at https://gerrit.osmocom.org/1475 fsm: log tweak: upon free, say 'Freeing instance' Logging 'Release' is a bit ambiguous. At first I tought a subscriber connection was being released, IMHO 'Freeing instance' better describes that we are freeing an osmo_fsm_inst. Change-Id: I5cf99707d2ba5620b2988f777fa39cc806ec0212 --- M src/fsm.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/1475/1 diff --git a/src/fsm.c b/src/fsm.c index 842c766..319c842 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -467,7 +467,7 @@ if (fi->fsm->cleanup) fi->fsm->cleanup(fi, cause); - LOGPFSMSRC(fi, file, line, "Release\n"); + LOGPFSMSRC(fi, file, line, "Freeing instance\n"); osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ -- To view, visit https://gerrit.osmocom.org/1475 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5cf99707d2ba5620b2988f777fa39cc806ec0212 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 13:44:11 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 13:44:11 +0000 Subject: [PATCH] libosmocore[master]: fsm: term: get parent pointer a little later Message-ID: Review at https://gerrit.osmocom.org/1476 fsm: term: get parent pointer a little later During FSM instance termination, fetch the parent pointer only after the cleanup callback is through, just in case the cleanup callback wishes to change anything about the parent, e.g. to prevent event dispatch. This patch was created to try and fix a problem that was in the end solved differently. There is no actual need or use case for this at the moment, but it generally makes sense to get the parent pointer as late as possible. Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 --- M src/fsm.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/1476/1 diff --git a/src/fsm.c b/src/fsm.c index 319c842..fafd3f3 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -428,7 +428,7 @@ const char *file, int line) { struct osmo_fsm_inst *first_child, *last_seen_first_child; - struct osmo_fsm_inst *parent = fi->proc.parent; + struct osmo_fsm_inst *parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", @@ -468,6 +468,7 @@ fi->fsm->cleanup(fi, cause); LOGPFSMSRC(fi, file, line, "Freeing instance\n"); + parent = fi->proc.parent; osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 21 14:00:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:00:23 +0000 Subject: [PATCH] osmo-hlr[master]: gsup: send subscriber MSISDN 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/1454 to look at the new patch set (#2). gsup: send subscriber MSISDN Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 --- M src/hlr.c 1 file changed, 15 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/54/1454/2 diff --git a/src/hlr.c b/src/hlr.c index 3101403..674a58b 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "db.h" #include "logging.h" @@ -266,6 +267,7 @@ { struct osmo_gsup_message gsup; uint8_t apn[APN_MAXLEN]; + uint8_t msisdn_enc[43]; /* TODO use constant; TS 24.008 10.5.4.7 */ int l; OSMO_ASSERT(luop->state == LU_S_LU_RECEIVED || @@ -274,8 +276,20 @@ memset(&gsup, 0, sizeof(gsup)); gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_REQUEST; strncpy(gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)-1); + + l = gsm48_encode_bcd_number(msisdn_enc, sizeof(msisdn_enc), 0, + luop->subscr.msisdn); + if (l < 1) { + LOGP(DMAIN, LOGL_ERROR, + "%s: Error: cannot encode MSISDN '%s'\n", + luop->subscr.imsi, luop->subscr.msisdn); + lu_op_tx_error(luop, GMM_CAUSE_PROTO_ERR_UNSPEC); + return; + } + gsup.msisdn_enc = msisdn_enc; + gsup.msisdn_enc_len = l; + /* FIXME: deal with encoding the following data */ - gsup.msisdn_enc; gsup.hlr_enc; if (luop->is_ps) { -- To view, visit https://gerrit.osmocom.org/1454 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 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 Wed Dec 21 14:01:17 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:01:17 +0000 Subject: osmo-hlr[master]: gsup: send subscriber MSISDN In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 only cosmetic merge conflict resolution, re-adding +2 from earlier -- To view, visit https://gerrit.osmocom.org/1454 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 Gerrit-PatchSet: 2 Gerrit-Project: osmo-hlr 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 Dec 21 14:01:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:01:25 +0000 Subject: [MERGED] osmo-hlr[master]: gsup: send subscriber MSISDN In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: gsup: send subscriber MSISDN ...................................................................... gsup: send subscriber MSISDN Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 --- M src/hlr.c 1 file changed, 15 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/hlr.c b/src/hlr.c index 3101403..674a58b 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "db.h" #include "logging.h" @@ -266,6 +267,7 @@ { struct osmo_gsup_message gsup; uint8_t apn[APN_MAXLEN]; + uint8_t msisdn_enc[43]; /* TODO use constant; TS 24.008 10.5.4.7 */ int l; OSMO_ASSERT(luop->state == LU_S_LU_RECEIVED || @@ -274,8 +276,20 @@ memset(&gsup, 0, sizeof(gsup)); gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_REQUEST; strncpy(gsup.imsi, luop->subscr.imsi, sizeof(gsup.imsi)-1); + + l = gsm48_encode_bcd_number(msisdn_enc, sizeof(msisdn_enc), 0, + luop->subscr.msisdn); + if (l < 1) { + LOGP(DMAIN, LOGL_ERROR, + "%s: Error: cannot encode MSISDN '%s'\n", + luop->subscr.imsi, luop->subscr.msisdn); + lu_op_tx_error(luop, GMM_CAUSE_PROTO_ERR_UNSPEC); + return; + } + gsup.msisdn_enc = msisdn_enc; + gsup.msisdn_enc_len = l; + /* FIXME: deal with encoding the following data */ - gsup.msisdn_enc; gsup.hlr_enc; if (luop->is_ps) { -- To view, visit https://gerrit.osmocom.org/1454 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iace97a1a828b29ce11913a14243bcf80bbae9136 Gerrit-PatchSet: 2 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 Dec 21 14:01:36 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:01:36 +0000 Subject: [MERGED] openbsc[master]: gitignore: gsup_test_client binary In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: gitignore: gsup_test_client binary ...................................................................... gitignore: gsup_test_client binary gsup_test_client was added in 4f8e34b226aeae221119c1d5ea659c3f087132aa and moved to libcommon in 2c1f8c8cebe41b30deca29c55290fef7a61e5343, both of which forgot to adjust the .gitignore. Change-Id: Idd0d29a2f5c5b9b038103c955e0027d9ee9fee73 --- M openbsc/.gitignore 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/.gitignore b/openbsc/.gitignore index 3324069..e3f25cb 100644 --- a/openbsc/.gitignore +++ b/openbsc/.gitignore @@ -55,6 +55,7 @@ src/gprs/osmo-gbproxy src/gprs/osmo-gtphub src/osmo-bsc_nat/osmo-bsc_nat +src/libcommon/gsup_test_client #tests tests/testsuite.dir -- To view, visit https://gerrit.osmocom.org/1472 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idd0d29a2f5c5b9b038103c955e0027d9ee9fee73 Gerrit-PatchSet: 1 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 Wed Dec 21 14:02:06 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:02:06 +0000 Subject: openbsc[master]: use new OSMO_VALUE_STRING In-Reply-To: References: Message-ID: Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 Gerrit-PatchSet: 4 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 Wed Dec 21 14:02:07 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:02:07 +0000 Subject: [MERGED] openbsc[master]: use new OSMO_VALUE_STRING In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: use new OSMO_VALUE_STRING ...................................................................... use new OSMO_VALUE_STRING libosmocore change-id I857af45ae602bb9a647ba26cf8b0d1b23403b54c adds OSMO_VALUE_STRING to compose value_string arrays with the exact enum names as entries. Use instead of identical local macros in two places. Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 --- M openbsc/src/libiu/iu.c M openbsc/src/libmsc/auth.c 2 files changed, 11 insertions(+), 13 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/libiu/iu.c b/openbsc/src/libiu/iu.c index c15c6c5..8ba6fa4 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -89,12 +90,10 @@ static LLIST_HEAD(rnc_list); const struct value_string iu_event_type_names[] = { -#define IU_EVT_STR(X) { X, #X } - IU_EVT_STR(IU_EVENT_RAB_ASSIGN), - IU_EVT_STR(IU_EVENT_SECURITY_MODE_COMPLETE), - IU_EVT_STR(IU_EVENT_IU_RELEASE), - IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), -#undef IU_EVT_STR + OSMO_VALUE_STRING(IU_EVENT_RAB_ASSIGN), + OSMO_VALUE_STRING(IU_EVENT_SECURITY_MODE_COMPLETE), + OSMO_VALUE_STRING(IU_EVENT_IU_RELEASE), + OSMO_VALUE_STRING(IU_EVENT_LINK_INVALIDATED), { 0, NULL } }; diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..bf62d3c 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -26,19 +26,18 @@ #include #include +#include #include #include const struct value_string auth_action_names[] = { -#define AUTH_ACTION_STR(X) { X, #X } - AUTH_ACTION_STR(AUTH_ERROR), - AUTH_ACTION_STR(AUTH_NOT_AVAIL), - AUTH_ACTION_STR(AUTH_DO_AUTH_THEN_CIPH), - AUTH_ACTION_STR(AUTH_DO_CIPH), - AUTH_ACTION_STR(AUTH_DO_AUTH), -#undef AUTH_ACTION_STR + OSMO_VALUE_STRING(AUTH_ERROR), + OSMO_VALUE_STRING(AUTH_NOT_AVAIL), + OSMO_VALUE_STRING(AUTH_DO_AUTH_THEN_CIPH), + OSMO_VALUE_STRING(AUTH_DO_CIPH), + OSMO_VALUE_STRING(AUTH_DO_AUTH), { 0, NULL } }; -- To view, visit https://gerrit.osmocom.org/1444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1b44d2a3f293785a01d6a587c78f9e0cbeec70c3 Gerrit-PatchSet: 5 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 Wed Dec 21 14:02:22 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:02:22 +0000 Subject: libosmocore[master]: doc: fix typo for osmo_hexparse In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1474 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifc2b499792fda378c807c678b8e06630cb64d273 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 Dec 21 14:02:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:02:25 +0000 Subject: libosmocore[master]: fsm: log tweak: upon free, say 'Freeing instance' In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1475 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5cf99707d2ba5620b2988f777fa39cc806ec0212 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 Dec 21 14:02:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:02:27 +0000 Subject: [MERGED] libosmocore[master]: fsm: log tweak: upon free, say 'Freeing instance' In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fsm: log tweak: upon free, say 'Freeing instance' ...................................................................... fsm: log tweak: upon free, say 'Freeing instance' Logging 'Release' is a bit ambiguous. At first I tought a subscriber connection was being released, IMHO 'Freeing instance' better describes that we are freeing an osmo_fsm_inst. Change-Id: I5cf99707d2ba5620b2988f777fa39cc806ec0212 --- M src/fsm.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index 842c766..319c842 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -467,7 +467,7 @@ if (fi->fsm->cleanup) fi->fsm->cleanup(fi, cause); - LOGPFSMSRC(fi, file, line, "Release\n"); + LOGPFSMSRC(fi, file, line, "Freeing instance\n"); osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ -- To view, visit https://gerrit.osmocom.org/1475 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5cf99707d2ba5620b2988f777fa39cc806ec0212 Gerrit-PatchSet: 1 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 Dec 21 14:02:28 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:02:28 +0000 Subject: [MERGED] libosmocore[master]: doc: fix typo for osmo_hexparse In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: doc: fix typo for osmo_hexparse ...................................................................... doc: fix typo for osmo_hexparse Change-Id: Ifc2b499792fda378c807c678b8e06630cb64d273 --- M src/utils.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/utils.c b/src/utils.c index 1bb2be8..02c2443 100644 --- a/src/utils.c +++ b/src/utils.c @@ -118,7 +118,7 @@ return c - 0x30; } -/*! \brief Parse a string ocntaining hexadecimal digits +/*! \brief Parse a string containing hexadecimal digits * \param[in] str string containing ASCII encoded hexadecimal digits * \param[out] b output buffer * \param[in] max_len maximum space in output buffer -- To view, visit https://gerrit.osmocom.org/1474 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifc2b499792fda378c807c678b8e06630cb64d273 Gerrit-PatchSet: 1 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 Dec 21 14:28:27 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:28:27 +0000 Subject: libosmocore[master]: fsm: term: get parent pointer a little later In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1476/1/src/fsm.c File src/fsm.c: Line 461: if (parent) problem! -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Wed Dec 21 14:32:19 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 21 Dec 2016 14:32:19 +0000 Subject: [PATCH] libosmocore[master]: fsm: term: get parent pointer as late as possible In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1476 to look at the new patch set (#2). fsm: term: get parent pointer as late as possible During FSM instance termination, fetch the parent pointer every time just before using it, in case the child termination or cleanup callback wish to change anything about the parent, e.g. to prevent event dispatch. This patch was created to try and fix a problem that was in the end solved differently. There is no actual need or use case for this at the moment, but it generally makes sense to get the parent pointer as late as possible. Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 --- M src/fsm.c 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/1476/2 diff --git a/src/fsm.c b/src/fsm.c index 319c842..c0f6f3b 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -428,7 +428,7 @@ const char *file, int line) { struct osmo_fsm_inst *first_child, *last_seen_first_child; - struct osmo_fsm_inst *parent = fi->proc.parent; + struct osmo_fsm_inst *parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", @@ -458,6 +458,7 @@ } /* delete ourselves from the parent */ + parent = fi->proc.parent; if (parent) LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", osmo_fsm_inst_name(parent)); @@ -468,6 +469,8 @@ fi->fsm->cleanup(fi, cause); LOGPFSMSRC(fi, file, line, "Freeing instance\n"); + /* Fetch parent again in case it has changed. */ + parent = fi->proc.parent; osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 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 Dec 21 16:46:58 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 16:46:58 +0000 Subject: [PATCH] libsmpp34[master]: Add gerrit settings Message-ID: Review at https://gerrit.osmocom.org/1477 Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: Ic97dda1950689ed86dcf01a49a0894aedaf57bab --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/77/1477/1 diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..b575bb3 --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libsmpp34 -- To view, visit https://gerrit.osmocom.org/1477 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic97dda1950689ed86dcf01a49a0894aedaf57bab Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 16:46:58 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 16:46:58 +0000 Subject: [PATCH] libsmpp34[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1478 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * remove useless comment debian/compat: update compatibility version debian/*.install: fix paths debian/coryright: add file matching Debian format Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Related: OS#1694 --- M debian/compat M debian/control A debian/copyright M debian/libsmpp0.install M debian/libsmpp34-dev.install M debian/rules 6 files changed, 72 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/78/1478/1 diff --git a/debian/compat b/debian/compat index 45a4fb7..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/debian/control b/debian/control index b5fd656..e612a4f 100644 --- a/debian/control +++ b/debian/control @@ -1,24 +1,50 @@ Source: libsmpp34 +Maintainer: Holger Freyther Section: libs Priority: optional -Maintainer: Holger Freyther -Build-Depends: debhelper (>= 8.0.0), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libxml2-dev, pkg-config -Standards-Version: 3.9.3 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore -Vcs-Git: git://git.osmocom.org/libosmocore.git +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + pkg-config, + libxml2-dev +Standards-Version: 3.9.6 Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Vcs-Git: git://git.osmocom.org/libosmocore.git +Homepage: https://projects.osmocom.org/projects/libsmpp34 Package: libsmpp0 Section: libs Architecture: any -Depends: ${misc:Depends} -Description: libsmpp34 codec library +Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Open PDU SMPP packaging and unpackaging tool + This library is an implementation for providing the PDU handling of the + SMPP-3.4 protocol. SMPP (Short Message Peer-to-Peer) is an open industry + standard protocol designed to provide a flexible data communication + interface for the transfer of short message data between External Short + Messaging Entities, Routing Entitites and Message Centres. Package: libsmpp34-dev -Section: libdevel Architecture: any -Depends: libsmpp0 (= ${binary:Version}), ${misc:Depends} -Description: Development headers libsmpp34 codec library +Multi-Arch: same +Section: libdevel +Depends: libsmpp0 (= ${binary:Version}), + ${misc:Depends} +Description: Development files for libsmpp34 + This library is an implementation for providing the PDU handling of the + SMPP-3.4 protocol. SMPP (Short Message Peer-to-Peer) is an open industry + standard protocol designed to provide a flexible data communication + interface for the transfer of short message data between External Short + Messaging Entities, Routing Entitites and Message Centres. + . + This package contains the development files for the library. Package: libsmpp34-utils Architecture: any diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..f92bc83 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libsmpp34 +Source: http://c-open-smpp-34.sourceforge.net/ + +Files: * +Copyright: 2006 Raul Tremsal +License: LGPL-2.1+ + +Files: debian/* +Copyright: 2016 Ruben Undheim +License: LGPL-2.1+ + + +License: LGPL-2.1+ + This package 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 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 Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/libsmpp0.install b/debian/libsmpp0.install index b56f189..3ddde58 100644 --- a/debian/libsmpp0.install +++ b/debian/libsmpp0.install @@ -1 +1 @@ -usr/lib/libsmpp34.so.* +usr/lib/*/lib*.so.* diff --git a/debian/libsmpp34-dev.install b/debian/libsmpp34-dev.install index a6fcb65..91180f6 100644 --- a/debian/libsmpp34-dev.install +++ b/debian/libsmpp34-dev.install @@ -1,5 +1,5 @@ usr/include/* -usr/lib/*.so -usr/lib/*.a -usr/lib/lib*.la -usr/lib/pkgconfig/* +usr/lib/*/lib*.so +usr/lib/*/*.a +usr/lib/*/lib*.la +usr/lib/*/pkgconfig/* diff --git a/debian/rules b/debian/rules index 7daafea..7b245b1 100755 --- a/debian/rules +++ b/debian/rules @@ -1,13 +1,8 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf --fail-missing -- To view, visit https://gerrit.osmocom.org/1478 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:01:06 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:01:06 +0000 Subject: [PATCH] openggsn[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1479 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * remove useless comment debian/copyright: update to match Debian format Change-Id: Ia7f0a3a583ad63f5c6e5cf5e5de2ff7dd9eed8a9 Related: OS#1694 --- M debian/control M debian/copyright M debian/rules 3 files changed, 82 insertions(+), 60 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/79/1479/1 diff --git a/debian/control b/debian/control index 588ce5a..9306656 100644 --- a/debian/control +++ b/debian/control @@ -1,31 +1,54 @@ Source: openggsn +Maintainer: Harald Welte Section: net Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, pkg-config, libdpkg-perl, git, dh-autoreconf, libosmocore-dev (>= 0.8.0) +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libdpkg-perl, git, + dh-autoreconf, + libosmocore-dev (>= 0.8.0) Standards-Version: 3.9.6 -Homepage: http://sourceforge.net/projects/ggsn/ -Vcs-Git: git://ggsn.git.sourceforge.net/gitroot/ggsn/ggsn Vcs-Browser: http://ggsn.git.sourceforge.net/git/gitweb.cgi?p=ggsn/ggsn;a=summary +Vcs-Git: git://ggsn.git.sourceforge.net/gitroot/ggsn/ggsn +Homepage: https://projects.osmocom.org/projects/openggsn Package: openggsn Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Gateway GPRS Support Node +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: Gateway GPRS Support Node (GGSN) + OpenGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile + operators as the interface between the Internet and the rest of the + mobile network infrastructure. Package: libgtp0 Architecture: any -Section: libs -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Section: libs +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: library implementing the GTP protocol between SGSN and GGSN + OpenGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile + operators as the interface between the Internet and the rest of the + mobile network infrastructure. + . + This library is part of openggsn and implements the GTP protocol between + SGSN (Serving GPRS support node) and GGSN. Package: libgtp0-dev -Depends: ${misc:Depends}, libgtp0 (= ${binary:Version}) -Multi-Arch: same Architecture: any +Multi-Arch: same Section: libdevel +Depends: ${misc:Depends}, + libgtp0 (= ${binary:Version}) Description: Development files for libgtp + OpenGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile + operators as the interface between the Internet and the rest of the + mobile network infrastructure. + . + The library libgtp implements the GTP protocol between SGSN and GGSN + and this package contains the development files for this library. Package: openggsn-dbg Section: debug diff --git a/debian/copyright b/debian/copyright index c5d2af9..b3339d9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,46 +1,55 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: openggsn +Source: http://sourceforge.net/projects/ggsn/ - Harald Welte on Tue, 24 Aug 2010 11:23:40 +0200 +Files: * +Copyright: 2002 Jens Jakobsen + 2002-2004 Mondru AB + 2010-2011 Harald Welte +License: GPL-2 -It was downloaded from: +Files: lib/getopt.c + lib/gnugetopt.h + lib/getopt1.c +Copyright: 1987-2001 Free Software Foundation, Inc. +License: LGPL-2.1+ - http://sourceforge.net/projects/ggsn +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2016 Ruben Undheim +License: GPL-2 -Upstream Author(s): - Jens Jakobsen - Harald Welte +License: GPL-2 + This package 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; version 2 of the License + . + 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2 can be found in "/usr/share/common-licenses/GPL-2". -Copyright: - Copyright (C) 2002 Mondru AB - Copyright (C) 2010 Harald Welte - -License: - - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This package 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, see - -On Debian systems, the complete text of the GNU General -Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". - -The Debian packaging is: - - Copyright (C) 2010 Harald Welte - -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. - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +License: LGPL-2.1+ + This package 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 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 Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index 62f5236..5562909 100755 --- a/debian/rules +++ b/debian/rules @@ -1,21 +1,11 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. -# -# Modified to make a template file for a multi-binary package with separated -# build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This has to be exported to make some magic below work. #export DH_OPTIONS -export DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf -- To view, visit https://gerrit.osmocom.org/1479 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia7f0a3a583ad63f5c6e5cf5e5de2ff7dd9eed8a9 Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:03:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:03:21 +0000 Subject: [PATCH] libosmo-sccp[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1468 to look at the new patch set (#2). Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment debian/copyright: update to match Debian format Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Related: OS#1694 --- M debian/control M debian/copyright M debian/rules 3 files changed, 79 insertions(+), 43 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/68/1468/2 diff --git a/debian/control b/debian/control index aa2035a..60bef71 100644 --- a/debian/control +++ b/debian/control @@ -1,16 +1,33 @@ Source: libosmo-sccp -Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, pkg-config, libosmocore-dev, autoconf, automake, libtool, dh-autoreconf, git, libdpkg-perl, libosmo-netif-dev, libsctp-dev -Standards-Version: 3.9.6 Section: libs -#Homepage: +Priority: optional +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libosmocore-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + git, + libdpkg-perl, + libosmo-netif-dev, + libsctp-dev +Standards-Version: 3.9.7 Vcs-Git: git://git.osmocom.org/libosmo-sccp.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-sccp.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmo-sccp Package: libosmo-sccp-dev -Section: libdevel Architecture: any Depends: ${misc:Depends} Multi-Arch: same -Description: Development files for Osmcoom SCCP library +Section: libdevel +Description: Development files for libosmosccp, libosmomtp and libosmoxua + SCCP is a network layer protocol that provides extended routing, flow control, + segmentation, connection-orientation, and error correction facilities in + Signaling System 7 telecommunications networks. + It is heavily used in cellular networks such as GSM. + . + This package contains the development files for the library. diff --git a/debian/copyright b/debian/copyright index 97328f2..78c9f12 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,36 +1,53 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libopen-sccp +Source: http://cgit.osmocom.org/libosmo-sccp/ - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2009-2010,2013 On-Waves + 2009-2011,2013 Holger Hans Peter Freyther + 2010 Harald Welte +License: GPL-2+ -It was downloaded from: +Files: include/sigtran/xua_msg.h + src/xua_msg.c + tests/m2ua/m2ua_test.c +Copyright: 2011 Holger Hans Peter Freyther +License: AGPL-3+ - git://git.osmocom.org/libosmo-sccp.git +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2016 Ruben Undheim +License: GPL-2+ -Upstream Author(s): - Holger Hans Peter Freyther +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2.1 can be found in "/usr/share/common-licenses/GPL-2". -Copyright: - Copyright (C) 2009-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 On-Waves - -License: - - GNU General Public License, Version 2 or later - -The Debian packaging is: - - Copyright (C) 2010 Harald Welte - -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. - -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +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 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/rules b/debian/rules index 1895067..c42676a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,19 +1,12 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2) DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') - -export DEB_BUILD_HARDENING=1 %: dh $@ --with autoreconf @@ -21,3 +14,12 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf + +override_dh_clean: + dh_clean + rm -f .version tests/package.m4 tests/testsuite + +# Print test results in case of a failure +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) + -- To view, visit https://gerrit.osmocom.org/1468 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:04:48 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:04:48 +0000 Subject: [PATCH] libosmo-abis[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1469 to look at the new patch set (#2). Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * add cleanup override debian/copyright: add file matching Debian format Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Related: OS#1694 --- M debian/control A debian/copyright M debian/rules 3 files changed, 135 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/69/1469/2 diff --git a/debian/control b/debian/control index eed3a4c..5df6c95 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,22 @@ Source: libosmo-abis +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libosmocore-dev (>= 0.6.4), pkg-config, libortp-dev -Standards-Version: 3.9.6 -Homepage: http://openbsc.osmocom.org/trac/wiki/libosmo-abis +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + libosmocore-dev (>= 0.6.4), + pkg-config, + libortp-dev +Standards-Version: 3.9.7 Vcs-Git: git://git.osmocom.org/libosmo-abis.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-abis.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmo-abis Package: libosmo-abis Section: oldlibs @@ -20,28 +30,51 @@ Package: libosmoabis5 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: GSM A-bis handling + This library contains common/shared code regarding the A-bis interface between + the GSM Base transceiver station (BTS) and the GSM Base station controller BSC. + . + It also implements drivers for mISDN and DAHDI based E1 cards, as well as some + A-bis/IP dialects. Package: libosmotrau1 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: GSM trau handling + This library implements the Transcoder and Rate Adaptation Unit (TRAU) for + GSM systems. It is closely related to the libosmo-abis library. + . + TRAU performs transcoding function for speech channels and rate adaptation (RA) + for data channels in the GSM network. Package: libosmo-abis-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmotrau1 (= ${binary:Version}), libosmoabis5 (= ${binary:Version}) Multi-Arch: same -Description: Development headers for A-bis interface. +Section: libdevel +Depends: ${misc:Depends}, + libosmotrau1 (= ${binary:Version}), + libosmoabis5 (= ${binary:Version}) +Description: Development headers for A-bis interface + The libosmo-abis library contains common/shared code regarding the A-bis + interface between GSM BTS and BSC. This package in particular contains the + development files needed to develop with the libosmoabis and libosmotrau + libraries. Package: libosmo-abis-dbg -Section: debug Architecture: any -Priority: extra -Depends: libosmoabis5 (= ${binary:Version}), libosmotrau1 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Debug symbols for A-bis interface. +Section: debug +Priority: extra +Depends: libosmoabis5 (= ${binary:Version}), + libosmotrau1 (= ${binary:Version}), + ${misc:Depends} +Description: Debug symbols for A-bis interface + The libosmo-abis library contains common/shared code regarding the A-bis + interface between GSM BTS and BSC. This package in particular contains the + debug symbols for the two libraries libosmoabis and libosmotrau. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..fdcf686 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,83 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmo-abis.git + +Files: * +Copyright: 2008 Daniel Willmann + 2008-2012 Harald Welte + 2009-2010 Holger Hans Peter Freyther + 2010,2014 On-Waves + 2011-2014 Pablo Neira Ayuso + 2012 Tobias Engel + 2014 Sysmocom s.f.m.c. GmBH +License: AGPL-3+ + +Files: src/input/lapd.c + src/trau/osmo_ortp.c + src/input/dahdi.c +Copyright: 2008-2011 Harald Welte + 2009 oystein at homelien.no + 2009 Holger Hans Peter Freyther + 2010 Digium and Matthew Fredrickson + 2011 Andreas Everberg +License: GPL-2+ + +Files: include/mISDNif.h +Copyright: 2008 Karsten Keil +License: LGPL-2.1 + +Files: debian/* +Copyright: 2012 Eric Butler + 2012-2015 Holger Hans Peter Freyther + 2015 Ruben Undheim +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 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 . + + +License: GPL-2+ + This package 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, 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: LGPL-2.1 + 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; + version 2.1 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index d3f1534..cec3c9f 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 + %: dh $@ --with autoreconf --fail-missing @@ -16,3 +17,7 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf + +override_dh_clean: + dh_clean + rm -f tests/package.m4 tests/testsuite .version .tarball-version -- To view, visit https://gerrit.osmocom.org/1469 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:05:42 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:05:42 +0000 Subject: [PATCH] libosmo-netif[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1473 to look at the new patch set (#2). Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * add cleanup override debian/copyright: add file matching Debian format Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Related: OS#1694 --- M debian/control A debian/copyright M debian/rules 3 files changed, 93 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/73/1473/2 diff --git a/debian/control b/debian/control index 3953414..f499728 100644 --- a/debian/control +++ b/debian/control @@ -2,24 +2,50 @@ Section: libs Priority: optional Maintainer: Holger Hans Peter Freyther -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libosmocore-dev, libosmo-abis-dev, pkg-config, libsctp-dev +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + libosmocore-dev, + libosmo-abis-dev, + pkg-config, + libsctp-dev, + libortp-dev Standards-Version: 3.9.6 -Vcs-Git: git://git.osmocom.org/libosmo-netif.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-netif.git;a=summary +Vcs-Git: git://git.osmocom.org/libosmo-netif.git +Homepage: https://projects.osmocom.org/projects/libosmo-netif Package: libosmonetif2 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same -Description: Library containing common/shared code regarding network interface +Description: Common/shared code regarding network interface for OpenBSC + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. Package: libosmo-netif-dev Section: libdevel Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore, libosmonetif2 (= ${binary:Version}) +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libosmocore-dev, + libosmocore, + libosmonetif3 (= ${binary:Version}) Multi-Arch: same Description: Development headers for Osmocom network interface + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. + . + This package contains the development files needed for developing with + the libosmo-netif library. Package: libosmo-netif-dbg Section: debug @@ -27,4 +53,9 @@ Priority: extra Depends: libosmonetif2 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Debug symbols for Osmocom network interface +Description: Debug symbols for Osmocom network interface library + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. + . + This package contains the debug symbols for the library. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..1c1eb91 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,51 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmo-netif.git + +Files: * +Copyright: 2012-2013 On-Waves + 2012-2013 Pablo Neira Ayuso +License: GPL-2+ + +Files: src/rs232.c +Copyright: 2008-2011 Harald Welte + Pablo Neira Ayuso +License: AGPL-3+ + +Files: debian/* +Copyright: 2013-2015 Holger Hans Peter Freyther + 2015 Ruben Undheim +License: GPL-2+ + + +License: GPL-2+ + This package 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, 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +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 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/rules b/debian/rules index a4ddfaa..f398831 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 %: @@ -21,3 +22,7 @@ override_dh_install: dh_install sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'` + +override_dh_clean: + dh_clean + rm -f tests/package.m4 tests/testsuite .version .tarball-version -- To view, visit https://gerrit.osmocom.org/1473 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:06:35 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:06:35 +0000 Subject: [PATCH] libsmpp34[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1478 to look at the new patch set (#2). Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * remove useless comment debian/compat: update compatibility version debian/*.install: fix paths debian/copyright: add file matching Debian format Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Related: OS#1694 --- M debian/compat M debian/control A debian/copyright M debian/libsmpp0.install M debian/libsmpp34-dev.install M debian/rules 6 files changed, 72 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/78/1478/2 diff --git a/debian/compat b/debian/compat index 45a4fb7..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/debian/control b/debian/control index b5fd656..e612a4f 100644 --- a/debian/control +++ b/debian/control @@ -1,24 +1,50 @@ Source: libsmpp34 +Maintainer: Holger Freyther Section: libs Priority: optional -Maintainer: Holger Freyther -Build-Depends: debhelper (>= 8.0.0), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libxml2-dev, pkg-config -Standards-Version: 3.9.3 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore -Vcs-Git: git://git.osmocom.org/libosmocore.git +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + pkg-config, + libxml2-dev +Standards-Version: 3.9.6 Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Vcs-Git: git://git.osmocom.org/libosmocore.git +Homepage: https://projects.osmocom.org/projects/libsmpp34 Package: libsmpp0 Section: libs Architecture: any -Depends: ${misc:Depends} -Description: libsmpp34 codec library +Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Open PDU SMPP packaging and unpackaging tool + This library is an implementation for providing the PDU handling of the + SMPP-3.4 protocol. SMPP (Short Message Peer-to-Peer) is an open industry + standard protocol designed to provide a flexible data communication + interface for the transfer of short message data between External Short + Messaging Entities, Routing Entitites and Message Centres. Package: libsmpp34-dev -Section: libdevel Architecture: any -Depends: libsmpp0 (= ${binary:Version}), ${misc:Depends} -Description: Development headers libsmpp34 codec library +Multi-Arch: same +Section: libdevel +Depends: libsmpp0 (= ${binary:Version}), + ${misc:Depends} +Description: Development files for libsmpp34 + This library is an implementation for providing the PDU handling of the + SMPP-3.4 protocol. SMPP (Short Message Peer-to-Peer) is an open industry + standard protocol designed to provide a flexible data communication + interface for the transfer of short message data between External Short + Messaging Entities, Routing Entitites and Message Centres. + . + This package contains the development files for the library. Package: libsmpp34-utils Architecture: any diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..f92bc83 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libsmpp34 +Source: http://c-open-smpp-34.sourceforge.net/ + +Files: * +Copyright: 2006 Raul Tremsal +License: LGPL-2.1+ + +Files: debian/* +Copyright: 2016 Ruben Undheim +License: LGPL-2.1+ + + +License: LGPL-2.1+ + This package 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 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 Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/libsmpp0.install b/debian/libsmpp0.install index b56f189..3ddde58 100644 --- a/debian/libsmpp0.install +++ b/debian/libsmpp0.install @@ -1 +1 @@ -usr/lib/libsmpp34.so.* +usr/lib/*/lib*.so.* diff --git a/debian/libsmpp34-dev.install b/debian/libsmpp34-dev.install index a6fcb65..91180f6 100644 --- a/debian/libsmpp34-dev.install +++ b/debian/libsmpp34-dev.install @@ -1,5 +1,5 @@ usr/include/* -usr/lib/*.so -usr/lib/*.a -usr/lib/lib*.la -usr/lib/pkgconfig/* +usr/lib/*/lib*.so +usr/lib/*/*.a +usr/lib/*/lib*.la +usr/lib/*/pkgconfig/* diff --git a/debian/rules b/debian/rules index 7daafea..7b245b1 100755 --- a/debian/rules +++ b/debian/rules @@ -1,13 +1,8 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf --fail-missing -- To view, visit https://gerrit.osmocom.org/1478 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Gerrit-PatchSet: 2 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:22:30 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:22:30 +0000 Subject: [PATCH] osmo-bts[master]: Fix some spelling errors Message-ID: Review at https://gerrit.osmocom.org/1480 Fix some spelling errors Change-Id: I5b57102f961f8fd7fb0689ceeaa37dd021535b17 --- M src/common/amr.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/80/1480/1 diff --git a/src/common/amr.c b/src/common/amr.c index b5d2c37..05d1aaa 100644 --- a/src/common/amr.c +++ b/src/common/amr.c @@ -83,7 +83,7 @@ int i, j = 0; if (mr_version != 1) { - LOGP(DRSL, LOGL_ERROR, "AMR Multirate Version %u unknonw\n", + LOGP(DRSL, LOGL_ERROR, "AMR Multirate Version %u unknown\n", mr_version); goto ret_einval; } -- To view, visit https://gerrit.osmocom.org/1480 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5b57102f961f8fd7fb0689ceeaa37dd021535b17 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:22:34 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:22:34 +0000 Subject: [PATCH] osmo-bts[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1481 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment * add cleanup and test overrides debian/compat: update compatibility version Change-Id: Ibf62448eee1df914d21834f5b54831e3f642b79c Related: OS#1694 --- M debian/compat M debian/control M debian/rules 3 files changed, 29 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/81/1481/1 diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index d067e31..e1a58b2 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,24 @@ Source: osmo-bts +Maintainer: Holger Hans Peter Freyther Section: net Priority: optional -Maintainer: Holger Hans Peter Freyther -Build-Depends: debhelper (>= 7.0.0~), dh-autoreconf, dh-systemd (>= 1.5), autotools-dev, pkg-config, libosmocore-dev, libortp-dev, libosmo-abis-dev, libosmo-netif-dev -Standards-Version: 3.8.4 -Homepage: http://osmocom.org/projects/osmobts -Vcs-Git: git://git.osmocom.org/osmo-bts +Build-Depends: debhelper (>= 9), + pkg-config, + dh-autoreconf, + dh-systemd (>= 1.5), + autotools-dev, + pkg-config, + libosmocore-dev, + openbsc-dev, + libosmo-abis-dev, + libosmo-netif-dev, + libgps-dev, + libortp-dev, + txt2man +Standards-Version: 3.9.8 Vcs-Browser: http://git.osmocom.org/osmo-bts/ +Vcs-Git: git://git.osmocom.org/osmo-bts +Homepage: https://projects.osmocom.org/projects/osmobts Package: osmo-bts-trx Architecture: any diff --git a/debian/rules b/debian/rules index f7f941b..80ba0b2 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: @@ -20,3 +20,13 @@ override_dh_auto_configure: dh_auto_configure -- --enable-trx + +override_dh_clean: + dh_clean + $(RM) tests/package.m4 + $(RM) tests/testsuite + +# Print test results in case of a failure +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) + -- To view, visit https://gerrit.osmocom.org/1481 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibf62448eee1df914d21834f5b54831e3f642b79c Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:42:12 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:42:12 +0000 Subject: [PATCH] osmo-trx[master]: Add gerrit settings Message-ID: Review at https://gerrit.osmocom.org/1482 Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I6bbe65cc09e086685995f084a07a646a7d60b93c --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/82/1482/1 diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..4521e98 --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=osmo-trx -- To view, visit https://gerrit.osmocom.org/1482 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6bbe65cc09e086685995f084a07a646a7d60b93c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:42:12 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:42:12 +0000 Subject: [PATCH] osmo-trx[master]: Integrate Debian packaging changes Message-ID: Review at https://gerrit.osmocom.org/1483 Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax debian/copyright: update to match Debian format Change-Id: I9a89e7311c8632ae26ac2e6c02d1e427d94b1608 Related: OS#1694 --- M debian/control M debian/copyright M debian/rules 3 files changed, 181 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/83/1483/1 diff --git a/debian/control b/debian/control index 0aef88e..f2ad1ef 100644 --- a/debian/control +++ b/debian/control @@ -1,17 +1,39 @@ Source: osmo-trx -Maintainer: Ivan Klyuchnikov Section: net Priority: optional -Standards-Version: 3.9.3 -Build-Depends: debhelper (>= 9), autotools-dev, libdbd-sqlite3, pkg-config, dh-autoreconf, libuhd-dev, libusb-1.0-0-dev, libboost-all-dev, hardening-wrapper -Homepage: http://openbsc.osmocom.org/trac/wiki/OsmoTRX -Vcs-Git: git://git.osmocom.org/osmo-trx +Maintainer: Ivan Klyuchnikov +Build-Depends: debhelper (>= 9), + autotools-dev, + libdbd-sqlite3, + dh-autoreconf, + pkg-config, + libuhd-dev, + libusb-1.0-0-dev, + libboost-all-dev, + libsqlite3-dev +Standards-Version: 3.9.6 Vcs-Browser: http://cgit.osmocom.org/osmo-trx +Vcs-Git: git://git.osmocom.org/osmo-trx +Homepage: https://projects.osmocom.org/projects/osmotrx Package: osmo-trx Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3 -Description: OsmoTRX is a software-defined radio transceiver that implements the Layer 1 physical layer of a BTS +Description: SDR transceiver that implements Layer 1 of a GSM BTS + OsmoTRX is a software-defined radio transceiver that implements the Layer 1 + physical layer of a BTS comprising the following 3GPP specifications: + . + TS 05.01 "Physical layer on the radio path" + TS 05.02 "Multiplexing and Multiple Access on the Radio Path" + TS 05.04 "Modulation" + TS 05.10 "Radio subsystem synchronization" + . + In this context, BTS is "Base transceiver station". It's the stations that + connect mobile phones to the mobile network. + . + 3GPP is the "3rd Generation Partnership Project" which is the collaboration + between different telecommunication associations for developing new + generations of mobile phone networks. (post-2G/GSM) Package: osmo-trx-dbg Architecture: any diff --git a/debian/copyright b/debian/copyright index 5f8836d..b60990e 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,25 +1,162 @@ -The Debian packaging is: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: OsmoTRX +Source: http://cgit.osmocom.org/osmo-trx/ +Files-Excluded: sqlite3 Transceiver52M/std_inband.rbf - Copyright (C) 2014 Max +Files: * +Copyright: 2008-2013 Free Software Foundation + 2010 Kestrel Signal Processing, Inc. + 2010-2012 Range Networks, Inc. +License: AGPL-3+ -It was downloaded from: +Files: Transceiver52M/arm/* + Transceiver52M/x86/* + Transceiver52M/common/* + Transceiver52M/Resampler.cpp + Transceiver52M/Resampler.h + Transceiver52M/osmo-trx.cpp + Transceiver52M/radioInterfaceDiversity.cpp +Copyright: 2012-2013 Thomas Tsou +License: LGPL-2.1+ - git://git.osmocom.org/osmo-trx +Files: config/ax_check_compile_flag.m4 +Copyright: 2008 Guido U. Draheim + 2011 Maarten Bosmans +License: GPL-3+ -Upstream Authors: +Files: config/ax_gcc_x86_cpuid.m4 +Copyright: 2008 Steven G. Johnson + 2008 Matteo Frigo +License: GPL-3+ - Thomas Tsou - David A. Burgess - Harvind S. Samra - Raffi Sevlian +Files: config/ax_ext.m4 +Copyright: 2007 Christophe Tournayre + 2013 Michael Petch +License: license_for_ax_ext_m4 -Copyright: +Files: config/ax_gcc_x86_avx_xgetbv.m4 +Copyright: 2013 Michael Petch +License: GPL-3+ - Copyright (C) 2012-2013 Thomas Tsou - Copyright (C) 2011 Range Networks, Inc. - Copyright (C) 2008-2011 Free Software Foundation, Inc. +Files: CommonLibs/Makefile.am + GSM/Makefile.am + Transceiver52M/Makefile.am + sqlite3/Makefile.am + Transceiver52M/Transceiver.h + Transceiver52M/Transceiver.cpp +Copyright: 2008-2010 Free Software Foundation + 2010-2012 Range Networks, Inc. +License: GPL-3+ -License: +Files: autogen.sh +Copyright: 2005-2009 United States Government as represented by + the U.S. Army Research Laboratory. +License: BSD-3-clause - GNU Affero General Public License, Version 3 +Files: CommonLibs/sqlite3util.cpp +Copyright: 2010 Kestrel Signal Processing Inc. +License: none + No license described for file. +Comment: In the previous version of the file in the git repository + at upstream it is written: + Written by David A. Burgess, Kestrel Signal Processing, Inc., 2010 + The author disclaims copyright to this source code. + In the git log, this is written: + I do not claim any copyright over this change, as it's very basic. + Looking forward to see it merged into mainline. + See revision e766abbf82f02473038a83fd2f78befd08544cab at + https://github.com/osmocom/osmo-trx +Files: debian/* +Copyright: 2015 Ruben Undheim +License: GPL-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 . + + +License: GPL-3+ + This package 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 package 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, see + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-2.1+ + 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 program. If not, see + + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in + "/usr/share/common-licenses/LGPL-2.1". + + +License: license_for_ax_ext_m4 + Copying and distribution of this file, with or without modification, are + permitted in any medium without royalty provided the copyright notice + and this notice are preserved. This file is offered as-is, without any + warranty. + + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + . + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian/rules b/debian/rules index 9ec67e5..e6e8c75 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f -DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf -- To view, visit https://gerrit.osmocom.org/1483 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9a89e7311c8632ae26ac2e6c02d1e427d94b1608 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:42:12 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:42:12 +0000 Subject: [PATCH] osmo-trx[master]: Do not embed sqlite3 when building Message-ID: Review at https://gerrit.osmocom.org/1484 Do not embed sqlite3 when building Change-Id: If5edadc04c3ff953b451676e55ad3d00d4e43c82 --- M Makefile.am M Makefile.common 2 files changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/84/1484/1 diff --git a/Makefile.am b/Makefile.am index 06251f0..f9f5a5c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,6 @@ # Order must be preserved SUBDIRS = \ - sqlite3 \ CommonLibs \ GSM \ Transceiver52M diff --git a/Makefile.common b/Makefile.common index 734ab3a..d7927a5 100644 --- a/Makefile.common +++ b/Makefile.common @@ -33,6 +33,6 @@ COMMON_LA = $(top_builddir)/CommonLibs/libcommon.la GSM_LA = $(top_builddir)/GSM/libGSM.la -SQLITE_LA = $(top_builddir)/sqlite3/libsqlite.la -ldl +SQLITE_LA = -lsqlite3 MOSTLYCLEANFILES = *~ -- To view, visit https://gerrit.osmocom.org/1484 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If5edadc04c3ff953b451676e55ad3d00d4e43c82 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Wed Dec 21 17:42:12 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 21 Dec 2016 17:42:12 +0000 Subject: [PATCH] osmo-trx[master]: Remove embedded sqlite3 Message-ID: Review at https://gerrit.osmocom.org/1485 Remove embedded sqlite3 Previous patch switches to using system-wide sqlite3 so it's safe to remove local copy now. Change-Id: Ie8e751cc62132fe1f7748ccd78c5d48469027329 --- M configure.ac M debian/copyright D sqlite3/Makefile.am D sqlite3/sqlite3.c D sqlite3/sqlite3.h D sqlite3/sqlite3ext.h 6 files changed, 1 insertion(+), 145,782 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/85/1485/1 -- To view, visit https://gerrit.osmocom.org/1485 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie8e751cc62132fe1f7748ccd78c5d48469027329 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 22 11:55:59 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 22 Dec 2016 11:55:59 +0000 Subject: [PATCH] osmo-bts[master]: DTX: don't always perform AMR HR specific check Message-ID: Review at https://gerrit.osmocom.org/1486 DTX: don't always perform AMR HR specific check Disable check specific to AMR HR if not DTX is enabled. Change-Id: I8af1daffbd7e59fef6e671dbd9b820497f82d354 Fixes: OS#1892 --- M src/common/msg_utils.c 1 file changed, 8 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/86/1486/1 diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index b844eec..9de9b6d 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -156,12 +156,14 @@ int8_t sti, cmi; int rc; - if (lchan->type == GSM_LCHAN_TCH_H && /* SID-FIRST P1 -> P2 completion */ - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { - *len = 3; - memcpy(l1_payload, lchan->tch.dtx.cache, 2); - dtx_dispatch(lchan, E_SID_U); - return 0; + if (dtx_dl_amr_enabled(lchan)) { + if (lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { + *len = 3; /* SID-FIRST P1 -> P2 completion */ + memcpy(l1_payload, lchan->tch.dtx.cache, 2); + dtx_dispatch(lchan, E_SID_U); + return 0; + } } if (!rtp_pl_len) -- To view, visit https://gerrit.osmocom.org/1486 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8af1daffbd7e59fef6e671dbd9b820497f82d354 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:16:56 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 22 Dec 2016 13:16:56 +0000 Subject: [PATCH] openbsc[master]: sndcp: Allow empty SNDCP-XID indications Message-ID: Review at https://gerrit.osmocom.org/1487 sndcp: Allow empty SNDCP-XID indications In some rare cases the modem might send a xid indication that does not contain anything except the version number field. The sgsn ignors such SNDCP-XID indications by stripping the entire field from the response. We found a modem in the wild that started to act problematic when the empty SNDCP-XID was missing in the response. This patch changes the XID negotiation behaviour in a way that if a modem should send empty SNDCP-XID indications, the reply will also contain an empty SNDCP-XID indication. Apart from that the SNDCP-XID version number is now parsed and echoed in the response. This ensures that we always reply with the version number that the modem expects. (The version was 0 in all cases we observed so far) Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Related: OS#1794 --- M openbsc/include/openbsc/gprs_sndcp_xid.h M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_sndcp.c M openbsc/src/gprs/gprs_sndcp_xid.c M openbsc/tests/sndcp_xid/sndcp_xid_test.c 5 files changed, 68 insertions(+), 49 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/87/1487/1 diff --git a/openbsc/include/openbsc/gprs_sndcp_xid.h b/openbsc/include/openbsc/gprs_sndcp_xid.h index 02904a7..e64bc52 100644 --- a/openbsc/include/openbsc/gprs_sndcp_xid.h +++ b/openbsc/include/openbsc/gprs_sndcp_xid.h @@ -24,7 +24,7 @@ #include #include -#define CURRENT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ +#define DEFAULT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ #define MAX_ENTITIES 32 /* 3GPP TS 44.065 reserves 5 bit * for compression enitity number */ @@ -197,13 +197,15 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields); + const struct llist_head *comp_fields, int version); /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, - const uint8_t * src, - unsigned int src_len, - const struct llist_head *comp_fields_req); +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, + const uint8_t *src, + unsigned int src_len, + const struct llist_head + *comp_fields_req); /* Find out to which compression class the specified comp-field belongs * (header compression or data compression?) */ diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index c2c3900..89a380f 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -137,7 +137,7 @@ struct gprs_llc_lle *lle) { /* Note: This function handles the response of a network originated - * XID-Request. There XID messages reflected by the phone are analyzed + * XID-Request. There XID messages reflected by the modem are analyzed * and processed here. The caller is called by rx_llc_xid(). */ struct llist_head *xid_fields; @@ -205,7 +205,7 @@ struct gprs_llc_lle *lle) { /* Note: This function computes the response that is sent back to the - * phone when a phone originated XID is received. The function is + * modem when a modem originated XID is received. The function is * called by rx_llc_xid() */ int rc = -EINVAL; @@ -232,7 +232,7 @@ * for validity. Currently we just blindly * accept all XID fields by just echoing them. * There is a remaining risk of malfunction - * when a phone submits values which defer from + * when a modem submits values which defer from * the default! */ LOGP(DLLC, LOGL_NOTICE, "Echoing XID-Field: XID: type %s, data_len=%d, data=%s\n", @@ -276,7 +276,7 @@ return rc; } -/* Dispatch XID indications and responses comming from the Phone */ +/* Dispatch XID indications and responses comming from the modem */ static void rx_llc_xid(struct gprs_llc_lle *lle, struct gprs_llc_hdr_parsed *gph) { @@ -286,7 +286,7 @@ /* FIXME: 8.5.3.3: check if XID is invalid */ if (gph->is_cmd) { LOGP(DLLC, LOGL_NOTICE, - "Received XID indication from phone.\n"); + "Received XID indication from modem.\n"); struct msgb *resp; uint8_t *xid; @@ -306,7 +306,7 @@ gprs_llc_tx_xid(lle, resp, 0); } else { LOGP(DLLC, LOGL_NOTICE, - "Received XID confirmation from phone.\n"); + "Received XID confirmation from modem.\n"); gprs_llc_process_xid_conf(gph->data, gph->data_len, lle); /* FIXME: if we had sent a XID reset, send * LLGMM-RESET.conf to GMM */ @@ -342,7 +342,7 @@ else ftype = "NULL"; LOGP(DLLC, LOGL_NOTICE, "Sending XID type %s (%d bytes) request" - " to phone...\n", ftype, xid_bytes_len); + " to modem...\n", ftype, xid_bytes_len); gprs_llc_tx_xid(lle, msg, 1); } else { LOGP(DLLC, LOGL_ERROR, diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c index 1cbeede..77c9507 100644 --- a/openbsc/src/gprs/gprs_sndcp.c +++ b/openbsc/src/gprs/gprs_sndcp.c @@ -960,8 +960,13 @@ llist_add(&v42bis_comp_field.list, &comp_fields); } + /* Do not attempt to compile anything if there is no data in the list */ + if(llist_empty(&comp_fields)) + return 0; + /* Compile bytestream */ - return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields); + return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields, + DEFAULT_SNDCP_VERSION); } /* Set of SNDCP-XID bnegotiation (See also: TS 144 065, @@ -1106,6 +1111,7 @@ int rc; int compclass; + int version; struct llist_head *comp_fields; struct gprs_sndcp_comp_field *comp_field; @@ -1115,21 +1121,12 @@ OSMO_ASSERT(lle); /* Parse SNDCP-CID XID-Field */ - comp_fields = gprs_sndcp_parse_xid(lle->llme, + comp_fields = gprs_sndcp_parse_xid(&version, lle->llme, xid_field_indication->data, xid_field_indication->data_len, NULL); if (!comp_fields) return -EINVAL; - - /* Don't bother with empty indications */ - if (llist_empty(comp_fields)) { - xid_field_response->data = NULL; - xid_field_response->data_len = 0; - DEBUGP(DSNDCP, - "SNDCP-XID indication did not contain any parameters!\n"); - return 0; - } /* Handle compression entites */ DEBUGP(DSNDCP, "SNDCP-XID-IND (ms):\n"); @@ -1168,7 +1165,7 @@ /* Compile modified SNDCP-XID bytes */ rc = gprs_sndcp_compile_xid(xid_field_response->data, xid_field_indication->data_len, - comp_fields); + comp_fields, 0); if (rc > 0) xid_field_response->data_len = rc; @@ -1210,7 +1207,7 @@ OSMO_ASSERT(xid_field_request); /* Parse SNDCP-CID XID-Field */ - comp_fields_req = gprs_sndcp_parse_xid(lle->llme, + comp_fields_req = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_request->data, xid_field_request->data_len, NULL); @@ -1221,7 +1218,7 @@ gprs_sndcp_dump_comp_fields(comp_fields_req, LOGL_DEBUG); /* Parse SNDCP-CID XID-Field */ - comp_fields_conf = gprs_sndcp_parse_xid(lle->llme, + comp_fields_conf = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_conf->data, xid_field_conf->data_len, comp_fields_req); diff --git a/openbsc/src/gprs/gprs_sndcp_xid.c b/openbsc/src/gprs/gprs_sndcp_xid.c index bb43eab..37551e4 100644 --- a/openbsc/src/gprs/gprs_sndcp_xid.c +++ b/openbsc/src/gprs/gprs_sndcp_xid.c @@ -549,26 +549,29 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields) + const struct llist_head *comp_fields, int version) { int rc; int byte_counter = 0; uint8_t comp_bytes[512]; - uint8_t xid_version_number[1] = { CURRENT_SNDCP_VERSION }; + uint8_t xid_version_number[1]; OSMO_ASSERT(comp_fields); OSMO_ASSERT(dst); OSMO_ASSERT(dst_maxlen >= 2 + sizeof(xid_version_number)); - /* Bail if there is no input */ - if (llist_empty(comp_fields)) - return -EINVAL; + /* Prepend header with version number */ + if (version >= 0) { + xid_version_number[0] = (uint8_t) (version & 0xff); + dst = + tlv_put(dst, SNDCP_XID_VERSION_NUMBER, + sizeof(xid_version_number), xid_version_number); + byte_counter += (sizeof(xid_version_number) + 2); + } - /* Prepend header */ - dst = - tlv_put(dst, SNDCP_XID_VERSION_NUMBER, - sizeof(xid_version_number), xid_version_number); - byte_counter += (sizeof(xid_version_number) + 2); + /* Stop if there is no compression fields supplied */ + if (llist_empty(comp_fields)) + return byte_counter; /* Add data compression fields */ rc = gprs_sndcp_pack_fields(comp_fields, comp_bytes, @@ -1283,11 +1286,10 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -static int gprs_sndcp_decode_xid(struct llist_head *comp_fields, +static int gprs_sndcp_decode_xid(int *version, struct llist_head *comp_fields, const uint8_t *src, unsigned int src_len, - const struct - entity_algo_table - *lt, unsigned int lt_len) + const struct entity_algo_table *lt, + unsigned int lt_len) { int src_pos = 0; uint8_t tag; @@ -1296,6 +1298,10 @@ int byte_counter = 0; int rc; int tlv_count = 0; + + /* Preset version value as invalid */ + if(version) + *version = -1; /* Valid TLV-Tag and types */ static const struct tlv_definition sndcp_xid_def = { @@ -1326,6 +1332,10 @@ talloc_free(comp_fields); return -EINVAL; } + + /* Decode sndcp xid version number */ + if (version && tag == SNDCP_XID_VERSION_NUMBER) + *version = val[0]; /* Decode compression parameters */ if ((tag == SNDCP_XID_PROTOCOL_COMPRESSION) @@ -1548,7 +1558,8 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, const uint8_t *src, unsigned int src_len, const struct llist_head @@ -1559,6 +1570,12 @@ struct llist_head *comp_fields; struct entity_algo_table lt[MAX_ENTITIES * 2]; + /* In case of a zero length field, just exit */ + if(src_len == 0) + return NULL; + + /* We should go any further if we have a field length greater + * zero and a null pointer as buffer! */ OSMO_ASSERT(src); comp_fields = talloc_zero(ctx, struct llist_head); @@ -1575,8 +1592,8 @@ } /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, lt, - lt_len); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + lt, lt_len); if (rc < 0) { talloc_free(comp_fields); return NULL; @@ -1591,7 +1608,8 @@ } else { /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, NULL, 0); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + NULL, 0); if (rc < 0) { talloc_free(comp_fields); return NULL; diff --git a/openbsc/tests/sndcp_xid/sndcp_xid_test.c b/openbsc/tests/sndcp_xid/sndcp_xid_test.c index 3a33619..151dd2b 100644 --- a/openbsc/tests/sndcp_xid/sndcp_xid_test.c +++ b/openbsc/tests/sndcp_xid/sndcp_xid_test.c @@ -47,13 +47,14 @@ uint8_t xid_r[512]; /* Parse and show contained comp fields */ - comp_fields = gprs_sndcp_parse_xid(ctx, xid, sizeof(xid), NULL); + comp_fields = gprs_sndcp_parse_xid(NULL, ctx, xid, sizeof(xid), NULL); OSMO_ASSERT(comp_fields); printf("Decoded:\n"); gprs_sndcp_dump_comp_fields(comp_fields, DSNDCP); /* Encode comp-fields again */ - rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields); + rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields, + DEFAULT_SNDCP_VERSION); printf("Result length=%i\n",rc); printf("Encoded: %s\n", osmo_hexdump_nospc(xid, sizeof(xid))); printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc)); @@ -226,13 +227,14 @@ gprs_sndcp_dump_comp_fields(&comp_fields, DSNDCP); /* Encode SNDCP-XID fields */ - rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields); + rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields, + DEFAULT_SNDCP_VERSION); OSMO_ASSERT(rc > 0); printf("Encoded: %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc); /* Parse and show contained comp fields */ - comp_fields_dec = gprs_sndcp_parse_xid(ctx, xid, rc, NULL); + comp_fields_dec = gprs_sndcp_parse_xid(NULL, ctx, xid, rc, NULL); OSMO_ASSERT(comp_fields_dec); printf("Decoded:\n"); -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:38:43 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 22 Dec 2016 13:38:43 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 3: Weird, the error I see in build 1628 should be fixed with PS3. -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 3 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 Thu Dec 22 13:52:59 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:52:59 +0000 Subject: openbsc[master]: sndcp: Allow empty SNDCP-XID indications In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1487/1/openbsc/src/gprs/gprs_llc.c File openbsc/src/gprs/gprs_llc.c: Line 208: * modem when a modem originated XID is received. The function is please remove all those cosmetic changes from the functional change. And while you're at it, use terminology like MS/ME/UE which is reasonably generic. Either Phone or Modem is wrong, so the proposed change is not really an improvement. Also, why worry at all about it? Let's focus on what we really need to do, i.e. fix and improve the code... -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:53:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:53:40 +0000 Subject: openbsc[master]: sndcp: Allow empty SNDCP-XID indications In-Reply-To: References: Message-ID: Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/1487/1/openbsc/src/gprs/gprs_sndcp.c File openbsc/src/gprs/gprs_sndcp.c: Line 964: if(llist_empty(&comp_fields)) if is not a function. -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:53:58 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:53:58 +0000 Subject: osmo-bts[master]: DTX: don't always perform AMR HR specific check In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1486 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8af1daffbd7e59fef6e671dbd9b820497f82d354 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 Dec 22 13:54:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:07 +0000 Subject: [MERGED] osmo-bts[master]: DTX: don't always perform AMR HR specific check In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: DTX: don't always perform AMR HR specific check ...................................................................... DTX: don't always perform AMR HR specific check Disable check specific to AMR HR if not DTX is enabled. Change-Id: I8af1daffbd7e59fef6e671dbd9b820497f82d354 Fixes: OS#1892 --- M src/common/msg_utils.c 1 file changed, 8 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index b844eec..9de9b6d 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -156,12 +156,14 @@ int8_t sti, cmi; int rc; - if (lchan->type == GSM_LCHAN_TCH_H && /* SID-FIRST P1 -> P2 completion */ - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { - *len = 3; - memcpy(l1_payload, lchan->tch.dtx.cache, 2); - dtx_dispatch(lchan, E_SID_U); - return 0; + if (dtx_dl_amr_enabled(lchan)) { + if (lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { + *len = 3; /* SID-FIRST P1 -> P2 completion */ + memcpy(l1_payload, lchan->tch.dtx.cache, 2); + dtx_dispatch(lchan, E_SID_U); + return 0; + } } if (!rtp_pl_len) -- To view, visit https://gerrit.osmocom.org/1486 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8af1daffbd7e59fef6e671dbd9b820497f82d354 Gerrit-PatchSet: 1 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 Thu Dec 22 13:54:24 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:24 +0000 Subject: libosmocore[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1455 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Gerrit-PatchSet: 3 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 Dec 22 13:54:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:32 +0000 Subject: [MERGED] libosmocore[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * move build-depends to a proper place * update project URL debian/rules: * use proper hardening syntax * strip linker option without explicit shell invocation * remove useless comment * add extra cleanup debian/: package documentation separately debian/docs: remove empty file debian/coryright: update to match Debian format Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Related: OS#1694 --- M debian/control M debian/copyright D debian/docs A debian/libosmocodec-doc.doc-base A debian/libosmocodec-doc.install D debian/libosmocore-dev.dirs M debian/libosmocore-dev.install A debian/libosmocore-doc.doc-base A debian/libosmocore-doc.install A debian/libosmogsm-doc.doc-base A debian/libosmogsm-doc.install A debian/libosmovty-doc.doc-base A debian/libosmovty-doc.install M debian/rules 14 files changed, 462 insertions(+), 77 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/control b/debian/control index c91ce77..4cdb672 100644 --- a/debian/control +++ b/debian/control @@ -1,87 +1,275 @@ Source: libosmocore +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev, python-minimal -Standards-Version: 3.9.6 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + doxygen, + libpcsclite-dev, + pkg-config, + libtalloc-dev, + python (>= 2.7.6) +Standards-Version: 3.9.8 Vcs-Git: git://git.osmocom.org/libosmocore.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmocore Package: libosmocore Section: libs Architecture: any -Depends: libosmocodec0, libosmocore8, libosmogb4, libosmogsm7, libosmovty3, libosmoctrl0, ${misc:Depends} Multi-Arch: foreign -Description: Open Source MObile COMmunications CORE library +Depends: libosmocodec0 (= ${binary:Version}), + libosmocore8 (= ${binary:Version}), + libosmogb4 (= ${binary:Version}), + libosmogsm7 (= ${binary:Version}), + libosmovty3 (= ${binary:Version}), + libosmoctrl0 (= ${binary:Version}), + libosmosim0 (= ${binary:Version}), + ${misc:Depends} +Description: Open Source MObile COMmunications CORE library (metapackage) + The libraries provided by this package contain various utility functions. + These were originally developed as part of the + OpenBSC project but are of a more generic nature and thus useful to (at + least) other programs that are developed in the sphere of Free Software / Open + Source mobile communication. Package: libosmocodec0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo codec library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocodec library in particular contains the implementation of multiple + GSM codecs: + . + - GSM 06.10 - GSM FR Codec + - GSM 06.20 - GSM HR Codec + - GSM 06.60 - GSM EFR Codec + - GSM 06.90 - GSM AMR Codec + +Package: libosmocodec-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmocodec0, + libjs-jquery +Description: Documentation for the osmo codec library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmocodec library. Package: libosmocore8 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmocore8 library in particular is a collection of common code used in + various sub-projects inside the Osmocom family of projects. + +Package: libosmocore-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmocore8, + libjs-jquery, + libosmocodec-doc, + libosmogsm-doc, + libosmovty-doc +Description: Documentation for the Osmo Core library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmocore library. Package: libosmogb4 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GPRS GB library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogb library in particular contains a GPRS BSSGP protocol + implementation. Package: libosmogsm7 Section: libs Architecture: any -Build-Depends: python (>= 2.7.6) -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmogsm library in particular is a collection of common code used in + various GSM related sub-projects inside the Osmocom family of projects. It + includes A5/1 and A5/2 ciphers, COMP128v1, a LAPDm implementation, a GSM TLV + parser, SMS utility routines as well as protocol definitions for a series of + protocols. + +Package: libosmogsm-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmogsm7, + libjs-jquery +Description: Documentation for the Osmo GSM utility library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmogsm library. Package: libosmovty3 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmovty library in particular implements the interactive command-line + on the VTY (Virtual TTY) as well as configuration file parsing. + +Package: libosmovty-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + libosmovty3, + libjs-jquery +Description: Documentation for the Osmo VTY library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + This package contains the documentation for the libosmovty library. Package: libosmoctrl0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo control library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmoctrl library in particular contains an SNMP-like status interface. Package: libosmosim0 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} Description: Osmo SIM library + This is part of the libosmocore "meta"-library. The libosmocore library + contains various utility functions that were originally developed as part of + the OpenBSC project, but which are of a more generic nature and thus useful to + (at least) other programs that are developed in the sphere of Free Software / + Open Source mobile communication. + . + The libosmosim library in particular contains routines for SIM card access. Package: libosmocore-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmocore, libtalloc-dev Multi-Arch: same +Section: libdevel +Depends: libosmocore, + libtalloc-dev, + ${misc:Depends} Description: Development headers for Open Source MObile COMmunications CORE library + The header files provided by this package may be used to develop + with any of the libosmocore libraries. + . + Also static libraries are installed with this package. Package: libosmocore-utils Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore +Section: utils +Depends: ${shlibs:Depends}, + libosmocore, + ${misc:Depends} Multi-Arch: same Description: Utilities for gsm + This package contains a program for frequency calculation for GSM called + 'osmo-arfcn' and a program called 'osmo-auc-gen' that is used for testing GSM + authentication. + . + They use the libosmocore library. The libosmocore library contain various + utility functions that were originally developed as part of the OpenBSC + project, but which are of a more generic nature and thus useful to (at least) + other programs that are developed in the sphere of Free Software / Open Source + mobile communication. Package: libosmocore-dbg Architecture: any +Multi-Arch: same Section: debug Priority: extra -Depends: libosmocore (= ${binary:Version}), ${misc:Depends} -Multi-Arch: same +Depends: libosmocore (= ${binary:Version}), + ${misc:Depends} Description: Debug symbols for Open Source MObile COMmunications CORE library + This proackage contains debug symbols for all the libraries that are part of + libosmocore. + . + The libosmocore library contain various utility functions that + were originally developed as part of the OpenBSC project, but which are of a + more generic nature and thus useful to (at least) other programs that are + developed in the sphere of Free Software / Open Source mobile communication. diff --git a/debian/copyright b/debian/copyright index c450be5..2991c85 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,54 +1,211 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmocore.git - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2008 Daniel Willmann + 2008-2010 Harald Welte + 2008-2010 Holger Hans Peter Freyther + 2009-2010 Sylvain Munaut + 2009-2010 On-Waves + 2010 Nico Golde +License: GPL-2+ -It was downloaded from: +Files: src/talloc.c include/osmocom/core/talloc.h +Copyright: 2004 Andrew Tridgell + 2006 Stefan Metzmacher +License: LGPL-3+ - git://git.osmocom.org/libosmocore.git +Files: include/osmocom/core/loggingrb.h + include/osmocom/core/strrb.h + src/strrb.c + src/loggingrb.c +Copyright: 2012-2013 Katerina Barone-Adesi +License: GPL-2+ -Upstream Author(s): +Files: include/osmocom/core/linuxrbtree.h + src/rbtree.c +Copyright: 1999 Andrea Arcangeli + 2002 David Woodhouse +License: GPL-2+ - Harald Welte - Holger Hans Peter Freyther - Sylvain Munaut - Daniel Willmann - Golde - For src/talloc.c and include/osmocore/talloc.h: - Andrew Tridgell - Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Kunihiro Ishiguro +Files: include/osmocom/core/crc16.h +Copyright: 2005 Ben Gardner +License: GPL-2+ -Copyright: +Files: src/utils.c +Copyright: 2011 Harald Welte + 2011 Sylvain Munaut + 2014 Nils O. Sel?sdal +License: GPL-2+ - Copyright (C) 2008-2010 Harald Welte - Copyright (C) 2008-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 Sylvain Munaut - Copyright (C) 2009-2010 On-Waves - Copyright (C) 2008 Daniel Willmann - Copyright (C) 2010 Nico Golde - For src/talloc.c and include/osmocore/talloc.h: - Copyright (C) 2004 Andrew Tridgell - Copyright (C) 2006 Stefan Metzmacher - For src/vty/* and include/osmocom/vty/* - Copyright (C) 1998 Kunihiro Ishiguro +Files: src/gsm/gsm48_ie.c + src/gsm/lapd_core.c + src/gsm/lapdm.c +Copyright: 2008,2010-2011 Harald Welte + 2009-2011 Andreas Eversberg +License: GPL-2+ -License: +Files: src/gsm/gsm0411_smc.c + src/gsm/gsm0411_smr.c + src/gsm/gsm0411_utils.c +Copyright: 2008 Daniel Willmann + 2009 Harald Welte + 2010-2013 Holger Hans Peter Freyther + 2010 On-Waves + 2011 Andreas Eversberg +License: GPL-2+ - GNU General Public License, Version 2 or later +Files: src/gsm/gsm0480.c +Copyright: 2009 Mike Haben + 2010 Holger Hans Peter Freyther +License: GPL-2+ -The Debian packaging is: +Files: src/gsm/milenage/aes-internal.c + src/gsm/milenage/aes-encblock.c + src/gsm/milenage/aes.h + src/gsm/milenage/milenage.c + src/gsm/milenage/aes_wrap.h + src/gsm/milenage/aes-internal-enc.c + src/gsm/milenage/aes_i.h +Copyright: 2003-2007 Jouni Malinen +License: GPL-2 +Comment: Most of the file aes-internal.c is public_domain - Copyright (C) 2010 Harald Welte +Files: include/osmocom/core/bitXXgen.h.tpl + src/gsm/kasumi.c +Copyright: 2013-2014 Max +License: GPL-2+ -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. +Files: src/gsm/auth_comp128v23.c +Copyright: 2010-2011 Harald Welte + 2013 K?vin Redon +License: GPL-2+ -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". +Files: src/gsm/comp128v23.c +Copyright: 2013 K?vin Redon +License: GPL-2+ -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +Files: tests/fr/fr_test.c + tests/logging/logging_test.c + tests/loggingrb/loggingrb_test.c +Copyright: 2008,2009,2012 Holger Hans Peter Freyther + 2012-2013 Katerina Barone-Adesi +License: AGPL-3+ + +Files: tests/strrb/strrb_test.c + tests/vty/vty_test.c +Copyright: 2012-2013 Katerina Barone-Adesi + 2013 Jacob Erlbeck +License: GPL-3+ + +Files: src/vty/* include/osmocom/vty/* +Copyright: 1997,1998 Kunihiro Ishiguro +License: GPL-2+ + +Files: include/osmocom/core/stats.h + src/stat_item.c + src/stats.c + src/vty/stats_vty.c + tests/stats/stats_test.c +Copyright: 2009-2010 by Harald Welte + 2009-2014 by Holger Hans Peter Freyther + 2015 Sysmocom s.f.m.c. GmbH +License: GPL-2+ + +Files: tests/gb/gprs_ns_test.c + tests/gb/gprs_bssgp_test.c +Copyright: 2013-2014 sysmocom s.f.m.c. GmbH +License: GPL-2+ +Comment: No license is listed in these files, but it is assumed that + the project specific license GPL-2+ applies since contributions by + sysmocom people to other files in this package are GPL licensed. + +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2014-2015 Ruben Undheim +License: GPL-3+ + + +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-2 + This package 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, version 2 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + + +License: LGPL-3+ + 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 3 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 3 can be found in "/usr/share/common-licenses/LGPL-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 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/docs b/debian/docs deleted file mode 100644 index e69de29..0000000 --- a/debian/docs +++ /dev/null diff --git a/debian/libosmocodec-doc.doc-base b/debian/libosmocodec-doc.doc-base new file mode 100644 index 0000000..8480c73 --- /dev/null +++ b/debian/libosmocodec-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmocodec-doc +Title: Documentation for the libosmocodec library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/codec/html/index.html +Files: /usr/share/doc/libosmocore/codec/html/*.html diff --git a/debian/libosmocodec-doc.install b/debian/libosmocodec-doc.install new file mode 100644 index 0000000..be0255b --- /dev/null +++ b/debian/libosmocodec-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/codec/ diff --git a/debian/libosmocore-dev.dirs b/debian/libosmocore-dev.dirs deleted file mode 100644 index 94090a3..0000000 --- a/debian/libosmocore-dev.dirs +++ /dev/null @@ -1,8 +0,0 @@ -usr/lib -usr/include -usr/include/osmocom -usr/include/osmocom/codec -usr/include/osmocom/core -usr/include/osmocom/crypt -usr/include/osmocom/gsm -usr/include/osmocom/vty diff --git a/debian/libosmocore-dev.install b/debian/libosmocore-dev.install index 7c5a789..465f933 100644 --- a/debian/libosmocore-dev.install +++ b/debian/libosmocore-dev.install @@ -3,4 +3,3 @@ usr/lib/*/lib*.so usr/lib/*/lib*.la usr/lib/*/pkgconfig/* -usr/share/doc/libosmocore/* diff --git a/debian/libosmocore-doc.doc-base b/debian/libosmocore-doc.doc-base new file mode 100644 index 0000000..b13b82d --- /dev/null +++ b/debian/libosmocore-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmocore-doc +Title: Documentation for the libosmocore library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/core/html/index.html +Files: /usr/share/doc/libosmocore/core/html/*.html diff --git a/debian/libosmocore-doc.install b/debian/libosmocore-doc.install new file mode 100644 index 0000000..fe4cb26 --- /dev/null +++ b/debian/libosmocore-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/core/ diff --git a/debian/libosmogsm-doc.doc-base b/debian/libosmogsm-doc.doc-base new file mode 100644 index 0000000..6318c1d --- /dev/null +++ b/debian/libosmogsm-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmogsm-doc +Title: Documentation for the libosmogsm library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/gsm/html/index.html +Files: /usr/share/doc/libosmocore/gsm/html/*.html diff --git a/debian/libosmogsm-doc.install b/debian/libosmogsm-doc.install new file mode 100644 index 0000000..a4300bc --- /dev/null +++ b/debian/libosmogsm-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/gsm/ diff --git a/debian/libosmovty-doc.doc-base b/debian/libosmovty-doc.doc-base new file mode 100644 index 0000000..dde189c --- /dev/null +++ b/debian/libosmovty-doc.doc-base @@ -0,0 +1,7 @@ +Document: libosmovty-doc +Title: Documentation for the libosmovty library +Section: Programming + +Format: HTML +Index: /usr/share/doc/libosmocore/vty/html/index.html +Files: /usr/share/doc/libosmocore/vty/html/*.html diff --git a/debian/libosmovty-doc.install b/debian/libosmovty-doc.install new file mode 100644 index 0000000..634ba41 --- /dev/null +++ b/debian/libosmovty-doc.install @@ -0,0 +1 @@ +usr/share/doc/libosmocore/vty/ diff --git a/debian/rules b/debian/rules index 3cce05e..e173510 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -13,10 +7,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') -# Our tests want to override symbols, make it possible on Ubuntu -export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS | sed -e 's/-Wl,-Bsymbolic-functions//') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all -export DEB_BUILD_HARDENING=1 +export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions %: dh $@ --with autoreconf --fail-missing @@ -38,3 +31,27 @@ override_dh_auto_configure: dh_auto_configure -- --enable-static + +override_dh_clean: + dh_clean + $(RM) .version + $(RM) debian/man/osmo-arfcn.1 + $(RM) debian/man/osmo-auc-gen.1 + $(RM) include/osmocom/core/bit16gen.h + $(RM) include/osmocom/core/bit32gen.h + $(RM) include/osmocom/core/bit64gen.h + $(RM) include/osmocom/core/crc16gen.h + $(RM) include/osmocom/core/crc32gen.h + $(RM) include/osmocom/core/crc64gen.h + $(RM) include/osmocom/core/crc8gen.h + $(RM) src/crc16gen.c + $(RM) src/crc32gen.c + $(RM) src/crc64gen.c + $(RM) src/crc8gen.c + $(RM) tests/package.m4 + $(RM) tests/testsuite + $(RM) -r doc/codec/ + $(RM) -r doc/core/ + $(RM) -r doc/gsm/ + $(RM) -r doc/vty/html/ + $(RM) -r doc/vty/latex/ -- To view, visit https://gerrit.osmocom.org/1455 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia7654d34730e9f269831612bfba70a1338ce29d3 Gerrit-PatchSet: 4 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 Thu Dec 22 13:54:46 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:46 +0000 Subject: libosmo-sccp[master]: Add gerrit settings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1467 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1988dcb73d5401544ff23d668e7328deecf004d6 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp 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 Dec 22 13:54:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:49 +0000 Subject: [MERGED] libosmo-sccp[master]: Add gerrit settings In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add gerrit settings ...................................................................... Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I1988dcb73d5401544ff23d668e7328deecf004d6 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..d9747f4 --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libosmo-sccp -- To view, visit https://gerrit.osmocom.org/1467 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1988dcb73d5401544ff23d668e7328deecf004d6 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:54:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:51 +0000 Subject: libsmpp34[master]: Add gerrit settings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1477 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic97dda1950689ed86dcf01a49a0894aedaf57bab Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 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 Dec 22 13:54:52 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:54:52 +0000 Subject: [MERGED] libsmpp34[master]: Add gerrit settings In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add gerrit settings ...................................................................... Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: Ic97dda1950689ed86dcf01a49a0894aedaf57bab --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..b575bb3 --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libsmpp34 -- To view, visit https://gerrit.osmocom.org/1477 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic97dda1950689ed86dcf01a49a0894aedaf57bab Gerrit-PatchSet: 1 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:55:12 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:55:12 +0000 Subject: libosmo-sccp[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1468 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-sccp 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 Dec 22 13:55:13 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:55:13 +0000 Subject: [MERGED] libosmo-sccp[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment debian/copyright: update to match Debian format Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Related: OS#1694 --- M debian/control M debian/copyright M debian/rules 3 files changed, 79 insertions(+), 43 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/control b/debian/control index aa2035a..60bef71 100644 --- a/debian/control +++ b/debian/control @@ -1,16 +1,33 @@ Source: libosmo-sccp -Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, pkg-config, libosmocore-dev, autoconf, automake, libtool, dh-autoreconf, git, libdpkg-perl, libosmo-netif-dev, libsctp-dev -Standards-Version: 3.9.6 Section: libs -#Homepage: +Priority: optional +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libosmocore-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + git, + libdpkg-perl, + libosmo-netif-dev, + libsctp-dev +Standards-Version: 3.9.7 Vcs-Git: git://git.osmocom.org/libosmo-sccp.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-sccp.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmo-sccp Package: libosmo-sccp-dev -Section: libdevel Architecture: any Depends: ${misc:Depends} Multi-Arch: same -Description: Development files for Osmcoom SCCP library +Section: libdevel +Description: Development files for libosmosccp, libosmomtp and libosmoxua + SCCP is a network layer protocol that provides extended routing, flow control, + segmentation, connection-orientation, and error correction facilities in + Signaling System 7 telecommunications networks. + It is heavily used in cellular networks such as GSM. + . + This package contains the development files for the library. diff --git a/debian/copyright b/debian/copyright index 97328f2..78c9f12 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,36 +1,53 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libopen-sccp +Source: http://cgit.osmocom.org/libosmo-sccp/ - Harald Welte on Tue, 24 Aug 2010 10:55:04 +0200 +Files: * +Copyright: 2009-2010,2013 On-Waves + 2009-2011,2013 Holger Hans Peter Freyther + 2010 Harald Welte +License: GPL-2+ -It was downloaded from: +Files: include/sigtran/xua_msg.h + src/xua_msg.c + tests/m2ua/m2ua_test.c +Copyright: 2011 Holger Hans Peter Freyther +License: AGPL-3+ - git://git.osmocom.org/libosmo-sccp.git +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2016 Ruben Undheim +License: GPL-2+ -Upstream Author(s): - Holger Hans Peter Freyther +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2.1 can be found in "/usr/share/common-licenses/GPL-2". -Copyright: - Copyright (C) 2009-2010 Holger Hans Peter Freyther - Copyright (C) 2009-2010 On-Waves - -License: - - GNU General Public License, Version 2 or later - -The Debian packaging is: - - Copyright (C) 2010 Harald Welte - -# Please chose a license for your packaging work. If the program you package -# uses a mainstream license, using the same license is the safest choice. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# If you just want it to be GPL version 3, leave the following lines in. - -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +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 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/rules b/debian/rules index 1895067..c42676a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,19 +1,12 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2) DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') - -export DEB_BUILD_HARDENING=1 %: dh $@ --with autoreconf @@ -21,3 +14,12 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf + +override_dh_clean: + dh_clean + rm -f .version tests/package.m4 tests/testsuite + +# Print test results in case of a failure +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) + -- To view, visit https://gerrit.osmocom.org/1468 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5d68891faa03ae83beeda58eb8ff8aa747dc6ad6 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:59:27 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:59:27 +0000 Subject: [PATCH] libosmocore[master]: Fix erroneously AGPL licensed file in libosmocore. Message-ID: Review at https://gerrit.osmocom.org/1488 Fix erroneously AGPL licensed file in libosmocore. libosmocore itself is GPLv2-or-later. Only the test cases are permitted to be AGPL licensed. Change-Id: I62f2eed6305bfa11a64c6d633e08aabeaf9f0b10 --- M src/gsm/gsm_04_08_gprs.c 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/88/1488/1 diff --git a/src/gsm/gsm_04_08_gprs.c b/src/gsm/gsm_04_08_gprs.c index 14207f8..6f0baba 100644 --- a/src/gsm/gsm_04_08_gprs.c +++ b/src/gsm/gsm_04_08_gprs.c @@ -5,16 +5,16 @@ * 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 + * 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 Affero General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ -- To view, visit https://gerrit.osmocom.org/1488 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62f2eed6305bfa11a64c6d633e08aabeaf9f0b10 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Dec 22 13:59:58 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 13:59:58 +0000 Subject: libosmo-abis[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1469 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis 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 Dec 22 14:00:00 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:00:00 +0000 Subject: [MERGED] libosmo-abis[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * add cleanup override debian/copyright: add file matching Debian format Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Related: OS#1694 --- M debian/control A debian/copyright M debian/rules 3 files changed, 135 insertions(+), 14 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/control b/debian/control index eed3a4c..5df6c95 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,22 @@ Source: libosmo-abis +Maintainer: Harald Welte Section: libs Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libosmocore-dev (>= 0.6.4), pkg-config, libortp-dev -Standards-Version: 3.9.6 -Homepage: http://openbsc.osmocom.org/trac/wiki/libosmo-abis +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + libosmocore-dev (>= 0.6.4), + pkg-config, + libortp-dev +Standards-Version: 3.9.7 Vcs-Git: git://git.osmocom.org/libosmo-abis.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-abis.git;a=summary +Homepage: https://projects.osmocom.org/projects/libosmo-abis Package: libosmo-abis Section: oldlibs @@ -20,28 +30,51 @@ Package: libosmoabis5 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: GSM A-bis handling + This library contains common/shared code regarding the A-bis interface between + the GSM Base transceiver station (BTS) and the GSM Base station controller BSC. + . + It also implements drivers for mISDN and DAHDI based E1 cards, as well as some + A-bis/IP dialects. Package: libosmotrau1 Section: libs Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: GSM trau handling + This library implements the Transcoder and Rate Adaptation Unit (TRAU) for + GSM systems. It is closely related to the libosmo-abis library. + . + TRAU performs transcoding function for speech channels and rate adaptation (RA) + for data channels in the GSM network. Package: libosmo-abis-dev -Section: libdevel Architecture: any -Depends: ${misc:Depends}, libosmotrau1 (= ${binary:Version}), libosmoabis5 (= ${binary:Version}) Multi-Arch: same -Description: Development headers for A-bis interface. +Section: libdevel +Depends: ${misc:Depends}, + libosmotrau1 (= ${binary:Version}), + libosmoabis5 (= ${binary:Version}) +Description: Development headers for A-bis interface + The libosmo-abis library contains common/shared code regarding the A-bis + interface between GSM BTS and BSC. This package in particular contains the + development files needed to develop with the libosmoabis and libosmotrau + libraries. Package: libosmo-abis-dbg -Section: debug Architecture: any -Priority: extra -Depends: libosmoabis5 (= ${binary:Version}), libosmotrau1 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Debug symbols for A-bis interface. +Section: debug +Priority: extra +Depends: libosmoabis5 (= ${binary:Version}), + libosmotrau1 (= ${binary:Version}), + ${misc:Depends} +Description: Debug symbols for A-bis interface + The libosmo-abis library contains common/shared code regarding the A-bis + interface between GSM BTS and BSC. This package in particular contains the + debug symbols for the two libraries libosmoabis and libosmotrau. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..fdcf686 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,83 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmo-abis.git + +Files: * +Copyright: 2008 Daniel Willmann + 2008-2012 Harald Welte + 2009-2010 Holger Hans Peter Freyther + 2010,2014 On-Waves + 2011-2014 Pablo Neira Ayuso + 2012 Tobias Engel + 2014 Sysmocom s.f.m.c. GmBH +License: AGPL-3+ + +Files: src/input/lapd.c + src/trau/osmo_ortp.c + src/input/dahdi.c +Copyright: 2008-2011 Harald Welte + 2009 oystein at homelien.no + 2009 Holger Hans Peter Freyther + 2010 Digium and Matthew Fredrickson + 2011 Andreas Everberg +License: GPL-2+ + +Files: include/mISDNif.h +Copyright: 2008 Karsten Keil +License: LGPL-2.1 + +Files: debian/* +Copyright: 2012 Eric Butler + 2012-2015 Holger Hans Peter Freyther + 2015 Ruben Undheim +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 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 . + + +License: GPL-2+ + This package 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, 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: LGPL-2.1 + 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; + version 2.1 of the License. + . + 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, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index d3f1534..cec3c9f 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 + %: dh $@ --with autoreconf --fail-missing @@ -16,3 +17,7 @@ override_dh_autoreconf: echo $(VERSION) > .tarball-version dh_autoreconf + +override_dh_clean: + dh_clean + rm -f tests/package.m4 tests/testsuite .version .tarball-version -- To view, visit https://gerrit.osmocom.org/1469 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6af8ab7f5c75b4d161cebf492f3de5d9dbd00220 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:03:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:03:43 +0000 Subject: [PATCH] libosmo-netif[master]: rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPL... Message-ID: Review at https://gerrit.osmocom.org/1489 rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPLv2-or-later Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7 --- M src/rs232.c 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/89/1489/1 diff --git a/src/rs232.c b/src/rs232.c index 798bf72..c05a693 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -8,16 +8,16 @@ * Pablo Neira Ayuso * * 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 + * 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 Affero General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ -- To view, visit https://gerrit.osmocom.org/1489 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:03:54 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:03:54 +0000 Subject: libosmo-netif[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1473 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif 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 Dec 22 14:03:58 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:03:58 +0000 Subject: [MERGED] libosmo-netif[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * add cleanup override debian/copyright: add file matching Debian format Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Related: OS#1694 --- M debian/control A debian/copyright M debian/rules 3 files changed, 93 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/control b/debian/control index 3953414..f499728 100644 --- a/debian/control +++ b/debian/control @@ -2,24 +2,50 @@ Section: libs Priority: optional Maintainer: Holger Hans Peter Freyther -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libosmocore-dev, libosmo-abis-dev, pkg-config, libsctp-dev +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + libosmocore-dev, + libosmo-abis-dev, + pkg-config, + libsctp-dev, + libortp-dev Standards-Version: 3.9.6 -Vcs-Git: git://git.osmocom.org/libosmo-netif.git Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmo-netif.git;a=summary +Vcs-Git: git://git.osmocom.org/libosmo-netif.git +Homepage: https://projects.osmocom.org/projects/libosmo-netif Package: libosmonetif2 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same -Description: Library containing common/shared code regarding network interface +Description: Common/shared code regarding network interface for OpenBSC + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. Package: libosmo-netif-dev Section: libdevel Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore, libosmonetif2 (= ${binary:Version}) +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libosmocore-dev, + libosmocore, + libosmonetif3 (= ${binary:Version}) Multi-Arch: same Description: Development headers for Osmocom network interface + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. + . + This package contains the development files needed for developing with + the libosmo-netif library. Package: libosmo-netif-dbg Section: debug @@ -27,4 +53,9 @@ Priority: extra Depends: libosmonetif2 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Debug symbols for Osmocom network interface +Description: Debug symbols for Osmocom network interface library + The libosmo-netif library is one of the libraries needed by the + OpenBSC GSM infrastructure software. This library in particular implements + the shared code for network interfaces. + . + This package contains the debug symbols for the library. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..1c1eb91 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,51 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libosmocore +Source: git://git.osmocom.org/libosmo-netif.git + +Files: * +Copyright: 2012-2013 On-Waves + 2012-2013 Pablo Neira Ayuso +License: GPL-2+ + +Files: src/rs232.c +Copyright: 2008-2011 Harald Welte + Pablo Neira Ayuso +License: AGPL-3+ + +Files: debian/* +Copyright: 2013-2015 Holger Hans Peter Freyther + 2015 Ruben Undheim +License: GPL-2+ + + +License: GPL-2+ + This package 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, 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +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 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/rules b/debian/rules index a4ddfaa..f398831 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,9 @@ DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 %: @@ -21,3 +22,7 @@ override_dh_install: dh_install sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'` + +override_dh_clean: + dh_clean + rm -f tests/package.m4 tests/testsuite .version .tarball-version -- To view, visit https://gerrit.osmocom.org/1473 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9174b34a79c0562ef43f757ea76d67301088f109 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:04:11 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:04:11 +0000 Subject: libsmpp34[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1478 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Gerrit-PatchSet: 2 Gerrit-Project: libsmpp34 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 Dec 22 14:04:12 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:04:12 +0000 Subject: [MERGED] libsmpp34[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * remove useless comment debian/compat: update compatibility version debian/*.install: fix paths debian/copyright: add file matching Debian format Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Related: OS#1694 --- M debian/compat M debian/control A debian/copyright M debian/libsmpp0.install M debian/libsmpp34-dev.install M debian/rules 6 files changed, 72 insertions(+), 22 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/compat b/debian/compat index 45a4fb7..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/debian/control b/debian/control index b5fd656..e612a4f 100644 --- a/debian/control +++ b/debian/control @@ -1,24 +1,50 @@ Source: libsmpp34 +Maintainer: Holger Freyther Section: libs Priority: optional -Maintainer: Holger Freyther -Build-Depends: debhelper (>= 8.0.0), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libxml2-dev, pkg-config -Standards-Version: 3.9.3 -Homepage: http://bb.osmocom.org/trac/wiki/libosmocore -Vcs-Git: git://git.osmocom.org/libosmocore.git +Build-Depends: debhelper (>= 9), + autotools-dev, + autoconf, + automake, + libtool, + dh-autoreconf, + libdpkg-perl, + git, + pkg-config, + libxml2-dev +Standards-Version: 3.9.6 Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary +Vcs-Git: git://git.osmocom.org/libosmocore.git +Homepage: https://projects.osmocom.org/projects/libsmpp34 Package: libsmpp0 Section: libs Architecture: any -Depends: ${misc:Depends} -Description: libsmpp34 codec library +Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Open PDU SMPP packaging and unpackaging tool + This library is an implementation for providing the PDU handling of the + SMPP-3.4 protocol. SMPP (Short Message Peer-to-Peer) is an open industry + standard protocol designed to provide a flexible data communication + interface for the transfer of short message data between External Short + Messaging Entities, Routing Entitites and Message Centres. Package: libsmpp34-dev -Section: libdevel Architecture: any -Depends: libsmpp0 (= ${binary:Version}), ${misc:Depends} -Description: Development headers libsmpp34 codec library +Multi-Arch: same +Section: libdevel +Depends: libsmpp0 (= ${binary:Version}), + ${misc:Depends} +Description: Development files for libsmpp34 + This library is an implementation for providing the PDU handling of the + SMPP-3.4 protocol. SMPP (Short Message Peer-to-Peer) is an open industry + standard protocol designed to provide a flexible data communication + interface for the transfer of short message data between External Short + Messaging Entities, Routing Entitites and Message Centres. + . + This package contains the development files for the library. Package: libsmpp34-utils Architecture: any diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..f92bc83 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libsmpp34 +Source: http://c-open-smpp-34.sourceforge.net/ + +Files: * +Copyright: 2006 Raul Tremsal +License: LGPL-2.1+ + +Files: debian/* +Copyright: 2016 Ruben Undheim +License: LGPL-2.1+ + + +License: LGPL-2.1+ + This package 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 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 Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/libsmpp0.install b/debian/libsmpp0.install index b56f189..3ddde58 100644 --- a/debian/libsmpp0.install +++ b/debian/libsmpp0.install @@ -1 +1 @@ -usr/lib/libsmpp34.so.* +usr/lib/*/lib*.so.* diff --git a/debian/libsmpp34-dev.install b/debian/libsmpp34-dev.install index a6fcb65..91180f6 100644 --- a/debian/libsmpp34-dev.install +++ b/debian/libsmpp34-dev.install @@ -1,5 +1,5 @@ usr/include/* -usr/lib/*.so -usr/lib/*.a -usr/lib/lib*.la -usr/lib/pkgconfig/* +usr/lib/*/lib*.so +usr/lib/*/*.a +usr/lib/*/lib*.la +usr/lib/*/pkgconfig/* diff --git a/debian/rules b/debian/rules index 7daafea..7b245b1 100755 --- a/debian/rules +++ b/debian/rules @@ -1,13 +1,8 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf --fail-missing -- To view, visit https://gerrit.osmocom.org/1478 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I50b54d7d89f7c7ed3e5a10fbf734d967090f30c7 Gerrit-PatchSet: 2 Gerrit-Project: libsmpp34 Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:04:20 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:04:20 +0000 Subject: osmo-bts[master]: Fix some spelling errors In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1480 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5b57102f961f8fd7fb0689ceeaa37dd021535b17 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:04:22 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:04:22 +0000 Subject: [MERGED] osmo-bts[master]: Fix some spelling errors In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix some spelling errors ...................................................................... Fix some spelling errors Change-Id: I5b57102f961f8fd7fb0689ceeaa37dd021535b17 --- M src/common/amr.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/amr.c b/src/common/amr.c index b5d2c37..05d1aaa 100644 --- a/src/common/amr.c +++ b/src/common/amr.c @@ -83,7 +83,7 @@ int i, j = 0; if (mr_version != 1) { - LOGP(DRSL, LOGL_ERROR, "AMR Multirate Version %u unknonw\n", + LOGP(DRSL, LOGL_ERROR, "AMR Multirate Version %u unknown\n", mr_version); goto ret_einval; } -- To view, visit https://gerrit.osmocom.org/1480 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5b57102f961f8fd7fb0689ceeaa37dd021535b17 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Ruben Undheim From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:04:36 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:04:36 +0000 Subject: osmo-bts[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1481 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibf62448eee1df914d21834f5b54831e3f642b79c 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 Dec 22 14:04:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:04:56 +0000 Subject: osmo-trx[master]: Add gerrit settings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1482 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6bbe65cc09e086685995f084a07a646a7d60b93c Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx 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 Dec 22 14:05:26 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:05:26 +0000 Subject: osmo-trx[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1483 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9a89e7311c8632ae26ac2e6c02d1e427d94b1608 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx 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 Dec 22 14:05:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:05:35 +0000 Subject: osmo-trx[master]: Do not embed sqlite3 when building In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1484 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5edadc04c3ff953b451676e55ad3d00d4e43c82 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Ruben Undheim Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:05:42 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:05:42 +0000 Subject: osmo-trx[master]: Remove embedded sqlite3 In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1485 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie8e751cc62132fe1f7748ccd78c5d48469027329 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx 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 Dec 22 14:05:55 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:05:55 +0000 Subject: libosmo-netif[master]: rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPL... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1489 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7 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 Dec 22 14:06:08 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:06:08 +0000 Subject: libosmocore[master]: Fix erroneously AGPL licensed file in libosmocore. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1488 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I62f2eed6305bfa11a64c6d633e08aabeaf9f0b10 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 Dec 22 14:06:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:06:34 +0000 Subject: libosmo-netif[master]: Add gerrit settings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1471 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4fc8b17a0cbea16c7bdd7e50d106ef4aa35780e0 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-netif 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 Dec 22 14:06:35 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:06:35 +0000 Subject: [MERGED] libosmo-netif[master]: Add gerrit settings In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add gerrit settings ...................................................................... Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I4fc8b17a0cbea16c7bdd7e50d106ef4aa35780e0 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..1ea007b --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libosmo-netif -- To view, visit https://gerrit.osmocom.org/1471 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4fc8b17a0cbea16c7bdd7e50d106ef4aa35780e0 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:06:56 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:06:56 +0000 Subject: libosmo-abis[master]: Add gerrit settings In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1470 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I04aeee90641555df19e969f925474ec6f9a23354 Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis 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 Dec 22 14:06:57 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:06:57 +0000 Subject: [MERGED] libosmo-abis[master]: Add gerrit settings In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add gerrit settings ...................................................................... Add gerrit settings Make it simple to setup and use this repo with 'git review' command. Change-Id: I04aeee90641555df19e969f925474ec6f9a23354 --- A .gitreview 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..2e575db --- /dev/null +++ b/.gitreview @@ -0,0 +1,3 @@ +[gerrit] +host=gerrit.osmocom.org +project=libosmo-abis -- To view, visit https://gerrit.osmocom.org/1470 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I04aeee90641555df19e969f925474ec6f9a23354 Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:07:42 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:07:42 +0000 Subject: openbsc[master]: bsc_vty: Fix missing break statements in switch() In-Reply-To: References: Message-ID: Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1326 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:07:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:07:43 +0000 Subject: [MERGED] openbsc[master]: bsc_vty: Fix missing break statements in switch() In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: bsc_vty: Fix missing break statements in switch() ...................................................................... bsc_vty: Fix missing break statements in switch() Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Fixes: Coverity CID 135188 Fixes: Coverity CID 135190 --- M openbsc/src/libbsc/bsc_vty.c 1 file changed, 2 insertions(+), 0 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/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index e3ec8d9..01ee4df 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -2799,9 +2799,11 @@ case -ENOMEM: vty_out(vty, "Unable to add arfcn: max number of UARFCNs (%u) " "reached%s", MAX_EARFCN_LIST, VTY_NEWLINE); + return CMD_WARNING; case -ENOSPC: vty_out(vty, "Warning: not enough space in si2quater for a " "given arfcn%s", VTY_NEWLINE); + return CMD_WARNING; case -EADDRINUSE: vty_out(vty, "Unable to add arfcn: (%u, %u) is already added%s", arfcn, scramble, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/1326 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:07:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Thu, 22 Dec 2016 14:07:53 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 3: BTW, the earlier build failures came from me installing libgnutls only on the build slave but forgetting to add it to the docker image as well. Please see in osmo-nitb/Makefile.am, there was a change for LIBCRYPTO_CFLAGS on master in the meantime, which I guess needs adjustment. Probably not related to the failure though. -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 3 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 Thu Dec 22 14:09:01 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:09:01 +0000 Subject: osmo-pcu[master]: Add counter at BTS level And statistics at TBF/MS level. In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1438 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:09:04 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:09:04 +0000 Subject: [MERGED] osmo-pcu[master]: Add counter at BTS level And statistics at TBF/MS level. In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Add counter at BTS level And statistics at TBF/MS level. ...................................................................... Add counter at BTS level And statistics at TBF/MS level. Adds spb counters at BTS level(show bts statistics). Adds RLC/MAC downlink control msg at ms level(show ms imsi ). Adds the number of coding schemes counter for UL at TBF level. Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38 --- M src/bts.cpp M src/bts.h M src/gprs_ms.cpp M src/gprs_ms.h M src/gprs_rlcmac_sched.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp M src/tbf_ul.cpp 10 files changed, 134 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/bts.cpp b/src/bts.cpp index 603da56..a47d7d8 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -90,6 +90,10 @@ { "llc.ul_bytes", "full PDUs received "}, { "rach.requests", "RACH requests "}, { "11bit_rach.requests", "11BIT_RACH requests "}, + { "spb.uplink_first_segment", "First seg of UL SPB "}, + { "spb.uplink_second_segment", "Second seg of UL SPB "}, + { "spb.downlink_first_segment", "First seg of DL SPB "}, + { "spb.downlink_second_segment","Second seg of DL SPB "}, { "immediate.assignment_UL", "Immediate Assign UL "}, { "immediate.assignment_rej", "Immediate Assign Rej "}, { "immediate.assignment_DL", "Immediate Assign DL "}, diff --git a/src/bts.h b/src/bts.h index ac870d5..636c7ec 100644 --- a/src/bts.h +++ b/src/bts.h @@ -266,6 +266,10 @@ CTR_LLC_DL_BYTES, CTR_LLC_UL_BYTES, CTR_RACH_REQUESTS, + CTR_SPB_UL_FIRST_SEGMENT, + CTR_SPB_UL_SECOND_SEGMENT, + CTR_SPB_DL_FIRST_SEGMENT, + CTR_SPB_DL_SECOND_SEGMENT, CTR_11BIT_RACH_REQUESTS, CTR_IMMEDIATE_ASSIGN_UL_TBF, CTR_IMMEDIATE_ASSIGN_REJ, @@ -397,6 +401,10 @@ void llc_dl_bytes(int bytes); void llc_ul_bytes(int bytes); void rach_frame(); + void spb_uplink_first_segment(); + void spb_uplink_second_segment(); + void spb_downlink_first_segment(); + void spb_downlink_second_segment(); void rach_frame_11bit(); void immediate_assignment_ul_tbf(); void immediate_assignment_reject(); @@ -594,6 +602,10 @@ CREATE_COUNT_ADD_INLINE(llc_dl_bytes, CTR_LLC_DL_BYTES); CREATE_COUNT_ADD_INLINE(llc_ul_bytes, CTR_LLC_UL_BYTES); CREATE_COUNT_INLINE(rach_frame, CTR_RACH_REQUESTS); +CREATE_COUNT_INLINE(spb_uplink_first_segment, CTR_SPB_UL_FIRST_SEGMENT); +CREATE_COUNT_INLINE(spb_uplink_second_segment, CTR_SPB_UL_SECOND_SEGMENT); +CREATE_COUNT_INLINE(spb_downlink_first_segment, CTR_SPB_DL_FIRST_SEGMENT); +CREATE_COUNT_INLINE(spb_downlink_second_segment, CTR_SPB_DL_SECOND_SEGMENT); CREATE_COUNT_INLINE(rach_frame_11bit, CTR_11BIT_RACH_REQUESTS); CREATE_COUNT_INLINE(immediate_assignment_ul_tbf, CTR_IMMEDIATE_ASSIGN_UL_TBF); CREATE_COUNT_INLINE(immediate_assignment_reject, CTR_IMMEDIATE_ASSIGN_REJ); diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp index 8facc50..c6b7e34 100644 --- a/src/gprs_ms.cpp +++ b/src/gprs_ms.cpp @@ -108,7 +108,8 @@ m_reserved_ul_slots(0), m_current_trx(NULL), m_codel_state(NULL), - m_mode(GprsCodingScheme::GPRS) + m_mode(GprsCodingScheme::GPRS), + m_dl_ctrl_msg(0) { int codel_interval = LLC_CODEL_USE_DEFAULT; diff --git a/src/gprs_ms.h b/src/gprs_ms.h index bcc4fb3..72a86c9 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -130,6 +130,8 @@ void update_l1_meas(const pcu_l1_meas *meas); const pcu_l1_meas* l1_meas() const {return &m_l1_meas;}; unsigned nack_rate_dl() const; + unsigned dl_ctrl_msg() const; + void update_dl_ctrl_msg(); /* internal use */ static void timeout(void *priv_); @@ -180,6 +182,8 @@ struct gprs_codel *m_codel_state; GprsCodingScheme::Mode m_mode; + + unsigned m_dl_ctrl_msg; }; inline bool GprsMs::is_idle() const @@ -263,6 +267,16 @@ return m_nack_rate_dl; } +inline unsigned GprsMs::dl_ctrl_msg() const +{ + return m_dl_ctrl_msg; +} + +inline void GprsMs::update_dl_ctrl_msg() +{ + m_dl_ctrl_msg++; +} + inline uint8_t GprsMs::reserved_dl_slots() const { return m_reserved_dl_slots; diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index a3723df..fdda79d 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -179,6 +179,8 @@ LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling control " "message at RTS for %s (TRX=%d, TS=%d)\n", tbf_name(tbf), trx, ts); + /* Updates the dl ctrl msg counter for ms */ + tbf->ms()->update_dl_ctrl_msg(); return msg; } /* schedule PACKET PAGING REQUEST */ @@ -186,6 +188,9 @@ if (msg) { LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling paging request " "message at RTS for (TRX=%d, TS=%d)\n", trx, ts); + + /* Updates the dl ctrl msg counter for ms */ + tbf->ms()->update_dl_ctrl_msg(); return msg; } diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 4b4b36d..ce79e05 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -70,6 +70,13 @@ gprs_rlc_ul_window *win = &ul_tbf->m_window; vty_out(vty, " V(Q)=%d V(R)=%d", win->v_q(), win->v_r()); + vty_out(vty, "%s", VTY_NEWLINE); + vty_out(vty, " TBF Statistics:%s", VTY_NEWLINE); + if(GprsCodingScheme::GPRS == tbf->ms()->mode()) { + vty_out_rate_ctr_group(vty, " ", ul_tbf->m_ul_gprs_ctrs); + } else { + vty_out_rate_ctr_group(vty, " ", ul_tbf->m_ul_egprs_ctrs); + } } if (dl_tbf) { gprs_rlc_dl_window *win = &dl_tbf->m_window; @@ -178,6 +185,8 @@ vty_out(vty, " MS I level (slot %d): %d dB%s", i, ms->l1_meas()->ts[i].ms_i_level, VTY_NEWLINE); } + vty_out(vty, " RLC/MAC DL Control Msg: %d%s", ms->dl_ctrl_msg(), + VTY_NEWLINE); if (ms->ul_tbf()) vty_out(vty, " Uplink TBF: TFI=%d, state=%s%s", ms->ul_tbf()->tfi(), diff --git a/src/tbf.cpp b/src/tbf.cpp index 60fba68..0e4d6cc 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -66,6 +66,25 @@ { "egprs.downlink.mcs9", "MCS9 " }, }; +static const struct rate_ctr_desc tbf_ul_gprs_ctr_description[] = { + { "gprs.uplink.cs1", "CS1 " }, + { "gprs.uplink.cs2", "CS2 " }, + { "gprs.uplink.cs3", "CS3 " }, + { "gprs.uplink.cs4", "CS4 " }, +}; + +static const struct rate_ctr_desc tbf_ul_egprs_ctr_description[] = { + { "egprs.uplink.mcs1", "MCS1 " }, + { "egprs.uplink.mcs2", "MCS2 " }, + { "egprs.uplink.mcs3", "MCS3 " }, + { "egprs.uplink.mcs4", "MCS4 " }, + { "egprs.uplink.mcs5", "MCS5 " }, + { "egprs.uplink.mcs6", "MCS6 " }, + { "egprs.uplink.mcs7", "MCS7 " }, + { "egprs.uplink.mcs8", "MCS8 " }, + { "egprs.uplink.mcs9", "MCS9 " }, +}; + static const struct rate_ctr_group_desc tbf_ctrg_desc = { "pcu.tbf", "TBF Statistics", @@ -88,6 +107,22 @@ OSMO_STATS_CLASS_SUBSCRIBER, ARRAY_SIZE(tbf_dl_egprs_ctr_description), tbf_dl_egprs_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_ul_gprs_ctrg_desc = { + "tbf.gprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_ul_gprs_ctr_description), + tbf_ul_gprs_ctr_description, +}; + +static const struct rate_ctr_group_desc tbf_ul_egprs_ctrg_desc = { + "tbf.egprs", + "Data Blocks", + OSMO_STATS_CLASS_SUBSCRIBER, + ARRAY_SIZE(tbf_ul_egprs_ctr_description), + tbf_ul_egprs_ctr_description, }; gprs_rlcmac_tbf::Meas::Meas() : @@ -370,9 +405,12 @@ { /* update counters */ if (tbf->direction == GPRS_RLCMAC_UL_TBF) { + gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf); tbf->bts->tbf_ul_freed(); if (tbf->state_is(GPRS_RLCMAC_FLOW)) tbf->bts->tbf_ul_aborted(); + rate_ctr_group_free(ul_tbf->m_ul_egprs_ctrs); + rate_ctr_group_free(ul_tbf->m_ul_gprs_ctrs); } else { gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); if (tbf->is_egprs_enabled()) { @@ -713,7 +751,9 @@ m_rx_counter(0), m_n3103(0), m_contention_resolution_done(0), - m_final_ack_sent(0) + m_final_ack_sent(0), + m_ul_gprs_ctrs(NULL), + m_ul_egprs_ctrs(NULL) { memset(&m_usf, 0, sizeof(m_usf)); } @@ -782,6 +822,9 @@ return NULL; } + tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_egprs_ctrg_desc, 0); + tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_gprs_ctrg_desc, 0); + llist_add(&tbf->list(), &bts->bts->ul_tbfs()); tbf->bts->tbf_ul_created(); diff --git a/src/tbf.h b/src/tbf.h index 5017d3e..ad1ece2 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -102,6 +102,25 @@ TBF_CTR_EGPRS_DL_MCS9, }; +enum tbf_gprs_ul_counters { + TBF_CTR_GPRS_UL_CS1, + TBF_CTR_GPRS_UL_CS2, + TBF_CTR_GPRS_UL_CS3, + TBF_CTR_GPRS_UL_CS4, +}; + +enum tbf_egprs_ul_counters { + TBF_CTR_EGPRS_UL_MCS1, + TBF_CTR_EGPRS_UL_MCS2, + TBF_CTR_EGPRS_UL_MCS3, + TBF_CTR_EGPRS_UL_MCS4, + TBF_CTR_EGPRS_UL_MCS5, + TBF_CTR_EGPRS_UL_MCS6, + TBF_CTR_EGPRS_UL_MCS7, + TBF_CTR_EGPRS_UL_MCS8, + TBF_CTR_EGPRS_UL_MCS9, +}; + #define GPRS_RLCMAC_FLAG_CCCH 0 /* assignment on CCCH */ #define GPRS_RLCMAC_FLAG_PACCH 1 /* assignment on PACCH */ #define GPRS_RLCMAC_FLAG_UL_DATA 2 /* uplink data received */ @@ -511,6 +530,9 @@ uint8_t m_contention_resolution_done; /* set after done */ uint8_t m_final_ack_sent; /* set if we sent final ack */ + struct rate_ctr_group *m_ul_gprs_ctrs; + struct rate_ctr_group *m_ul_egprs_ctrs; + protected: void maybe_schedule_uplink_acknack(const gprs_rlc_data_info *rlc); }; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 2af2ff0..78f06e9 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -1298,16 +1298,21 @@ * other wise it should be 2 */ if (block_status_dl == EGPRS_RESEG_FIRST_SEG_SENT) { + + /* statistics */ + bts->spb_downlink_second_segment(); return EGPRS_RLCMAC_DL_SEC_SEG; } else if ((cs_init.headerTypeData() == GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1) || (cs_init.headerTypeData() == GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2)) { + bts->spb_downlink_first_segment(); return EGPRS_RLCMAC_DL_FIRST_SEG; } else if ((GprsCodingScheme::Scheme(cs_init) == GprsCodingScheme::MCS4) && (GprsCodingScheme::Scheme(cs_current_trans) == GprsCodingScheme::MCS1)) { + bts->spb_downlink_first_segment(); return EGPRS_RLCMAC_DL_FIRST_SEG; } } diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 420fc1a..0de0127 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -397,6 +397,8 @@ union split_block_status *spb_status = &block->spb_status; uint8_t *rlc_data = &block->block[0]; + bts->spb_uplink_second_segment(); + if (spb_status->block_status_ul & EGPRS_RESEG_FIRST_SEG_RXD) { LOGP(DRLCMACUL, LOGL_DEBUG, @@ -432,6 +434,8 @@ const gprs_rlc_data_block_info *rdbi = &rlc->block_info[block_idx]; uint8_t *rlc_data = &block->block[0]; union split_block_status *spb_status = &block->spb_status; + + bts->spb_uplink_first_segment(); if (spb_status->block_status_ul & EGPRS_RESEG_SECOND_SEG_RXD) { LOGP(DRLCMACUL, LOGL_DEBUG, @@ -527,45 +531,58 @@ switch (coding_scheme) { case GprsCodingScheme::CS1 : bts->gprs_ul_cs1(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS1]); break; case GprsCodingScheme::CS2 : bts->gprs_ul_cs2(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS2]); break; case GprsCodingScheme::CS3 : bts->gprs_ul_cs3(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS3]); break; case GprsCodingScheme::CS4 : bts->gprs_ul_cs4(); + rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS4]); break; } } else { switch (coding_scheme) { case GprsCodingScheme::MCS1 : bts->egprs_ul_mcs1(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS1]); break; case GprsCodingScheme::MCS2 : bts->egprs_ul_mcs2(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS2]); break; case GprsCodingScheme::MCS3 : bts->egprs_ul_mcs3(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS3]); break; case GprsCodingScheme::MCS4 : bts->egprs_ul_mcs4(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS4]); break; case GprsCodingScheme::MCS5 : bts->egprs_ul_mcs5(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS5]); break; case GprsCodingScheme::MCS6 : bts->egprs_ul_mcs6(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS6]); break; case GprsCodingScheme::MCS7 : bts->egprs_ul_mcs7(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS7]); break; case GprsCodingScheme::MCS8 : bts->egprs_ul_mcs8(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS8]); break; case GprsCodingScheme::MCS9 : bts->egprs_ul_mcs9(); + rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS9]); break; } } -- To view, visit https://gerrit.osmocom.org/1438 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:09:23 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:09:23 +0000 Subject: [MERGED] openggsn[master]: gtp.c: Improve debug statements about GTP header flags In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: gtp.c: Improve debug statements about GTP header flags ...................................................................... gtp.c: Improve debug statements about GTP header flags * as there are muptiple flags in the field, use plural * print the flags as hex value, not decimal. Hex is customary for bitfields. Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b --- M gtp/gtp.c 1 file changed, 8 insertions(+), 8 deletions(-) Approvals: Jenkins Builder: Verified Holger Freyther: Looks good to me, approved diff --git a/gtp/gtp.c b/gtp/gtp.c index dcbe777..42aa4ea 100644 --- a/gtp/gtp.c +++ b/gtp/gtp.c @@ -210,7 +210,7 @@ } else if ((packet->flags & 0xe2) == 0x22) { /* Version 1 with seq */ return ntoh16(packet->gtp1l.h.seq); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return 0; } } @@ -246,7 +246,7 @@ } else if ((packet->flags & 0xe7) == 0x20) { /* Short version 1 */ return GTP1_HEADER_SIZE_SHORT; } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return 0; } } @@ -265,7 +265,7 @@ } else if ((packet->flags & 0xe0) == 0x20) { /* Version 1 */ return ntoh32(packet->gtp1l.h.tei); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return 0xffffffff; } } @@ -388,7 +388,7 @@ packet->gtp1l.h.tei = hton32(pdp->teic_gn); fd = gsn->fd1c; } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return -1; } @@ -537,7 +537,7 @@ else if (pdp) packet->gtp1l.h.tei = hton32(pdp->teic_gn); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return -1; } @@ -595,7 +595,7 @@ packet->gtp1l.h.length = hton16(len - GTP1_HEADER_SIZE_SHORT); packet->gtp1l.h.seq = hton16(seq); } else { - LOGP(DLGTP, LOGL_ERROR, "Unknown packet flag: %u\n", packet->flags); + LOGP(DLGTP, LOGL_ERROR, "Unknown packet flags: 0x%02x\n", packet->flags); return -1; } @@ -2864,7 +2864,7 @@ if (((pheader->flags & 0xf7) != 0x32)) { gsn->unsup++; GTP_LOGPKG(LOGL_ERROR, &peer, buffer, - status, "Unsupported packet flag\n"); + status, "Unsupported packet flags: 0x%02x\n", pheader->flags); continue; } @@ -3039,7 +3039,7 @@ if (((pheader->flags & 0xf5) != 0x30)) { gsn->unsup++; GTP_LOGPKG(LOGL_ERROR, &peer, buffer, - status, "Unsupported packet flag\n"); + status, "Unsupported packet flags 0x%02x\n", pheader->flags); continue; } -- To view, visit https://gerrit.osmocom.org/1437 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib23d80fae32b4e9fa146d82d8f5a1dada1a3cb2b Gerrit-PatchSet: 1 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:09:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:09:41 +0000 Subject: osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari 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 Thu Dec 22 14:09:43 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:09:43 +0000 Subject: [MERGED] osmo-pcu[master]: Adds rate_ctr_init in the startup of osmo-pcu In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Adds rate_ctr_init in the startup of osmo-pcu ...................................................................... Adds rate_ctr_init in the startup of osmo-pcu Issue:Though the rate_ctr framework is used in osmo-pcu for bts statistics, the interval counters are always 0. Fix:rate_ctr_init is added in the startup which arms the timer and hence the rate ctr intervals is displayed with proper values. Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b --- M src/pcu_main.cpp 1 file changed, 1 insertion(+), 0 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/src/pcu_main.cpp b/src/pcu_main.cpp index 4a75c79..0a0362b 100644 --- a/src/pcu_main.cpp +++ b/src/pcu_main.cpp @@ -221,6 +221,7 @@ osmo_init_logging(&gprs_log_info); osmo_stats_init(tall_pcu_ctx); + rate_ctr_init(tall_pcu_ctx); gprs_ns_set_log_ss(DNS); bssgp_set_log_ss(DBSSGP); -- To view, visit https://gerrit.osmocom.org/1428 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib0f33d2de9406aa7436aa9aeb6a8dabdff96383b Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:10:06 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:10:06 +0000 Subject: openggsn[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1479 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia7f0a3a583ad63f5c6e5cf5e5de2ff7dd9eed8a9 Gerrit-PatchSet: 1 Gerrit-Project: openggsn 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 Dec 22 14:10:07 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:10:07 +0000 Subject: [MERGED] openggsn[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * remove useless comment debian/copyright: update to match Debian format Change-Id: Ia7f0a3a583ad63f5c6e5cf5e5de2ff7dd9eed8a9 Related: OS#1694 --- M debian/control M debian/copyright M debian/rules 3 files changed, 82 insertions(+), 60 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/control b/debian/control index 588ce5a..9306656 100644 --- a/debian/control +++ b/debian/control @@ -1,31 +1,54 @@ Source: openggsn +Maintainer: Harald Welte Section: net Priority: optional -Maintainer: Harald Welte -Build-Depends: debhelper (>= 9), autotools-dev, pkg-config, libdpkg-perl, git, dh-autoreconf, libosmocore-dev (>= 0.8.0) +Build-Depends: debhelper (>= 9), + autotools-dev, + pkg-config, + libdpkg-perl, git, + dh-autoreconf, + libosmocore-dev (>= 0.8.0) Standards-Version: 3.9.6 -Homepage: http://sourceforge.net/projects/ggsn/ -Vcs-Git: git://ggsn.git.sourceforge.net/gitroot/ggsn/ggsn Vcs-Browser: http://ggsn.git.sourceforge.net/git/gitweb.cgi?p=ggsn/ggsn;a=summary +Vcs-Git: git://ggsn.git.sourceforge.net/gitroot/ggsn/ggsn +Homepage: https://projects.osmocom.org/projects/openggsn Package: openggsn Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Gateway GPRS Support Node +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: Gateway GPRS Support Node (GGSN) + OpenGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile + operators as the interface between the Internet and the rest of the + mobile network infrastructure. Package: libgtp0 Architecture: any -Section: libs -Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same +Section: libs +Depends: ${shlibs:Depends}, + ${misc:Depends} Description: library implementing the GTP protocol between SGSN and GGSN + OpenGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile + operators as the interface between the Internet and the rest of the + mobile network infrastructure. + . + This library is part of openggsn and implements the GTP protocol between + SGSN (Serving GPRS support node) and GGSN. Package: libgtp0-dev -Depends: ${misc:Depends}, libgtp0 (= ${binary:Version}) -Multi-Arch: same Architecture: any +Multi-Arch: same Section: libdevel +Depends: ${misc:Depends}, + libgtp0 (= ${binary:Version}) Description: Development files for libgtp + OpenGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile + operators as the interface between the Internet and the rest of the + mobile network infrastructure. + . + The library libgtp implements the GTP protocol between SGSN and GGSN + and this package contains the development files for this library. Package: openggsn-dbg Section: debug diff --git a/debian/copyright b/debian/copyright index c5d2af9..b3339d9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,46 +1,55 @@ -This work was packaged for Debian by: +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: openggsn +Source: http://sourceforge.net/projects/ggsn/ - Harald Welte on Tue, 24 Aug 2010 11:23:40 +0200 +Files: * +Copyright: 2002 Jens Jakobsen + 2002-2004 Mondru AB + 2010-2011 Harald Welte +License: GPL-2 -It was downloaded from: +Files: lib/getopt.c + lib/gnugetopt.h + lib/getopt1.c +Copyright: 1987-2001 Free Software Foundation, Inc. +License: LGPL-2.1+ - http://sourceforge.net/projects/ggsn +Files: debian/* +Copyright: 2010-2015 Harald Welte + 2016 Ruben Undheim +License: GPL-2 -Upstream Author(s): - Jens Jakobsen - Harald Welte +License: GPL-2 + This package 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; version 2 of the License + . + 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, see . + . + On Debian systems, the complete text of the GNU General Public + License version 2 can be found in "/usr/share/common-licenses/GPL-2". -Copyright: - Copyright (C) 2002 Mondru AB - Copyright (C) 2010 Harald Welte - -License: - - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This package 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, see - -On Debian systems, the complete text of the GNU General -Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". - -The Debian packaging is: - - Copyright (C) 2010 Harald Welte - -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. - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +License: LGPL-2.1+ + This package 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 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 Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". diff --git a/debian/rules b/debian/rules index 62f5236..5562909 100755 --- a/debian/rules +++ b/debian/rules @@ -1,21 +1,11 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. -# -# Modified to make a template file for a multi-binary package with separated -# build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This has to be exported to make some magic below work. #export DH_OPTIONS -export DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with autoreconf -- To view, visit https://gerrit.osmocom.org/1479 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia7f0a3a583ad63f5c6e5cf5e5de2ff7dd9eed8a9 Gerrit-PatchSet: 2 Gerrit-Project: openggsn Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:11:16 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:11:16 +0000 Subject: libosmocore[master]: utils/conv_gen.py: use shared tables if possible In-Reply-To: References: Message-ID: Patch Set 6: @tnt: could you give this another go? I would like to see those patches merged before the work by Vadim is lost :/ Thanks! -- To view, visit https://gerrit.osmocom.org/1173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:16:15 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 22 Dec 2016 14:16:15 +0000 Subject: osmo-bts[master]: Use system-installed pcuif_proto.h instead of local copy In-Reply-To: References: Message-ID: Patch Set 8: What about contrib/jenkins_bts_trx.sh and jenkins_oct_and_bts_trx.sh? Does it have to be adapted as well? -- To view, visit https://gerrit.osmocom.org/1258 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4dd2537aeef60c7d154e90f279dc4e7c2392ff76 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: 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 Dec 22 14:19:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:19:31 +0000 Subject: libosmo-netif[master]: rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPL... In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1489 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7 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 Dec 22 14:19:33 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:19:33 +0000 Subject: [MERGED] libosmo-netif[master]: rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPL... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPLv2-or-later ...................................................................... rs232.c: Fix license to GPLv2-or-later. libosmo-netif is GPLv2-or-later Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7 --- M src/rs232.c 1 file changed, 3 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/src/rs232.c b/src/rs232.c index 798bf72..c05a693 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -8,16 +8,16 @@ * Pablo Neira Ayuso * * 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 + * 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 Affero General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ -- To view, visit https://gerrit.osmocom.org/1489 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c73d1a0b15cfb2a729687cde6f9a8e62a230fd7 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 Thu Dec 22 14:19:45 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:19:45 +0000 Subject: libosmocore[master]: Fix erroneously AGPL licensed file in libosmocore. In-Reply-To: References: Message-ID: Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/1488 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I62f2eed6305bfa11a64c6d633e08aabeaf9f0b10 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 Dec 22 14:19:46 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:19:46 +0000 Subject: [MERGED] libosmocore[master]: Fix erroneously AGPL licensed file in libosmocore. In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Fix erroneously AGPL licensed file in libosmocore. ...................................................................... Fix erroneously AGPL licensed file in libosmocore. libosmocore itself is GPLv2-or-later. Only the test cases are permitted to be AGPL licensed. Change-Id: I62f2eed6305bfa11a64c6d633e08aabeaf9f0b10 --- M src/gsm/gsm_04_08_gprs.c 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/src/gsm/gsm_04_08_gprs.c b/src/gsm/gsm_04_08_gprs.c index 14207f8..6f0baba 100644 --- a/src/gsm/gsm_04_08_gprs.c +++ b/src/gsm/gsm_04_08_gprs.c @@ -5,16 +5,16 @@ * 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 + * 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 Affero General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ -- To view, visit https://gerrit.osmocom.org/1488 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I62f2eed6305bfa11a64c6d633e08aabeaf9f0b10 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 Dec 22 14:21:19 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Thu, 22 Dec 2016 14:21:19 +0000 Subject: osmo-bts[master]: Use system-installed pcuif_proto.h instead of local copy In-Reply-To: References: Message-ID: Patch Set 8: Code-Review-1 let's not merge this until we have figured out how to properly handle dependencies on certain versions of that file. For libraries, we have pkg-config. But what do we do about something like this? Treat it the same way and install a .pc file? -- To view, visit https://gerrit.osmocom.org/1258 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4dd2537aeef60c7d154e90f279dc4e7c2392ff76 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte 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 Dec 22 14:31:17 2016 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Thu, 22 Dec 2016 14:31:17 +0000 Subject: libosmocore[master]: utils/conv_gen.py: use shared tables if possible In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 14:31:28 2016 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Thu, 22 Dec 2016 14:31:28 +0000 Subject: libosmocore[master]: utils/conv_gen.py: separate code definitions In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1223 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3428561251b7d7a180d1e9b6fcaad50bdbbc37fa Gerrit-PatchSet: 2 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Thu Dec 22 15:24:14 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 22 Dec 2016 15:24:14 +0000 Subject: [MERGED] osmo-bts[master]: Integrate Debian packaging changes In-Reply-To: References: Message-ID: Max has submitted this change and it was merged. Change subject: Integrate Debian packaging changes ...................................................................... Integrate Debian packaging changes debian/control: * restructure to make it easier to incorporate further changes * update package descriptions * update project URL debian/rules: * use proper hardening syntax * restructure to make it easier to incorporate further changes * remove useless comment * add cleanup and test overrides debian/compat: update compatibility version Change-Id: Ibf62448eee1df914d21834f5b54831e3f642b79c Related: OS#1694 --- M debian/compat M debian/control M debian/rules 3 files changed, 29 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index d067e31..e1a58b2 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,24 @@ Source: osmo-bts +Maintainer: Holger Hans Peter Freyther Section: net Priority: optional -Maintainer: Holger Hans Peter Freyther -Build-Depends: debhelper (>= 7.0.0~), dh-autoreconf, dh-systemd (>= 1.5), autotools-dev, pkg-config, libosmocore-dev, libortp-dev, libosmo-abis-dev, libosmo-netif-dev -Standards-Version: 3.8.4 -Homepage: http://osmocom.org/projects/osmobts -Vcs-Git: git://git.osmocom.org/osmo-bts +Build-Depends: debhelper (>= 9), + pkg-config, + dh-autoreconf, + dh-systemd (>= 1.5), + autotools-dev, + pkg-config, + libosmocore-dev, + openbsc-dev, + libosmo-abis-dev, + libosmo-netif-dev, + libgps-dev, + libortp-dev, + txt2man +Standards-Version: 3.9.8 Vcs-Browser: http://git.osmocom.org/osmo-bts/ +Vcs-Git: git://git.osmocom.org/osmo-bts +Homepage: https://projects.osmocom.org/projects/osmobts Package: osmo-bts-trx Architecture: any diff --git a/debian/rules b/debian/rules index f7f941b..80ba0b2 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') #export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: @@ -20,3 +20,13 @@ override_dh_auto_configure: dh_auto_configure -- --enable-trx + +override_dh_clean: + dh_clean + $(RM) tests/package.m4 + $(RM) tests/testsuite + +# Print test results in case of a failure +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) + -- To view, visit https://gerrit.osmocom.org/1481 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibf62448eee1df914d21834f5b54831e3f642b79c Gerrit-PatchSet: 2 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 Dec 22 15:30:35 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 22 Dec 2016 15:30:35 +0000 Subject: [PATCH] osmo-bts[master]: Add copyright for .deb packages Message-ID: Review at https://gerrit.osmocom.org/1490 Add copyright for .deb packages Add debian/copyright in Debian format which should have been added in c2ecca6b0496127709dcd3afa9d366085d8bec97. Change-Id: I4c7ef1286ba6d2f3c6aadc8ea1864be513f8cf1d Related: OS#1694 --- A debian/copyright 1 file changed, 81 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/90/1490/1 diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..302d1d9 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,81 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: osmo-bts +Source: http://cgit.osmocom.org/osmo-bts/ + +Files: * +Copyright: 2008-2014 Harald Welte + 2009,2011,2013 Andreas Eversberg + 2010,2011 On-Waves + 2012-2015 Holger Hans Peter Freyther + 2014 sysmocom s.f.m.c. Gmbh + 2015 Alexander Chemeris +License: AGPL-3+ + +Files: src/osmo-bts-sysmo/eeprom.c + src/osmo-bts-sysmo/eeprom.h +Copyright: 2012 Nutaq +License: MIT +Comment: Yves Godin is the author + +Files: src/common/pcu_sock.c +Copyright: 2008-2010 Harald Welte + 2009-2012 Andreas Eversberg + 2012 Holger Hans Peter Freyther +License: GPL-2+ + +Files: debian/* +Copyright: 2015-2016 Ruben Undheim +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 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 . + + +License: GPL-2+ + This package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to do + so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. -- To view, visit https://gerrit.osmocom.org/1490 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4c7ef1286ba6d2f3c6aadc8ea1864be513f8cf1d Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Thu Dec 22 18:19:18 2016 From: gerrit-no-reply at lists.osmocom.org (keith) Date: Thu, 22 Dec 2016 18:19:18 +0000 Subject: [PATCH] openbsc[master]: Pass actual smpp_avail_status through to smpp in alert_all_e... Message-ID: Review at https://gerrit.osmocom.org/1491 Pass actual smpp_avail_status through to smpp in alert_all_esme() Change-Id: I4b00d8821c1688ca0c990b6042607f4ded0f80e3 --- M openbsc/src/libmsc/smpp_openbsc.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/91/1491/1 diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c index 0269f4b..228e61d 100644 --- a/openbsc/src/libmsc/smpp_openbsc.c +++ b/openbsc/src/libmsc/smpp_openbsc.c @@ -263,11 +263,11 @@ if (esme->acl && esme->acl->deliver_src_imsi) { smpp_tx_alert(esme, TON_Subscriber_Number, NPI_Land_Mobile_E212, - subscr->imsi, 0); + subscr->imsi, smpp_avail_status); } else { smpp_tx_alert(esme, TON_Network_Specific, NPI_ISDN_E163_E164, - subscr->extension, 0); + subscr->extension, smpp_avail_status); } } } -- To view, visit https://gerrit.osmocom.org/1491 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b00d8821c1688ca0c990b6042607f4ded0f80e3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: keith From gerrit-no-reply at lists.osmocom.org Fri Dec 23 03:46:22 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 03:46:22 +0000 Subject: [PATCH] libosmocore[master]: fsm_test.c: fix compiler warning: timer cb return type Message-ID: Review at https://gerrit.osmocom.org/1492 fsm_test.c: fix compiler warning: timer cb return type Change-Id: Ifd7e85cd69b5e7e473000abc1ef7a56748aafc0e --- M tests/fsm/fsm_test.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/1492/1 diff --git a/tests/fsm/fsm_test.c b/tests/fsm/fsm_test.c index edbba9e..7a64421 100644 --- a/tests/fsm/fsm_test.c +++ b/tests/fsm/fsm_test.c @@ -53,7 +53,7 @@ } } -static void test_fsm_tmr_cb(struct osmo_fsm_inst *fi) +static int test_fsm_tmr_cb(struct osmo_fsm_inst *fi) { OSMO_ASSERT(fi->T == 2342); OSMO_ASSERT(fi->state == ST_TWO); -- To view, visit https://gerrit.osmocom.org/1492 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifd7e85cd69b5e7e473000abc1ef7a56748aafc0e Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 23 03:46:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 03:46:23 +0000 Subject: [PATCH] libosmocore[master]: fsm: doc: add missing file, line args; fix ws + tweak on one... Message-ID: Review at https://gerrit.osmocom.org/1493 fsm: doc: add missing file, line args; fix ws + tweak on one line Change-Id: I6af0d43ab0082e45df676c1d69b26310b59a8031 --- M src/fsm.c 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/93/1493/1 diff --git a/src/fsm.c b/src/fsm.c index 319c842..8675f75 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -317,6 +317,8 @@ * \param[in] new_state The new state into which we should change * \param[in] timeout_secs Timeout in seconds (if !=0) * \param[in] T Timer number (if \ref timeout_secs != 0) + * \param[in] file Calling source file (from osmo_fsm_inst_state_chg macro) + * \param[in] line Calling source line (from osmo_fsm_inst_state_chg macro) * \returns 0 on success; negative on error */ int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, @@ -371,6 +373,8 @@ * \param[in] fi FSM instance * \param[in] event Event to send to FSM instance * \param[in] data Data to pass along with the event + * \param[in] file Calling source file (from osmo_fsm_inst_dispatch macro) + * \param[in] line Calling source line (from osmo_fsm_inst_dispatch macro) * \returns 0 in case of success; negative on error */ int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, @@ -421,7 +425,9 @@ * * \param[in] fi FSM instance to be terminated * \param[in] cause Cause / reason for termination - * \param[in] data Opaqueevent data to be passed to parent + * \param[in] data Opaque event data to be passed with the parent term event + * \param[in] file Calling source file (from osmo_fsm_inst_term macro) + * \param[in] line Calling source line (from osmo_fsm_inst_term macro) */ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, -- To view, visit https://gerrit.osmocom.org/1493 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6af0d43ab0082e45df676c1d69b26310b59a8031 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 23 03:46:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 03:46:23 +0000 Subject: [PATCH] libosmocore[master]: fsm: log calling file+line for error "event for NULL fi" Message-ID: Review at https://gerrit.osmocom.org/1494 fsm: log calling file+line for error "event for NULL fi" Change-Id: I1970773440865f1415004bcf0164603468acf90b --- M src/fsm.c 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/94/1494/1 diff --git a/src/fsm.c b/src/fsm.c index 8675f75..c9902ae 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -384,8 +384,9 @@ const struct osmo_fsm_state *fs; if (!fi) { - LOGP(DLGLOBAL, LOGL_ERROR, "Trying to dispatch event %u to " - "non-existing FSM Instance!\n", event); + LOGPSRC(DLGLOBAL, LOGL_ERROR, file, line, + "Trying to dispatch event %u to non-existent" + " FSM instance!\n", event); osmo_log_backtrace(DLGLOBAL, LOGL_ERROR); return -ENODEV; } -- To view, visit https://gerrit.osmocom.org/1494 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1970773440865f1415004bcf0164603468acf90b Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 23 03:46:23 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 03:46:23 +0000 Subject: [PATCH] libosmocore[master]: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h Message-ID: Review at https://gerrit.osmocom.org/1495 fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h LOGPFSM and LOGPFSML are in the header file, put the *SRC variants also there so users of the osmo_fsm_inst API may conveniently create own functions that log the caller's source file and line. Very useful if many action functions call the same event dispatching function, like foo_fsm_done(), and one needs to know which of the callers to debug. Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/1495/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 57d9a76..8f65533 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -125,6 +125,19 @@ #define LOGPFSM(fi, fmt, args...) \ LOGPFSML(fi, (fi)->log_level, fmt, ## args) +#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ + LOGPSRC((fi)->fsm->log_subsys, level, \ + caller_file, caller_line, \ + "%s{%s}: " fmt, \ + osmo_fsm_inst_name(fi), \ + osmo_fsm_state_name((fi)->fsm, (fi)->state), \ + ## args) + +#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ + LOGPFSMLSRC(fi, (fi)->log_level, \ + caller_file, caller_line, \ + fmt, ## args) + int osmo_fsm_register(struct osmo_fsm *fsm); void osmo_fsm_unregister(struct osmo_fsm *fsm); struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv, diff --git a/src/fsm.c b/src/fsm.c index c9902ae..750f016 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -284,19 +284,6 @@ return fsm->states[state].name; } -#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ - LOGPSRC((fi)->fsm->log_subsys, level, \ - caller_file, caller_line, \ - "%s{%s}: " fmt, \ - osmo_fsm_inst_name(fi), \ - osmo_fsm_state_name((fi)->fsm, (fi)->state), \ - ## args) - -#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ - LOGPFSMLSRC(fi, (fi)->log_level, \ - caller_file, caller_line, \ - fmt, ## args) - /*! \brief perform a state change of the given FSM instance * * Best invoke via the osmo_fsm_inst_state_chg() macro which logs the source -- To view, visit https://gerrit.osmocom.org/1495 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 23 03:46:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 03:46:24 +0000 Subject: [PATCH] libosmocore[master]: fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_... Message-ID: Review at https://gerrit.osmocom.org/1496 fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_inst_term() osmo_fsm_inst_term() has code for safe child removal, publish that part as osmo_fsm_inst_term_children(); also use from osmo_fsm_inst_term(). As with osmo_fsm_inst_term(), add osmo_fsm_inst_term_children() macro to pass the caller's source file and line to new _osmo_fsm_inst_term_children(). Rationale: in openbsc's VLR, I want to discard child FSMs when certain events are handled. I could keep a pointer to each one, or simply iterate all children, making the code a lot simpler in some places. (Unfortunately, the patch may be displayed subobtimally. This really only moves the children-loop to a new function, replaces it with a call to _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, file, line) and drops two local iterator variables. No other code changes are made, even though the diff may show large removal + addition chunks) Change-Id: I8dac1206259cbd251660f793ad023aaa1dc705a2 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 55 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/1496/1 diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index 8f65533..a2c20b7 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -187,4 +187,17 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line); +/*! \brief Terminate all child FSM instances of an FSM instance. + * + * This is a macro that calls _osmo_fsm_inst_term_children() with the given + * parameters as well as the caller's source file and line number for logging + * purposes. See there for documentation. + */ +#define osmo_fsm_inst_term_children(fi, cause, data) \ + _osmo_fsm_inst_term_children(fi, cause, data, __BASE_FILE__, __LINE__) +void _osmo_fsm_inst_term_children(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, + void *data, + const char *file, int line); + /*! @} */ diff --git a/src/fsm.c b/src/fsm.c index 750f016..5c47a44 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -421,12 +421,52 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line) { - struct osmo_fsm_inst *first_child, *last_seen_first_child; struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", osmo_fsm_term_cause_name(cause)); + + _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, + file, line); + + /* delete ourselves from the parent */ + if (parent) + LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", + osmo_fsm_inst_name(parent)); + llist_del(&fi->proc.child); + + /* call destructor / clean-up function */ + if (fi->fsm->cleanup) + fi->fsm->cleanup(fi, cause); + + LOGPFSMSRC(fi, file, line, "Freeing instance\n"); + osmo_fsm_inst_free(fi); + + /* indicate our termination to the parent */ + if (parent && cause != OSMO_FSM_TERM_PARENT) + _osmo_fsm_inst_dispatch(parent, parent_term_event, data, + file, line); +} + +/*! \brief Terminate all child FSM instances of an FSM instance. + * + * Iterate over all children and send them a termination event, with the given + * cause. Pass OSMO_FSM_TERM_PARENT to avoid dispatching events from the + * terminated child FSMs. + * + * \param[in] fi FSM instance that should be cleared of child FSMs + * \param[in] cause Cause / reason for termination (OSMO_FSM_TERM_PARENT) + * \param[in] data Opaque event data to be passed with the parent term events + * \param[in] file Calling source file (from osmo_fsm_inst_term_children macro) + * \param[in] line Calling source line (from osmo_fsm_inst_term_children macro) + */ +void _osmo_fsm_inst_term_children(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, + void *data, + const char *file, int line) +{ + struct osmo_fsm_inst *first_child, *last_seen_first_child; /* iterate over all children, starting from the beginning every time: * terminating an FSM may emit events that cause other FSMs to also @@ -447,27 +487,9 @@ last_seen_first_child = first_child; /* terminate child */ - _osmo_fsm_inst_term(first_child, OSMO_FSM_TERM_PARENT, NULL, + _osmo_fsm_inst_term(first_child, cause, data, file, line); } - - /* delete ourselves from the parent */ - if (parent) - LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", - osmo_fsm_inst_name(parent)); - llist_del(&fi->proc.child); - - /* call destructor / clean-up function */ - if (fi->fsm->cleanup) - fi->fsm->cleanup(fi, cause); - - LOGPFSMSRC(fi, file, line, "Freeing instance\n"); - osmo_fsm_inst_free(fi); - - /* indicate our termination to the parent */ - if (parent && cause != OSMO_FSM_TERM_PARENT) - _osmo_fsm_inst_dispatch(parent, parent_term_event, data, - file, line); } const struct value_string osmo_fsm_term_cause_names[] = { -- To view, visit https://gerrit.osmocom.org/1496 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8dac1206259cbd251660f793ad023aaa1dc705a2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Fri Dec 23 09:30:20 2016 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 23 Dec 2016 09:30:20 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: Describe how to run multiple instances of osmo-nitb and osmo... Message-ID: Review at https://gerrit.osmocom.org/1497 Describe how to run multiple instances of osmo-nitb and osmo-bts Change-Id: I69adeef85adda6f08b31b7d176f51e16968c1435 --- M OsmoBTS/chapters/configuration.adoc M OsmoNITB/chapters/running.adoc 2 files changed, 62 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/97/1497/1 diff --git a/OsmoBTS/chapters/configuration.adoc b/OsmoBTS/chapters/configuration.adoc index b91d8ac..86d8457 100644 --- a/OsmoBTS/chapters/configuration.adoc +++ b/OsmoBTS/chapters/configuration.adoc @@ -179,3 +179,29 @@ De-activating power-ramping can be performed by setting the max-initial value to the nominal power. The default max-initial value is 23 dBm. + + +==== Running multiple instances + +It is possible to run multiple instances of *osmo-bts* on one and the same +machine, if the phy-interface is flexible enough to distinguish between +different phy hardware interfaces. + +Since usually a BTS instance comes included with its individual PCU instance, +the socket-path between PCU and BTS has to be individualized as well. It is +possible to change the default socket path via VTY config: + +.Example: Personalize PCU socket path +---- +bts 0 + pcu-socket /tmp/pcu_bts_2 +---- + +It is also necessary to separate the VTY interfaces of the different instances. +The VTY can be bound to a free ip-address from the loopback range: + +.Example: Binding VTY to a specific ip-address +---- +line vty + bind 127.0.0.2 +---- diff --git a/OsmoNITB/chapters/running.adoc b/OsmoNITB/chapters/running.adoc index ae2c3fc..7b903f6 100644 --- a/OsmoNITB/chapters/running.adoc +++ b/OsmoNITB/chapters/running.adoc @@ -58,3 +58,39 @@ *-r, --rf-ctl 'RFCTL'*:: Offer a Unix domain socket for RF control at the path/filename 'RFCTL' in the file system. + + +=== Multiple instances + +Running multiple instances of *osmo-nitb* is possible if all interfaces (vty, +oml) are separated using the appropriate configuration options. The ip based +interfaces are binding to local host by default. In order to separate the +processes, the user has to bind those services to specific but different +ip-addresses. + +The VTY and the control interface can be bind to ip-addresses from the loopback +address range. + +.Example: Binding VTY and control interface to a specific ip-address +---- +line vty + bind 127.0.0.2 +ctrl + bind 127.0.0.2 +---- + +The OML interface also needs be separated by binding it to different ip +addresses. In general it is not possible to use addresses from the loopback +address range here since the address we binding on has to be reachable (from +outside) to the bts. If only one ethernet interface is available, subdevices +with different ip addresses can be created. + +.Example: Binding OML to a specific ip-address +---- +e1_input + ipa bind 10.9.1.101 +---- + +NOTE: Depending on the application it is necessary to have different ARFCN, +MCC, MNC and network name. It might also be necessary to point to different +database and config files using command line options (see option -l and -c). -- To view, visit https://gerrit.osmocom.org/1497 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I69adeef85adda6f08b31b7d176f51e16968c1435 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Fri Dec 23 10:07:40 2016 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 23 Dec 2016 10:07:40 +0000 Subject: [PATCH] openbsc[master]: sndcp: Allow empty SNDCP-XID indications 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/1487 to look at the new patch set (#2). sndcp: Allow empty SNDCP-XID indications In some rare cases the modem might send a xid indication that does not contain anything except the version number field. The sgsn ignors such SNDCP-XID indications by stripping the entire field from the response. We found a modem in the wild that started to act problematic when the empty SNDCP-XID was missing in the response. This patch changes the XID negotiation behaviour in a way that if a modem should send empty SNDCP-XID indications, the reply will also contain an empty SNDCP-XID indication. Apart from that the SNDCP-XID version number is now parsed and echoed in the response. This ensures that we always reply with the version number that the modem expects. (The version was 0 in all cases we observed so far) Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Related: OS#1794 --- M openbsc/include/openbsc/gprs_sndcp_xid.h M openbsc/src/gprs/gprs_sndcp.c M openbsc/src/gprs/gprs_sndcp_xid.c M openbsc/tests/sndcp_xid/sndcp_xid_test.c 4 files changed, 61 insertions(+), 42 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/87/1487/2 diff --git a/openbsc/include/openbsc/gprs_sndcp_xid.h b/openbsc/include/openbsc/gprs_sndcp_xid.h index 02904a7..e64bc52 100644 --- a/openbsc/include/openbsc/gprs_sndcp_xid.h +++ b/openbsc/include/openbsc/gprs_sndcp_xid.h @@ -24,7 +24,7 @@ #include #include -#define CURRENT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ +#define DEFAULT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ #define MAX_ENTITIES 32 /* 3GPP TS 44.065 reserves 5 bit * for compression enitity number */ @@ -197,13 +197,15 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields); + const struct llist_head *comp_fields, int version); /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, - const uint8_t * src, - unsigned int src_len, - const struct llist_head *comp_fields_req); +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, + const uint8_t *src, + unsigned int src_len, + const struct llist_head + *comp_fields_req); /* Find out to which compression class the specified comp-field belongs * (header compression or data compression?) */ diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c index 1cbeede..77c9507 100644 --- a/openbsc/src/gprs/gprs_sndcp.c +++ b/openbsc/src/gprs/gprs_sndcp.c @@ -960,8 +960,13 @@ llist_add(&v42bis_comp_field.list, &comp_fields); } + /* Do not attempt to compile anything if there is no data in the list */ + if(llist_empty(&comp_fields)) + return 0; + /* Compile bytestream */ - return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields); + return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields, + DEFAULT_SNDCP_VERSION); } /* Set of SNDCP-XID bnegotiation (See also: TS 144 065, @@ -1106,6 +1111,7 @@ int rc; int compclass; + int version; struct llist_head *comp_fields; struct gprs_sndcp_comp_field *comp_field; @@ -1115,21 +1121,12 @@ OSMO_ASSERT(lle); /* Parse SNDCP-CID XID-Field */ - comp_fields = gprs_sndcp_parse_xid(lle->llme, + comp_fields = gprs_sndcp_parse_xid(&version, lle->llme, xid_field_indication->data, xid_field_indication->data_len, NULL); if (!comp_fields) return -EINVAL; - - /* Don't bother with empty indications */ - if (llist_empty(comp_fields)) { - xid_field_response->data = NULL; - xid_field_response->data_len = 0; - DEBUGP(DSNDCP, - "SNDCP-XID indication did not contain any parameters!\n"); - return 0; - } /* Handle compression entites */ DEBUGP(DSNDCP, "SNDCP-XID-IND (ms):\n"); @@ -1168,7 +1165,7 @@ /* Compile modified SNDCP-XID bytes */ rc = gprs_sndcp_compile_xid(xid_field_response->data, xid_field_indication->data_len, - comp_fields); + comp_fields, 0); if (rc > 0) xid_field_response->data_len = rc; @@ -1210,7 +1207,7 @@ OSMO_ASSERT(xid_field_request); /* Parse SNDCP-CID XID-Field */ - comp_fields_req = gprs_sndcp_parse_xid(lle->llme, + comp_fields_req = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_request->data, xid_field_request->data_len, NULL); @@ -1221,7 +1218,7 @@ gprs_sndcp_dump_comp_fields(comp_fields_req, LOGL_DEBUG); /* Parse SNDCP-CID XID-Field */ - comp_fields_conf = gprs_sndcp_parse_xid(lle->llme, + comp_fields_conf = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_conf->data, xid_field_conf->data_len, comp_fields_req); diff --git a/openbsc/src/gprs/gprs_sndcp_xid.c b/openbsc/src/gprs/gprs_sndcp_xid.c index bb43eab..37551e4 100644 --- a/openbsc/src/gprs/gprs_sndcp_xid.c +++ b/openbsc/src/gprs/gprs_sndcp_xid.c @@ -549,26 +549,29 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields) + const struct llist_head *comp_fields, int version) { int rc; int byte_counter = 0; uint8_t comp_bytes[512]; - uint8_t xid_version_number[1] = { CURRENT_SNDCP_VERSION }; + uint8_t xid_version_number[1]; OSMO_ASSERT(comp_fields); OSMO_ASSERT(dst); OSMO_ASSERT(dst_maxlen >= 2 + sizeof(xid_version_number)); - /* Bail if there is no input */ - if (llist_empty(comp_fields)) - return -EINVAL; + /* Prepend header with version number */ + if (version >= 0) { + xid_version_number[0] = (uint8_t) (version & 0xff); + dst = + tlv_put(dst, SNDCP_XID_VERSION_NUMBER, + sizeof(xid_version_number), xid_version_number); + byte_counter += (sizeof(xid_version_number) + 2); + } - /* Prepend header */ - dst = - tlv_put(dst, SNDCP_XID_VERSION_NUMBER, - sizeof(xid_version_number), xid_version_number); - byte_counter += (sizeof(xid_version_number) + 2); + /* Stop if there is no compression fields supplied */ + if (llist_empty(comp_fields)) + return byte_counter; /* Add data compression fields */ rc = gprs_sndcp_pack_fields(comp_fields, comp_bytes, @@ -1283,11 +1286,10 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -static int gprs_sndcp_decode_xid(struct llist_head *comp_fields, +static int gprs_sndcp_decode_xid(int *version, struct llist_head *comp_fields, const uint8_t *src, unsigned int src_len, - const struct - entity_algo_table - *lt, unsigned int lt_len) + const struct entity_algo_table *lt, + unsigned int lt_len) { int src_pos = 0; uint8_t tag; @@ -1296,6 +1298,10 @@ int byte_counter = 0; int rc; int tlv_count = 0; + + /* Preset version value as invalid */ + if(version) + *version = -1; /* Valid TLV-Tag and types */ static const struct tlv_definition sndcp_xid_def = { @@ -1326,6 +1332,10 @@ talloc_free(comp_fields); return -EINVAL; } + + /* Decode sndcp xid version number */ + if (version && tag == SNDCP_XID_VERSION_NUMBER) + *version = val[0]; /* Decode compression parameters */ if ((tag == SNDCP_XID_PROTOCOL_COMPRESSION) @@ -1548,7 +1558,8 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, const uint8_t *src, unsigned int src_len, const struct llist_head @@ -1559,6 +1570,12 @@ struct llist_head *comp_fields; struct entity_algo_table lt[MAX_ENTITIES * 2]; + /* In case of a zero length field, just exit */ + if(src_len == 0) + return NULL; + + /* We should go any further if we have a field length greater + * zero and a null pointer as buffer! */ OSMO_ASSERT(src); comp_fields = talloc_zero(ctx, struct llist_head); @@ -1575,8 +1592,8 @@ } /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, lt, - lt_len); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + lt, lt_len); if (rc < 0) { talloc_free(comp_fields); return NULL; @@ -1591,7 +1608,8 @@ } else { /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, NULL, 0); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + NULL, 0); if (rc < 0) { talloc_free(comp_fields); return NULL; diff --git a/openbsc/tests/sndcp_xid/sndcp_xid_test.c b/openbsc/tests/sndcp_xid/sndcp_xid_test.c index 3a33619..151dd2b 100644 --- a/openbsc/tests/sndcp_xid/sndcp_xid_test.c +++ b/openbsc/tests/sndcp_xid/sndcp_xid_test.c @@ -47,13 +47,14 @@ uint8_t xid_r[512]; /* Parse and show contained comp fields */ - comp_fields = gprs_sndcp_parse_xid(ctx, xid, sizeof(xid), NULL); + comp_fields = gprs_sndcp_parse_xid(NULL, ctx, xid, sizeof(xid), NULL); OSMO_ASSERT(comp_fields); printf("Decoded:\n"); gprs_sndcp_dump_comp_fields(comp_fields, DSNDCP); /* Encode comp-fields again */ - rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields); + rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields, + DEFAULT_SNDCP_VERSION); printf("Result length=%i\n",rc); printf("Encoded: %s\n", osmo_hexdump_nospc(xid, sizeof(xid))); printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc)); @@ -226,13 +227,14 @@ gprs_sndcp_dump_comp_fields(&comp_fields, DSNDCP); /* Encode SNDCP-XID fields */ - rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields); + rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields, + DEFAULT_SNDCP_VERSION); OSMO_ASSERT(rc > 0); printf("Encoded: %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc); /* Parse and show contained comp fields */ - comp_fields_dec = gprs_sndcp_parse_xid(ctx, xid, rc, NULL); + comp_fields_dec = gprs_sndcp_parse_xid(NULL, ctx, xid, rc, NULL); OSMO_ASSERT(comp_fields_dec); printf("Decoded:\n"); -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Fri Dec 23 10:07:41 2016 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 23 Dec 2016 10:07:41 +0000 Subject: [PATCH] openbsc[master]: cosmetic: Rename phone to ms Message-ID: Review at https://gerrit.osmocom.org/1498 cosmetic: Rename phone to ms The term "phone" is incorrect. Rename phone to "MS" (mobile station) in the comments and log output of gprs_llc.c Change-Id: I322d3d99452502da7555cc2af6bc8a192ca3c9c5 --- M openbsc/src/gprs/gprs_llc.c 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/98/1498/1 diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index c2c3900..2be663f 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -137,7 +137,7 @@ struct gprs_llc_lle *lle) { /* Note: This function handles the response of a network originated - * XID-Request. There XID messages reflected by the phone are analyzed + * XID-Request. There XID messages reflected by the MS are analyzed * and processed here. The caller is called by rx_llc_xid(). */ struct llist_head *xid_fields; @@ -205,7 +205,7 @@ struct gprs_llc_lle *lle) { /* Note: This function computes the response that is sent back to the - * phone when a phone originated XID is received. The function is + * MS when a mobile originated XID is received. The function is * called by rx_llc_xid() */ int rc = -EINVAL; @@ -232,7 +232,7 @@ * for validity. Currently we just blindly * accept all XID fields by just echoing them. * There is a remaining risk of malfunction - * when a phone submits values which defer from + * when a MS submits values which defer from * the default! */ LOGP(DLLC, LOGL_NOTICE, "Echoing XID-Field: XID: type %s, data_len=%d, data=%s\n", @@ -276,7 +276,7 @@ return rc; } -/* Dispatch XID indications and responses comming from the Phone */ +/* Dispatch XID indications and responses comming from the MS */ static void rx_llc_xid(struct gprs_llc_lle *lle, struct gprs_llc_hdr_parsed *gph) { @@ -286,7 +286,7 @@ /* FIXME: 8.5.3.3: check if XID is invalid */ if (gph->is_cmd) { LOGP(DLLC, LOGL_NOTICE, - "Received XID indication from phone.\n"); + "Received XID indication from MS.\n"); struct msgb *resp; uint8_t *xid; @@ -306,7 +306,7 @@ gprs_llc_tx_xid(lle, resp, 0); } else { LOGP(DLLC, LOGL_NOTICE, - "Received XID confirmation from phone.\n"); + "Received XID confirmation from MS.\n"); gprs_llc_process_xid_conf(gph->data, gph->data_len, lle); /* FIXME: if we had sent a XID reset, send * LLGMM-RESET.conf to GMM */ @@ -342,7 +342,7 @@ else ftype = "NULL"; LOGP(DLLC, LOGL_NOTICE, "Sending XID type %s (%d bytes) request" - " to phone...\n", ftype, xid_bytes_len); + " to MS...\n", ftype, xid_bytes_len); gprs_llc_tx_xid(lle, msg, 1); } else { LOGP(DLLC, LOGL_ERROR, -- To view, visit https://gerrit.osmocom.org/1498 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I322d3d99452502da7555cc2af6bc8a192ca3c9c5 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: dexter From gerrit-no-reply at lists.osmocom.org Fri Dec 23 10:19:27 2016 From: gerrit-no-reply at lists.osmocom.org (dexter) Date: Fri, 23 Dec 2016 10:19:27 +0000 Subject: [PATCH] openbsc[master]: sndcp: Allow empty SNDCP-XID indications 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/1487 to look at the new patch set (#3). sndcp: Allow empty SNDCP-XID indications In some rare cases the modem might send a xid indication that does not contain anything except the version number field. The sgsn ignors such SNDCP-XID indications by stripping the entire field from the response. We found a modem in the wild that started to act problematic when the empty SNDCP-XID was missing in the response. This patch changes the XID negotiation behaviour in a way that if a modem should send empty SNDCP-XID indications, the reply will also contain an empty SNDCP-XID indication. Apart from that the SNDCP-XID version number is now parsed and echoed in the response. This ensures that we always reply with the version number that the modem expects. (The version was 0 in all cases we observed so far) Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Related: OS#1794 --- M openbsc/include/openbsc/gprs_sndcp_xid.h M openbsc/src/gprs/gprs_sndcp.c M openbsc/src/gprs/gprs_sndcp_xid.c M openbsc/tests/sndcp_xid/sndcp_xid_test.c 4 files changed, 61 insertions(+), 42 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/87/1487/3 diff --git a/openbsc/include/openbsc/gprs_sndcp_xid.h b/openbsc/include/openbsc/gprs_sndcp_xid.h index 02904a7..e64bc52 100644 --- a/openbsc/include/openbsc/gprs_sndcp_xid.h +++ b/openbsc/include/openbsc/gprs_sndcp_xid.h @@ -24,7 +24,7 @@ #include #include -#define CURRENT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ +#define DEFAULT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ #define MAX_ENTITIES 32 /* 3GPP TS 44.065 reserves 5 bit * for compression enitity number */ @@ -197,13 +197,15 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields); + const struct llist_head *comp_fields, int version); /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, - const uint8_t * src, - unsigned int src_len, - const struct llist_head *comp_fields_req); +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, + const uint8_t *src, + unsigned int src_len, + const struct llist_head + *comp_fields_req); /* Find out to which compression class the specified comp-field belongs * (header compression or data compression?) */ diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c index 1cbeede..60455b5 100644 --- a/openbsc/src/gprs/gprs_sndcp.c +++ b/openbsc/src/gprs/gprs_sndcp.c @@ -960,8 +960,13 @@ llist_add(&v42bis_comp_field.list, &comp_fields); } + /* Do not attempt to compile anything if there is no data in the list */ + if (llist_empty(&comp_fields)) + return 0; + /* Compile bytestream */ - return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields); + return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields, + DEFAULT_SNDCP_VERSION); } /* Set of SNDCP-XID bnegotiation (See also: TS 144 065, @@ -1106,6 +1111,7 @@ int rc; int compclass; + int version; struct llist_head *comp_fields; struct gprs_sndcp_comp_field *comp_field; @@ -1115,21 +1121,12 @@ OSMO_ASSERT(lle); /* Parse SNDCP-CID XID-Field */ - comp_fields = gprs_sndcp_parse_xid(lle->llme, + comp_fields = gprs_sndcp_parse_xid(&version, lle->llme, xid_field_indication->data, xid_field_indication->data_len, NULL); if (!comp_fields) return -EINVAL; - - /* Don't bother with empty indications */ - if (llist_empty(comp_fields)) { - xid_field_response->data = NULL; - xid_field_response->data_len = 0; - DEBUGP(DSNDCP, - "SNDCP-XID indication did not contain any parameters!\n"); - return 0; - } /* Handle compression entites */ DEBUGP(DSNDCP, "SNDCP-XID-IND (ms):\n"); @@ -1168,7 +1165,7 @@ /* Compile modified SNDCP-XID bytes */ rc = gprs_sndcp_compile_xid(xid_field_response->data, xid_field_indication->data_len, - comp_fields); + comp_fields, 0); if (rc > 0) xid_field_response->data_len = rc; @@ -1210,7 +1207,7 @@ OSMO_ASSERT(xid_field_request); /* Parse SNDCP-CID XID-Field */ - comp_fields_req = gprs_sndcp_parse_xid(lle->llme, + comp_fields_req = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_request->data, xid_field_request->data_len, NULL); @@ -1221,7 +1218,7 @@ gprs_sndcp_dump_comp_fields(comp_fields_req, LOGL_DEBUG); /* Parse SNDCP-CID XID-Field */ - comp_fields_conf = gprs_sndcp_parse_xid(lle->llme, + comp_fields_conf = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_conf->data, xid_field_conf->data_len, comp_fields_req); diff --git a/openbsc/src/gprs/gprs_sndcp_xid.c b/openbsc/src/gprs/gprs_sndcp_xid.c index bb43eab..dfea5fe 100644 --- a/openbsc/src/gprs/gprs_sndcp_xid.c +++ b/openbsc/src/gprs/gprs_sndcp_xid.c @@ -549,26 +549,29 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields) + const struct llist_head *comp_fields, int version) { int rc; int byte_counter = 0; uint8_t comp_bytes[512]; - uint8_t xid_version_number[1] = { CURRENT_SNDCP_VERSION }; + uint8_t xid_version_number[1]; OSMO_ASSERT(comp_fields); OSMO_ASSERT(dst); OSMO_ASSERT(dst_maxlen >= 2 + sizeof(xid_version_number)); - /* Bail if there is no input */ - if (llist_empty(comp_fields)) - return -EINVAL; + /* Prepend header with version number */ + if (version >= 0) { + xid_version_number[0] = (uint8_t) (version & 0xff); + dst = + tlv_put(dst, SNDCP_XID_VERSION_NUMBER, + sizeof(xid_version_number), xid_version_number); + byte_counter += (sizeof(xid_version_number) + 2); + } - /* Prepend header */ - dst = - tlv_put(dst, SNDCP_XID_VERSION_NUMBER, - sizeof(xid_version_number), xid_version_number); - byte_counter += (sizeof(xid_version_number) + 2); + /* Stop if there is no compression fields supplied */ + if (llist_empty(comp_fields)) + return byte_counter; /* Add data compression fields */ rc = gprs_sndcp_pack_fields(comp_fields, comp_bytes, @@ -1283,11 +1286,10 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -static int gprs_sndcp_decode_xid(struct llist_head *comp_fields, +static int gprs_sndcp_decode_xid(int *version, struct llist_head *comp_fields, const uint8_t *src, unsigned int src_len, - const struct - entity_algo_table - *lt, unsigned int lt_len) + const struct entity_algo_table *lt, + unsigned int lt_len) { int src_pos = 0; uint8_t tag; @@ -1296,6 +1298,10 @@ int byte_counter = 0; int rc; int tlv_count = 0; + + /* Preset version value as invalid */ + if (version) + *version = -1; /* Valid TLV-Tag and types */ static const struct tlv_definition sndcp_xid_def = { @@ -1326,6 +1332,10 @@ talloc_free(comp_fields); return -EINVAL; } + + /* Decode sndcp xid version number */ + if (version && tag == SNDCP_XID_VERSION_NUMBER) + *version = val[0]; /* Decode compression parameters */ if ((tag == SNDCP_XID_PROTOCOL_COMPRESSION) @@ -1548,7 +1558,8 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, const uint8_t *src, unsigned int src_len, const struct llist_head @@ -1559,6 +1570,12 @@ struct llist_head *comp_fields; struct entity_algo_table lt[MAX_ENTITIES * 2]; + /* In case of a zero length field, just exit */ + if (src_len == 0) + return NULL; + + /* We should go any further if we have a field length greater + * zero and a null pointer as buffer! */ OSMO_ASSERT(src); comp_fields = talloc_zero(ctx, struct llist_head); @@ -1575,8 +1592,8 @@ } /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, lt, - lt_len); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + lt, lt_len); if (rc < 0) { talloc_free(comp_fields); return NULL; @@ -1591,7 +1608,8 @@ } else { /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, NULL, 0); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + NULL, 0); if (rc < 0) { talloc_free(comp_fields); return NULL; diff --git a/openbsc/tests/sndcp_xid/sndcp_xid_test.c b/openbsc/tests/sndcp_xid/sndcp_xid_test.c index 3a33619..151dd2b 100644 --- a/openbsc/tests/sndcp_xid/sndcp_xid_test.c +++ b/openbsc/tests/sndcp_xid/sndcp_xid_test.c @@ -47,13 +47,14 @@ uint8_t xid_r[512]; /* Parse and show contained comp fields */ - comp_fields = gprs_sndcp_parse_xid(ctx, xid, sizeof(xid), NULL); + comp_fields = gprs_sndcp_parse_xid(NULL, ctx, xid, sizeof(xid), NULL); OSMO_ASSERT(comp_fields); printf("Decoded:\n"); gprs_sndcp_dump_comp_fields(comp_fields, DSNDCP); /* Encode comp-fields again */ - rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields); + rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields, + DEFAULT_SNDCP_VERSION); printf("Result length=%i\n",rc); printf("Encoded: %s\n", osmo_hexdump_nospc(xid, sizeof(xid))); printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc)); @@ -226,13 +227,14 @@ gprs_sndcp_dump_comp_fields(&comp_fields, DSNDCP); /* Encode SNDCP-XID fields */ - rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields); + rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields, + DEFAULT_SNDCP_VERSION); OSMO_ASSERT(rc > 0); printf("Encoded: %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc); /* Parse and show contained comp fields */ - comp_fields_dec = gprs_sndcp_parse_xid(ctx, xid, rc, NULL); + comp_fields_dec = gprs_sndcp_parse_xid(NULL, ctx, xid, rc, NULL); OSMO_ASSERT(comp_fields_dec); printf("Decoded:\n"); -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Fri Dec 23 14:16:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 14:16:53 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/1464/3/openbsc/src/osmo-bsc_nat/bsc_nat.c File openbsc/src/osmo-bsc_nat/bsc_nat.c: Line 77: #include you need to '#include ' *above* crypto.h. Interesting choice there by gnutls. -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 3 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 Fri Dec 23 14:17:35 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 14:17:35 +0000 Subject: [PATCH] openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1464 to look at the new patch set (#4). Migrate from OpenSSL to GnuTLS This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Related: OS#1694 --- M debian/control M openbsc/configure.ac M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gb_proxy.c M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_sgsn.c M openbsc/src/libiu/Makefile.am M openbsc/src/libmsc/Makefile.am M openbsc/src/libmsc/auth.c M openbsc/src/libmsc/db.c M openbsc/src/osmo-bsc_nat/Makefile.am M openbsc/src/osmo-bsc_nat/bsc_nat.c M openbsc/src/osmo-nitb/Makefile.am M openbsc/tests/channel/Makefile.am M openbsc/tests/db/Makefile.am M openbsc/tests/gbproxy/Makefile.am M openbsc/tests/gbproxy/gbproxy_test.c M openbsc/tests/mm_auth/Makefile.am M openbsc/tests/mm_auth/mm_auth_test.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sndcp_xid/Makefile.am M openbsc/tests/xid/Makefile.am 24 files changed, 92 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/1464/4 diff --git a/debian/control b/debian/control index 79f18df..d4ee0c2 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, - libssl-dev, + libgnutls28-dev, libc-ares-dev, libsmpp34-dev Standards-Version: 3.9.8 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 0753834..3bf497d 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -37,7 +37,10 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5) +PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 3.3.0) + +AC_SUBST(LIBGNUTLS_CFLAGS) +AC_SUBST(LIBGNUTLS_LIBS) # Enabke/disable the NAT? AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])], diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index cff17dd..40e7feb 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -15,7 +15,7 @@ $(LIBOSMOGB_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(LIBCARES_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBGTP_CFLAGS) \ $(NULL) if BUILD_IU @@ -63,7 +63,7 @@ osmo_gbproxy_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ $(OSMO_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) @@ -98,7 +98,7 @@ $(OSMO_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ -lgtp \ -lm \ diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index d95139f..c16124a 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -51,7 +51,8 @@ #include #include -#include +#include +#include static const struct rate_ctr_desc global_ctr_description[] = { { "inv-bvci", "Invalid BVC Identifier " }, @@ -236,7 +237,8 @@ bss_ptmsi = sgsn_ptmsi; } else { do { - if (RAND_bytes((uint8_t *) &bss_ptmsi, sizeof(bss_ptmsi)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &bss_ptmsi, + sizeof(bss_ptmsi)) < 0) { bss_ptmsi = GSM_RESERVED_TMSI; break; } @@ -273,7 +275,8 @@ } else { do { /* create random TLLI, 0b01111xxx... */ - if (RAND_bytes((uint8_t *) &sgsn_tlli, sizeof(sgsn_tlli)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &sgsn_tlli, + sizeof(sgsn_tlli)) < 0) { sgsn_tlli = 0; break; } diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 363b457..1a1338a 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -31,7 +31,8 @@ #include #include -#include +#include +#include #include "bscconfig.h" @@ -551,9 +552,9 @@ /* ? 10.5.5.7: */ acreq->force_stby = force_standby; /* 3GPP TS 24.008 ? 10.5.5.19: */ - if (RAND_bytes(&rbyte, 1) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed for A&C ref, falling " - "back to rand()\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, &rbyte, 1) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed for A&C ref, falling" + " back to rand()\n"); acreq->ac_ref_nr = rand(); } else acreq->ac_ref_nr = rbyte; @@ -1195,8 +1196,8 @@ }; /* XXX: Hack to make 3G auth work with special SIM card */ ctx->auth_state = SGSN_AUTH_AUTHENTICATE; - - RAND_bytes(tmp_rand, 16); + /* FIXME: check return value and propagate error */ + gnutls_rnd(GNUTLS_RND_NONCE, tmp_rand, 16); memset(&ctx->auth_triplet.vec, 0, sizeof(ctx->auth_triplet.vec)); osmo_auth_gen_vec(&ctx->auth_triplet.vec, &auth, tmp_rand); diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index c2c3900..47f3996 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include @@ -1070,8 +1071,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } @@ -1103,8 +1104,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e85e1a9..a8f5e39 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -45,7 +45,8 @@ #include -#include +#include +#include #define GPRS_LLME_CHECK_TICK 30 @@ -614,7 +615,7 @@ int max_retries = 100; restart: - if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &ptmsi, sizeof(ptmsi)) < 0) goto failed; /* Enforce that the 2 MSB are set without loosing the distance between diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am index e5f9e27..0070679 100644 --- a/openbsc/src/libiu/Makefile.am +++ b/openbsc/src/libiu/Makefile.am @@ -7,7 +7,7 @@ AM_CFLAGS = \ -Wall \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBASN1C_CFLAGS) \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index 9d966db..20a0876 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -10,7 +10,7 @@ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ $(NULL) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 3b1fd73..f1f468f 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -27,7 +27,8 @@ #include -#include +#include +#include #include @@ -123,8 +124,10 @@ } atuple->use_count = 1; - if (RAND_bytes(atuple->vec.rand, sizeof(atuple->vec.rand)) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, atuple->vec.rand, + sizeof(atuple->vec.rand)) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed, can't generate new" + " auth tuple\n"); return AUTH_ERROR; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..ccd4762 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -40,7 +40,8 @@ #include #include -#include +#include +#include /* Semi-Private-Interface (SPI) for the subscriber code */ void subscr_direct_free(struct gsm_subscriber *subscr); @@ -1223,8 +1224,9 @@ char *tmsi_quoted; for (;;) { - if (RAND_bytes((uint8_t *) &subscriber->tmsi, sizeof(subscriber->tmsi)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &subscriber->tmsi, + sizeof(subscriber->tmsi)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (subscriber->tmsi == GSM_RESERVED_TMSI) @@ -1303,8 +1305,9 @@ uint32_t try; for (;;) { - if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &try, + sizeof(try)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (!try) /* 0 is an invalid token */ diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am index be33d28..af99d11 100644 --- a/openbsc/src/osmo-bsc_nat/Makefile.am +++ b/openbsc/src/osmo-bsc_nat/Makefile.am @@ -13,7 +13,7 @@ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMONETIF_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) @@ -53,6 +53,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBOSMONETIF_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index a4dd679..2acd292 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -74,7 +74,8 @@ #include -#include +#include +#include #include "../../bscconfig.h" @@ -223,7 +224,7 @@ buf = v_put(buf, 0x23); mrand = bsc->last_rand; - if (RAND_bytes(mrand, 16) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, mrand, 16) != 1) goto failed_random; memcpy(buf, mrand, 16); diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index f4ef487..6474b27 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -40,6 +40,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBSMPP34_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 5e9583f..0663b64 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -30,6 +30,6 @@ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am index 0eed5cd..332bf09 100644 --- a/openbsc/tests/db/Makefile.am +++ b/openbsc/tests/db/Makefile.am @@ -43,6 +43,6 @@ $(LIBOSMOGSM_LIBS) \ $(LIBSMPP34_LIBS) \ $(LIBOSMOVTY_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am index 2dd66df..8fdefb5 100644 --- a/openbsc/tests/gbproxy/Makefile.am +++ b/openbsc/tests/gbproxy/Makefile.am @@ -28,7 +28,7 @@ $(NULL) gbproxy_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ $(NULL) gbproxy_test_LDADD = \ @@ -49,6 +49,6 @@ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBRARY_DL) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 577daa9..97a0ba9 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -37,7 +37,8 @@ #include #include -#include +#include +#include #define REMOTE_BSS_ADDR 0x01020304 #define REMOTE_SGSN_ADDR 0x05060708 @@ -53,30 +54,30 @@ struct llist_head *received_messages = NULL; -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, data, len); } static int rand_seq_num = 0; -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { uint32_t val; - OSMO_ASSERT(num == sizeof(val)); - OSMO_ASSERT(__real_RAND_bytes(buf, num) == 1); + OSMO_ASSERT(len == sizeof(val)); + OSMO_ASSERT(__real_gnutls_rnd(level, data, len) == 0); val = 0x00dead00 + rand_seq_num; rand_seq_num++; - memcpy(buf, &val, num); + memcpy(data, &val, len); return 1; } diff --git a/openbsc/tests/mm_auth/Makefile.am b/openbsc/tests/mm_auth/Makefile.am index cb35198..ea6f516 100644 --- a/openbsc/tests/mm_auth/Makefile.am +++ b/openbsc/tests/mm_auth/Makefile.am @@ -8,7 +8,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(NULL) noinst_PROGRAMS = \ diff --git a/openbsc/tests/mm_auth/mm_auth_test.c b/openbsc/tests/mm_auth/mm_auth_test.c index b8777a8..0e3817b 100644 --- a/openbsc/tests/mm_auth/mm_auth_test.c +++ b/openbsc/tests/mm_auth/mm_auth_test.c @@ -8,6 +8,9 @@ #include #include +#include +#include + #define min(A,B) ((A)>(B)? (B) : (A)) static char *auth_tuple_str(struct gsm_auth_tuple *atuple) @@ -120,8 +123,8 @@ return auth_action; } -/* override libssl RAND_bytes() to get testable crypto results */ -int RAND_bytes(uint8_t *rand, int len) +/* override GnuTLS' gnutls_rnd() to get testable crypto results */ +int gnutls_rnd(gnutls_rnd_level_t level, void *rand, size_t len) { memset(rand, 23, len); return 1; diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index f1606cb..0925995 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -32,7 +32,7 @@ $(NULL) sgsn_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ @@ -66,7 +66,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index b4bcaf6..843a924 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -37,6 +37,9 @@ #include #include +#include +#include + #include void *tall_bsc_ctx; @@ -99,21 +102,22 @@ return 0; } -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *buf, size_t num) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, buf, num); } /* make results of A&C ref predictable */ -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t num) { + uint8_t *buf = (uint8_t *)data; if (num > 1) - return __real_RAND_bytes(buf, num); + return __real_gnutls_rnd(level, data, num); buf[0] = 0; return 1; } diff --git a/openbsc/tests/sndcp_xid/Makefile.am b/openbsc/tests/sndcp_xid/Makefile.am index 99b9d1a..e9e5d6f 100644 --- a/openbsc/tests/sndcp_xid/Makefile.am +++ b/openbsc/tests/sndcp_xid/Makefile.am @@ -14,7 +14,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lgtp -lrt -lm diff --git a/openbsc/tests/xid/Makefile.am b/openbsc/tests/xid/Makefile.am index aaf17ed..512dade 100644 --- a/openbsc/tests/xid/Makefile.am +++ b/openbsc/tests/xid/Makefile.am @@ -31,7 +31,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 4 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 Fri Dec 23 22:01:31 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:01:31 +0000 Subject: [PATCH] libosmocore[master]: add CRC16-CCITT to libosmocore Message-ID: Review at https://gerrit.osmocom.org/1499 add CRC16-CCITT to libosmocore Use the implementation from Linux lib/crc-ccitt.c (GPLv2) Change-Id: I26bb54038f5ab36bbb34da7f5fb8ae6c0c0386a4 --- M include/osmocom/core/crc16.h M src/crc16.c 2 files changed, 54 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/99/1499/1 diff --git a/include/osmocom/core/crc16.h b/include/osmocom/core/crc16.h index 83b2e5f..f1564bd 100644 --- a/include/osmocom/core/crc16.h +++ b/include/osmocom/core/crc16.h @@ -29,3 +29,15 @@ { return (crc >> 8) ^ osmo_crc16_table[(crc ^ data) & 0xff]; } + + +/* CCITT polynome 0x8408. This corresponds to x^0 + x^5 + x^12 */ + +extern uint16_t const osmo_crc16_ccitt_table[256]; + +extern uint16_t osmo_crc16_ccitt(uint16_t crc, const uint8_t *buffer, size_t len); + +static inline uint16_t osmo_crc16_ccitt_byte(uint16_t crc, const uint8_t data) +{ + return (crc >> 8) ^ osmo_crc16_ccitt_table[(crc ^ data) & 0xff]; +} diff --git a/src/crc16.c b/src/crc16.c index 9dd4672..accb0b4 100644 --- a/src/crc16.c +++ b/src/crc16.c @@ -58,3 +58,45 @@ crc = osmo_crc16_byte(crc, *buffer++); return crc; } + +uint16_t const osmo_crc16_ccitt_table[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 +}; + +uint16_t osmo_crc16_ccitt(uint16_t crc, uint8_t const *buffer, size_t len) +{ + while (len--) + crc = osmo_crc16_ccitt_byte(crc, *buffer++); + return crc; +} -- To view, visit https://gerrit.osmocom.org/1499 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26bb54038f5ab36bbb34da7f5fb8ae6c0c0386a4 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 23 22:01:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:01:34 +0000 Subject: [PATCH] libosmocore[master]: serial: Open devie in non-blocking mode and then switch to b... Message-ID: Review at https://gerrit.osmocom.org/1500 serial: Open devie in non-blocking mode and then switch to blocking There are some serial ports that apparently block during the open in some circumstances. We don't want that. We want to either open it immediately, or fail fast. Change-Id: I626b138574bc50f4f4b09c4d609f3623ff512dff --- M src/serial.c 1 file changed, 17 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/1500/1 diff --git a/src/serial.c b/src/serial.c index 66ee756..4403226 100644 --- a/src/serial.c +++ b/src/serial.c @@ -59,16 +59,30 @@ int osmo_serial_init(const char *dev, speed_t baudrate) { - int rc, fd=0, v24; + int rc, fd=0, v24, flags; struct termios tio; - /* Open device */ - fd = open(dev, O_RDWR | O_NOCTTY); + /* Use nonblock as the device might block otherwise */ + fd = open(dev, O_RDWR | O_NOCTTY | O_SYNC | O_NONBLOCK); if (fd < 0) { dbg_perror("open"); return -errno; } + /* now put it into blcoking mode */ + flags = fcntl(fd, F_GETFL, 0); + if (flags < 0) { + dbg_perror("fcntl get flags"); + return -1; + } + + flags &= ~O_NONBLOCK; + rc = fcntl(fd, F_SETFL, flags); + if (rc != 0) { + dbg_perror("fcntl set flags"); + return -1; + } + /* Configure serial interface */ rc = tcgetattr(fd, &tio); if (rc < 0) { -- To view, visit https://gerrit.osmocom.org/1500 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I626b138574bc50f4f4b09c4d609f3623ff512dff Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 23 22:01:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:01:34 +0000 Subject: [PATCH] libosmocore[master]: serial.c: Some ports don't support TIOCMBIS for RTS/CTS control Message-ID: Review at https://gerrit.osmocom.org/1501 serial.c: Some ports don't support TIOCMBIS for RTS/CTS control So let's ignore the error we might get from this opreration. Change-Id: I69dad90403355b6512c3bf4c7fd10dd1dd985f01 --- M src/serial.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/01/1501/1 diff --git a/src/serial.c b/src/serial.c index 4403226..1cbd3c0 100644 --- a/src/serial.c +++ b/src/serial.c @@ -113,8 +113,8 @@ rc = ioctl(fd, TIOCMBIS, &v24); if (rc < 0) { dbg_perror("ioctl(TIOCMBIS)"); - rc = -errno; - goto error; + /* some serial porst don't support this, so let's not + * return an error here */ } return fd; -- To view, visit https://gerrit.osmocom.org/1501 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I69dad90403355b6512c3bf4c7fd10dd1dd985f01 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Fri Dec 23 22:36:50 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 22:36:50 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 4: > http://jenkins.osmocom.org/jenkins/job/OpenBSC-gerrit/1635/ : > FAILURE After my edit adding the include, it's now Traceback (most recent call last): File "./vty_test_runner.py", line 790, in testBSCreload self.assertTrue(3 == nat_bsc_num_con(self)) -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 4 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 Fri Dec 23 22:45:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:45:34 +0000 Subject: libosmocore[master]: add CRC16-CCITT to libosmocore In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1499 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I26bb54038f5ab36bbb34da7f5fb8ae6c0c0386a4 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 Dec 23 22:45:36 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:45:36 +0000 Subject: libosmocore[master]: serial: Open devie in non-blocking mode and then switch to b... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1500 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I626b138574bc50f4f4b09c4d609f3623ff512dff 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 Dec 23 22:45:38 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:45:38 +0000 Subject: libosmocore[master]: serial.c: Some ports don't support TIOCMBIS for RTS/CTS control In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1501 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I69dad90403355b6512c3bf4c7fd10dd1dd985f01 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 Dec 23 22:45:47 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:45:47 +0000 Subject: [MERGED] libosmocore[master]: serial.c: Some ports don't support TIOCMBIS for RTS/CTS control In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: serial.c: Some ports don't support TIOCMBIS for RTS/CTS control ...................................................................... serial.c: Some ports don't support TIOCMBIS for RTS/CTS control So let's ignore the error we might get from this opreration. Change-Id: I69dad90403355b6512c3bf4c7fd10dd1dd985f01 --- M src/serial.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/serial.c b/src/serial.c index 4403226..1cbd3c0 100644 --- a/src/serial.c +++ b/src/serial.c @@ -113,8 +113,8 @@ rc = ioctl(fd, TIOCMBIS, &v24); if (rc < 0) { dbg_perror("ioctl(TIOCMBIS)"); - rc = -errno; - goto error; + /* some serial porst don't support this, so let's not + * return an error here */ } return fd; -- To view, visit https://gerrit.osmocom.org/1501 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I69dad90403355b6512c3bf4c7fd10dd1dd985f01 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 Dec 23 22:45:47 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:45:47 +0000 Subject: [MERGED] libosmocore[master]: serial: Open devie in non-blocking mode and then switch to b... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: serial: Open devie in non-blocking mode and then switch to blocking ...................................................................... serial: Open devie in non-blocking mode and then switch to blocking There are some serial ports that apparently block during the open in some circumstances. We don't want that. We want to either open it immediately, or fail fast. Change-Id: I626b138574bc50f4f4b09c4d609f3623ff512dff --- M src/serial.c 1 file changed, 17 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/serial.c b/src/serial.c index 66ee756..4403226 100644 --- a/src/serial.c +++ b/src/serial.c @@ -59,16 +59,30 @@ int osmo_serial_init(const char *dev, speed_t baudrate) { - int rc, fd=0, v24; + int rc, fd=0, v24, flags; struct termios tio; - /* Open device */ - fd = open(dev, O_RDWR | O_NOCTTY); + /* Use nonblock as the device might block otherwise */ + fd = open(dev, O_RDWR | O_NOCTTY | O_SYNC | O_NONBLOCK); if (fd < 0) { dbg_perror("open"); return -errno; } + /* now put it into blcoking mode */ + flags = fcntl(fd, F_GETFL, 0); + if (flags < 0) { + dbg_perror("fcntl get flags"); + return -1; + } + + flags &= ~O_NONBLOCK; + rc = fcntl(fd, F_SETFL, flags); + if (rc != 0) { + dbg_perror("fcntl set flags"); + return -1; + } + /* Configure serial interface */ rc = tcgetattr(fd, &tio); if (rc < 0) { -- To view, visit https://gerrit.osmocom.org/1500 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I626b138574bc50f4f4b09c4d609f3623ff512dff 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 Dec 23 22:45:47 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Fri, 23 Dec 2016 22:45:47 +0000 Subject: [MERGED] libosmocore[master]: add CRC16-CCITT to libosmocore In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: add CRC16-CCITT to libosmocore ...................................................................... add CRC16-CCITT to libosmocore Use the implementation from Linux lib/crc-ccitt.c (GPLv2) Change-Id: I26bb54038f5ab36bbb34da7f5fb8ae6c0c0386a4 --- M include/osmocom/core/crc16.h M src/crc16.c 2 files changed, 54 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/crc16.h b/include/osmocom/core/crc16.h index 83b2e5f..f1564bd 100644 --- a/include/osmocom/core/crc16.h +++ b/include/osmocom/core/crc16.h @@ -29,3 +29,15 @@ { return (crc >> 8) ^ osmo_crc16_table[(crc ^ data) & 0xff]; } + + +/* CCITT polynome 0x8408. This corresponds to x^0 + x^5 + x^12 */ + +extern uint16_t const osmo_crc16_ccitt_table[256]; + +extern uint16_t osmo_crc16_ccitt(uint16_t crc, const uint8_t *buffer, size_t len); + +static inline uint16_t osmo_crc16_ccitt_byte(uint16_t crc, const uint8_t data) +{ + return (crc >> 8) ^ osmo_crc16_ccitt_table[(crc ^ data) & 0xff]; +} diff --git a/src/crc16.c b/src/crc16.c index 9dd4672..accb0b4 100644 --- a/src/crc16.c +++ b/src/crc16.c @@ -58,3 +58,45 @@ crc = osmo_crc16_byte(crc, *buffer++); return crc; } + +uint16_t const osmo_crc16_ccitt_table[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 +}; + +uint16_t osmo_crc16_ccitt(uint16_t crc, uint8_t const *buffer, size_t len) +{ + while (len--) + crc = osmo_crc16_ccitt_byte(crc, *buffer++); + return crc; +} -- To view, visit https://gerrit.osmocom.org/1499 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I26bb54038f5ab36bbb34da7f5fb8ae6c0c0386a4 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 Dec 23 22:48:05 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Fri, 23 Dec 2016 22:48:05 +0000 Subject: osmo-bts[master]: Use system-installed pcuif_proto.h instead of local copy In-Reply-To: References: Message-ID: Patch Set 8: > What about contrib/jenkins_bts_trx.sh and jenkins_oct_and_bts_trx.sh? > Does it have to be adapted as well? As you can see, these apparently already include the --with-osmo-pcu configure switch. It probably came about because they were added recently, probably not intentional, but it doesn't hurt either. -- To view, visit https://gerrit.osmocom.org/1258 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4dd2537aeef60c7d154e90f279dc4e7c2392ff76 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte 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 Sat Dec 24 17:00:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:00:32 +0000 Subject: [PATCH] libosmocore[master]: serial.c: Fix fd leak in case of fcntl() error paths Message-ID: Review at https://gerrit.osmocom.org/1502 serial.c: Fix fd leak in case of fcntl() error paths Change-Id: I14f934957e1086b803f3a7b9b5e6d602380f0be2 Fixes: Coverity CID 158987 --- M src/serial.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/1502/1 diff --git a/src/serial.c b/src/serial.c index 1cbd3c0..6316e45 100644 --- a/src/serial.c +++ b/src/serial.c @@ -73,14 +73,16 @@ flags = fcntl(fd, F_GETFL, 0); if (flags < 0) { dbg_perror("fcntl get flags"); - return -1; + rc = -errno; + goto error; } flags &= ~O_NONBLOCK; rc = fcntl(fd, F_SETFL, flags); if (rc != 0) { dbg_perror("fcntl set flags"); - return -1; + rc = -errno; + goto error; } /* Configure serial interface */ -- To view, visit https://gerrit.osmocom.org/1502 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I14f934957e1086b803f3a7b9b5e6d602380f0be2 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:00:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:00:34 +0000 Subject: [PATCH] libosmocore[master]: serial.c: file descriptor '0' is a valid value Message-ID: Review at https://gerrit.osmocom.org/1503 serial.c: file descriptor '0' is a valid value if stdin/stdout/stderr are all closed by our environment, it may very well be that opening a serial port returns fd == 0. Change-Id: Ifd9670260883a35da0629369e0d49e467d5b4d72 --- M src/serial.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/1503/1 diff --git a/src/serial.c b/src/serial.c index 6316e45..05bdc86 100644 --- a/src/serial.c +++ b/src/serial.c @@ -59,7 +59,7 @@ int osmo_serial_init(const char *dev, speed_t baudrate) { - int rc, fd=0, v24, flags; + int rc, fd=-1, v24, flags; struct termios tio; /* Use nonblock as the device might block otherwise */ @@ -122,7 +122,7 @@ return fd; error: - if (fd) + if (fd >= 0) close(fd); return rc; } -- To view, visit https://gerrit.osmocom.org/1503 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifd9670260883a35da0629369e0d49e467d5b4d72 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:06:38 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:06:38 +0000 Subject: libosmocore[master]: serial.c: file descriptor '0' is a valid value In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1503 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd9670260883a35da0629369e0d49e467d5b4d72 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 Sat Dec 24 17:06:41 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:06:41 +0000 Subject: libosmocore[master]: serial.c: Fix fd leak in case of fcntl() error paths In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1502 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I14f934957e1086b803f3a7b9b5e6d602380f0be2 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 Sat Dec 24 17:06:47 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:06:47 +0000 Subject: [MERGED] libosmocore[master]: serial.c: Fix fd leak in case of fcntl() error paths In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: serial.c: Fix fd leak in case of fcntl() error paths ...................................................................... serial.c: Fix fd leak in case of fcntl() error paths Change-Id: I14f934957e1086b803f3a7b9b5e6d602380f0be2 Fixes: Coverity CID 158987 --- M src/serial.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/serial.c b/src/serial.c index 1cbd3c0..6316e45 100644 --- a/src/serial.c +++ b/src/serial.c @@ -73,14 +73,16 @@ flags = fcntl(fd, F_GETFL, 0); if (flags < 0) { dbg_perror("fcntl get flags"); - return -1; + rc = -errno; + goto error; } flags &= ~O_NONBLOCK; rc = fcntl(fd, F_SETFL, flags); if (rc != 0) { dbg_perror("fcntl set flags"); - return -1; + rc = -errno; + goto error; } /* Configure serial interface */ -- To view, visit https://gerrit.osmocom.org/1502 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I14f934957e1086b803f3a7b9b5e6d602380f0be2 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 Sat Dec 24 17:06:50 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:06:50 +0000 Subject: [MERGED] libosmocore[master]: serial.c: file descriptor '0' is a valid value In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: serial.c: file descriptor '0' is a valid value ...................................................................... serial.c: file descriptor '0' is a valid value if stdin/stdout/stderr are all closed by our environment, it may very well be that opening a serial port returns fd == 0. Change-Id: Ifd9670260883a35da0629369e0d49e467d5b4d72 --- M src/serial.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/serial.c b/src/serial.c index 6316e45..05bdc86 100644 --- a/src/serial.c +++ b/src/serial.c @@ -59,7 +59,7 @@ int osmo_serial_init(const char *dev, speed_t baudrate) { - int rc, fd=0, v24, flags; + int rc, fd=-1, v24, flags; struct termios tio; /* Use nonblock as the device might block otherwise */ @@ -122,7 +122,7 @@ return fd; error: - if (fd) + if (fd >= 0) close(fd); return rc; } -- To view, visit https://gerrit.osmocom.org/1503 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd9670260883a35da0629369e0d49e467d5b4d72 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 Sat Dec 24 17:07:28 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:07:28 +0000 Subject: openbsc[master]: sndcp: Allow empty SNDCP-XID indications In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:07:37 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:07:37 +0000 Subject: openbsc[master]: cosmetic: Rename phone to ms In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1498 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I322d3d99452502da7555cc2af6bc8a192ca3c9c5 Gerrit-PatchSet: 2 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 Sat Dec 24 17:07:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:07:39 +0000 Subject: [MERGED] openbsc[master]: cosmetic: Rename phone to ms In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: cosmetic: Rename phone to ms ...................................................................... cosmetic: Rename phone to ms The term "phone" is incorrect. Rename phone to "MS" (mobile station) in the comments and log output of gprs_llc.c Change-Id: I322d3d99452502da7555cc2af6bc8a192ca3c9c5 --- M openbsc/src/gprs/gprs_llc.c 1 file changed, 7 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index c2c3900..2be663f 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -137,7 +137,7 @@ struct gprs_llc_lle *lle) { /* Note: This function handles the response of a network originated - * XID-Request. There XID messages reflected by the phone are analyzed + * XID-Request. There XID messages reflected by the MS are analyzed * and processed here. The caller is called by rx_llc_xid(). */ struct llist_head *xid_fields; @@ -205,7 +205,7 @@ struct gprs_llc_lle *lle) { /* Note: This function computes the response that is sent back to the - * phone when a phone originated XID is received. The function is + * MS when a mobile originated XID is received. The function is * called by rx_llc_xid() */ int rc = -EINVAL; @@ -232,7 +232,7 @@ * for validity. Currently we just blindly * accept all XID fields by just echoing them. * There is a remaining risk of malfunction - * when a phone submits values which defer from + * when a MS submits values which defer from * the default! */ LOGP(DLLC, LOGL_NOTICE, "Echoing XID-Field: XID: type %s, data_len=%d, data=%s\n", @@ -276,7 +276,7 @@ return rc; } -/* Dispatch XID indications and responses comming from the Phone */ +/* Dispatch XID indications and responses comming from the MS */ static void rx_llc_xid(struct gprs_llc_lle *lle, struct gprs_llc_hdr_parsed *gph) { @@ -286,7 +286,7 @@ /* FIXME: 8.5.3.3: check if XID is invalid */ if (gph->is_cmd) { LOGP(DLLC, LOGL_NOTICE, - "Received XID indication from phone.\n"); + "Received XID indication from MS.\n"); struct msgb *resp; uint8_t *xid; @@ -306,7 +306,7 @@ gprs_llc_tx_xid(lle, resp, 0); } else { LOGP(DLLC, LOGL_NOTICE, - "Received XID confirmation from phone.\n"); + "Received XID confirmation from MS.\n"); gprs_llc_process_xid_conf(gph->data, gph->data_len, lle); /* FIXME: if we had sent a XID reset, send * LLGMM-RESET.conf to GMM */ @@ -342,7 +342,7 @@ else ftype = "NULL"; LOGP(DLLC, LOGL_NOTICE, "Sending XID type %s (%d bytes) request" - " to phone...\n", ftype, xid_bytes_len); + " to MS...\n", ftype, xid_bytes_len); gprs_llc_tx_xid(lle, msg, 1); } else { LOGP(DLLC, LOGL_ERROR, -- To view, visit https://gerrit.osmocom.org/1498 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I322d3d99452502da7555cc2af6bc8a192ca3c9c5 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 Sat Dec 24 17:07:40 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:07:40 +0000 Subject: [MERGED] openbsc[master]: sndcp: Allow empty SNDCP-XID indications In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: sndcp: Allow empty SNDCP-XID indications ...................................................................... sndcp: Allow empty SNDCP-XID indications In some rare cases the modem might send a xid indication that does not contain anything except the version number field. The sgsn ignors such SNDCP-XID indications by stripping the entire field from the response. We found a modem in the wild that started to act problematic when the empty SNDCP-XID was missing in the response. This patch changes the XID negotiation behaviour in a way that if a modem should send empty SNDCP-XID indications, the reply will also contain an empty SNDCP-XID indication. Apart from that the SNDCP-XID version number is now parsed and echoed in the response. This ensures that we always reply with the version number that the modem expects. (The version was 0 in all cases we observed so far) Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Related: OS#1794 --- M openbsc/include/openbsc/gprs_sndcp_xid.h M openbsc/src/gprs/gprs_sndcp.c M openbsc/src/gprs/gprs_sndcp_xid.c M openbsc/tests/sndcp_xid/sndcp_xid_test.c 4 files changed, 61 insertions(+), 42 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gprs_sndcp_xid.h b/openbsc/include/openbsc/gprs_sndcp_xid.h index 02904a7..e64bc52 100644 --- a/openbsc/include/openbsc/gprs_sndcp_xid.h +++ b/openbsc/include/openbsc/gprs_sndcp_xid.h @@ -24,7 +24,7 @@ #include #include -#define CURRENT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ +#define DEFAULT_SNDCP_VERSION 0 /* See 3GPP TS 44.065, clause 8 */ #define MAX_ENTITIES 32 /* 3GPP TS 44.065 reserves 5 bit * for compression enitity number */ @@ -197,13 +197,15 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields); + const struct llist_head *comp_fields, int version); /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, - const uint8_t * src, - unsigned int src_len, - const struct llist_head *comp_fields_req); +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, + const uint8_t *src, + unsigned int src_len, + const struct llist_head + *comp_fields_req); /* Find out to which compression class the specified comp-field belongs * (header compression or data compression?) */ diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c index 1cbeede..60455b5 100644 --- a/openbsc/src/gprs/gprs_sndcp.c +++ b/openbsc/src/gprs/gprs_sndcp.c @@ -960,8 +960,13 @@ llist_add(&v42bis_comp_field.list, &comp_fields); } + /* Do not attempt to compile anything if there is no data in the list */ + if (llist_empty(&comp_fields)) + return 0; + /* Compile bytestream */ - return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields); + return gprs_sndcp_compile_xid(bytes, bytes_len, &comp_fields, + DEFAULT_SNDCP_VERSION); } /* Set of SNDCP-XID bnegotiation (See also: TS 144 065, @@ -1106,6 +1111,7 @@ int rc; int compclass; + int version; struct llist_head *comp_fields; struct gprs_sndcp_comp_field *comp_field; @@ -1115,21 +1121,12 @@ OSMO_ASSERT(lle); /* Parse SNDCP-CID XID-Field */ - comp_fields = gprs_sndcp_parse_xid(lle->llme, + comp_fields = gprs_sndcp_parse_xid(&version, lle->llme, xid_field_indication->data, xid_field_indication->data_len, NULL); if (!comp_fields) return -EINVAL; - - /* Don't bother with empty indications */ - if (llist_empty(comp_fields)) { - xid_field_response->data = NULL; - xid_field_response->data_len = 0; - DEBUGP(DSNDCP, - "SNDCP-XID indication did not contain any parameters!\n"); - return 0; - } /* Handle compression entites */ DEBUGP(DSNDCP, "SNDCP-XID-IND (ms):\n"); @@ -1168,7 +1165,7 @@ /* Compile modified SNDCP-XID bytes */ rc = gprs_sndcp_compile_xid(xid_field_response->data, xid_field_indication->data_len, - comp_fields); + comp_fields, 0); if (rc > 0) xid_field_response->data_len = rc; @@ -1210,7 +1207,7 @@ OSMO_ASSERT(xid_field_request); /* Parse SNDCP-CID XID-Field */ - comp_fields_req = gprs_sndcp_parse_xid(lle->llme, + comp_fields_req = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_request->data, xid_field_request->data_len, NULL); @@ -1221,7 +1218,7 @@ gprs_sndcp_dump_comp_fields(comp_fields_req, LOGL_DEBUG); /* Parse SNDCP-CID XID-Field */ - comp_fields_conf = gprs_sndcp_parse_xid(lle->llme, + comp_fields_conf = gprs_sndcp_parse_xid(NULL, lle->llme, xid_field_conf->data, xid_field_conf->data_len, comp_fields_req); diff --git a/openbsc/src/gprs/gprs_sndcp_xid.c b/openbsc/src/gprs/gprs_sndcp_xid.c index bb43eab..dfea5fe 100644 --- a/openbsc/src/gprs/gprs_sndcp_xid.c +++ b/openbsc/src/gprs/gprs_sndcp_xid.c @@ -549,26 +549,29 @@ /* Transform a list with compression fields into an SNDCP-XID message (dst) */ int gprs_sndcp_compile_xid(uint8_t *dst, unsigned int dst_maxlen, - const struct llist_head *comp_fields) + const struct llist_head *comp_fields, int version) { int rc; int byte_counter = 0; uint8_t comp_bytes[512]; - uint8_t xid_version_number[1] = { CURRENT_SNDCP_VERSION }; + uint8_t xid_version_number[1]; OSMO_ASSERT(comp_fields); OSMO_ASSERT(dst); OSMO_ASSERT(dst_maxlen >= 2 + sizeof(xid_version_number)); - /* Bail if there is no input */ - if (llist_empty(comp_fields)) - return -EINVAL; + /* Prepend header with version number */ + if (version >= 0) { + xid_version_number[0] = (uint8_t) (version & 0xff); + dst = + tlv_put(dst, SNDCP_XID_VERSION_NUMBER, + sizeof(xid_version_number), xid_version_number); + byte_counter += (sizeof(xid_version_number) + 2); + } - /* Prepend header */ - dst = - tlv_put(dst, SNDCP_XID_VERSION_NUMBER, - sizeof(xid_version_number), xid_version_number); - byte_counter += (sizeof(xid_version_number) + 2); + /* Stop if there is no compression fields supplied */ + if (llist_empty(comp_fields)) + return byte_counter; /* Add data compression fields */ rc = gprs_sndcp_pack_fields(comp_fields, comp_bytes, @@ -1283,11 +1286,10 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -static int gprs_sndcp_decode_xid(struct llist_head *comp_fields, +static int gprs_sndcp_decode_xid(int *version, struct llist_head *comp_fields, const uint8_t *src, unsigned int src_len, - const struct - entity_algo_table - *lt, unsigned int lt_len) + const struct entity_algo_table *lt, + unsigned int lt_len) { int src_pos = 0; uint8_t tag; @@ -1296,6 +1298,10 @@ int byte_counter = 0; int rc; int tlv_count = 0; + + /* Preset version value as invalid */ + if (version) + *version = -1; /* Valid TLV-Tag and types */ static const struct tlv_definition sndcp_xid_def = { @@ -1326,6 +1332,10 @@ talloc_free(comp_fields); return -EINVAL; } + + /* Decode sndcp xid version number */ + if (version && tag == SNDCP_XID_VERSION_NUMBER) + *version = val[0]; /* Decode compression parameters */ if ((tag == SNDCP_XID_PROTOCOL_COMPRESSION) @@ -1548,7 +1558,8 @@ } /* Transform an SNDCP-XID message (src) into a list of SNDCP-XID fields */ -struct llist_head *gprs_sndcp_parse_xid(const void *ctx, +struct llist_head *gprs_sndcp_parse_xid(int *version, + const void *ctx, const uint8_t *src, unsigned int src_len, const struct llist_head @@ -1559,6 +1570,12 @@ struct llist_head *comp_fields; struct entity_algo_table lt[MAX_ENTITIES * 2]; + /* In case of a zero length field, just exit */ + if (src_len == 0) + return NULL; + + /* We should go any further if we have a field length greater + * zero and a null pointer as buffer! */ OSMO_ASSERT(src); comp_fields = talloc_zero(ctx, struct llist_head); @@ -1575,8 +1592,8 @@ } /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, lt, - lt_len); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + lt, lt_len); if (rc < 0) { talloc_free(comp_fields); return NULL; @@ -1591,7 +1608,8 @@ } else { /* Parse SNDCP-CID XID-Field */ - rc = gprs_sndcp_decode_xid(comp_fields, src, src_len, NULL, 0); + rc = gprs_sndcp_decode_xid(version, comp_fields, src, src_len, + NULL, 0); if (rc < 0) { talloc_free(comp_fields); return NULL; diff --git a/openbsc/tests/sndcp_xid/sndcp_xid_test.c b/openbsc/tests/sndcp_xid/sndcp_xid_test.c index 3a33619..151dd2b 100644 --- a/openbsc/tests/sndcp_xid/sndcp_xid_test.c +++ b/openbsc/tests/sndcp_xid/sndcp_xid_test.c @@ -47,13 +47,14 @@ uint8_t xid_r[512]; /* Parse and show contained comp fields */ - comp_fields = gprs_sndcp_parse_xid(ctx, xid, sizeof(xid), NULL); + comp_fields = gprs_sndcp_parse_xid(NULL, ctx, xid, sizeof(xid), NULL); OSMO_ASSERT(comp_fields); printf("Decoded:\n"); gprs_sndcp_dump_comp_fields(comp_fields, DSNDCP); /* Encode comp-fields again */ - rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields); + rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields, + DEFAULT_SNDCP_VERSION); printf("Result length=%i\n",rc); printf("Encoded: %s\n", osmo_hexdump_nospc(xid, sizeof(xid))); printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc)); @@ -226,13 +227,14 @@ gprs_sndcp_dump_comp_fields(&comp_fields, DSNDCP); /* Encode SNDCP-XID fields */ - rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields); + rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields, + DEFAULT_SNDCP_VERSION); OSMO_ASSERT(rc > 0); printf("Encoded: %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc); /* Parse and show contained comp fields */ - comp_fields_dec = gprs_sndcp_parse_xid(ctx, xid, rc, NULL); + comp_fields_dec = gprs_sndcp_parse_xid(NULL, ctx, xid, rc, NULL); OSMO_ASSERT(comp_fields_dec); printf("Decoded:\n"); -- To view, visit https://gerrit.osmocom.org/1487 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:08:05 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:08:05 +0000 Subject: osmo-gsm-manuals[master]: Describe how to run multiple instances of osmo-nitb and osmo... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1497 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I69adeef85adda6f08b31b7d176f51e16968c1435 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 Sat Dec 24 17:09:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:09:53 +0000 Subject: osmo-gsm-manuals[master]: Describe how to run multiple instances of osmo-nitb and osmo... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/1497/1/OsmoNITB/chapters/running.adoc File OsmoNITB/chapters/running.adoc: Line 93: I think the MNCC socket is not covered here. Please explain how to handle different MNCC sockets in case of multiple instances. Is it automatic? Or is maual configuration needed? -- To view, visit https://gerrit.osmocom.org/1497 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I69adeef85adda6f08b31b7d176f51e16968c1435 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals 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 Sat Dec 24 17:10:15 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:10:15 +0000 Subject: libosmocore[master]: fsm: log calling file+line for error "event for NULL fi" In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1494 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1970773440865f1415004bcf0164603468acf90b 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 Sat Dec 24 17:10:25 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:10:25 +0000 Subject: libosmocore[master]: fsm_test.c: fix compiler warning: timer cb return type In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1492 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifd7e85cd69b5e7e473000abc1ef7a56748aafc0e 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 Sat Dec 24 17:10:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:10:39 +0000 Subject: libosmocore[master]: fsm: doc: add missing file, line args; fix ws + tweak on one... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1493 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6af0d43ab0082e45df676c1d69b26310b59a8031 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 Sat Dec 24 17:11:02 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:02 +0000 Subject: libosmocore[master]: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1495 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80 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 Sat Dec 24 17:11:51 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:51 +0000 Subject: libosmocore[master]: fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1496 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8dac1206259cbd251660f793ad023aaa1dc705a2 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 Sat Dec 24 17:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:53 +0000 Subject: [MERGED] libosmocore[master]: fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_inst_term() ...................................................................... fsm: factor out osmo_fsm_inst_term_children() from osmo_fsm_inst_term() osmo_fsm_inst_term() has code for safe child removal, publish that part as osmo_fsm_inst_term_children(); also use from osmo_fsm_inst_term(). As with osmo_fsm_inst_term(), add osmo_fsm_inst_term_children() macro to pass the caller's source file and line to new _osmo_fsm_inst_term_children(). Rationale: in openbsc's VLR, I want to discard child FSMs when certain events are handled. I could keep a pointer to each one, or simply iterate all children, making the code a lot simpler in some places. (Unfortunately, the patch may be displayed subobtimally. This really only moves the children-loop to a new function, replaces it with a call to _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, file, line) and drops two local iterator variables. No other code changes are made, even though the diff may show large removal + addition chunks) Change-Id: I8dac1206259cbd251660f793ad023aaa1dc705a2 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 55 insertions(+), 20 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 8f65533..a2c20b7 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -187,4 +187,17 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line); +/*! \brief Terminate all child FSM instances of an FSM instance. + * + * This is a macro that calls _osmo_fsm_inst_term_children() with the given + * parameters as well as the caller's source file and line number for logging + * purposes. See there for documentation. + */ +#define osmo_fsm_inst_term_children(fi, cause, data) \ + _osmo_fsm_inst_term_children(fi, cause, data, __BASE_FILE__, __LINE__) +void _osmo_fsm_inst_term_children(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, + void *data, + const char *file, int line); + /*! @} */ diff --git a/src/fsm.c b/src/fsm.c index 750f016..5c47a44 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -421,12 +421,52 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line) { - struct osmo_fsm_inst *first_child, *last_seen_first_child; struct osmo_fsm_inst *parent = fi->proc.parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", osmo_fsm_term_cause_name(cause)); + + _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL, + file, line); + + /* delete ourselves from the parent */ + if (parent) + LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", + osmo_fsm_inst_name(parent)); + llist_del(&fi->proc.child); + + /* call destructor / clean-up function */ + if (fi->fsm->cleanup) + fi->fsm->cleanup(fi, cause); + + LOGPFSMSRC(fi, file, line, "Freeing instance\n"); + osmo_fsm_inst_free(fi); + + /* indicate our termination to the parent */ + if (parent && cause != OSMO_FSM_TERM_PARENT) + _osmo_fsm_inst_dispatch(parent, parent_term_event, data, + file, line); +} + +/*! \brief Terminate all child FSM instances of an FSM instance. + * + * Iterate over all children and send them a termination event, with the given + * cause. Pass OSMO_FSM_TERM_PARENT to avoid dispatching events from the + * terminated child FSMs. + * + * \param[in] fi FSM instance that should be cleared of child FSMs + * \param[in] cause Cause / reason for termination (OSMO_FSM_TERM_PARENT) + * \param[in] data Opaque event data to be passed with the parent term events + * \param[in] file Calling source file (from osmo_fsm_inst_term_children macro) + * \param[in] line Calling source line (from osmo_fsm_inst_term_children macro) + */ +void _osmo_fsm_inst_term_children(struct osmo_fsm_inst *fi, + enum osmo_fsm_term_cause cause, + void *data, + const char *file, int line) +{ + struct osmo_fsm_inst *first_child, *last_seen_first_child; /* iterate over all children, starting from the beginning every time: * terminating an FSM may emit events that cause other FSMs to also @@ -447,27 +487,9 @@ last_seen_first_child = first_child; /* terminate child */ - _osmo_fsm_inst_term(first_child, OSMO_FSM_TERM_PARENT, NULL, + _osmo_fsm_inst_term(first_child, cause, data, file, line); } - - /* delete ourselves from the parent */ - if (parent) - LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", - osmo_fsm_inst_name(parent)); - llist_del(&fi->proc.child); - - /* call destructor / clean-up function */ - if (fi->fsm->cleanup) - fi->fsm->cleanup(fi, cause); - - LOGPFSMSRC(fi, file, line, "Freeing instance\n"); - osmo_fsm_inst_free(fi); - - /* indicate our termination to the parent */ - if (parent && cause != OSMO_FSM_TERM_PARENT) - _osmo_fsm_inst_dispatch(parent, parent_term_event, data, - file, line); } const struct value_string osmo_fsm_term_cause_names[] = { -- To view, visit https://gerrit.osmocom.org/1496 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8dac1206259cbd251660f793ad023aaa1dc705a2 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 Sat Dec 24 17:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:53 +0000 Subject: [MERGED] libosmocore[master]: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h ...................................................................... fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h LOGPFSM and LOGPFSML are in the header file, put the *SRC variants also there so users of the osmo_fsm_inst API may conveniently create own functions that log the caller's source file and line. Very useful if many action functions call the same event dispatching function, like foo_fsm_done(), and one needs to know which of the callers to debug. Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80 --- M include/osmocom/core/fsm.h M src/fsm.c 2 files changed, 13 insertions(+), 13 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 57d9a76..8f65533 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -125,6 +125,19 @@ #define LOGPFSM(fi, fmt, args...) \ LOGPFSML(fi, (fi)->log_level, fmt, ## args) +#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ + LOGPSRC((fi)->fsm->log_subsys, level, \ + caller_file, caller_line, \ + "%s{%s}: " fmt, \ + osmo_fsm_inst_name(fi), \ + osmo_fsm_state_name((fi)->fsm, (fi)->state), \ + ## args) + +#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ + LOGPFSMLSRC(fi, (fi)->log_level, \ + caller_file, caller_line, \ + fmt, ## args) + int osmo_fsm_register(struct osmo_fsm *fsm); void osmo_fsm_unregister(struct osmo_fsm *fsm); struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv, diff --git a/src/fsm.c b/src/fsm.c index c9902ae..750f016 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -284,19 +284,6 @@ return fsm->states[state].name; } -#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \ - LOGPSRC((fi)->fsm->log_subsys, level, \ - caller_file, caller_line, \ - "%s{%s}: " fmt, \ - osmo_fsm_inst_name(fi), \ - osmo_fsm_state_name((fi)->fsm, (fi)->state), \ - ## args) - -#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \ - LOGPFSMLSRC(fi, (fi)->log_level, \ - caller_file, caller_line, \ - fmt, ## args) - /*! \brief perform a state change of the given FSM instance * * Best invoke via the osmo_fsm_inst_state_chg() macro which logs the source -- To view, visit https://gerrit.osmocom.org/1495 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80 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 Sat Dec 24 17:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:53 +0000 Subject: [MERGED] libosmocore[master]: fsm: doc: add missing file, line args; fix ws + tweak on one... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: doc: add missing file, line args; fix ws + tweak on one line ...................................................................... fsm: doc: add missing file, line args; fix ws + tweak on one line Change-Id: I6af0d43ab0082e45df676c1d69b26310b59a8031 --- M src/fsm.c 1 file changed, 7 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index 319c842..8675f75 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -317,6 +317,8 @@ * \param[in] new_state The new state into which we should change * \param[in] timeout_secs Timeout in seconds (if !=0) * \param[in] T Timer number (if \ref timeout_secs != 0) + * \param[in] file Calling source file (from osmo_fsm_inst_state_chg macro) + * \param[in] line Calling source line (from osmo_fsm_inst_state_chg macro) * \returns 0 on success; negative on error */ int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, @@ -371,6 +373,8 @@ * \param[in] fi FSM instance * \param[in] event Event to send to FSM instance * \param[in] data Data to pass along with the event + * \param[in] file Calling source file (from osmo_fsm_inst_dispatch macro) + * \param[in] line Calling source line (from osmo_fsm_inst_dispatch macro) * \returns 0 in case of success; negative on error */ int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, @@ -421,7 +425,9 @@ * * \param[in] fi FSM instance to be terminated * \param[in] cause Cause / reason for termination - * \param[in] data Opaqueevent data to be passed to parent + * \param[in] data Opaque event data to be passed with the parent term event + * \param[in] file Calling source file (from osmo_fsm_inst_term macro) + * \param[in] line Calling source line (from osmo_fsm_inst_term macro) */ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, -- To view, visit https://gerrit.osmocom.org/1493 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6af0d43ab0082e45df676c1d69b26310b59a8031 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 Sat Dec 24 17:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:53 +0000 Subject: [MERGED] libosmocore[master]: fsm_test.c: fix compiler warning: timer cb return type In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm_test.c: fix compiler warning: timer cb return type ...................................................................... fsm_test.c: fix compiler warning: timer cb return type Change-Id: Ifd7e85cd69b5e7e473000abc1ef7a56748aafc0e --- M tests/fsm/fsm_test.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/fsm/fsm_test.c b/tests/fsm/fsm_test.c index edbba9e..7a64421 100644 --- a/tests/fsm/fsm_test.c +++ b/tests/fsm/fsm_test.c @@ -53,7 +53,7 @@ } } -static void test_fsm_tmr_cb(struct osmo_fsm_inst *fi) +static int test_fsm_tmr_cb(struct osmo_fsm_inst *fi) { OSMO_ASSERT(fi->T == 2342); OSMO_ASSERT(fi->state == ST_TWO); -- To view, visit https://gerrit.osmocom.org/1492 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd7e85cd69b5e7e473000abc1ef7a56748aafc0e 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 Sat Dec 24 17:11:53 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:11:53 +0000 Subject: [MERGED] libosmocore[master]: fsm: log calling file+line for error "event for NULL fi" In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: fsm: log calling file+line for error "event for NULL fi" ...................................................................... fsm: log calling file+line for error "event for NULL fi" Change-Id: I1970773440865f1415004bcf0164603468acf90b --- M src/fsm.c 1 file changed, 3 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index 8675f75..c9902ae 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -384,8 +384,9 @@ const struct osmo_fsm_state *fs; if (!fi) { - LOGP(DLGLOBAL, LOGL_ERROR, "Trying to dispatch event %u to " - "non-existing FSM Instance!\n", event); + LOGPSRC(DLGLOBAL, LOGL_ERROR, file, line, + "Trying to dispatch event %u to non-existent" + " FSM instance!\n", event); osmo_log_backtrace(DLGLOBAL, LOGL_ERROR); return -ENODEV; } -- To view, visit https://gerrit.osmocom.org/1494 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1970773440865f1415004bcf0164603468acf90b 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 Sat Dec 24 17:12:32 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:12:32 +0000 Subject: openbsc[master]: Pass actual smpp_avail_status through to smpp in alert_all_e... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1491 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4b00d8821c1688ca0c990b6042607f4ded0f80e3 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: keith Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:12:34 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:12:34 +0000 Subject: [MERGED] openbsc[master]: Pass actual smpp_avail_status through to smpp in alert_all_e... In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: Pass actual smpp_avail_status through to smpp in alert_all_esme() ...................................................................... Pass actual smpp_avail_status through to smpp in alert_all_esme() Change-Id: I4b00d8821c1688ca0c990b6042607f4ded0f80e3 --- M openbsc/src/libmsc/smpp_openbsc.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c index 0269f4b..228e61d 100644 --- a/openbsc/src/libmsc/smpp_openbsc.c +++ b/openbsc/src/libmsc/smpp_openbsc.c @@ -263,11 +263,11 @@ if (esme->acl && esme->acl->deliver_src_imsi) { smpp_tx_alert(esme, TON_Subscriber_Number, NPI_Land_Mobile_E212, - subscr->imsi, 0); + subscr->imsi, smpp_avail_status); } else { smpp_tx_alert(esme, TON_Network_Specific, NPI_ISDN_E163_E164, - subscr->extension, 0); + subscr->extension, smpp_avail_status); } } } -- To view, visit https://gerrit.osmocom.org/1491 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4b00d8821c1688ca0c990b6042607f4ded0f80e3 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: keith Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:12:45 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:12:45 +0000 Subject: libosmocore[master]: utils/conv_gen.py: use shared tables if possible In-Reply-To: References: Message-ID: Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:12:48 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:12:48 +0000 Subject: libosmocore[master]: utils/conv_gen.py: separate code definitions In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1223 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3428561251b7d7a180d1e9b6fcaad50bdbbc37fa Gerrit-PatchSet: 2 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 Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:12:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:12:49 +0000 Subject: [MERGED] libosmocore[master]: utils/conv_gen.py: separate code definitions In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: utils/conv_gen.py: separate code definitions ...................................................................... utils/conv_gen.py: separate code definitions This change separates the convolutional code definitions from the code generator logic, allowing us to make further changes in more specific way. For example, adding some new codes, you change the conv_codes.py only because such change isn't related to the generator. Change-Id: I3428561251b7d7a180d1e9b6fcaad50bdbbc37fa --- A utils/conv_codes_gsm.py M utils/conv_gen.py 2 files changed, 728 insertions(+), 714 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_codes_gsm.py b/utils/conv_codes_gsm.py new file mode 100644 index 0000000..1bee6db --- /dev/null +++ b/utils/conv_codes_gsm.py @@ -0,0 +1,706 @@ +#!/usr/bin/python2 + +from conv_gen import ConvolutionalCode +from conv_gen import poly + +# Polynomials according to 3GPP TS 05.03 Annex B +G0 = poly(0, 3, 4) +G1 = poly(0, 1, 3, 4) +G2 = poly(0, 2, 4) +G3 = poly(0, 1, 2, 3, 4) +G4 = poly(0, 2, 3, 5, 6) +G5 = poly(0, 1, 4, 6) +G6 = poly(0, 1, 2, 3, 4, 6) +G7 = poly(0, 1, 2, 3, 6) + +# Shared polynomials +shared_polys = { + "xcch" : [ + ( G0, 1 ), + ( G1, 1 ), + ], + "mcs" : [ + ( G4, 1 ), + ( G7, 1 ), + ( G5, 1 ), + ], +} + +# Convolutional code definitions +conv_codes = [ + # xCCH definition + ConvolutionalCode( + 224, + shared_polys["xcch"], + name = "xcch", + description = [ + "xCCH convolutional code:", + "228 bits blocks, rate 1/2, k = 5", + "G0 = 1 + D3 + D4", + "G1 = 1 + D + D3 + D4", + ] + ), + + # RACH definition + ConvolutionalCode( + 14, + shared_polys["xcch"], + name = "rach", + description = ["RACH convolutional code"] + ), + + # SCH definition + ConvolutionalCode( + 35, + shared_polys["xcch"], + name = "sch", + description = ["SCH convolutional code"] + ), + + # CS2 definition + ConvolutionalCode( + 290, + shared_polys["xcch"], + puncture = [ + 15, 19, 23, 27, 31, 35, 43, 47, 51, 55, 59, 63, 67, 71, + 75, 79, 83, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, + 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 187, 191, 195, + 199, 203, 207, 211, 215, 219, 223, 227, 235, 239, 243, 247, 251, 255, + 259, 263, 267, 271, 275, 283, 287, 291, 295, 299, 303, 307, 311, 315, + 319, 323, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, 379, + 383, 387, 391, 395, 399, 403, 407, 411, 415, 419, 427, 431, 435, 439, + 443, 447, 451, 455, 459, 463, 467, 475, 479, 483, 487, 491, 495, 499, + 503, 507, 511, 515, 523, 527, 531, 535, 539, 543, 547, 551, 555, 559, + 563, 571, 575, 579, 583, 587, -1 + ], + name = "cs2", + description = [ + "CS2 convolutional code:", + "G0 = 1 + D3 + D4", + "G1 = 1 + D + D3 + D4", + ] + ), + + # CS3 definition + ConvolutionalCode( + 334, + shared_polys["xcch"], + puncture = [ + 15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45, 47, 51, 53, + 57, 59, 63, 65, 69, 71, 75, 77, 81, 83, 87, 89, 93, 95, + 99, 101, 105, 107, 111, 113, 117, 119, 123, 125, 129, 131, 135, 137, + 141, 143, 147, 149, 153, 155, 159, 161, 165, 167, 171, 173, 177, 179, + 183, 185, 189, 191, 195, 197, 201, 203, 207, 209, 213, 215, 219, 221, + 225, 227, 231, 233, 237, 239, 243, 245, 249, 251, 255, 257, 261, 263, + 267, 269, 273, 275, 279, 281, 285, 287, 291, 293, 297, 299, 303, 305, + 309, 311, 315, 317, 321, 323, 327, 329, 333, 335, 339, 341, 345, 347, + 351, 353, 357, 359, 363, 365, 369, 371, 375, 377, 381, 383, 387, 389, + 393, 395, 399, 401, 405, 407, 411, 413, 417, 419, 423, 425, 429, 431, + 435, 437, 441, 443, 447, 449, 453, 455, 459, 461, 465, 467, 471, 473, + 477, 479, 483, 485, 489, 491, 495, 497, 501, 503, 507, 509, 513, 515, + 519, 521, 525, 527, 531, 533, 537, 539, 543, 545, 549, 551, 555, 557, + 561, 563, 567, 569, 573, 575, 579, 581, 585, 587, 591, 593, 597, 599, + 603, 605, 609, 611, 615, 617, 621, 623, 627, 629, 633, 635, 639, 641, + 645, 647, 651, 653, 657, 659, 663, 665, 669, 671, -1 + ], + name = "cs3", + description = [ + "CS3 convolutional code:", + "G0 = 1 + D3 + D4", + "G1 = 1 + D + D3 + D4", + ] + ), + + # TCH_AFS_12_2 definition + ConvolutionalCode( + 250, + [ + ( 1, 1 ), + ( G1, G0 ), + ], + puncture = [ + 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 363, + 365, 369, 373, 377, 379, 381, 385, 389, 393, 395, 397, 401, + 405, 409, 411, 413, 417, 421, 425, 427, 429, 433, 437, 441, + 443, 445, 449, 453, 457, 459, 461, 465, 469, 473, 475, 477, + 481, 485, 489, 491, 493, 495, 497, 499, 501, 503, 505, 507, + -1 + ], + name = 'tch_afs_12_2', + description = [ + "TCH/AFS 12.2 kbits convolutional code:", + "250 bits block, rate 1/2, punctured", + "G0/G0 = 1", + "G1/G0 = 1 + D + D3 + D4 / 1 + D3 + D4", + ] + ), + + # TCH_AFS_10_2 definition + ConvolutionalCode( + 210, + [ + ( G1, G3 ), + ( G2, G3 ), + ( 1, 1 ), + ], + puncture = [ + 1, 4, 7, 10, 16, 19, 22, 28, 31, 34, 40, 43, + 46, 52, 55, 58, 64, 67, 70, 76, 79, 82, 88, 91, + 94, 100, 103, 106, 112, 115, 118, 124, 127, 130, 136, 139, + 142, 148, 151, 154, 160, 163, 166, 172, 175, 178, 184, 187, + 190, 196, 199, 202, 208, 211, 214, 220, 223, 226, 232, 235, + 238, 244, 247, 250, 256, 259, 262, 268, 271, 274, 280, 283, + 286, 292, 295, 298, 304, 307, 310, 316, 319, 322, 325, 328, + 331, 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, 364, + 367, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, + 403, 406, 409, 412, 415, 418, 421, 424, 427, 430, 433, 436, + 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, + 475, 478, 481, 484, 487, 490, 493, 496, 499, 502, 505, 508, + 511, 514, 517, 520, 523, 526, 529, 532, 535, 538, 541, 544, + 547, 550, 553, 556, 559, 562, 565, 568, 571, 574, 577, 580, + 583, 586, 589, 592, 595, 598, 601, 604, 607, 609, 610, 613, + 616, 619, 621, 622, 625, 627, 628, 631, 633, 634, 636, 637, + 639, 640, -1 + ], + name = 'tch_afs_10_2', + description = [ + "TCH/AFS 10.2 kbits convolutional code:", + "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", + "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", + "G3/G3 = 1", + ] + ), + + # TCH_AFS_7_95 definition + ConvolutionalCode( + 165, + [ + ( 1, 1 ), + ( G5, G4 ), + ( G6, G4 ), + ], + puncture = [ + 1, 2, 4, 5, 8, 22, 70, 118, 166, 214, 262, 310, + 317, 319, 325, 332, 334, 341, 343, 349, 356, 358, 365, 367, + 373, 380, 382, 385, 389, 391, 397, 404, 406, 409, 413, 415, + 421, 428, 430, 433, 437, 439, 445, 452, 454, 457, 461, 463, + 469, 476, 478, 481, 485, 487, 490, 493, 500, 502, 503, 505, + 506, 508, 509, 511, 512, -1 + ], + name = 'tch_afs_7_95', + description = [ + "TCH/AFS 7.95 kbits convolutional code:", + "G4/G4 = 1", + "G5/G4 = 1 + D + D4 + D6 / 1 + D2 + D3 + D5 + D6", + "G6/G4 = 1 + D + D2 + D3 + D4 + D6 / 1 + D2 + D3 + D5 + D6", + ] + ), + + # TCH_AFS_7_4 definition + ConvolutionalCode( + 154, + [ + ( G1, G3 ), + ( G2, G3 ), + ( 1, 1 ), + ], + puncture = [ + 0, 355, 361, 367, 373, 379, 385, 391, 397, 403, 409, 415, + 421, 427, 433, 439, 445, 451, 457, 460, 463, 466, 468, 469, + 471, 472, -1 + ], + name = 'tch_afs_7_4', + description = [ + "TCH/AFS 7.4 kbits convolutional code:", + "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", + "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", + "G3/G3 = 1", + ] + ), + + # TCH_AFS_6_7 definition + ConvolutionalCode( + 140, + [ + ( G1, G3 ), + ( G2, G3 ), + ( 1, 1 ), + ( 1, 1 ), + ], + puncture = [ + 1, 3, 7, 11, 15, 27, 39, 55, 67, 79, 95, 107, + 119, 135, 147, 159, 175, 187, 199, 215, 227, 239, 255, 267, + 279, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 327, + 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 369, 371, + 375, 377, 379, 383, 385, 387, 391, 393, 395, 399, 401, 403, + 407, 409, 411, 415, 417, 419, 423, 425, 427, 431, 433, 435, + 439, 441, 443, 447, 449, 451, 455, 457, 459, 463, 465, 467, + 471, 473, 475, 479, 481, 483, 487, 489, 491, 495, 497, 499, + 503, 505, 507, 511, 513, 515, 519, 521, 523, 527, 529, 531, + 535, 537, 539, 543, 545, 547, 549, 551, 553, 555, 557, 559, + 561, 563, 565, 567, 569, 571, 573, 575, -1 + ], + name = 'tch_afs_6_7', + description = [ + "TCH/AFS 6.7 kbits convolutional code:", + "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", + "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", + "G3/G3 = 1", + "G3/G3 = 1", + ] + ), + + # TCH_AFS_5_9 definition + ConvolutionalCode( + 124, + [ + ( G4, G6 ), + ( G5, G6 ), + ( 1, 1), + ( 1, 1), + ], + puncture = [ + 0, 1, 3, 5, 7, 11, 15, 31, 47, 63, 79, 95, + 111, 127, 143, 159, 175, 191, 207, 223, 239, 255, 271, 287, + 303, 319, 327, 331, 335, 343, 347, 351, 359, 363, 367, 375, + 379, 383, 391, 395, 399, 407, 411, 415, 423, 427, 431, 439, + 443, 447, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, + 495, 499, 503, 507, 509, 511, 512, 513, 515, 516, 517, 519, + -1 + ], + name = 'tch_afs_5_9', + description = [ + "TCH/AFS 5.9 kbits convolutional code:", + "124 bits", + "G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6", + "G5/G6 = 1 + D + D4 + D6 / 1 + D + D2 + D3 + D4 + D6", + "G6/G6 = 1", + "G6/G6 = 1", + ] + ), + + # TCH_AFS_5_15 definition + ConvolutionalCode( + 109, + [ + ( G1, G3 ), + ( G1, G3 ), + ( G2, G3 ), + ( 1, 1 ), + ( 1, 1 ), + ], + puncture = [ + 0, 4, 5, 9, 10, 14, 15, 20, 25, 30, 35, 40, + 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, + 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, + 290, 300, 310, 315, 320, 325, 330, 334, 335, 340, 344, 345, + 350, 354, 355, 360, 364, 365, 370, 374, 375, 380, 384, 385, + 390, 394, 395, 400, 404, 405, 410, 414, 415, 420, 424, 425, + 430, 434, 435, 440, 444, 445, 450, 454, 455, 460, 464, 465, + 470, 474, 475, 480, 484, 485, 490, 494, 495, 500, 504, 505, + 510, 514, 515, 520, 524, 525, 529, 530, 534, 535, 539, 540, + 544, 545, 549, 550, 554, 555, 559, 560, 564, -1 + ], + name = 'tch_afs_5_15', + description = [ + "TCH/AFS 5.15 kbits convolutional code:", + "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", + "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", + "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", + "G3/G3 = 1", + "G3/G3 = 1", + ] + ), + + # TCH_AFS_4_75 definition + ConvolutionalCode( + 101, + [ + ( G4, G6 ), + ( G4, G6 ), + ( G5, G6 ), + ( 1, 1 ), + ( 1, 1 ), + ], + puncture = [ + 0, 1, 2, 4, 5, 7, 9, 15, 25, 35, 45, 55, + 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, + 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, + 305, 315, 325, 335, 345, 355, 365, 375, 385, 395, 400, 405, + 410, 415, 420, 425, 430, 435, 440, 445, 450, 455, 459, 460, + 465, 470, 475, 479, 480, 485, 490, 495, 499, 500, 505, 509, + 510, 515, 517, 519, 520, 522, 524, 525, 526, 527, 529, 530, + 531, 532, 534, -1 + ], + name = 'tch_afs_4_75', + description = [ + "TCH/AFS 4.75 kbits convolutional code:", + "G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6", + "G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6", + "G5/G6 = 1 + D + D4 + D6 / 1 + D + D2 + D3 + D4 + D6", + "G6/G6 = 1", + "G6/G6 = 1", + ] + ), + + # TCH_FR definition + ConvolutionalCode( + 185, + shared_polys["xcch"], + name = "tch_fr", + description = ["TCH/F convolutional code"] + ), + + # TCH_HR definition + ConvolutionalCode( + 98, + [ + ( G4, 1 ), + ( G5, 1 ), + ( G6, 1 ), + ], + puncture = [ + 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, + 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, + 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, + 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, + 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178, + 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, + 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, + 253, 256, 259, 262, 265, 268, 271, 274, 277, 280, 283, 295, + 298, 301, 304, 307, 310, -1, + ], + name = "tch_hr", + description = ["TCH/H convolutional code"] + ), + + # TCH_AHS_7_95 definition + ConvolutionalCode( + 129, + [ + ( 1, 1 ), + ( G1, G0 ), + ], + puncture = [ + 1, 3, 5, 7, 11, 15, 19, 23, 27, 31, 35, 43, + 47, 51, 55, 59, 63, 67, 71, 79, 83, 87, 91, 95, + 99, 103, 107, 115, 119, 123, 127, 131, 135, 139, 143, 151, + 155, 159, 163, 167, 171, 175, 177, 179, 183, 185, 187, 191, + 193, 195, 197, 199, 203, 205, 207, 211, 213, 215, 219, 221, + 223, 227, 229, 231, 233, 235, 239, 241, 243, 247, 249, 251, + 255, 257, 259, 261, 263, 265, -1, + ], + name = "tch_ahs_7_95", + description = ["TCH/AHS 7.95 kbits convolutional code"] + ), + + # TCH_AHS_7_4 definition + ConvolutionalCode( + 126, + [ + ( 1, 1 ), + ( G1, G0 ), + ], + puncture = [ + 1, 3, 7, 11, 19, 23, 27, 35, 39, 43, 51, 55, + 59, 67, 71, 75, 83, 87, 91, 99, 103, 107, 115, 119, + 123, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, + 175, 179, 183, 187, 191, 195, 199, 203, 207, 211, 215, 219, + 221, 223, 227, 229, 231, 235, 237, 239, 243, 245, 247, 251, + 253, 255, 257, 259, -1, + ], + name = "tch_ahs_7_4", + description = ["TCH/AHS 7.4 kbits convolutional code"] + ), + + # TCH_AHS_6_7 definition + ConvolutionalCode( + 116, + [ + ( 1, 1 ), + ( G1, G0 ), + ], + puncture = [ + 1, 3, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, + 109, 119, 129, 139, 149, 159, 167, 169, 177, 179, 187, 189, + 197, 199, 203, 207, 209, 213, 217, 219, 223, 227, 229, 231, + 233, 235, 237, 239, -1, + ], + name = "tch_ahs_6_7", + description = ["TCH/AHS 6.7 kbits convolutional code"] + ), + + # TCH_AHS_5_9 definition + ConvolutionalCode( + 108, + [ + ( 1, 1 ), + ( G1, G0 ), + ], + puncture = [ + 1, 15, 71, 127, 139, 151, 163, 175, 187, 195, 203, 211, + 215, 219, 221, 223, -1, + ], + name = "tch_ahs_5_9", + description = ["TCH/AHS 5.9 kbits convolutional code"] + ), + + # TCH_AHS_5_15 definition + ConvolutionalCode( + 97, + [ + ( G1, G3 ), + ( G2, G3 ), + ( 1, 1 ), + ], + puncture = [ + 0, 1, 3, 4, 6, 9, 12, 15, 18, 21, 27, 33, + 39, 45, 51, 54, 57, 63, 69, 75, 81, 87, 90, 93, + 99, 105, 111, 117, 123, 126, 129, 135, 141, 147, 153, 159, + 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, + 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, + 234, 237, 240, 243, 244, 246, 249, 252, 255, 256, 258, 261, + 264, 267, 268, 270, 273, 276, 279, 280, 282, 285, 288, 289, + 291, 294, 295, 297, 298, 300, 301, -1, + ], + name = "tch_ahs_5_15", + description = ["TCH/AHS 5.15 kbits convolutional code"] + ), + + # TCH_AHS_4_75 definition + ConvolutionalCode( + 89, + [ + ( 1, 1 ), + ( G5, G4 ), + ( G6, G4 ), + ], + puncture = [ + 1, 2, 4, 5, 7, 8, 10, 13, 16, 22, 28, 34, + 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, + 112, 118, 124, 130, 136, 142, 148, 151, 154, 160, 163, 166, + 172, 175, 178, 184, 187, 190, 196, 199, 202, 208, 211, 214, + 220, 223, 226, 232, 235, 238, 241, 244, 247, 250, 253, 256, + 259, 262, 265, 268, 271, 274, 275, 277, 278, 280, 281, 283, + 284, -1, + ], + name = "tch_ahs_4_75", + description = ["TCH/AHS 4.75 kbits convolutional code"] + ), + + # EDGE MCS1_DL_HDR definition + ConvolutionalCode( + 36, + shared_polys["mcs"], + name = "mcs1_dl_hdr", + term_type = "CONV_TERM_TAIL_BITING", + description = [ + "EDGE MCS-1 DL header convolutional code:", + "42 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS1_UL_HDR definition + ConvolutionalCode( + 39, + shared_polys["mcs"], + name = "mcs1_ul_hdr", + term_type = "CONV_TERM_TAIL_BITING", + description = [ + "EDGE MCS-1 UL header convolutional code:", + "45 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS1 definition + ConvolutionalCode( + 190, + shared_polys["mcs"], + name = "mcs1", + description = [ + "EDGE MCS-1 data convolutional code:", + "196 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS2 definition + ConvolutionalCode( + 238, + shared_polys["mcs"], + name = "mcs2", + description = [ + "EDGE MCS-2 data convolutional code:", + "244 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS3 definition + ConvolutionalCode( + 310, + shared_polys["mcs"], + name = "mcs3", + description = [ + "EDGE MCS-3 data convolutional code:", + "316 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS4 definition + ConvolutionalCode( + 366, + shared_polys["mcs"], + name = "mcs4", + description = [ + "EDGE MCS-4 data convolutional code:", + "372 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS5_DL_HDR definition + ConvolutionalCode( + 33, + shared_polys["mcs"], + name = "mcs5_dl_hdr", + term_type = "CONV_TERM_TAIL_BITING", + description = [ + "EDGE MCS-5 DL header convolutional code:", + "39 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS5_UL_HDR definition + ConvolutionalCode( + 45, + shared_polys["mcs"], + name = "mcs5_ul_hdr", + term_type = "CONV_TERM_TAIL_BITING", + description = [ + "EDGE MCS-5 UL header convolutional code:", + "51 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS5 definition + ConvolutionalCode( + 462, + shared_polys["mcs"], + name = "mcs5", + description = [ + "EDGE MCS-5 data convolutional code:", + "468 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS6 definition + ConvolutionalCode( + 606, + shared_polys["mcs"], + name = "mcs6", + description = [ + "EDGE MCS-6 data convolutional code:", + "612 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS7_DL_HDR definition + ConvolutionalCode( + 45, + shared_polys["mcs"], + name = "mcs7_dl_hdr", + term_type = "CONV_TERM_TAIL_BITING", + description = [ + "EDGE MCS-7 DL header convolutional code:", + "51 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS7_UL_HDR definition + ConvolutionalCode( + 54, + shared_polys["mcs"], + name = "mcs7_ul_hdr", + term_type = "CONV_TERM_TAIL_BITING", + description = [ + "EDGE MCS-7 UL header convolutional code:", + "60 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS7 definition + ConvolutionalCode( + 462, + shared_polys["mcs"], + name = "mcs7", + description = [ + "EDGE MCS-7 data convolutional code:", + "468 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS8 definition + ConvolutionalCode( + 558, + shared_polys["mcs"], + name = "mcs8", + description = [ + "EDGE MCS-8 data convolutional code:", + "564 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), + + # EDGE MCS9 definition + ConvolutionalCode( + 606, + shared_polys["mcs"], + name = "mcs9", + description = [ + "EDGE MCS-9 data convolutional code:", + "612 bits blocks, rate 1/3, k = 7", + "G4 = 1 + D2 + D3 + D5 + D6", + "G7 = 1 + D + D2 + D3 + D6", + "G5 = 1 + D + D4 + D6" + ] + ), +] diff --git a/utils/conv_gen.py b/utils/conv_gen.py index 1ecb550..60580ed 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -25,6 +25,7 @@ import sys, os, math from functools import reduce +import conv_codes_gsm class ConvolutionalCode(object): @@ -247,736 +248,43 @@ fi.write("\n") -def print_shared(fi): +def print_shared(fi, shared_polys): for (name, polys) in shared_polys.items(): # HACK code = ConvolutionalCode(0, polys, name = name) code.print_state_and_output(fi) -# Polynomials according to 3GPP TS 05.03 Annex B -G0 = poly(0, 3, 4) -G1 = poly(0, 1, 3, 4) -G2 = poly(0, 2, 4) -G3 = poly(0, 1, 2, 3, 4) -G4 = poly(0, 2, 3, 5, 6) -G5 = poly(0, 1, 4, 6) -G6 = poly(0, 1, 2, 3, 4, 6) -G7 = poly(0, 1, 2, 3, 6) - -shared_polys = { - "xcch" : [ - ( G0, 1 ), - ( G1, 1 ), - ], - "mcs" : [ - ( G4, 1 ), - ( G7, 1 ), - ( G5, 1 ), - ], -} - -conv_codes = [ - # xCCH definition - ConvolutionalCode( - 224, - shared_polys["xcch"], - name = "xcch", - description = [ - "xCCH convolutional code:", - "228 bits blocks, rate 1/2, k = 5", - "G0 = 1 + D3 + D4", - "G1 = 1 + D + D3 + D4", - ] - ), - - # RACH definition - ConvolutionalCode( - 14, - shared_polys["xcch"], - name = "rach", - description = ["RACH convolutional code"] - ), - - # SCH definition - ConvolutionalCode( - 35, - shared_polys["xcch"], - name = "sch", - description = ["SCH convolutional code"] - ), - - # CS2 definition - ConvolutionalCode( - 290, - shared_polys["xcch"], - puncture = [ - 15, 19, 23, 27, 31, 35, 43, 47, 51, 55, 59, 63, 67, 71, - 75, 79, 83, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, - 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 187, 191, 195, - 199, 203, 207, 211, 215, 219, 223, 227, 235, 239, 243, 247, 251, 255, - 259, 263, 267, 271, 275, 283, 287, 291, 295, 299, 303, 307, 311, 315, - 319, 323, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, 379, - 383, 387, 391, 395, 399, 403, 407, 411, 415, 419, 427, 431, 435, 439, - 443, 447, 451, 455, 459, 463, 467, 475, 479, 483, 487, 491, 495, 499, - 503, 507, 511, 515, 523, 527, 531, 535, 539, 543, 547, 551, 555, 559, - 563, 571, 575, 579, 583, 587, -1 - ], - name = "cs2", - description = [ - "CS2 convolutional code:", - "G0 = 1 + D3 + D4", - "G1 = 1 + D + D3 + D4", - ] - ), - - # CS3 definition - ConvolutionalCode( - 334, - shared_polys["xcch"], - puncture = [ - 15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45, 47, 51, 53, - 57, 59, 63, 65, 69, 71, 75, 77, 81, 83, 87, 89, 93, 95, - 99, 101, 105, 107, 111, 113, 117, 119, 123, 125, 129, 131, 135, 137, - 141, 143, 147, 149, 153, 155, 159, 161, 165, 167, 171, 173, 177, 179, - 183, 185, 189, 191, 195, 197, 201, 203, 207, 209, 213, 215, 219, 221, - 225, 227, 231, 233, 237, 239, 243, 245, 249, 251, 255, 257, 261, 263, - 267, 269, 273, 275, 279, 281, 285, 287, 291, 293, 297, 299, 303, 305, - 309, 311, 315, 317, 321, 323, 327, 329, 333, 335, 339, 341, 345, 347, - 351, 353, 357, 359, 363, 365, 369, 371, 375, 377, 381, 383, 387, 389, - 393, 395, 399, 401, 405, 407, 411, 413, 417, 419, 423, 425, 429, 431, - 435, 437, 441, 443, 447, 449, 453, 455, 459, 461, 465, 467, 471, 473, - 477, 479, 483, 485, 489, 491, 495, 497, 501, 503, 507, 509, 513, 515, - 519, 521, 525, 527, 531, 533, 537, 539, 543, 545, 549, 551, 555, 557, - 561, 563, 567, 569, 573, 575, 579, 581, 585, 587, 591, 593, 597, 599, - 603, 605, 609, 611, 615, 617, 621, 623, 627, 629, 633, 635, 639, 641, - 645, 647, 651, 653, 657, 659, 663, 665, 669, 671, -1 - ], - name = "cs3", - description = [ - "CS3 convolutional code:", - "G0 = 1 + D3 + D4", - "G1 = 1 + D + D3 + D4", - ] - ), - - # TCH_AFS_12_2 definition - ConvolutionalCode( - 250, - [ - ( 1, 1 ), - ( G1, G0 ), - ], - puncture = [ - 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 363, - 365, 369, 373, 377, 379, 381, 385, 389, 393, 395, 397, 401, - 405, 409, 411, 413, 417, 421, 425, 427, 429, 433, 437, 441, - 443, 445, 449, 453, 457, 459, 461, 465, 469, 473, 475, 477, - 481, 485, 489, 491, 493, 495, 497, 499, 501, 503, 505, 507, - -1 - ], - name = 'tch_afs_12_2', - description = [ - "TCH/AFS 12.2 kbits convolutional code:", - "250 bits block, rate 1/2, punctured", - "G0/G0 = 1", - "G1/G0 = 1 + D + D3 + D4 / 1 + D3 + D4", - ] - ), - - # TCH_AFS_10_2 definition - ConvolutionalCode( - 210, - [ - ( G1, G3 ), - ( G2, G3 ), - ( 1, 1 ), - ], - puncture = [ - 1, 4, 7, 10, 16, 19, 22, 28, 31, 34, 40, 43, - 46, 52, 55, 58, 64, 67, 70, 76, 79, 82, 88, 91, - 94, 100, 103, 106, 112, 115, 118, 124, 127, 130, 136, 139, - 142, 148, 151, 154, 160, 163, 166, 172, 175, 178, 184, 187, - 190, 196, 199, 202, 208, 211, 214, 220, 223, 226, 232, 235, - 238, 244, 247, 250, 256, 259, 262, 268, 271, 274, 280, 283, - 286, 292, 295, 298, 304, 307, 310, 316, 319, 322, 325, 328, - 331, 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, 364, - 367, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, - 403, 406, 409, 412, 415, 418, 421, 424, 427, 430, 433, 436, - 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, - 475, 478, 481, 484, 487, 490, 493, 496, 499, 502, 505, 508, - 511, 514, 517, 520, 523, 526, 529, 532, 535, 538, 541, 544, - 547, 550, 553, 556, 559, 562, 565, 568, 571, 574, 577, 580, - 583, 586, 589, 592, 595, 598, 601, 604, 607, 609, 610, 613, - 616, 619, 621, 622, 625, 627, 628, 631, 633, 634, 636, 637, - 639, 640, -1 - ], - name = 'tch_afs_10_2', - description = [ - "TCH/AFS 10.2 kbits convolutional code:", - "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", - "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", - "G3/G3 = 1", - ] - ), - - # TCH_AFS_7_95 definition - ConvolutionalCode( - 165, - [ - ( 1, 1 ), - ( G5, G4 ), - ( G6, G4 ), - ], - puncture = [ - 1, 2, 4, 5, 8, 22, 70, 118, 166, 214, 262, 310, - 317, 319, 325, 332, 334, 341, 343, 349, 356, 358, 365, 367, - 373, 380, 382, 385, 389, 391, 397, 404, 406, 409, 413, 415, - 421, 428, 430, 433, 437, 439, 445, 452, 454, 457, 461, 463, - 469, 476, 478, 481, 485, 487, 490, 493, 500, 502, 503, 505, - 506, 508, 509, 511, 512, -1 - ], - name = 'tch_afs_7_95', - description = [ - "TCH/AFS 7.95 kbits convolutional code:", - "G4/G4 = 1", - "G5/G4 = 1 + D + D4 + D6 / 1 + D2 + D3 + D5 + D6", - "G6/G4 = 1 + D + D2 + D3 + D4 + D6 / 1 + D2 + D3 + D5 + D6", - ] - ), - - # TCH_AFS_7_4 definition - ConvolutionalCode( - 154, - [ - ( G1, G3 ), - ( G2, G3 ), - ( 1, 1 ), - ], - puncture = [ - 0, 355, 361, 367, 373, 379, 385, 391, 397, 403, 409, 415, - 421, 427, 433, 439, 445, 451, 457, 460, 463, 466, 468, 469, - 471, 472, -1 - ], - name = 'tch_afs_7_4', - description = [ - "TCH/AFS 7.4 kbits convolutional code:", - "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", - "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", - "G3/G3 = 1", - ] - ), - - # TCH_AFS_6_7 definition - ConvolutionalCode( - 140, - [ - ( G1, G3 ), - ( G2, G3 ), - ( 1, 1 ), - ( 1, 1 ), - ], - puncture = [ - 1, 3, 7, 11, 15, 27, 39, 55, 67, 79, 95, 107, - 119, 135, 147, 159, 175, 187, 199, 215, 227, 239, 255, 267, - 279, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 327, - 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 369, 371, - 375, 377, 379, 383, 385, 387, 391, 393, 395, 399, 401, 403, - 407, 409, 411, 415, 417, 419, 423, 425, 427, 431, 433, 435, - 439, 441, 443, 447, 449, 451, 455, 457, 459, 463, 465, 467, - 471, 473, 475, 479, 481, 483, 487, 489, 491, 495, 497, 499, - 503, 505, 507, 511, 513, 515, 519, 521, 523, 527, 529, 531, - 535, 537, 539, 543, 545, 547, 549, 551, 553, 555, 557, 559, - 561, 563, 565, 567, 569, 571, 573, 575, -1 - ], - name = 'tch_afs_6_7', - description = [ - "TCH/AFS 6.7 kbits convolutional code:", - "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", - "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", - "G3/G3 = 1", - "G3/G3 = 1", - ] - ), - - # TCH_AFS_5_9 definition - ConvolutionalCode( - 124, - [ - ( G4, G6 ), - ( G5, G6 ), - ( 1, 1), - ( 1, 1), - ], - puncture = [ - 0, 1, 3, 5, 7, 11, 15, 31, 47, 63, 79, 95, - 111, 127, 143, 159, 175, 191, 207, 223, 239, 255, 271, 287, - 303, 319, 327, 331, 335, 343, 347, 351, 359, 363, 367, 375, - 379, 383, 391, 395, 399, 407, 411, 415, 423, 427, 431, 439, - 443, 447, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, - 495, 499, 503, 507, 509, 511, 512, 513, 515, 516, 517, 519, - -1 - ], - name = 'tch_afs_5_9', - description = [ - "TCH/AFS 5.9 kbits convolutional code:", - "124 bits", - "G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6", - "G5/G6 = 1 + D + D4 + D6 / 1 + D + D2 + D3 + D4 + D6", - "G6/G6 = 1", - "G6/G6 = 1", - ] - ), - - # TCH_AFS_5_15 definition - ConvolutionalCode( - 109, - [ - ( G1, G3 ), - ( G1, G3 ), - ( G2, G3 ), - ( 1, 1 ), - ( 1, 1 ), - ], - puncture = [ - 0, 4, 5, 9, 10, 14, 15, 20, 25, 30, 35, 40, - 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, - 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, - 290, 300, 310, 315, 320, 325, 330, 334, 335, 340, 344, 345, - 350, 354, 355, 360, 364, 365, 370, 374, 375, 380, 384, 385, - 390, 394, 395, 400, 404, 405, 410, 414, 415, 420, 424, 425, - 430, 434, 435, 440, 444, 445, 450, 454, 455, 460, 464, 465, - 470, 474, 475, 480, 484, 485, 490, 494, 495, 500, 504, 505, - 510, 514, 515, 520, 524, 525, 529, 530, 534, 535, 539, 540, - 544, 545, 549, 550, 554, 555, 559, 560, 564, -1 - ], - name = 'tch_afs_5_15', - description = [ - "TCH/AFS 5.15 kbits convolutional code:", - "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", - "G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4", - "G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4", - "G3/G3 = 1", - "G3/G3 = 1", - ] - ), - - # TCH_AFS_4_75 definition - ConvolutionalCode( - 101, - [ - ( G4, G6 ), - ( G4, G6 ), - ( G5, G6 ), - ( 1, 1 ), - ( 1, 1 ), - ], - puncture = [ - 0, 1, 2, 4, 5, 7, 9, 15, 25, 35, 45, 55, - 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, - 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, - 305, 315, 325, 335, 345, 355, 365, 375, 385, 395, 400, 405, - 410, 415, 420, 425, 430, 435, 440, 445, 450, 455, 459, 460, - 465, 470, 475, 479, 480, 485, 490, 495, 499, 500, 505, 509, - 510, 515, 517, 519, 520, 522, 524, 525, 526, 527, 529, 530, - 531, 532, 534, -1 - ], - name = 'tch_afs_4_75', - description = [ - "TCH/AFS 4.75 kbits convolutional code:", - "G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6", - "G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6", - "G5/G6 = 1 + D + D4 + D6 / 1 + D + D2 + D3 + D4 + D6", - "G6/G6 = 1", - "G6/G6 = 1", - ] - ), - - # TCH_FR definition - ConvolutionalCode( - 185, - shared_polys["xcch"], - name = "tch_fr", - description = ["TCH/F convolutional code"] - ), - - # TCH_HR definition - ConvolutionalCode( - 98, - [ - ( G4, 1 ), - ( G5, 1 ), - ( G6, 1 ), - ], - puncture = [ - 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, - 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, - 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, - 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, - 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178, - 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, - 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, - 253, 256, 259, 262, 265, 268, 271, 274, 277, 280, 283, 295, - 298, 301, 304, 307, 310, -1, - ], - name = "tch_hr", - description = ["TCH/H convolutional code"] - ), - - # TCH_AHS_7_95 definition - ConvolutionalCode( - 129, - [ - ( 1, 1 ), - ( G1, G0 ), - ], - puncture = [ - 1, 3, 5, 7, 11, 15, 19, 23, 27, 31, 35, 43, - 47, 51, 55, 59, 63, 67, 71, 79, 83, 87, 91, 95, - 99, 103, 107, 115, 119, 123, 127, 131, 135, 139, 143, 151, - 155, 159, 163, 167, 171, 175, 177, 179, 183, 185, 187, 191, - 193, 195, 197, 199, 203, 205, 207, 211, 213, 215, 219, 221, - 223, 227, 229, 231, 233, 235, 239, 241, 243, 247, 249, 251, - 255, 257, 259, 261, 263, 265, -1, - ], - name = "tch_ahs_7_95", - description = ["TCH/AHS 7.95 kbits convolutional code"] - ), - - # TCH_AHS_7_4 definition - ConvolutionalCode( - 126, - [ - ( 1, 1 ), - ( G1, G0 ), - ], - puncture = [ - 1, 3, 7, 11, 19, 23, 27, 35, 39, 43, 51, 55, - 59, 67, 71, 75, 83, 87, 91, 99, 103, 107, 115, 119, - 123, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, - 175, 179, 183, 187, 191, 195, 199, 203, 207, 211, 215, 219, - 221, 223, 227, 229, 231, 235, 237, 239, 243, 245, 247, 251, - 253, 255, 257, 259, -1, - ], - name = "tch_ahs_7_4", - description = ["TCH/AHS 7.4 kbits convolutional code"] - ), - - # TCH_AHS_6_7 definition - ConvolutionalCode( - 116, - [ - ( 1, 1 ), - ( G1, G0 ), - ], - puncture = [ - 1, 3, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, - 109, 119, 129, 139, 149, 159, 167, 169, 177, 179, 187, 189, - 197, 199, 203, 207, 209, 213, 217, 219, 223, 227, 229, 231, - 233, 235, 237, 239, -1, - ], - name = "tch_ahs_6_7", - description = ["TCH/AHS 6.7 kbits convolutional code"] - ), - - # TCH_AHS_5_9 definition - ConvolutionalCode( - 108, - [ - ( 1, 1 ), - ( G1, G0 ), - ], - puncture = [ - 1, 15, 71, 127, 139, 151, 163, 175, 187, 195, 203, 211, - 215, 219, 221, 223, -1, - ], - name = "tch_ahs_5_9", - description = ["TCH/AHS 5.9 kbits convolutional code"] - ), - - # TCH_AHS_5_15 definition - ConvolutionalCode( - 97, - [ - ( G1, G3 ), - ( G2, G3 ), - ( 1, 1 ), - ], - puncture = [ - 0, 1, 3, 4, 6, 9, 12, 15, 18, 21, 27, 33, - 39, 45, 51, 54, 57, 63, 69, 75, 81, 87, 90, 93, - 99, 105, 111, 117, 123, 126, 129, 135, 141, 147, 153, 159, - 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, - 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, - 234, 237, 240, 243, 244, 246, 249, 252, 255, 256, 258, 261, - 264, 267, 268, 270, 273, 276, 279, 280, 282, 285, 288, 289, - 291, 294, 295, 297, 298, 300, 301, -1, - ], - name = "tch_ahs_5_15", - description = ["TCH/AHS 5.15 kbits convolutional code"] - ), - - # TCH_AHS_4_75 definition - ConvolutionalCode( - 89, - [ - ( 1, 1 ), - ( G5, G4 ), - ( G6, G4 ), - ], - puncture = [ - 1, 2, 4, 5, 7, 8, 10, 13, 16, 22, 28, 34, - 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, - 112, 118, 124, 130, 136, 142, 148, 151, 154, 160, 163, 166, - 172, 175, 178, 184, 187, 190, 196, 199, 202, 208, 211, 214, - 220, 223, 226, 232, 235, 238, 241, 244, 247, 250, 253, 256, - 259, 262, 265, 268, 271, 274, 275, 277, 278, 280, 281, 283, - 284, -1, - ], - name = "tch_ahs_4_75", - description = ["TCH/AHS 4.75 kbits convolutional code"] - ), - - # EDGE MCS1_DL_HDR definition - ConvolutionalCode( - 36, - shared_polys["mcs"], - name = "mcs1_dl_hdr", - term_type = "CONV_TERM_TAIL_BITING", - description = [ - "EDGE MCS-1 DL header convolutional code:", - "42 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS1_UL_HDR definition - ConvolutionalCode( - 39, - shared_polys["mcs"], - name = "mcs1_ul_hdr", - term_type = "CONV_TERM_TAIL_BITING", - description = [ - "EDGE MCS-1 UL header convolutional code:", - "45 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS1 definition - ConvolutionalCode( - 190, - shared_polys["mcs"], - name = "mcs1", - description = [ - "EDGE MCS-1 data convolutional code:", - "196 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS2 definition - ConvolutionalCode( - 238, - shared_polys["mcs"], - name = "mcs2", - description = [ - "EDGE MCS-2 data convolutional code:", - "244 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS3 definition - ConvolutionalCode( - 310, - shared_polys["mcs"], - name = "mcs3", - description = [ - "EDGE MCS-3 data convolutional code:", - "316 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS4 definition - ConvolutionalCode( - 366, - shared_polys["mcs"], - name = "mcs4", - description = [ - "EDGE MCS-4 data convolutional code:", - "372 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS5_DL_HDR definition - ConvolutionalCode( - 33, - shared_polys["mcs"], - name = "mcs5_dl_hdr", - term_type = "CONV_TERM_TAIL_BITING", - description = [ - "EDGE MCS-5 DL header convolutional code:", - "39 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS5_UL_HDR definition - ConvolutionalCode( - 45, - shared_polys["mcs"], - name = "mcs5_ul_hdr", - term_type = "CONV_TERM_TAIL_BITING", - description = [ - "EDGE MCS-5 UL header convolutional code:", - "51 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS5 definition - ConvolutionalCode( - 462, - shared_polys["mcs"], - name = "mcs5", - description = [ - "EDGE MCS-5 data convolutional code:", - "468 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS6 definition - ConvolutionalCode( - 606, - shared_polys["mcs"], - name = "mcs6", - description = [ - "EDGE MCS-6 data convolutional code:", - "612 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS7_DL_HDR definition - ConvolutionalCode( - 45, - shared_polys["mcs"], - name = "mcs7_dl_hdr", - term_type = "CONV_TERM_TAIL_BITING", - description = [ - "EDGE MCS-7 DL header convolutional code:", - "51 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS7_UL_HDR definition - ConvolutionalCode( - 54, - shared_polys["mcs"], - name = "mcs7_ul_hdr", - term_type = "CONV_TERM_TAIL_BITING", - description = [ - "EDGE MCS-7 UL header convolutional code:", - "60 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS7 definition - ConvolutionalCode( - 462, - shared_polys["mcs"], - name = "mcs7", - description = [ - "EDGE MCS-7 data convolutional code:", - "468 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS8 definition - ConvolutionalCode( - 558, - shared_polys["mcs"], - name = "mcs8", - description = [ - "EDGE MCS-8 data convolutional code:", - "564 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), - - # EDGE MCS9 definition - ConvolutionalCode( - 606, - shared_polys["mcs"], - name = "mcs9", - description = [ - "EDGE MCS-9 data convolutional code:", - "612 bits blocks, rate 1/3, k = 7", - "G4 = 1 + D2 + D3 + D5 + D6", - "G7 = 1 + D + D2 + D3 + D6", - "G5 = 1 + D + D4 + D6" - ] - ), -] - -if __name__ == '__main__': - path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd() - prefix = "gsm0503" - - sys.stderr.write("Generating convolutional codes...\n") - +def generate_codes(codes, path, prefix): # Open a new file for writing - f = open(os.path.join(path, "gsm0503_conv.c"), 'w') + f = open(os.path.join(path, prefix + "_conv.c"), 'w') f.write(mod_license + "\n") f.write("#include \n") f.write("#include \n\n") - print_shared(f) + + # Print shared tables first + if hasattr(codes, "shared_polys"): + print_shared(f, codes.shared_polys) # Generate the tables one by one - for code in conv_codes: + for code in codes.conv_codes: sys.stderr.write("Generate '%s' definition\n" % code.name) # Check whether shared polynomials are used shared = None - for (name, polys) in shared_polys.items(): - if code.polys == polys: - shared = name - break + if hasattr(codes, "shared_polys"): + for (name, polys) in codes.shared_polys.items(): + if code.polys == polys: + shared = name + break code.gen_tables(prefix, f, shared_tables = shared) +if __name__ == '__main__': + path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd() + + sys.stderr.write("Generating convolutional codes...\n") + + # Generate GSM specific codes + generate_codes(conv_codes_gsm, path, "gsm0503") + sys.stderr.write("Generation complete.\n") -- To view, visit https://gerrit.osmocom.org/1223 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3428561251b7d7a180d1e9b6fcaad50bdbbc37fa Gerrit-PatchSet: 3 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 Sat Dec 24 17:12:49 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:12:49 +0000 Subject: [MERGED] libosmocore[master]: utils/conv_gen.py: use shared tables if possible In-Reply-To: References: Message-ID: Harald Welte has submitted this change and it was merged. Change subject: utils/conv_gen.py: use shared tables if possible ...................................................................... utils/conv_gen.py: use shared tables if possible This change introduces the memory usage optimization, mentioned in d2d9760c08f35a231d32f0ebeb73b2927e5573b3. The aim is to make code generator able to detect, whether the same tables are used by several convolutional code definitions, and prevent one from writing these tables multiple times. For now, the detection process isn't fully automatic, so all shared polynomials should be placed inside the 'shared_polys' dictionary, for example: shared_polys = { "xcch" : [ ( G0, 1 ), ( G1, 1 ), ], "mcs" : [ ( G4, 1 ), ( G7, 1 ), ( G5, 1 ), ], } Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b --- M utils/conv_gen.py 1 file changed, 61 insertions(+), 37 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 62fa8ad..1ecb550 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -164,7 +164,7 @@ # Up to 12 numbers should be placed per line print_formatted(self.puncture, "%3d, ", 12, fi) - def gen_tables(self, pref, fi): + def print_state_and_output(self, fi): pack = lambda n: \ sum([x << (self.rate_inv - i - 1) for i, x in enumerate(n)]) num_states = 1 << (self.k - 1) @@ -186,6 +186,14 @@ self._print_term(fi, num_states, pack) fi.write("};\n\n") + def gen_tables(self, pref, fi, shared_tables = None): + # Do not print shared tables + if shared_tables is None: + self.print_state_and_output(fi) + table_pref = self.name + else: + table_pref = shared_tables + if len(self.puncture): fi.write("static const int %s_puncture[] = {\n" % self.name) self._print_puncture(fi) @@ -203,15 +211,15 @@ fi.write("\t.N = %d,\n" % self.rate_inv) fi.write("\t.K = %d,\n" % self.k) fi.write("\t.len = %d,\n" % self.block_len) - fi.write("\t.next_output = %s_output,\n" % self.name) - fi.write("\t.next_state = %s_state,\n" % self.name) + fi.write("\t.next_output = %s_output,\n" % table_pref) + fi.write("\t.next_state = %s_state,\n" % table_pref) if self.term_type is not None: fi.write("\t.term = %s,\n" % self.term_type) if self.recursive: - fi.write("\t.next_term_output = %s_term_output,\n" % self.name) - fi.write("\t.next_term_state = %s_term_state,\n" % self.name) + fi.write("\t.next_term_output = %s_term_output,\n" % table_pref) + fi.write("\t.next_term_state = %s_term_state,\n" % table_pref) if len(self.puncture): fi.write("\t.puncture = %s_puncture,\n" % self.name) @@ -239,6 +247,12 @@ fi.write("\n") +def print_shared(fi): + for (name, polys) in shared_polys.items(): + # HACK + code = ConvolutionalCode(0, polys, name = name) + code.print_state_and_output(fi) + # Polynomials according to 3GPP TS 05.03 Annex B G0 = poly(0, 3, 4) G1 = poly(0, 1, 3, 4) @@ -249,22 +263,23 @@ G6 = poly(0, 1, 2, 3, 4, 6) G7 = poly(0, 1, 2, 3, 6) -CCH_poly = [ - ( G0, 1 ), - ( G1, 1 ), -] - -MCS_poly = [ - ( G4, 1 ), - ( G7, 1 ), - ( G5, 1 ), -] +shared_polys = { + "xcch" : [ + ( G0, 1 ), + ( G1, 1 ), + ], + "mcs" : [ + ( G4, 1 ), + ( G7, 1 ), + ( G5, 1 ), + ], +} conv_codes = [ # xCCH definition ConvolutionalCode( 224, - CCH_poly, + shared_polys["xcch"], name = "xcch", description = [ "xCCH convolutional code:", @@ -277,7 +292,7 @@ # RACH definition ConvolutionalCode( 14, - CCH_poly, + shared_polys["xcch"], name = "rach", description = ["RACH convolutional code"] ), @@ -285,7 +300,7 @@ # SCH definition ConvolutionalCode( 35, - CCH_poly, + shared_polys["xcch"], name = "sch", description = ["SCH convolutional code"] ), @@ -293,7 +308,7 @@ # CS2 definition ConvolutionalCode( 290, - CCH_poly, + shared_polys["xcch"], puncture = [ 15, 19, 23, 27, 31, 35, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, @@ -317,7 +332,7 @@ # CS3 definition ConvolutionalCode( 334, - CCH_poly, + shared_polys["xcch"], puncture = [ 15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45, 47, 51, 53, 57, 59, 63, 65, 69, 71, 75, 77, 81, 83, 87, 89, 93, 95, @@ -579,7 +594,7 @@ # TCH_FR definition ConvolutionalCode( 185, - CCH_poly, + shared_polys["xcch"], name = "tch_fr", description = ["TCH/F convolutional code"] ), @@ -724,7 +739,7 @@ # EDGE MCS1_DL_HDR definition ConvolutionalCode( 36, - MCS_poly, + shared_polys["mcs"], name = "mcs1_dl_hdr", term_type = "CONV_TERM_TAIL_BITING", description = [ @@ -739,7 +754,7 @@ # EDGE MCS1_UL_HDR definition ConvolutionalCode( 39, - MCS_poly, + shared_polys["mcs"], name = "mcs1_ul_hdr", term_type = "CONV_TERM_TAIL_BITING", description = [ @@ -754,7 +769,7 @@ # EDGE MCS1 definition ConvolutionalCode( 190, - MCS_poly, + shared_polys["mcs"], name = "mcs1", description = [ "EDGE MCS-1 data convolutional code:", @@ -768,7 +783,7 @@ # EDGE MCS2 definition ConvolutionalCode( 238, - MCS_poly, + shared_polys["mcs"], name = "mcs2", description = [ "EDGE MCS-2 data convolutional code:", @@ -782,7 +797,7 @@ # EDGE MCS3 definition ConvolutionalCode( 310, - MCS_poly, + shared_polys["mcs"], name = "mcs3", description = [ "EDGE MCS-3 data convolutional code:", @@ -796,7 +811,7 @@ # EDGE MCS4 definition ConvolutionalCode( 366, - MCS_poly, + shared_polys["mcs"], name = "mcs4", description = [ "EDGE MCS-4 data convolutional code:", @@ -810,7 +825,7 @@ # EDGE MCS5_DL_HDR definition ConvolutionalCode( 33, - MCS_poly, + shared_polys["mcs"], name = "mcs5_dl_hdr", term_type = "CONV_TERM_TAIL_BITING", description = [ @@ -825,7 +840,7 @@ # EDGE MCS5_UL_HDR definition ConvolutionalCode( 45, - MCS_poly, + shared_polys["mcs"], name = "mcs5_ul_hdr", term_type = "CONV_TERM_TAIL_BITING", description = [ @@ -840,7 +855,7 @@ # EDGE MCS5 definition ConvolutionalCode( 462, - MCS_poly, + shared_polys["mcs"], name = "mcs5", description = [ "EDGE MCS-5 data convolutional code:", @@ -854,7 +869,7 @@ # EDGE MCS6 definition ConvolutionalCode( 606, - MCS_poly, + shared_polys["mcs"], name = "mcs6", description = [ "EDGE MCS-6 data convolutional code:", @@ -868,7 +883,7 @@ # EDGE MCS7_DL_HDR definition ConvolutionalCode( 45, - MCS_poly, + shared_polys["mcs"], name = "mcs7_dl_hdr", term_type = "CONV_TERM_TAIL_BITING", description = [ @@ -883,7 +898,7 @@ # EDGE MCS7_UL_HDR definition ConvolutionalCode( 54, - MCS_poly, + shared_polys["mcs"], name = "mcs7_ul_hdr", term_type = "CONV_TERM_TAIL_BITING", description = [ @@ -898,7 +913,7 @@ # EDGE MCS7 definition ConvolutionalCode( 462, - MCS_poly, + shared_polys["mcs"], name = "mcs7", description = [ "EDGE MCS-7 data convolutional code:", @@ -912,7 +927,7 @@ # EDGE MCS8 definition ConvolutionalCode( 558, - MCS_poly, + shared_polys["mcs"], name = "mcs8", description = [ "EDGE MCS-8 data convolutional code:", @@ -926,7 +941,7 @@ # EDGE MCS9 definition ConvolutionalCode( 606, - MCS_poly, + shared_polys["mcs"], name = "mcs9", description = [ "EDGE MCS-9 data convolutional code:", @@ -949,10 +964,19 @@ f.write(mod_license + "\n") f.write("#include \n") f.write("#include \n\n") + print_shared(f) # Generate the tables one by one for code in conv_codes: sys.stderr.write("Generate '%s' definition\n" % code.name) - code.gen_tables(prefix, f) + + # Check whether shared polynomials are used + shared = None + for (name, polys) in shared_polys.items(): + if code.polys == polys: + shared = name + break + + code.gen_tables(prefix, f, shared_tables = shared) sys.stderr.write("Generation complete.\n") -- To view, visit https://gerrit.osmocom.org/1173 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b Gerrit-PatchSet: 7 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: tnt From gerrit-no-reply at lists.osmocom.org Sat Dec 24 17:13:39 2016 From: gerrit-no-reply at lists.osmocom.org (Harald Welte) Date: Sat, 24 Dec 2016 17:13:39 +0000 Subject: libosmocore[master]: fsm: term: get parent pointer as late as possible In-Reply-To: References: Message-ID: Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 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 Sat Dec 24 17:45:24 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 24 Dec 2016 17:45:24 +0000 Subject: [PATCH] libosmocore[master]: fsm: term: get parent pointer as late as possible 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/1476 to look at the new patch set (#3). fsm: term: get parent pointer as late as possible During FSM instance termination, fetch the parent pointer every time just before using it, in case the child termination or cleanup callback wish to change anything about the parent, e.g. to prevent event dispatch. This patch was created to try and fix a problem that was in the end solved differently. There is no actual need or use case for this at the moment, but it generally makes sense to get the parent pointer as late as possible. Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 --- M src/fsm.c 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/1476/3 diff --git a/src/fsm.c b/src/fsm.c index 5c47a44..19705b9 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -421,7 +421,7 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line) { - struct osmo_fsm_inst *parent = fi->proc.parent; + struct osmo_fsm_inst *parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", @@ -431,6 +431,7 @@ file, line); /* delete ourselves from the parent */ + parent = fi->proc.parent; if (parent) LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", osmo_fsm_inst_name(parent)); @@ -441,6 +442,8 @@ fi->fsm->cleanup(fi, cause); LOGPFSMSRC(fi, file, line, "Freeing instance\n"); + /* Fetch parent again in case it has changed. */ + parent = fi->proc.parent; osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 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 Sat Dec 24 22:22:53 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 24 Dec 2016 22:22:53 +0000 Subject: libosmocore[master]: fsm: term: get parent pointer as late as possible In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 new patch set only resolves a merge conflict on rebase, re-adding +2 -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 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 Sat Dec 24 22:22:59 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 24 Dec 2016 22:22:59 +0000 Subject: [MERGED] libosmocore[master]: fsm: term: get parent pointer as late as possible In-Reply-To: References: Message-ID: Neels Hofmeyr has submitted this change and it was merged. Change subject: fsm: term: get parent pointer as late as possible ...................................................................... fsm: term: get parent pointer as late as possible During FSM instance termination, fetch the parent pointer every time just before using it, in case the child termination or cleanup callback wish to change anything about the parent, e.g. to prevent event dispatch. This patch was created to try and fix a problem that was in the end solved differently. There is no actual need or use case for this at the moment, but it generally makes sense to get the parent pointer as late as possible. Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 --- M src/fsm.c 1 file changed, 4 insertions(+), 1 deletion(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/fsm.c b/src/fsm.c index 5c47a44..19705b9 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -421,7 +421,7 @@ enum osmo_fsm_term_cause cause, void *data, const char *file, int line) { - struct osmo_fsm_inst *parent = fi->proc.parent; + struct osmo_fsm_inst *parent; uint32_t parent_term_event = fi->proc.parent_term_event; LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n", @@ -431,6 +431,7 @@ file, line); /* delete ourselves from the parent */ + parent = fi->proc.parent; if (parent) LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", osmo_fsm_inst_name(parent)); @@ -441,6 +442,8 @@ fi->fsm->cleanup(fi, cause); LOGPFSMSRC(fi, file, line, "Freeing instance\n"); + /* Fetch parent again in case it has changed. */ + parent = fi->proc.parent; osmo_fsm_inst_free(fi); /* indicate our termination to the parent */ -- To view, visit https://gerrit.osmocom.org/1476 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I999d7f29ba10281d4005c5163130bb2d80148362 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 Sat Dec 24 22:24:12 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 24 Dec 2016 22:24:12 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 9: lol, "libosmocoding", a lib that helps hacking on osmocom :) -- 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: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder 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 Sun Dec 25 00:33:32 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:33:32 +0000 Subject: [PATCH] openbsc[master]: db.c: fix retrieval of Ki blob, safe against e.g. zero bytes Message-ID: Review at https://gerrit.osmocom.org/1504 db.c: fix retrieval of Ki blob, safe against e.g. zero bytes It appears that we've so far always been unable to use Ki keys that contain a zero byte, or apparently anything that's outside the 7bit ascii space ... ? With this Ki stored in the hlr.sqlite3 db: sqlite> INSERT INTO "AuthKeys" VALUES(57,2,X'000102030405060708090A0B0C0D0E0F'); sqlite> select hex(a3a8_ki) from AuthKeys; 000102030405060708090A0B0C0D0E0F I always get: DMM <0002> ../../../src/libmsc/auth.c:70 Invalid COMP128v1 key (len=0) Curious, could it be the zero byte? Just to check, I put the zero byte further left: sqlite> select hex(a3a8_ki) from AuthKeys; F00102030405060008090A0B0C0D0E ^ nonzero ^^ zero Now the log says: DMM <0002> ../../../src/libmsc/auth.c:70 Invalid COMP128v1 key (len=5) f1 f3 f4 f5 f6 I was expecting a 7 byte BLOB of "f0 01 02 03 04 05 06", definitely not the above. With this patch, all of these problems disappear and Ki bytes are retrieved correctly from the sqlite db. TODO: are other BLOB values also affected? BTW, this turned up because I'm working on the new VLR, which will inherently fix this issue, but in the course of that I recapped the current osmo-nitb's sequence of events for 2G ciphering as it is on the openbsc master branch. Change-Id: Iffc814e2091aa5d2a833035c3fbccd1b06b50f34 --- M openbsc/src/libmsc/db.c 1 file changed, 10 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/04/1504/1 diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..0f2c7f0 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -616,10 +616,11 @@ struct gsm_subscriber *subscr) { dbi_result result; - const unsigned char *a3a8_ki; + const char *a3a8_ki; + int rc; result = dbi_conn_queryf(conn, - "SELECT * FROM AuthKeys WHERE subscriber_id=%llu", + "SELECT algorithm_id, hex(a3a8_ki) FROM AuthKeys WHERE subscriber_id=%llu", subscr->id); if (!result) return -EIO; @@ -630,11 +631,13 @@ } ainfo->auth_algo = dbi_result_get_ulonglong(result, "algorithm_id"); - ainfo->a3a8_ki_len = dbi_result_get_field_length(result, "a3a8_ki"); - a3a8_ki = dbi_result_get_binary(result, "a3a8_ki"); - if (ainfo->a3a8_ki_len > sizeof(ainfo->a3a8_ki)) - ainfo->a3a8_ki_len = sizeof(ainfo->a3a8_ki); - memcpy(ainfo->a3a8_ki, a3a8_ki, ainfo->a3a8_ki_len); + a3a8_ki = dbi_result_get_string_idx(result, 2); + rc = osmo_hexparse(a3a8_ki, ainfo->a3a8_ki, sizeof(ainfo->a3a8_ki)); + if (rc < 0) + ainfo->a3a8_ki_len = 0; + else { + ainfo->a3a8_ki_len = osmo_hexparse(a3a8_ki, ainfo->a3a8_ki, sizeof(ainfo->a3a8_ki)); + } dbi_result_free(result); -- To view, visit https://gerrit.osmocom.org/1504 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iffc814e2091aa5d2a833035c3fbccd1b06b50f34 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 25 00:33:33 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:33:33 +0000 Subject: [PATCH] openbsc[master]: auth.c: more logging Message-ID: Review at https://gerrit.osmocom.org/1505 auth.c: more logging Change-Id: I5660a0a53910bc1d0b96d4eafd37c0e0559aa49c --- M openbsc/src/libmsc/auth.c 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/05/1505/1 diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index bf62d3c..3fccd16 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -110,6 +110,7 @@ } /* Generate a new one */ + DEBUGP(DMM, "%s: Generate new auth tuple\n", subscr_name(subscr)); if (rc != 0) { /* If db_get_lastauthtuple_for_subscr() returned nothing, make * sure the atuple memory is initialized to zero and thus start @@ -135,11 +136,13 @@ case AUTH_ALGO_XOR: if (_use_xor(&ainfo, atuple)) return AUTH_NOT_AVAIL; + DEBUGP(DMM, "%s: auth algo: xor\n", subscr_name(subscr)); break; case AUTH_ALGO_COMP128v1: if (_use_comp128_v1(&ainfo, atuple)) return AUTH_NOT_AVAIL; + DEBUGP(DMM, "%s: auth algo: comp128v1\n", subscr_name(subscr)); break; default: @@ -151,6 +154,9 @@ db_sync_lastauthtuple_for_subscr(atuple, subscr); DEBUGP(DMM, "Need to do authentication and ciphering\n"); + DEBUGP(DMM, "rand %s\n", osmo_hexdump_nospc(atuple->vec.rand, sizeof(atuple->vec.rand))); + DEBUGP(DMM, "kc %s\n", osmo_hexdump_nospc(atuple->vec.kc, sizeof(atuple->vec.kc))); + DEBUGP(DMM, "sres %s\n", osmo_hexdump_nospc(atuple->vec.sres, sizeof(atuple->vec.sres))); return AUTH_DO_AUTH_THEN_CIPH; } -- To view, visit https://gerrit.osmocom.org/1505 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5660a0a53910bc1d0b96d4eafd37c0e0559aa49c Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 25 00:33:33 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:33:33 +0000 Subject: [PATCH] openbsc[master]: db.c: mad logging TEMP Message-ID: Review at https://gerrit.osmocom.org/1506 db.c: mad logging TEMP Change-Id: I1946b5d8373bda6eb5f56b8193427532bd0ebf1a --- M openbsc/src/libmsc/db.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/06/1506/1 diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 0f2c7f0..2a22100 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -638,6 +638,9 @@ else { ainfo->a3a8_ki_len = osmo_hexparse(a3a8_ki, ainfo->a3a8_ki, sizeof(ainfo->a3a8_ki)); } + printf("GOT ki str %zu %s\n", strlen(a3a8_ki), a3a8_ki); + + printf("GOT ki bin %u %s\n", ainfo->a3a8_ki_len, osmo_hexdump_nospc((void*)ainfo->a3a8_ki, ainfo->a3a8_ki_len)); dbi_result_free(result); -- To view, visit https://gerrit.osmocom.org/1506 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1946b5d8373bda6eb5f56b8193427532bd0ebf1a Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Sun Dec 25 00:34:25 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:34:25 +0000 Subject: [ABANDON] openbsc[master]: auth.c: more logging In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: auth.c: more logging ...................................................................... Abandoned accidental upload -- To view, visit https://gerrit.osmocom.org/1505 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I5660a0a53910bc1d0b96d4eafd37c0e0559aa49c 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 Sun Dec 25 00:34:32 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:34:32 +0000 Subject: [ABANDON] openbsc[master]: db.c: mad logging TEMP In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: db.c: mad logging TEMP ...................................................................... Abandoned accidental upload -- To view, visit https://gerrit.osmocom.org/1506 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I1946b5d8373bda6eb5f56b8193427532bd0ebf1a 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 Sun Dec 25 00:39:46 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:39:46 +0000 Subject: openbsc[master]: db.c: fix retrieval of Ki blob, safe against e.g. zero bytes In-Reply-To: References: Message-ID: Patch Set 1: see also https://lists.osmocom.org/pipermail/openbsc/2016-December/010012.html -- To view, visit https://gerrit.osmocom.org/1504 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iffc814e2091aa5d2a833035c3fbccd1b06b50f34 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 Sun Dec 25 00:42:10 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 00:42:10 +0000 Subject: [PATCH] openbsc[master]: db.c: fix retrieval of Ki blob, safe against e.g. zero bytes In-Reply-To: References: Message-ID: db.c: fix retrieval of Ki blob, safe against e.g. zero bytes It appears that we've so far always been unable to use Ki keys that contain a zero byte, or apparently anything that's outside the 7bit ascii space ... ? With this Ki stored in the hlr.sqlite3 db: sqlite> INSERT INTO "AuthKeys" VALUES(57,2,X'000102030405060708090A0B0C0D0E0F'); sqlite> select hex(a3a8_ki) from AuthKeys; 000102030405060708090A0B0C0D0E0F I always get: DMM <0002> ../../../src/libmsc/auth.c:70 Invalid COMP128v1 key (len=0) Curious, could it be the zero byte? Just to check, I put the zero byte further right: sqlite> select hex(a3a8_ki) from AuthKeys; F00102030405060008090A0B0C0D0E ^ nonzero ^^ zero Now the log says: DMM <0002> ../../../src/libmsc/auth.c:70 Invalid COMP128v1 key (len=5) f1 f3 f4 f5 f6 I was expecting a 7 byte BLOB of "f0 01 02 03 04 05 06", definitely not the above. With this patch, all of these problems disappear and Ki bytes are retrieved correctly from the sqlite db. TODO: are other BLOB values also affected? BTW, this turned up because I'm working on the new VLR, which will inherently fix this issue, but in the course of that I recapped the current osmo-nitb's sequence of events for 2G ciphering as it is on the openbsc master branch. Change-Id: Iffc814e2091aa5d2a833035c3fbccd1b06b50f34 --- M openbsc/src/libmsc/db.c 1 file changed, 10 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/04/1504/2 diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..0f2c7f0 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -616,10 +616,11 @@ struct gsm_subscriber *subscr) { dbi_result result; - const unsigned char *a3a8_ki; + const char *a3a8_ki; + int rc; result = dbi_conn_queryf(conn, - "SELECT * FROM AuthKeys WHERE subscriber_id=%llu", + "SELECT algorithm_id, hex(a3a8_ki) FROM AuthKeys WHERE subscriber_id=%llu", subscr->id); if (!result) return -EIO; @@ -630,11 +631,13 @@ } ainfo->auth_algo = dbi_result_get_ulonglong(result, "algorithm_id"); - ainfo->a3a8_ki_len = dbi_result_get_field_length(result, "a3a8_ki"); - a3a8_ki = dbi_result_get_binary(result, "a3a8_ki"); - if (ainfo->a3a8_ki_len > sizeof(ainfo->a3a8_ki)) - ainfo->a3a8_ki_len = sizeof(ainfo->a3a8_ki); - memcpy(ainfo->a3a8_ki, a3a8_ki, ainfo->a3a8_ki_len); + a3a8_ki = dbi_result_get_string_idx(result, 2); + rc = osmo_hexparse(a3a8_ki, ainfo->a3a8_ki, sizeof(ainfo->a3a8_ki)); + if (rc < 0) + ainfo->a3a8_ki_len = 0; + else { + ainfo->a3a8_ki_len = osmo_hexparse(a3a8_ki, ainfo->a3a8_ki, sizeof(ainfo->a3a8_ki)); + } dbi_result_free(result); -- To view, visit https://gerrit.osmocom.org/1504 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iffc814e2091aa5d2a833035c3fbccd1b06b50f34 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 Sun Dec 25 01:17:11 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 01:17:11 +0000 Subject: osmo-gsm-manuals[master]: Describe how to run multiple instances of osmo-nitb and osmo... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (16 comments) Apologies, I'm very nitpicky on docs and English. I find that it's written quite well, but I still had a lot of two cents to add. It might have been faster to just edit myself... https://gerrit.osmocom.org/#/c/1497/1/OsmoBTS/chapters/configuration.adoc File OsmoBTS/chapters/configuration.adoc: Line 186: It is possible to run multiple instances of *osmo-bts* on one and the same we usually mark binaries with backticks in the manuals `osmo-bts` though this isn't really a binary (would be `osmo-bts-foo`). So actually I guess we'd write OsmoBTS instead. Line 190: Since usually a BTS instance comes included with its individual PCU instance, included is a bit misleading. maybe like this? Since usually a BTS instance runs in conjunction with a dedicated PCU instance, Line 191: the socket-path between PCU and BTS has to be individualized as well. It is The English don't use word-joining or wordjoining like Germans do. Rather say socket path Instead of "individualized...as well" I'd say has to be distinguished between the two running instances. Line 201: The VTY can be bound to a free ip-address from the loopback range: drop the hyphen, and maybe IP should be capitalized? IP address and maybe tweak as can be bound to any IP address available on the system, e.g. to a free IP address from the loopback range: https://gerrit.osmocom.org/#/c/1497/1/OsmoNITB/chapters/running.adoc File OsmoNITB/chapters/running.adoc: Line 65: Running multiple instances of *osmo-nitb* is possible if all interfaces (vty, backtick `osmo-nitb` Capitalize "VTY" and "OML"? Line 66: oml) are separated using the appropriate configuration options. The ip based "IP" ? Line 68: processes, the user has to bind those services to specific but different 2x whitespace errors at end of line Line 69: ip-addresses. IP addresses Line 71: The VTY and the control interface can be bind to ip-addresses from the loopback "For example,..." / "bound" / "IP addresses" Line 74: .Example: Binding VTY and control interface to a specific ip-address IP address Line 82: The OML interface also needs be separated by binding it to different ip "needs to be" / "IP" Line 84: address range here since the address we binding on has to be reachable (from rather Usually, it is not possible [...] since the OML interface needs to be reachable by an external BTS. (with osmo-bts-trx or on a sysmoBTS NITB config, it is quite possible to run both osmo-bts and osmo-nitb on the same box.) Line 85: outside) to the bts. If only one ethernet interface is available, subdevices a rare case where the English do hyphenate: sub-devices ...why do I know stuff like this !?!? Line 86: with different ip addresses can be created. IP Line 88: .Example: Binding OML to a specific ip-address IP address Line 94: NOTE: Depending on the application it is necessary to have different ARFCN, comma after 'application' / include the word 'settings' somewhere, e.g. at the end of the sentence. -- To view, visit https://gerrit.osmocom.org/1497 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I69adeef85adda6f08b31b7d176f51e16968c1435 Gerrit-PatchSet: 1 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: Yes From gerrit-no-reply at lists.osmocom.org Sun Dec 25 15:58:04 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sun, 25 Dec 2016 15:58:04 +0000 Subject: [ABANDON] openbsc[master]: db.c: fix retrieval of Ki blob, safe against e.g. zero bytes In-Reply-To: References: Message-ID: Neels Hofmeyr has abandoned this change. Change subject: db.c: fix retrieval of Ki blob, safe against e.g. zero bytes ...................................................................... Abandoned libdbi escapes its blobs -- added to the list of dumb ways to waste 20 minutes. Setting the Ki via the VTY works fine. -- To view, visit https://gerrit.osmocom.org/1504 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: Iffc814e2091aa5d2a833035c3fbccd1b06b50f34 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 Tue Dec 27 09:33:14 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 27 Dec 2016 09:33:14 +0000 Subject: osmo-bts[master]: Use system-installed pcuif_proto.h instead of local copy In-Reply-To: References: Message-ID: Patch Set 8: > how to properly handle dependencies on certain versions of that file Isn't this already handled in runtime by version number in that file? Or you're talking about package versioning? -- To view, visit https://gerrit.osmocom.org/1258 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4dd2537aeef60c7d154e90f279dc4e7c2392ff76 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte 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 Dec 27 11:35:51 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 27 Dec 2016 11:35:51 +0000 Subject: [PATCH] openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1464 to look at the new patch set (#5). Migrate from OpenSSL to GnuTLS This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Related: OS#1694 Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb --- M debian/control M openbsc/configure.ac M openbsc/src/gprs/Makefile.am M openbsc/src/gprs/gb_proxy.c M openbsc/src/gprs/gprs_gmm.c M openbsc/src/gprs/gprs_llc.c M openbsc/src/gprs/gprs_sgsn.c M openbsc/src/libiu/Makefile.am M openbsc/src/libmsc/Makefile.am M openbsc/src/libmsc/auth.c M openbsc/src/libmsc/db.c M openbsc/src/osmo-bsc_nat/Makefile.am M openbsc/src/osmo-bsc_nat/bsc_nat.c M openbsc/src/osmo-nitb/Makefile.am M openbsc/tests/channel/Makefile.am M openbsc/tests/db/Makefile.am M openbsc/tests/gbproxy/Makefile.am M openbsc/tests/gbproxy/gbproxy_test.c M openbsc/tests/mm_auth/Makefile.am M openbsc/tests/mm_auth/mm_auth_test.c M openbsc/tests/sgsn/Makefile.am M openbsc/tests/sgsn/sgsn_test.c M openbsc/tests/sndcp_xid/Makefile.am M openbsc/tests/xid/Makefile.am 24 files changed, 92 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/1464/5 diff --git a/debian/control b/debian/control index 79f18df..d4ee0c2 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ libosmo-netif-dev, libdbd-sqlite3, libpcap-dev, - libssl-dev, + libgnutls28-dev, libc-ares-dev, libsmpp34-dev Standards-Version: 3.9.8 diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 0753834..3bf497d 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -37,7 +37,10 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) -PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5) +PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 3.3.0) + +AC_SUBST(LIBGNUTLS_CFLAGS) +AC_SUBST(LIBGNUTLS_LIBS) # Enabke/disable the NAT? AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])], diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index cff17dd..40e7feb 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -15,7 +15,7 @@ $(LIBOSMOGB_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(LIBCARES_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBGTP_CFLAGS) \ $(NULL) if BUILD_IU @@ -63,7 +63,7 @@ osmo_gbproxy_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ $(OSMO_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) @@ -98,7 +98,7 @@ $(OSMO_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ -lgtp \ -lm \ diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index d95139f..c16124a 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -51,7 +51,8 @@ #include #include -#include +#include +#include static const struct rate_ctr_desc global_ctr_description[] = { { "inv-bvci", "Invalid BVC Identifier " }, @@ -236,7 +237,8 @@ bss_ptmsi = sgsn_ptmsi; } else { do { - if (RAND_bytes((uint8_t *) &bss_ptmsi, sizeof(bss_ptmsi)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &bss_ptmsi, + sizeof(bss_ptmsi)) < 0) { bss_ptmsi = GSM_RESERVED_TMSI; break; } @@ -273,7 +275,8 @@ } else { do { /* create random TLLI, 0b01111xxx... */ - if (RAND_bytes((uint8_t *) &sgsn_tlli, sizeof(sgsn_tlli)) != 1) { + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &sgsn_tlli, + sizeof(sgsn_tlli)) < 0) { sgsn_tlli = 0; break; } diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 363b457..1a1338a 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -31,7 +31,8 @@ #include #include -#include +#include +#include #include "bscconfig.h" @@ -551,9 +552,9 @@ /* ? 10.5.5.7: */ acreq->force_stby = force_standby; /* 3GPP TS 24.008 ? 10.5.5.19: */ - if (RAND_bytes(&rbyte, 1) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed for A&C ref, falling " - "back to rand()\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, &rbyte, 1) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed for A&C ref, falling" + " back to rand()\n"); acreq->ac_ref_nr = rand(); } else acreq->ac_ref_nr = rbyte; @@ -1195,8 +1196,8 @@ }; /* XXX: Hack to make 3G auth work with special SIM card */ ctx->auth_state = SGSN_AUTH_AUTHENTICATE; - - RAND_bytes(tmp_rand, 16); + /* FIXME: check return value and propagate error */ + gnutls_rnd(GNUTLS_RND_NONCE, tmp_rand, 16); memset(&ctx->auth_triplet.vec, 0, sizeof(ctx->auth_triplet.vec)); osmo_auth_gen_vec(&ctx->auth_triplet.vec, &auth, tmp_rand); diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index 2be663f..416b2a3 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include @@ -1070,8 +1071,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } @@ -1103,8 +1104,8 @@ uint8_t *xid; LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n"); - if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) { - LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, " + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &llme->iov_ui, 4) < 0) { + LOGP(DLLC, LOGL_NOTICE, "gnutls_rnd() failed for LLC XID reset, " "falling back to rand()\n"); llme->iov_ui = rand(); } diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index e85e1a9..a8f5e39 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -45,7 +45,8 @@ #include -#include +#include +#include #define GPRS_LLME_CHECK_TICK 30 @@ -614,7 +615,7 @@ int max_retries = 100; restart: - if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &ptmsi, sizeof(ptmsi)) < 0) goto failed; /* Enforce that the 2 MSB are set without loosing the distance between diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am index e5f9e27..0070679 100644 --- a/openbsc/src/libiu/Makefile.am +++ b/openbsc/src/libiu/Makefile.am @@ -7,7 +7,7 @@ AM_CFLAGS = \ -Wall \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBASN1C_CFLAGS) \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am index 9d966db..20a0876 100644 --- a/openbsc/src/libmsc/Makefile.am +++ b/openbsc/src/libmsc/Makefile.am @@ -10,7 +10,7 @@ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(COVERAGE_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(LIBSMPP34_CFLAGS) \ $(NULL) diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index bf62d3c..cd44dc5 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -28,7 +28,8 @@ #include #include -#include +#include +#include #include @@ -122,8 +123,10 @@ } atuple->use_count = 1; - if (RAND_bytes(atuple->vec.rand, sizeof(atuple->vec.rand)) != 1) { - LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, atuple->vec.rand, + sizeof(atuple->vec.rand)) < 0) { + LOGP(DMM, LOGL_NOTICE, "gnutls_rnd() failed, can't generate new" + " auth tuple\n"); return AUTH_ERROR; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 5cccb32..ccd4762 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -40,7 +40,8 @@ #include #include -#include +#include +#include /* Semi-Private-Interface (SPI) for the subscriber code */ void subscr_direct_free(struct gsm_subscriber *subscr); @@ -1223,8 +1224,9 @@ char *tmsi_quoted; for (;;) { - if (RAND_bytes((uint8_t *) &subscriber->tmsi, sizeof(subscriber->tmsi)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &subscriber->tmsi, + sizeof(subscriber->tmsi)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (subscriber->tmsi == GSM_RESERVED_TMSI) @@ -1303,8 +1305,9 @@ uint32_t try; for (;;) { - if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) { - LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n"); + if (gnutls_rnd(GNUTLS_RND_NONCE, (uint8_t *) &try, + sizeof(try)) < 0) { + LOGP(DDB, LOGL_ERROR, "gnutls_rnd() failed\n"); return 1; } if (!try) /* 0 is an invalid token */ diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am index be33d28..af99d11 100644 --- a/openbsc/src/osmo-bsc_nat/Makefile.am +++ b/openbsc/src/osmo-bsc_nat/Makefile.am @@ -13,7 +13,7 @@ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMONETIF_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) @@ -53,6 +53,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBOSMONETIF_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index a4dd679..2492bd8 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -74,7 +74,8 @@ #include -#include +#include +#include #include "../../bscconfig.h" @@ -223,7 +224,7 @@ buf = v_put(buf, 0x23); mrand = bsc->last_rand; - if (RAND_bytes(mrand, 16) != 1) + if (gnutls_rnd(GNUTLS_RND_NONCE, mrand, 16) < 0) goto failed_random; memcpy(buf, mrand, 16); diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am index f4ef487..6474b27 100644 --- a/openbsc/src/osmo-nitb/Makefile.am +++ b/openbsc/src/osmo-nitb/Makefile.am @@ -40,6 +40,6 @@ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBSMPP34_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 5e9583f..0663b64 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -30,6 +30,6 @@ $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am index 0eed5cd..332bf09 100644 --- a/openbsc/tests/db/Makefile.am +++ b/openbsc/tests/db/Makefile.am @@ -43,6 +43,6 @@ $(LIBOSMOGSM_LIBS) \ $(LIBSMPP34_LIBS) \ $(LIBOSMOVTY_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -ldbi \ $(NULL) diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am index 2dd66df..8fdefb5 100644 --- a/openbsc/tests/gbproxy/Makefile.am +++ b/openbsc/tests/gbproxy/Makefile.am @@ -28,7 +28,7 @@ $(NULL) gbproxy_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ $(NULL) gbproxy_test_LDADD = \ @@ -49,6 +49,6 @@ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOABIS_LIBS) \ $(LIBRARY_DL) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lrt \ $(NULL) diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 577daa9..97a0ba9 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -37,7 +37,8 @@ #include #include -#include +#include +#include #define REMOTE_BSS_ADDR 0x01020304 #define REMOTE_SGSN_ADDR 0x05060708 @@ -53,30 +54,30 @@ struct llist_head *received_messages = NULL; -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, data, len); } static int rand_seq_num = 0; -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) { uint32_t val; - OSMO_ASSERT(num == sizeof(val)); - OSMO_ASSERT(__real_RAND_bytes(buf, num) == 1); + OSMO_ASSERT(len == sizeof(val)); + OSMO_ASSERT(__real_gnutls_rnd(level, data, len) == 0); val = 0x00dead00 + rand_seq_num; rand_seq_num++; - memcpy(buf, &val, num); + memcpy(data, &val, len); return 1; } diff --git a/openbsc/tests/mm_auth/Makefile.am b/openbsc/tests/mm_auth/Makefile.am index cb35198..ea6f516 100644 --- a/openbsc/tests/mm_auth/Makefile.am +++ b/openbsc/tests/mm_auth/Makefile.am @@ -8,7 +8,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ - $(LIBCRYPTO_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) \ $(NULL) noinst_PROGRAMS = \ diff --git a/openbsc/tests/mm_auth/mm_auth_test.c b/openbsc/tests/mm_auth/mm_auth_test.c index b8777a8..0e3817b 100644 --- a/openbsc/tests/mm_auth/mm_auth_test.c +++ b/openbsc/tests/mm_auth/mm_auth_test.c @@ -8,6 +8,9 @@ #include #include +#include +#include + #define min(A,B) ((A)>(B)? (B) : (A)) static char *auth_tuple_str(struct gsm_auth_tuple *atuple) @@ -120,8 +123,8 @@ return auth_action; } -/* override libssl RAND_bytes() to get testable crypto results */ -int RAND_bytes(uint8_t *rand, int len) +/* override GnuTLS' gnutls_rnd() to get testable crypto results */ +int gnutls_rnd(gnutls_rnd_level_t level, void *rand, size_t len) { memset(rand, 23, len); return 1; diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index f1606cb..0925995 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -32,7 +32,7 @@ $(NULL) sgsn_test_LDFLAGS = \ - -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=gnutls_rnd \ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ @@ -66,7 +66,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index b4bcaf6..843a924 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -37,6 +37,9 @@ #include #include +#include +#include + #include void *tall_bsc_ctx; @@ -99,21 +102,22 @@ return 0; } -/* override, requires '-Wl,--wrap=RAND_bytes' */ -int __real_RAND_bytes(unsigned char *buf, int num); -int mock_RAND_bytes(unsigned char *buf, int num); -int (*RAND_bytes_cb)(unsigned char *, int) = - &mock_RAND_bytes; +/* override, requires '-Wl,--wrap=gnutls_rnd' */ +int __real_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); +int (*gnutls_rnd_cb)(gnutls_rnd_level_t, void *, size_t) = + &mock_gnutls_rnd; -int __wrap_RAND_bytes(unsigned char *buf, int num) +int __wrap_gnutls_rnd(gnutls_rnd_level_t level, void *buf, size_t num) { - return (*RAND_bytes_cb)(buf, num); + return (*gnutls_rnd_cb)(level, buf, num); } /* make results of A&C ref predictable */ -int mock_RAND_bytes(unsigned char *buf, int num) +int mock_gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t num) { + uint8_t *buf = (uint8_t *)data; if (num > 1) - return __real_RAND_bytes(buf, num); + return __real_gnutls_rnd(level, data, num); buf[0] = 0; return 1; } diff --git a/openbsc/tests/sndcp_xid/Makefile.am b/openbsc/tests/sndcp_xid/Makefile.am index 99b9d1a..e9e5d6f 100644 --- a/openbsc/tests/sndcp_xid/Makefile.am +++ b/openbsc/tests/sndcp_xid/Makefile.am @@ -14,7 +14,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ -lgtp -lrt -lm diff --git a/openbsc/tests/xid/Makefile.am b/openbsc/tests/xid/Makefile.am index aaf17ed..512dade 100644 --- a/openbsc/tests/xid/Makefile.am +++ b/openbsc/tests/xid/Makefile.am @@ -31,7 +31,7 @@ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOGB_LIBS) \ $(LIBCARES_LIBS) \ - $(LIBCRYPTO_LIBS) \ + $(LIBGNUTLS_LIBS) \ $(LIBGTP_LIBS) \ -lrt \ -lm \ -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 5 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 Dec 27 12:01:48 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 27 Dec 2016 12:01:48 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 5: Note: this should not be merged until OS#1894 is implemented. -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb 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: No From gerrit-no-reply at lists.osmocom.org Tue Dec 27 14:58:48 2016 From: gerrit-no-reply at lists.osmocom.org (tnt) Date: Tue, 27 Dec 2016 14:58:48 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 5: Wouldn't having osmo_rand make sense ? (just make it a wrapper around your preferred crypto library but avoid having this reference to an external lib spread around). -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max 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 Tue Dec 27 16:19:06 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Tue, 27 Dec 2016 16:19:06 +0000 Subject: openbsc[master]: Migrate from OpenSSL to GnuTLS In-Reply-To: References: Message-ID: Patch Set 5: Sure, why not. Shall it be in libosmocore or some other lib? -- To view, visit https://gerrit.osmocom.org/1464 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max 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 Wed Dec 28 00:20:21 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 28 Dec 2016 00:20:21 +0000 Subject: [PATCH] osmo-bts[master]: fix: dyn ts: uplink measurement report Message-ID: Review at https://gerrit.osmocom.org/1507 fix: dyn ts: uplink measurement report Fix pchan value used for uplink measurement decisions for dynamic channels in TCH mode. Fixes this error log message flooding the osmo-bts log when a dyn ts is serving a voice call: <0004> ../../../src/common/measurement.c:104 (bts=0,trx=0,ts=3,ss=0) no space for uplink measurement Change-Id: Id19316701fd8de6f295eeae0272eea0c315ab1b7 --- M src/common/measurement.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/07/1507/1 diff --git a/src/common/measurement.c b/src/common/measurement.c index be1d4f6..6a11888 100644 --- a/src/common/measurement.c +++ b/src/common/measurement.c @@ -144,7 +144,7 @@ int i; /* if measurement period is not complete, abort */ - if (!is_meas_complete(lchan->ts->pchan, lchan->ts->nr, + if (!is_meas_complete(ts_pchan(lchan->ts), lchan->ts->nr, lchan->nr, fn)) return 0; -- To view, visit https://gerrit.osmocom.org/1507 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id19316701fd8de6f295eeae0272eea0c315ab1b7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 28 10:16:43 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 28 Dec 2016 10:16:43 +0000 Subject: osmo-bts[master]: fix: dyn ts: uplink measurement report In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1507 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id19316701fd8de6f295eeae0272eea0c315ab1b7 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts 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 Dec 28 17:29:43 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Wed, 28 Dec 2016 17:29:43 +0000 Subject: [PATCH] osmo-bts[master]: DTX AMR HR: fix inhibition Message-ID: Review at https://gerrit.osmocom.org/1508 DTX AMR HR: fix inhibition Unlike in AMR FR, in AMR HR incoming ONSET have to be treated differently depending on whether we've recently sent SID UPDATE or EMPTY frame. Split ST_SID_U FSM state into 2 states to accommodate for that and make sure that additional states specific to AMR HR are not used for AMR FR. Also, avoid sending E_VOICE and E_SID_U in corresponding states as those do not initiate FSM state transitions anyway. This decrease extra load from FSM signalling which otherwise would be triggered on per-frame basis. Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Related: OS#1801 --- M include/osmo-bts/dtx_dl_amr_fsm.h M src/common/bts.c M src/common/dtx_dl_amr_fsm.c M src/common/msg_utils.c M src/osmo-bts-litecell15/tch.c M src/osmo-bts-sysmo/tch.c 6 files changed, 118 insertions(+), 35 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/08/1508/1 diff --git a/include/osmo-bts/dtx_dl_amr_fsm.h b/include/osmo-bts/dtx_dl_amr_fsm.h index 4fb2f25..9ea3fc2 100644 --- a/include/osmo-bts/dtx_dl_amr_fsm.h +++ b/include/osmo-bts/dtx_dl_amr_fsm.h @@ -14,6 +14,7 @@ ST_SID_F2, ST_F1_INH, ST_U_INH, + ST_U_NOINH, ST_F1_INH_REC, ST_U_INH_REC, ST_SID_U, diff --git a/src/common/bts.c b/src/common/bts.c index 9c2f0e0..d249137 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -45,6 +45,7 @@ #include #include #include +#include #define MIN_QUAL_RACH 5.0f /* at least 5 dB C/I */ #define MIN_QUAL_NORM -0.5f /* at least -1 dB C/I */ diff --git a/src/common/dtx_dl_amr_fsm.c b/src/common/dtx_dl_amr_fsm.c index d903b0c..1bf1f74 100644 --- a/src/common/dtx_dl_amr_fsm.c +++ b/src/common/dtx_dl_amr_fsm.c @@ -47,7 +47,7 @@ Was observed during testing, let's just ignore it for now */ break; case E_SID_U: - osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); + osmo_fsm_inst_state_chg(fi, ST_U_NOINH, 0, 0); break; case E_VOICE: osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); @@ -74,7 +74,7 @@ void dtx_fsm_sid_f2(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_SID_U: + case E_COMPL: osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); break; case E_VOICE: @@ -145,6 +145,33 @@ } } +void dtx_fsm_u_noinh(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case E_FACCH: + osmo_fsm_inst_state_chg(fi, ST_ONSET_F, 0, 0); + break; + case E_VOICE: + osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); + break; + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); + break; + case E_SID_U: + case E_SID_F: +/* FIXME: what shall we do if we get SID-FIRST _after_ sending SID-UPDATE? + Was observed during testing, let's just ignore it for now */ + break; + case E_ONSET: + osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); + break; + default: + LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); + OSMO_ASSERT(0); + break; + } +} + void dtx_fsm_sid_upd(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -159,11 +186,7 @@ break; case E_SID_U: case E_SID_F: -/* FIXME: what shall we do if we get SID-FIRST _after_ sending SID-UPDATE? - Was observed during testing, let's just ignore it for now */ - break; - case E_ONSET: - osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); + osmo_fsm_inst_state_chg(fi, ST_U_NOINH, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -256,14 +279,14 @@ start of silence period (might be interrupted in case of AMR HR) */ [ST_SID_F1]= { .in_event_mask = X(E_SID_F) | X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_COMPL) | X(E_INHIB) | X(E_ONSET), - .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_SID_F2) | X(ST_F1_INH) | X(ST_ONSET_V), + .out_state_mask = X(ST_U_NOINH) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_SID_F2) | X(ST_F1_INH) | X(ST_ONSET_V), .name = "SID-FIRST (P1)", .action = dtx_fsm_sid_f1, }, /* SID-FIRST P2 (only for AMR HR): actual start of silence period in case of AMR HR */ [ST_SID_F2]= { - .in_event_mask = X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), + .in_event_mask = X(E_COMPL) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_ONSET_V), .name = "SID-FIRST (P2)", .action = dtx_fsm_sid_f2, @@ -281,6 +304,13 @@ .out_state_mask = X(ST_U_INH_REC), .name = "SID-UPDATE (Inh)", .action = dtx_fsm_u_inh, + }, + /* SID-UPDATE: Inhibited not allowed (only for AMR HR) */ + [ST_U_NOINH]= { + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_COMPL) | X(E_SID_U) | X(E_SID_F) | X(E_ONSET), + .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_SID_U) | X(ST_ONSET_V), + .name = "SID-UPDATE (NoInh)", + .action = dtx_fsm_u_noinh, }, /* SID-FIRST Inhibition recursion in progress: Inhibit itself was already sent, now have to send the voice that caused it */ @@ -300,9 +330,9 @@ }, /* Silence period with periodic comfort noise data updates */ [ST_SID_U]= { - .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_INHIB) | X(E_SID_U) | X(E_SID_F) | X(E_ONSET), - .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_U_INH) | X(ST_SID_U) | X(ST_ONSET_V), - .name = "SID-UPDATE", + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_INHIB) | X(E_SID_U) | X(E_SID_F), + .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_U_INH) | X(ST_U_NOINH), + .name = "SID-UPDATE (AMR/HR)", .action = dtx_fsm_sid_upd, }, /* ONSET - end of silent period due to incoming SPEECH frame */ diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index 9de9b6d..e7a09f9 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -93,6 +93,28 @@ return type; } +/* check that DTX is in the middle of silence */ +static inline bool dtx_is_update(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U || + lchan->tch.dtx.dl_amr_fsm->state == ST_U_NOINH) + return true; + return false; +} + +/* check that DTX is in the beginning of silence for AMR HR */ +static inline bool dtx_is_first_p1(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + if ((lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1)) + return true; + return false; +} + /* update lchan SID status */ void lchan_set_marker(bool t, struct gsm_lchan *lchan) { @@ -123,9 +145,7 @@ if (update == 0) { lchan->tch.dtx.is_update = false; /* Mark SID FIRST explicitly */ /* for non-AMR case - always update FN for incoming SID FIRST */ - if (!amr || - (dtx_dl_amr_enabled(lchan) && - lchan->tch.dtx.dl_amr_fsm->state != ST_SID_U)) + if (!amr || !dtx_is_update(lchan)) lchan->tch.dtx.fn = fn; /* for AMR case - do not update FN if SID FIRST arrives in a middle of silence: this should not be happening according to @@ -157,12 +177,24 @@ int rc; if (dtx_dl_amr_enabled(lchan)) { - if (lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { - *len = 3; /* SID-FIRST P1 -> P2 completion */ - memcpy(l1_payload, lchan->tch.dtx.cache, 2); - dtx_dispatch(lchan, E_SID_U); - return 0; + if (lchan->type == GSM_LCHAN_TCH_H && !rtp_pl) { + /* we're called by gen_empty_tch_msg() to handle states + specific to AMR HR DTX */ + switch (lchan->tch.dtx.dl_amr_fsm->state) { + case ST_SID_F2: + *len = 3; /* SID-FIRST P1 -> P2 completion */ + memcpy(l1_payload, lchan->tch.dtx.cache, 2); + rc = 0; + dtx_dispatch(lchan, E_COMPL); + break; + case ST_SID_U: + rc = -EBADMSG; + dtx_dispatch(lchan, E_SID_U); + break; + default: + rc = -EBADMSG; + } + return rc; } } @@ -171,8 +203,8 @@ rc = osmo_amr_rtp_dec(rtp_pl, rtp_pl_len, &cmr, &cmi, &ft, &bfi, &sti); if (rc < 0) { - LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu)\n", - rtp_pl_len); + LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu, " + "%p)\n", rtp_pl_len, rtp_pl); return rc; } @@ -197,19 +229,29 @@ return 0; if (osmo_amr_is_speech(ft)) { - /* AMR HR - Inhibition */ - if (lchan->type == GSM_LCHAN_TCH_H && marker && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) + /* AMR HR - SID-FIRST_P1 Inhibition */ + if (marker && dtx_is_first_p1(lchan)) return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_INHIB, (void *)lchan); + + /* AMR HR - SID-UPDATE Inhibition */ + if (marker && lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_INHIB, (void *)lchan); + /* AMR FR & HR - generic */ if (marker && (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 || lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 || - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U )) + lchan->tch.dtx.dl_amr_fsm->state == ST_U_NOINH)) return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_ONSET, (void *)lchan); - return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_VOICE, - (void *)lchan); + + if (lchan->tch.dtx.dl_amr_fsm->state != ST_VOICE) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_VOICE, (void *)lchan); + + return 0; } if (ft == AMR_SID) { @@ -222,6 +264,9 @@ E_SID_F, (void *)lchan); } else dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, sti); + if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_COMPL, (void *)lchan); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, sti ? E_SID_U : E_SID_F, (void *)lchan); @@ -357,6 +402,7 @@ return false; if (lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH || + lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH_REC || lchan->tch.dtx.dl_amr_fsm->state == ST_F1_INH || lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F || lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_V || @@ -389,9 +435,7 @@ if (!dtx_dl_amr_enabled(lchan)) return; - if ((lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) || - dtx_recursion(lchan)) + if (dtx_is_first_p1(lchan) || dtx_recursion(lchan)) dtx_dispatch(lchan, E_COMPL); } @@ -425,12 +469,17 @@ osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_U, (void *)lchan); dtx_sti_unset(lchan); - } else if (lchan->tch.dtx.dl_amr_fsm->state == - ST_SID_U) { + } else if (dtx_is_update(lchan)) { /* enforce SID UPDATE for next repetition: it might have been altered by FACCH handling */ dtx_sti_set(lchan); - lchan->tch.dtx.is_update = true; + if (lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == + ST_U_NOINH) + osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_COMPL, + (void *)lchan); + lchan->tch.dtx.is_update = true; } } memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len); diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c index de3c7e3..a47a88f 100644 --- a/src/osmo-bts-litecell15/tch.c +++ b/src/osmo-bts-litecell15/tch.c @@ -322,6 +322,7 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, 0); return 1; case ST_SID_U: + case ST_U_NOINH: return -EAGAIN; case ST_FACCH: return -EBADMSG; diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 16c2cf3..bc495d9 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -420,6 +420,7 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, 0); return 1; case ST_SID_U: + case ST_U_NOINH: return -EAGAIN; case ST_FACCH: return -EBADMSG; -- To view, visit https://gerrit.osmocom.org/1508 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Wed Dec 28 17:57:10 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 28 Dec 2016 17:57:10 +0000 Subject: [PATCH] openbsc[master]: fix 'osmo-nitb --version' segfault Message-ID: Review at https://gerrit.osmocom.org/1509 fix 'osmo-nitb --version' segfault Call vty_init() before handle_options() to make sure the host.app_info is populated before --version potentially tries to print it. Change-Id: Ice91256d72b9eabd52709352ba6cc6a42af2921b --- M openbsc/src/osmo-nitb/bsc_hack.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/09/1509/1 diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 992d4c8..bbcdd1b 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -269,6 +269,7 @@ osmo_init_logging(&log_info); osmo_stats_init(tall_bsc_ctx); bts_init(); + vty_init(&vty_info); /* Parse options */ handle_options(argc, argv); @@ -282,7 +283,6 @@ } /* Initialize VTY */ - vty_init(&vty_info); bsc_vty_init(&log_info, bsc_gsmnet); ctrl_vty_init(tall_bsc_ctx); -- To view, visit https://gerrit.osmocom.org/1509 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice91256d72b9eabd52709352ba6cc6a42af2921b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Wed Dec 28 19:26:03 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Wed, 28 Dec 2016 19:26:03 +0000 Subject: [PATCH] osmo-pcu[master]: fix segfault: check for NULL tbf in sched_select_ctrl_msg() Message-ID: Review at https://gerrit.osmocom.org/1510 fix segfault: check for NULL tbf in sched_select_ctrl_msg() Apparently fixes a corrupted stack looking like this on sysmobts: (gdb) run Starting program: /usr/bin/osmo-pcu -c /etc/osmocom/osmo-pcu.cfg [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". <000b> telnet_interface.c:95 telnet at 127.0.0.1 4240 <0001> osmobts_sock.cpp:227 Opening OsmoPCU L1 interface to OsmoBTS <0001> osmobts_sock.cpp:285 osmo-bts PCU socket has been connected <0001> pcu_l1_if.cpp:368 BTS available <0008> gprs_ns.c:233 NSVCI=65534 Creating NS-VC <0008> gprs_ns.c:233 NSVCI=100 Creating NS-VC <0008> gprs_ns.c:1568 NSEI=100 RESET procedure based on API request <0008> gprs_ns.c:393 NSEI=100 Tx NS RESET (NSVCI=100, cause=O&M intervention) <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=2 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=2 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=3 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=3 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=4 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=4 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=5 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=5 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=6 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=6 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=7 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=7 <0001> pcu_l1_if.cpp:319 RACH request received: sapi=1 qta=0, ra=120, fn=103198 <0009> tbf_ul.cpp:373 LLC [PCU -> SGSN] TBF(TFI=0 TLLI=0x7f2dd569 DIR=UL STATE=FLOW) len=6 <0008> gprs_ns.c:684 All NS-VCs for NSEI 100 are either dead or blocked! Program received signal SIGSEGV, Segmentation fault. gprs_rlcmac_rcv_rts_block (bts=0x60a08, trx=trx at entry=0 '\000', ts=ts at entry=4 '\004', fn=7, fn at entry=103272, block_nr=block_nr at entry=0 '\000') at gprs_rlcmac_sched.cpp:349 349 gprs_rlcmac_sched.cpp: No such file or directory. (gdb) bt #0 gprs_rlcmac_rcv_rts_block (bts=0x60a08, trx=trx at entry=0 '\000', ts=ts at entry=4 '\004', fn=7, fn at entry=103272, block_nr=block_nr at entry=0 '\000') at gprs_rlcmac_sched.cpp:349 #1 0x0001151c in pcu_rx_rts_req_pdtch (trx=, ts=, fn=103272, block_nr=) at pcu_l1_if.cpp:279 #2 0x0000bfcc in handle_ph_readytosend_ind (fl1h=0xafa40, rts_ind=0xb03f8) at osmo-bts-sysmo/sysmo_l1_if.c:142 #3 l1if_handle_l1prim (wq=, fl1h=0xafa40, msg=0xb0330) at osmo-bts-sysmo/sysmo_l1_if.c:259 #4 0x4fcd6330 in osmo_fd_disp_fds (_eset=0xbefffb68, _wset=0xbefffae8, _rset=0xbefffa68) at select.c:149 #5 osmo_select_main (polling=) at select.c:189 #6 0x0000b2a0 in main (argc=, argv=0x66628 <_ZStL8__ioinit>) at pcu_main.cpp:295 Change-Id: I357492e558e98cfdbf5bb3438b5013029195b02b Related: https://lists.osmocom.org/pipermail/osmocom-net-gprs/2016-December/000785.html --- M src/gprs_rlcmac_sched.cpp 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/10/1510/1 diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index fdda79d..8b27cac 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -173,6 +173,9 @@ } } + if (!tbf) + return NULL; + /* any message */ if (msg) { tbf->rotate_in_list(); -- To view, visit https://gerrit.osmocom.org/1510 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I357492e558e98cfdbf5bb3438b5013029195b02b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr From gerrit-no-reply at lists.osmocom.org Thu Dec 29 09:12:05 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 29 Dec 2016 09:12:05 +0000 Subject: openbsc[master]: fix 'osmo-nitb --version' segfault In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1509 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ice91256d72b9eabd52709352ba6cc6a42af2921b 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 Dec 29 09:13:21 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Thu, 29 Dec 2016 09:13:21 +0000 Subject: osmo-pcu[master]: fix segfault: check for NULL tbf in sched_select_ctrl_msg() In-Reply-To: References: Message-ID: Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/1510 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I357492e558e98cfdbf5bb3438b5013029195b02b Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu 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 Dec 29 10:57:39 2016 From: gerrit-no-reply at lists.osmocom.org (sivasankari) Date: Thu, 29 Dec 2016 10:57:39 +0000 Subject: [PATCH] osmo-pcu[master]: Array indexing for SPB counters in bts statistics. Message-ID: Review at https://gerrit.osmocom.org/1511 Array indexing for SPB counters in bts statistics. Array indexing mismatch is corrected for SPB counters. (bts_ctr_description with the bts counter declaration). Change-Id: I9b17ca0f838a37d9405cebf2319e722a302f5ed9 --- M src/bts.h 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/1511/1 diff --git a/src/bts.h b/src/bts.h index 636c7ec..2932154 100644 --- a/src/bts.h +++ b/src/bts.h @@ -266,11 +266,11 @@ CTR_LLC_DL_BYTES, CTR_LLC_UL_BYTES, CTR_RACH_REQUESTS, + CTR_11BIT_RACH_REQUESTS, CTR_SPB_UL_FIRST_SEGMENT, CTR_SPB_UL_SECOND_SEGMENT, CTR_SPB_DL_FIRST_SEGMENT, CTR_SPB_DL_SECOND_SEGMENT, - CTR_11BIT_RACH_REQUESTS, CTR_IMMEDIATE_ASSIGN_UL_TBF, CTR_IMMEDIATE_ASSIGN_REJ, CTR_IMMEDIATE_ASSIGN_DL_TBF, @@ -401,11 +401,11 @@ void llc_dl_bytes(int bytes); void llc_ul_bytes(int bytes); void rach_frame(); + void rach_frame_11bit(); void spb_uplink_first_segment(); void spb_uplink_second_segment(); void spb_downlink_first_segment(); void spb_downlink_second_segment(); - void rach_frame_11bit(); void immediate_assignment_ul_tbf(); void immediate_assignment_reject(); void immediate_assignment_dl_tbf(); @@ -602,11 +602,11 @@ CREATE_COUNT_ADD_INLINE(llc_dl_bytes, CTR_LLC_DL_BYTES); CREATE_COUNT_ADD_INLINE(llc_ul_bytes, CTR_LLC_UL_BYTES); CREATE_COUNT_INLINE(rach_frame, CTR_RACH_REQUESTS); +CREATE_COUNT_INLINE(rach_frame_11bit, CTR_11BIT_RACH_REQUESTS); CREATE_COUNT_INLINE(spb_uplink_first_segment, CTR_SPB_UL_FIRST_SEGMENT); CREATE_COUNT_INLINE(spb_uplink_second_segment, CTR_SPB_UL_SECOND_SEGMENT); CREATE_COUNT_INLINE(spb_downlink_first_segment, CTR_SPB_DL_FIRST_SEGMENT); CREATE_COUNT_INLINE(spb_downlink_second_segment, CTR_SPB_DL_SECOND_SEGMENT); -CREATE_COUNT_INLINE(rach_frame_11bit, CTR_11BIT_RACH_REQUESTS); CREATE_COUNT_INLINE(immediate_assignment_ul_tbf, CTR_IMMEDIATE_ASSIGN_UL_TBF); CREATE_COUNT_INLINE(immediate_assignment_reject, CTR_IMMEDIATE_ASSIGN_REJ); CREATE_COUNT_INLINE(immediate_assignment_dl_tbf, CTR_IMMEDIATE_ASSIGN_DL_TBF); -- To view, visit https://gerrit.osmocom.org/1511 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9b17ca0f838a37d9405cebf2319e722a302f5ed9 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: sivasankari From gerrit-no-reply at lists.osmocom.org Fri Dec 30 07:22:13 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 30 Dec 2016 07:22:13 +0000 Subject: [PATCH] osmo-pcu[master]: PDCH allocation across two TRX Message-ID: Review at https://gerrit.osmocom.org/1512 PDCH allocation across two TRX Implementation: PCU keeps track of number PDCH across all the TRXs at BTS context and also keeps number of active PDCHs in each TRX context. This ratio gives the CAPACITY of each TRX. 1st Phase: While selection of TRX, functions get_possible_trxs(for multiple TS) and get_possible_trxs_sba(Single block allocation, Ex: during RACH) gets possible TRXs based on TFIs availability. 2nd Phase: outcome of TRXs(from get_possible_trxs, get_possible_trxs_sba) will be fed to get_suitable_trx function. Which does actual load balancing on each TRX. And selects the best fit TRX, based on below equation PROBABILITY = MAX_PROBABILITY ? ((LOAD * 100)/CAPACITY); If same PROBABILITY Select the one with higher capacity Else Find the TRX with higher PROBABILITY MAX_PROBABILITY = 65535; LOAD: Initialized to 0, Later gets incremented with number of TS allocated. and decremented whle TBF deletion, based on number of TS allocated Below are the test executed on Unit test environment 1) 2 TRXs, with same Capacity 2) 2 TRX with ? capacity 3) 2 TRXs with ? capacity 4) 2 TRX with UL and DL allocation to ensure Tbfs on both direction is hosted on same TRX 5) 2 TRX with same Capacity and DL TBF creation and deletion scenarios to ensure proper load balancing criteria for actual Load. Below are the Test executed on Integration setup with Ettus B200 setup with 2 TRXs with same CAPACITY. 1) TRX allocation during RACH procedure(SBA allocation) 2) TRX allocation during DL TBF creation with multi time slots(4 time slots) 3) TRX allocation while Ping Test 4) TRX allocation while UDP test 5) TRX allocation for web browsing. 6) 2 MS test with each TRX sharing 1 MS. Received aggregate throughput of 446 kbps(223 Kbps each) Limitation: 1) BSSGP flow control needs to be tuned since test with 2 MS with each MS on different TRX runs for 20 mins 2) USF resource availibility is not checked while selecting the TRX as existing implementation Change-Id: I222c3340872ffa1dd6e8fabe5276d793e660f67d Related: OS# 1775 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac_ts_alloc.cpp M src/sba.cpp M src/tbf.cpp M tests/tbf/TbfTest.cpp M tests/tbf/TbfTest.err M tests/tbf/TbfTest.ok 8 files changed, 1,995 insertions(+), 40 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/12/1512/1 diff --git a/src/bts.cpp b/src/bts.cpp index a47d7d8..cd13862 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -188,11 +188,13 @@ { memset(&m_bts, 0, sizeof(m_bts)); m_bts.bts = this; - + m_total_pdch = 0; /* initialize back pointers */ for (size_t trx_no = 0; trx_no < ARRAY_SIZE(m_bts.trx); ++trx_no) { struct gprs_rlcmac_trx *trx = &m_bts.trx[trx_no]; trx->trx_no = trx_no; + trx->num_pdch = 0; + trx->current_load = 0; trx->bts = this; for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ++ts_no) { @@ -417,9 +419,82 @@ uint8_t *_trx, int8_t use_trx) { struct gprs_rlcmac_pdch *pdch; - uint32_t free_tfis; + uint32_t free_tfis = 0xffffffff; + uint8_t ts, tfi; + bool possible_trx[8]; + int ret; + + /* This function will get list of possible TRXs */ + ret = get_possible_trxs(dir, possible_trx, use_trx); + if (ret < 0) + return -EBUSY; + + + if (use_trx >= 0) + *_trx = use_trx; + else + *_trx = get_suitable_trx(possible_trx); + + LOGP(DRLCMAC, LOGL_DEBUG, + "Searching for first unallocated TFI: TRX=%d\n", *_trx); + + for (ts = 0; ts < 8; ts++) { + pdch = &m_bts.trx[*_trx].pdch[ts]; + free_tfis &= ~pdch->assigned_tfi(dir); + } + /* find the first */ + for (tfi = 0; tfi < 32; tfi++) { + if (free_tfis & 1 << tfi) + break; + } + + OSMO_ASSERT(tfi < 32); + + LOGP(DRLCMAC, LOGL_DEBUG, " Found TFI=%d.\n", tfi); + + return tfi; +} + +/* + * Search for free TFI and return TFI, TRX. + * This method returns the first TFI that is currently not used in any PDCH of + * a TRX. The first TRX that contains such an TFI is returned. Negative values + * indicate errors. + */ +int BTS::get_possible_trxs_sba( + bool *_trx) +{ + uint8_t trx; bool has_pdch = false; - uint8_t trx_from, trx_to, trx, ts, tfi; + + for (trx = 0; trx < 8; trx++) { + if (bts_data()->trx[trx].num_pdch) { + _trx[trx] = true; + has_pdch = true; + LOGP(DRLCMAC, LOGL_DEBUG, " Valid TRX=%d.\n", trx); + } else { + _trx[trx] = false; + LOGP(DRLCMAC, LOGL_DEBUG, " Not valid TRX=%d.\n", trx); + } + } + if (has_pdch) + return 0; + + return -EINVAL; +} + +/* + * This method loops through all possible TRX and + * returns subset of possible TRXs based on availability. + */ +int BTS::get_possible_trxs(enum gprs_rlcmac_tbf_direction dir, + bool *_trx, int8_t use_trx) +{ + struct gprs_rlcmac_pdch *pdch; + uint32_t free_tfis; + uint32_t is_tfis_available = false; + bool has_pdch = false; + uint8_t trx_from, trx_to, trx, ts; if (use_trx >= 0 && use_trx < 8) trx_from = trx_to = use_trx; @@ -442,8 +517,12 @@ trx_has_pdch = true; has_pdch = true; } - if (trx_has_pdch && free_tfis) - break; + if (trx_has_pdch && free_tfis) { + _trx[trx] = true; + is_tfis_available = true; + } else { + _trx[trx] = false; + } free_tfis = 0; } @@ -452,26 +531,69 @@ return -EINVAL; } - if (!free_tfis) { + if (!is_tfis_available) { LOGP(DRLCMAC, LOGL_NOTICE, "No TFI available.\n"); return -EBUSY; } + return 0; +} +/* + * This method loops through all subset of TRXs provided by + * get_possible_trxs and does the load balancing algorithm. and + * selects best TRX possible based on load and capacity + */ +int BTS::get_suitable_trx(bool *avail_trx) +{ + uint8_t trx_from, trx_to, trx; + uint32_t select_probability = 0; + uint32_t temp_probability = 0; + int selected_trx = -1; + bool is_better_trx = false; - LOGP(DRLCMAC, LOGL_DEBUG, - "Searching for first unallocated TFI: TRX=%d\n", trx); + trx_from = 0; + trx_to = 7; - /* find the first */ - for (tfi = 0; tfi < 32; tfi++) { - if (free_tfis & 1 << tfi) - break; + for (trx = trx_from; trx <= trx_to; trx++) { + /* Check if this TRX is in possible list */ + if (!avail_trx[trx]) + continue; + + is_better_trx = false; + + temp_probability = MAX_LOAD_PROBABILITY - + (get_num_pdch() * 100 * + m_bts.trx[trx].current_load) + / m_bts.trx[trx].num_pdch; + + LOGP(DRLCMAC, LOGL_DEBUG, "trx(%d) cur load(%d)" + " numpdch(%d) prob1(%u) seleprob(%u)" + " btsnumpdch(%d)\n", trx, + m_bts.trx[trx].current_load, + m_bts.trx[trx].num_pdch, + temp_probability, select_probability, + get_num_pdch()); + + if (temp_probability >= select_probability) { + if (temp_probability > select_probability) + is_better_trx = true; + else if (temp_probability == select_probability) + if (selected_trx >= 0 || selected_trx < 8) + if (m_bts.trx[selected_trx].num_pdch + < m_bts.trx[trx].num_pdch) + is_better_trx = true; + } + if (is_better_trx) { + selected_trx = trx; + select_probability = + temp_probability; + LOGP(DRLCMAC, LOGL_DEBUG, "selected pro(%u)" + "selected_trx(%d)\n", + select_probability, selected_trx); + } } - OSMO_ASSERT(tfi < 32); - - LOGP(DRLCMAC, LOGL_DEBUG, " Found TFI=%d.\n", tfi); - *_trx = trx; - return tfi; + return selected_trx; } int BTS::rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn) @@ -783,13 +905,17 @@ { /* TODO: Check if there are still allocated resources.. */ INIT_LLIST_HEAD(&paging_list); + trx->num_pdch++; m_is_enabled = 1; + bts()->increment_num_pdch(); } void gprs_rlcmac_pdch::disable() { /* TODO.. kick free_resources once we know the TRX/TS we are on */ m_is_enabled = 0; + trx->num_pdch--; + bts()->decrement_num_pdch(); } void gprs_rlcmac_pdch::free_resources() diff --git a/src/bts.h b/src/bts.h index 636c7ec..00ec72b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -44,6 +44,7 @@ #define LLC_CODEL_USE_DEFAULT (-1) #define MAX_GPRS_CS 9 +#define MAX_LOAD_PROBABILITY 0xffffffff struct BTS; struct GprsMs; @@ -136,7 +137,8 @@ /* back pointers */ struct BTS *bts; uint8_t trx_no; - + uint8_t current_load; + uint8_t num_pdch; #ifdef __cplusplus void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); @@ -345,6 +347,9 @@ gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts); int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx); + int get_possible_trxs(enum gprs_rlcmac_tbf_direction dir, + bool *_trx, int8_t use_trx); + int get_suitable_trx(bool *suitable_trx); 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, @@ -451,6 +456,10 @@ void ms_present(int32_t n); int32_t ms_present_get(); + void increment_num_pdch(); + void decrement_num_pdch(); + uint8_t get_num_pdch() const; + int get_possible_trxs_sba(bool *_trx); /* * Below for C interface for the VTY @@ -476,6 +485,8 @@ /* list of downlink TBFs */ LListHead m_dl_tbfs; + /* The summation of all the PDCH across all TRX for this BTS*/ + uint8_t m_total_pdch; private: /* disable copying to avoid slicing */ BTS(const BTS&); @@ -487,6 +498,21 @@ return m_cur_fn; } +inline void BTS::increment_num_pdch() +{ + m_total_pdch++; +} + +inline void BTS::decrement_num_pdch() +{ + m_total_pdch--; +} + +inline uint8_t BTS::get_num_pdch() const +{ + return m_total_pdch; +} + inline SBAController *BTS::sba() { return &m_sba; diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 57197b2..0300134 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -383,8 +383,11 @@ int tfi; uint8_t trx_no; - if (use_trx == -1 && ms->current_trx()) + LOGP(DRLCMAC, LOGL_DEBUG, " Use trx = %d \n",use_trx); + if (use_trx == -1 && ms->current_trx()) { use_trx = ms->current_trx()->trx_no; + LOGP(DRLCMAC, LOGL_DEBUG, " MS alive = %d \n",use_trx); + } tfi = bts->tfi_find_free(dir, &trx_no, use_trx); if (tfi < 0) @@ -392,6 +395,8 @@ if (trx_no_) *trx_no_ = trx_no; + + LOGP(DRLCMAC, LOGL_DEBUG, " TREE trx = %d TFI = %d\n", *trx_no_, tfi); return tfi; } @@ -479,6 +484,7 @@ } tbf_->trx = trx; + trx->current_load++; /* the only one TS is the common TS */ tbf_->first_ts = tbf_->first_common_ts = ts; ms_->set_reserved_slots(trx, 1 << ts, 1 << ts); @@ -1000,6 +1006,7 @@ if (!(dl_slots & (1 << ts))) continue; + trx->current_load++; LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning DL TS " "%d\n", ts); assign_dlink_tbf(&trx->pdch[ts], dl_tbf, tfi); @@ -1012,6 +1019,7 @@ continue; OSMO_ASSERT(usf[ts] >= 0); + trx->current_load++; LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS " "%d\n", ts); diff --git a/src/sba.cpp b/src/sba.cpp index 46c1431..b4d9723 100644 --- a/src/sba.cpp +++ b/src/sba.cpp @@ -46,11 +46,29 @@ int SBAController::alloc( uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta) { - struct gprs_rlcmac_pdch *pdch; struct gprs_rlcmac_sba *sba; - int8_t trx, ts; + int8_t ts; uint32_t fn; + bool trxs[8]; + int selected_trx; + int ret; + + ret = m_bts.get_possible_trxs_sba(trxs); + + if (ret == -EINVAL) + return -EINVAL; + + selected_trx = m_bts.get_suitable_trx(trxs); + + for (ts = 7; ts >= 0; ts--) { + pdch = &m_bts.bts_data()->trx[selected_trx].pdch[ts]; + if (!pdch->is_enabled()) + continue; + break; + } + if (ts < 0) + return -EINVAL; sba = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_sba); if (!sba) @@ -59,25 +77,10 @@ if (!gsm48_ta_is_valid(ta)) return -EINVAL; - for (trx = 0; trx < 8; trx++) { - for (ts = 7; ts >= 0; ts--) { - pdch = &m_bts.bts_data()->trx[trx].pdch[ts]; - if (!pdch->is_enabled()) - continue; - break; - } - if (ts >= 0) - break; - } - if (trx == 8) { - LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH available.\n"); - talloc_free(sba); - return -EINVAL; - } fn = (pdch->last_rts_fn + AGCH_START_OFFSET) % 2715648; - sba->trx_no = trx; + sba->trx_no = selected_trx; sba->ts_no = ts; sba->fn = fn; sba->ta = ta; @@ -85,9 +88,11 @@ llist_add(&sba->list, &m_sbas); m_bts.sba_allocated(); - *_trx = trx; + *_trx = selected_trx; *_ts = ts; *_fn = fn; + LOGP(DRLCMAC, LOGL_DEBUG, " sba fn=%d ts = %d trx = %d\n", fn, ts, selected_trx); + return 0; } diff --git a/src/tbf.cpp b/src/tbf.cpp index 0e4d6cc..0ad6490 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -395,7 +395,7 @@ for (ts = 0; ts < 8; ts++) { if (!tbf->pdch[ts]) continue; - + tbf->trx->current_load--; tbf->pdch[ts]->detach_tbf(tbf); tbf->pdch[ts] = NULL; } diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index bebb6ef..c5d85ba 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -2833,6 +2833,263 @@ ARRAY_SIZE(default_categories), }; +void test_multi_trx_test_same_capacity() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + the_bts.bts_data()->trx[1].pdch[4].enable(); + the_bts.bts_data()->trx[1].pdch[5].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); + +} + +void test_multi_trx_test_1_2_capacity() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->trx[1].pdch[4].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + + printf("=== end %s ===\n", __func__); + +} + +void test_multi_trx_test_1_4_capacity() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->trx[0].pdch[6].enable(); + the_bts.bts_data()->trx[0].pdch[7].enable(); + the_bts.bts_data()->trx[1].pdch[0].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); +} + +void test_multi_trx_test_release_alloc() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->trx[1].pdch[0].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + tbf_free(dl_tbf); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + tbf_free(dl_tbf); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + tbf_free(dl_tbf); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); +} + +void test_multi_trx_test_same_capacity_dl_ul_combined() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + static gprs_rlcmac_ul_tbf *ul_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + the_bts.bts_data()->trx[1].pdch[4].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + ul_tbf = tbf_alloc_ul(the_bts.bts_data(), + dl_tbf->trx->trx_no, + dl_tbf->ms_class(), dl_tbf->ms()->egprs_ms_class(), + dl_tbf->tlli(), dl_tbf->ta(), dl_tbf->ms()); + OSMO_ASSERT(ul_tbf->trx->trx_no == 0); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + ul_tbf = tbf_alloc_ul(the_bts.bts_data(), + dl_tbf->trx->trx_no, + dl_tbf->ms_class(), dl_tbf->ms()->egprs_ms_class(), + dl_tbf->tlli(), dl_tbf->ta(), dl_tbf->ms()); + OSMO_ASSERT(ul_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); + +} + +void test_multi_trx_test() +{ + printf("=== start %s ===\n", __func__); + test_multi_trx_test_same_capacity(); + test_multi_trx_test_1_2_capacity(); + test_multi_trx_test_1_4_capacity(); + test_multi_trx_test_release_alloc(); + test_multi_trx_test_same_capacity_dl_ul_combined(); + printf("=== end %s ===\n", __func__); + +} void test_packet_access_rej_epdan() { BTS the_bts; @@ -2900,6 +3157,7 @@ test_tbf_epdan_out_of_rx_window(); test_immediate_assign_rej(); test_packet_access_rej_epdan(); + test_multi_trx_test(); if (getenv("TALLOC_REPORT_FULL")) talloc_report_full(tall_pcu_ctx, stderr); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 2647551..2166776 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -35,6 +35,8 @@ The MS object cannot fully confirm an unexpected TLLI: 0x00004232, partly confirmed Modifying MS object, TLLI: 0x00002342 -> 0x00004232, already confirmed partly Modifying MS object, TLLI = 0x00004232, TA 4 -> 6 +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -123,6 +125,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=1 TLLI=0xffeeddcc DIR=DL STATE=RELEASING) ********** TBF ends here ********** Destroying MS object, TLLI = 0xffeeddcc +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -211,6 +215,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING) ********** TBF ends here ********** Destroying MS object, TLLI = 0xffeeddcc +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -514,6 +520,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -535,6 +543,8 @@ Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 Modifying MS object, TLLI = 0x00000000, TA 220 -> 0 TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to FLOW +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=1. ********** TBF starts here ********** @@ -1508,6 +1518,8 @@ Polling cannot be scheduled in this TS 7 (first control TS 4) msg block (BSN 2, CS-1): 07 01 04 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 MSG = 07 01 04 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. MS requests UL TBF on RACH, so we provide one @@ -1588,10 +1600,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -1674,10 +1699,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -1809,10 +1847,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654232 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(2) numpdch(1) prob1(4294967095) seleprob(0) btsnumpdch(1) +selected pro(4294967095)selected_trx(0) + sba fn=2654335 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654232 (17,39,22), SBFn=2654335 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8c f6 07 00 c0 0c 68 ab 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(2) numpdch(1) prob1(4294967095) seleprob(0) btsnumpdch(1) +selected pro(4294967095)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=1. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED) poll timeout for FN=2654292, TS=7 (curr FN 2654335) @@ -1886,10 +1937,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -1980,10 +2044,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654224 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) + sba fn=2654327 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654224 (17,31,14), SBFn=2654327 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b ee 07 00 c0 0c 60 6b 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -2065,10 +2142,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -2155,6 +2245,8 @@ PDCH(TS 7, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW), 0 TBFs, USFs = 00, TFIs = 00000000. Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) ********** TBF ends here ********** +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. MS requests UL TBF on RACH, so we provide one @@ -2221,10 +2313,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -3279,8 +3384,10 @@ Allocating DL TBF: MS_CLASS=12/0 Creating MS object, TLLI = 0x00000000 Modifying MS object, TLLI = 0x00000000, MS class 0 -> 12 + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 Slot Allocation (Algorithm B) for class 12 - Rx=4 Tx=4 Sum Rx+Tx=5 Tta=2 Ttb=1 Tra=2 Trb=1 Type=1 - Skipping TS 0, because not enabled @@ -3318,8 +3425,10 @@ Modifying MS object, TLLI = 0x00000000, MS class 0 -> 12 Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 12 Enabled EGPRS for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), mode EGPRS + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 Slot Allocation (Algorithm B) for class 12 - Rx=4 Tx=4 Sum Rx+Tx=5 Tta=2 Ttb=1 Tra=2 Trb=1 Type=1 - Skipping TS 0, because not enabled @@ -3356,10 +3465,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -3449,10 +3571,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -3701,6 +3836,8 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL EGPRS) changes state from NULL to ASSIGN TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) starting timer 0. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) append +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4035,6 +4172,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4314,6 +4453,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4552,6 +4693,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4754,6 +4897,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4934,6 +5079,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5095,6 +5242,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5252,6 +5401,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5396,6 +5547,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5541,6 +5694,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5592,6 +5747,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5643,6 +5800,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5694,6 +5853,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5764,6 +5925,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5834,6 +5997,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5904,6 +6069,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5974,6 +6141,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6031,6 +6200,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6088,6 +6259,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6145,6 +6318,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6212,10 +6387,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -6337,8 +6525,10 @@ Modifying MS object, TLLI = 0x00000000, MS class 0 -> 11 Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 11 Enabled EGPRS for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), mode EGPRS + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 Slot Allocation (Algorithm B) for class 11 - Rx=4 Tx=3 Sum Rx+Tx=5 Tta=3 Ttb=1 Tra=2 Trb=1 Type=1 - Skipping TS 0, because not enabled @@ -6358,8 +6548,10 @@ DL TBF slots: 0x10, N: 1, WS: 192 ********** TBF update ********** PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), 0 TBFs, USFs = 00, TFIs = 00000000. + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 - Selected DL slots: (TS=0)"..DDDD.."(TS=7) Using 4 slots for DL - Assigning DL TS 2 @@ -6385,10 +6577,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -6492,6 +6697,8 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL EGPRS) changes state from NULL to ASSIGN TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) starting timer 0. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) append +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6844,9 +7051,18 @@ MS requests UL TBF on RACH, so we provide one ra=0x70 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation -No PDCH available. + Not valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. No PDCH resource for single block allocation.sending Immediate Assignment Uplink (AGCH) reject Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=4d 06 3a 10 70 8b 29 14 70 8b 29 14 70 8b 29 14 70 8b 29 14 0b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6871,3 +7087,1307 @@ TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to FLOW The MS object cannot fully confirm an unexpected TLLI: 0xffeeddcc, partly confirmed TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) append +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(4) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(2) prob1(4294967295) seleprob(4294967295) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967095) seleprob(0) btsnumpdch(4) +selected pro(4294967095)selected_trx(0) +trx(1) cur load(0) numpdch(2) prob1(4294967295) seleprob(4294967095) btsnumpdch(4) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967095) seleprob(0) btsnumpdch(4) +selected pro(4294967095)selected_trx(0) +trx(1) cur load(1) numpdch(2) prob1(4294967095) seleprob(4294967095) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(2) prob1(4294966895) seleprob(0) btsnumpdch(4) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(1) numpdch(2) prob1(4294967095) seleprob(4294966895) btsnumpdch(4) +selected pro(4294967095)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(2) prob1(4294966895) seleprob(0) btsnumpdch(4) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(2) numpdch(2) prob1(4294966895) seleprob(4294966895) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=2. + TREE trx = 0 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000005. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966695) seleprob(0) btsnumpdch(4) +selected pro(4294966695)selected_trx(0) +trx(1) cur load(2) numpdch(2) prob1(4294966895) seleprob(4294966695) btsnumpdch(4) +selected pro(4294966895)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=2. + TREE trx = 1 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000005. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966695) seleprob(0) btsnumpdch(4) +selected pro(4294966695)selected_trx(0) +trx(1) cur load(3) numpdch(2) prob1(4294966695) seleprob(4294966695) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=3. + TREE trx = 0 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 0000000a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(2) prob1(4294966495) seleprob(0) btsnumpdch(4) +selected pro(4294966495)selected_trx(0) +trx(1) cur load(3) numpdch(2) prob1(4294966695) seleprob(4294966495) btsnumpdch(4) +selected pro(4294966695)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=3. + TREE trx = 1 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 1): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 0000000a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(2) prob1(4294966495) seleprob(0) btsnumpdch(4) +selected pro(4294966495)selected_trx(0) +trx(1) cur load(4) numpdch(2) prob1(4294966495) seleprob(4294966495) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=4. + TREE trx = 0 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000015. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966295) seleprob(0) btsnumpdch(4) +selected pro(4294966295)selected_trx(0) +trx(1) cur load(4) numpdch(2) prob1(4294966495) seleprob(4294966295) btsnumpdch(4) +selected pro(4294966495)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=4. + TREE trx = 1 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000015. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966295) seleprob(0) btsnumpdch(4) +selected pro(4294966295)selected_trx(0) +trx(1) cur load(5) numpdch(2) prob1(4294966295) seleprob(4294966295) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=5. + TREE trx = 0 TFI = 5 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 0000002a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(3) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967145) btsnumpdch(3) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294967145) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(2) prob1(4294966995) seleprob(0) btsnumpdch(3) +selected pro(4294966995)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294966995) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=2. + TREE trx = 0 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000005. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966845) seleprob(0) btsnumpdch(3) +selected pro(4294966845)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294966845) btsnumpdch(3) +selected pro(4294966995)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966845) seleprob(0) btsnumpdch(3) +selected pro(4294966845)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966695) seleprob(4294966845) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=3. + TREE trx = 0 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 0000000a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(2) prob1(4294966695) seleprob(0) btsnumpdch(3) +selected pro(4294966695)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966695) seleprob(4294966695) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=4. + TREE trx = 0 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000015. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966545) seleprob(0) btsnumpdch(3) +selected pro(4294966545)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966695) seleprob(4294966545) btsnumpdch(3) +selected pro(4294966695)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=2. + TREE trx = 1 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000007. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966545) seleprob(0) btsnumpdch(3) +selected pro(4294966545)selected_trx(0) +trx(1) cur load(3) numpdch(1) prob1(4294966395) seleprob(4294966545) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=5. + TREE trx = 0 TFI = 5 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 0000002a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(6) numpdch(2) prob1(4294966395) seleprob(0) btsnumpdch(3) +selected pro(4294966395)selected_trx(0) +trx(1) cur load(3) numpdch(1) prob1(4294966395) seleprob(4294966395) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=6. + TREE trx = 0 TFI = 6 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL), 4 TBFs, USFs = 00, TFIs = 00000055. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(7) numpdch(2) prob1(4294966245) seleprob(0) btsnumpdch(3) +selected pro(4294966245)selected_trx(0) +trx(1) cur load(3) numpdch(1) prob1(4294966395) seleprob(4294966245) btsnumpdch(3) +selected pro(4294966395)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=3. + TREE trx = 1 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 4 TBFs, USFs = 00, TFIs = 0000000f. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(4) prob1(4294967295) seleprob(0) btsnumpdch(5) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(4) prob1(4294967170) seleprob(0) btsnumpdch(5) +selected pro(4294967170)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967170) btsnumpdch(5) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(4) prob1(4294967170) seleprob(0) btsnumpdch(5) +selected pro(4294967170)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294967170) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(4) prob1(4294967045) seleprob(0) btsnumpdch(5) +selected pro(4294967045)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294967045) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=2. + TREE trx = 0 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"......D."(TS=7), single +Using single slot at TS 6 for DL +- Reserved DL/UL slots: (TS=0)"......C."(TS=7) +- Assigning DL TS 6 +PDCH(TS 6, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000004. +- Setting Control TS 6 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 40, dl_slots = 40 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(4) prob1(4294966920) seleprob(0) btsnumpdch(5) +selected pro(4294966920)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294966920) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=3. + TREE trx = 0 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".......D"(TS=7), single +Using single slot at TS 7 for DL +- Reserved DL/UL slots: (TS=0)".......C"(TS=7) +- Assigning DL TS 7 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000008. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(4) prob1(4294966795) seleprob(0) btsnumpdch(5) +selected pro(4294966795)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294966795) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=4. + TREE trx = 0 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000011. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(4) prob1(4294966670) seleprob(0) btsnumpdch(5) +selected pro(4294966670)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294966670) btsnumpdch(5) +selected pro(4294966795)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000003. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(4) prob1(4294966670) seleprob(0) btsnumpdch(5) +selected pro(4294966670)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966670) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=5. + TREE trx = 0 TFI = 5 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000022. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(6) numpdch(4) prob1(4294966545) seleprob(0) btsnumpdch(5) +selected pro(4294966545)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966545) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=6. + TREE trx = 0 TFI = 6 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"......D."(TS=7), single +Using single slot at TS 6 for DL +- Reserved DL/UL slots: (TS=0)"......C."(TS=7) +- Assigning DL TS 6 +PDCH(TS 6, TRX 0): Attaching TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000044. +- Setting Control TS 6 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 40, dl_slots = 40 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(7) numpdch(4) prob1(4294966420) seleprob(0) btsnumpdch(5) +selected pro(4294966420)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966420) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=7. + TREE trx = 0 TFI = 7 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".......D"(TS=7), single +Using single slot at TS 7 for DL +- Reserved DL/UL slots: (TS=0)".......C"(TS=7) +- Assigning DL TS 7 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=7 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000088. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=7 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=7 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(8) numpdch(4) prob1(4294966295) seleprob(0) btsnumpdch(5) +selected pro(4294966295)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966295) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=8. + TREE trx = 0 TFI = 8 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=8 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000111. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=8 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=8 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(3) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to RELEASING +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) free +PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) +Destroying MS object, TLLI = 0x00000000 +********** TBF ends here ********** +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(3) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967145) btsnumpdch(3) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to RELEASING +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) free +PDCH(TS 0, TRX 1): Detaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) +Destroying MS object, TLLI = 0x00000000 +********** TBF ends here ********** +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967145) btsnumpdch(3) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294967145) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to RELEASING +TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=RELEASING) free +PDCH(TS 5, TRX 0): Detaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=RELEASING) +Destroying MS object, TLLI = 0x00000000 +********** TBF ends here ********** +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294967145) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(2) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(2) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=1/1 + Use trx = 0 +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +- Selected UL slots: (TS=0)"....U..."(TS=7) +Using 1 slots for UL +- Assigning UL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL), 1 TBFs, USFs = 01, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 00 +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to ASSIGN +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=ASSIGN) starting timer 3169. +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(1) prob1(4294966895) seleprob(0) btsnumpdch(2) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294966895) btsnumpdch(2) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(1) prob1(4294966895) seleprob(0) btsnumpdch(2) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294967095) seleprob(4294966895) btsnumpdch(2) +selected pro(4294967095)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(1) prob1(4294966895) seleprob(0) btsnumpdch(2) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966895) seleprob(4294966895) btsnumpdch(2) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 01, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=1/1 + Use trx = 0 +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +- Selected UL slots: (TS=0)"....U..."(TS=7) +Using 1 slots for UL +- Assigning UL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL), 2 TBFs, USFs = 03, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 00 +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to ASSIGN +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=ASSIGN) starting timer 3169. diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok index dc07fc7..f9dc63e 100644 --- a/tests/tbf/TbfTest.ok +++ b/tests/tbf/TbfTest.ok @@ -75,3 +75,15 @@ === start test_packet_access_rej_epdan === packet reject: 40 84 7f f7 6e e6 41 4b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b === end test_packet_access_rej_epdan === +=== start test_multi_trx_test === +=== start test_multi_trx_test_same_capacity === +=== end test_multi_trx_test_same_capacity === +=== start test_multi_trx_test_1_2_capacity === +=== end test_multi_trx_test_1_2_capacity === +=== start test_multi_trx_test_1_4_capacity === +=== end test_multi_trx_test_1_4_capacity === +=== start test_multi_trx_test_release_alloc === +=== end test_multi_trx_test_release_alloc === +=== start test_multi_trx_test_same_capacity_dl_ul_combined === +=== end test_multi_trx_test_same_capacity_dl_ul_combined === +=== end test_multi_trx_test === -- To view, visit https://gerrit.osmocom.org/1512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I222c3340872ffa1dd6e8fabe5276d793e660f67d Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 30 07:44:19 2016 From: gerrit-no-reply at lists.osmocom.org (arvind.sirsikar) Date: Fri, 30 Dec 2016 07:44:19 +0000 Subject: [PATCH] osmo-pcu[master]: Enable padding support for retransmission in EGPRS DL TBF Message-ID: Review at https://gerrit.osmocom.org/1513 Enable padding support for retransmission in EGPRS DL TBF Earlier, due to limitation of LiteCell, padding cases were failing. Hence from the code MCS8->MCS3 transition was blocked. Now the limitation is removed from L1 of LiteCell, so the support has been enabled from the code. This patch is integration tested with LiteCell 1.5 and B210, B200 setup. Change-Id: Idaf956244aa029c4bef70ecf94163044a3c85f59 --- M src/tbf_dl.cpp M tests/tbf/TbfTest.err 2 files changed, 10 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/13/1513/1 diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 78f06e9..f408418 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -391,14 +391,6 @@ ms()->current_cs_dl().to_num(), m_rlc.block(bsn)->cs_current_trans.to_num(), bts->bts_data()->dl_arq_type, bsn); - - /* TODO: Need to remove this check when MCS-8 -> MCS-6 - * transistion is handled. - * Refer commit be881c028fc4da00c4046ecd9296727975c206a3 - */ - if (m_rlc.block(bsn)->cs_init == GprsCodingScheme::MCS8) - m_rlc.block(bsn)->cs_current_trans = - GprsCodingScheme::MCS8; } else m_rlc.block(bsn)->cs_current_trans = m_rlc.block(bsn)->cs_last; @@ -661,15 +653,7 @@ spb_status == EGPRS_RESEG_SECOND_SEG_SENT) need_padding = true; } else if (num_bsns == 1) { - /* TODO: remove the conditional when MCS-6 padding isn't - * failing to be decoded by MEs anymore */ - /* TODO: support of MCS-8 -> MCS-6 transition should be - * handled - * Refer commit be881c028fc4da00c4046ecd9296727975c206a3 - * dated 2016-02-07 23:45:40 (UTC) - */ - if (cs != GprsCodingScheme(GprsCodingScheme::MCS8)) - cs.decToSingleBlock(&need_padding); + cs.decToSingleBlock(&need_padding); } spb = get_egprs_dl_spb(index); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 2647551..3e35670 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -5298,18 +5298,17 @@ Complete DL frame for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS)len=56 data block (BSN 0, MCS-8): 14 71 01 01 01 01 01 01 01 01 01 01 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b - Restarting at BSN 0, because all blocks have been transmitted (FLOW). -- need_padding 0 spb_status 0 spb 0(BSN1 0 BSN2 -1) +- need_padding 1 spb_status 0 spb 0(BSN1 0 BSN2 -1) - Copying data unit 0 (BSN 0) -- Copying data unit 1 (BSN 0) - Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent). Polling is already scheduled for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) -msg block (BSN 0, MCS-8): 07 00 00 00 60 50 c4 05 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 40 11 17 10 10 10 10 10 10 10 10 10 30 04 1c b0 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 02 -Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=4 block=1 data=07 00 00 00 60 50 c4 05 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 40 11 17 10 10 10 10 10 10 10 10 10 30 04 1c b0 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 02 +msg block (BSN 0, MCS-6, padded): 07 00 00 04 00 00 00 00 00 00 45 5c 40 40 40 40 40 40 40 40 40 c0 10 70 c0 ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca 0a +Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=4 block=1 data=07 00 00 04 00 00 00 00 00 00 45 5c 40 40 40 40 40 40 40 40 40 c0 10 70 c0 ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca 0a TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) append Received RTS for PDCH: TRX=0 TS=4 FN=8 block_nr=2 scheduling free USF for polling at FN=13 of TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=3 TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) downlink (V(A)==0 .. V(S)==1) -- initial_cs_dl(8) last_mcs(8) demanded_mcs(8) cs_trans(8) arq_type(1) bsn(0) +- initial_cs_dl(8) last_mcs(6) demanded_mcs(8) cs_trans(8) arq_type(1) bsn(0) - Resending BSN 0 - Sending new block at BSN 1, CS=MCS-8 - Dequeue next LLC for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) (len=512) @@ -5320,8 +5319,8 @@ - Copying data unit 1 (BSN 1) - Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent). Polling is already scheduled for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) -msg block (BSN 0, MCS-8): 07 00 00 02 88 50 c4 05 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 14 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 00 -Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=8 block=2 data=07 00 00 02 88 50 c4 05 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 14 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 00 +msg block (BSN 0, MCS-8): 07 00 00 02 58 50 c4 05 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 14 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 00 +Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=8 block=2 data=07 00 00 02 58 50 c4 05 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 14 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 00 Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=3 TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) downlink (V(A)==0 .. V(S)==2) - Sending new block at BSN 2, CS=MCS-8 @@ -5378,13 +5377,12 @@ Complete DL frame for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS)len=30 data block (BSN 8, MCS-8): 48 3d 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b - Restarting at BSN 0, because all blocks have been transmitted (FLOW). -- need_padding 0 spb_status 0 spb 0(BSN1 8 BSN2 -1) +- need_padding 1 spb_status 0 spb 0(BSN1 8 BSN2 -1) - Copying data unit 0 (BSN 8) -- Copying data unit 1 (BSN 8) - Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent). Polling is already scheduled for TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) -msg block (BSN 8, MCS-8): 07 00 02 00 60 20 f5 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 80 d4 13 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 30 04 1c b0 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 02 -Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=26 block=6 data=07 00 02 00 60 20 f5 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 0c 01 07 ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac ac 80 d4 13 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 30 04 1c b0 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 02 +msg block (BSN 8, MCS-6, padded): 07 00 02 04 00 00 00 00 00 00 52 4f 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 c0 10 70 c0 ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca 0a +Sending data request: trx=0 ts=4 sapi=5 arfcn=0 fn=26 block=6 data=07 00 02 04 00 00 00 00 00 00 52 4f 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 c0 10 70 c0 ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca ca 0a TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) downlink acknowledge - Final ACK received. TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) changes state from FLOW to WAIT RELEASE -- To view, visit https://gerrit.osmocom.org/1513 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idaf956244aa029c4bef70ecf94163044a3c85f59 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar From gerrit-no-reply at lists.osmocom.org Fri Dec 30 08:51:53 2016 From: gerrit-no-reply at lists.osmocom.org (ikostov) Date: Fri, 30 Dec 2016 08:51:53 +0000 Subject: [PATCH] osmo-gsm-manuals[master]: Diagrams of relationship between osmo-{pcu, bts, nitb, sgsn} ar... Message-ID: Review at https://gerrit.osmocom.org/1514 Diagrams of relationship between osmo-{pcu,bts,nitb,sgsn} are added in OsmoBSC OsmoBTS manuals Change-Id: I0eb09706efb768fa4f6810872fb6568cbc9838cb --- M OsmoBSC/chapters/overview.adoc M OsmoBTS/chapters/interfaces.adoc 2 files changed, 82 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/14/1514/1 diff --git a/OsmoBSC/chapters/overview.adoc b/OsmoBSC/chapters/overview.adoc index 580a42e..4990440 100644 --- a/OsmoBSC/chapters/overview.adoc +++ b/OsmoBSC/chapters/overview.adoc @@ -13,6 +13,68 @@ GSM Base Station Controller with A-bis interface towards BTSs and A interface towards a MSC. +The difference between classic The difference between classic GSM network +architecture and the OsmoNITB based GSM network architecture is illustrated +in next figures. + +[[fig-gsm-classic]] +.Classic GSM network architecture (simplified) +[graphviz] +---- +digraph G { + rankdir=LR; + MS0 [label="MS"] + MS1 [label="MS"] + MS2 [label="MS"] + MS3 [label="MS"] + BTS0 [label="BTS"] + BTS1 [label="BTS"] + MSC [label="MSC/VLR"] + HLR [label="HLR/AUC"] + MS0->BTS0 [label="Um"] + MS1->BTS0 [label="Um"] + MS2->BTS1 [label="Um"] + MS3->BTS1 [label="Um"] + BTS0->BSC [label="Abis"] + BTS1->BSC [label="Abis"] + BSC->MSC [label="A"] + MSC->HLR [label="C"] + MSC->EIR [label="F"] + MSC->SMSC +} +---- + +[[fig-gsm-nitb]] +.GSM system architecture using OsmoNITB +[graphviz] +---- +digraph G { + rankdir=LR; + MS0 [label="MS"] + MS1 [label="MS"] + MS2 [label="MS"] + MS3 [label="MS"] + BTS0 [label="BTS"] + BTS1 [label="BTS"] + MS0->BTS0 [label="Um"] + MS1->BTS0 [label="Um"] + MS2->BTS1 [label="Um"] + MS3->BTS1 [label="Um"] + BTS0->BSC [label="Abis"] + BTS1->BSC [label="Abis"] + subgraph cluster_nitb { + label = "OsmoNITB"; + BSC + MSC [label="MSC/VLR"] + HLR [label="HLR/AUC"] + BSC->MSC [label="A"] + MSC->HLR [label="C"] + MSC->EIR [label="F"] + MSC->SMSC; + } +} +---- + === Software Components diff --git a/OsmoBTS/chapters/interfaces.adoc b/OsmoBTS/chapters/interfaces.adoc index 242fa23..bcc90d0 100644 --- a/OsmoBTS/chapters/interfaces.adoc +++ b/OsmoBTS/chapters/interfaces.adoc @@ -113,6 +113,26 @@ co-locate the PCU with the BSC. However, the GSM specifications keep the location up to the implementor. +The GPRS network architecture including PCU in BTS is presented below. + +[[fig-gprs-pcubts]] +.GPRS network architecture with PCU in BTS +[graphviz] +---- +digraph G { + rankdir=LR; + MS0 [label="MS"] + MS1 [label="MS"] + MS0->BTS [label="Um"] + MS1->BTS [label="Um"] + BTS->BSC [label="Abis"] + BSC->MSC [label="A"] + BTS->PCU [label="pcu_sock"] + PCU->SGSN [label="Gb"] + SGSN->GGSN [label="GTP"] +} +---- + The PCU socket interface serves the following purposes: * to pass PCU relevant configuration from BTS to PCU -- To view, visit https://gerrit.osmocom.org/1514 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0eb09706efb768fa4f6810872fb6568cbc9838cb Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: ikostov From gerrit-no-reply at lists.osmocom.org Fri Dec 30 09:57:59 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 09:57:59 +0000 Subject: [PATCH] osmo-bts[master]: DTX AMR HR: fix inhibition In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1508 to look at the new patch set (#2). DTX AMR HR: fix inhibition * Unlike in AMR FR, in AMR HR incoming ONSET have to be treated differently depending on whether we've recently sent SID UPDATE or EMPTY frame. Split ST_SID_U FSM state into 2 states to accommodate for that and make sure that additional states specific to AMR HR are not used for AMR FR. * Avoid sending E_VOICE and E_SID_U in corresponding states as those do not initiate FSM state transitions anyway. This decrease extra load from FSM signalling which otherwise would be triggered on per-frame basis. * Introduce separate signal for SID First P1 -> P2 transition to avoid confusion with E_COMPL and E_SID_U initiated transitions from P1 state. Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Related: OS#1801 --- M include/osmo-bts/dtx_dl_amr_fsm.h M include/osmo-bts/msg_utils.h M src/common/bts.c M src/common/dtx_dl_amr_fsm.c M src/common/msg_utils.c M src/osmo-bts-litecell15/l1_if.c M src/osmo-bts-litecell15/tch.c M src/osmo-bts-sysmo/tch.c 8 files changed, 129 insertions(+), 39 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/08/1508/2 diff --git a/include/osmo-bts/dtx_dl_amr_fsm.h b/include/osmo-bts/dtx_dl_amr_fsm.h index 4fb2f25..f747f9f 100644 --- a/include/osmo-bts/dtx_dl_amr_fsm.h +++ b/include/osmo-bts/dtx_dl_amr_fsm.h @@ -14,6 +14,7 @@ ST_SID_F2, ST_F1_INH, ST_U_INH, + ST_U_NOINH, ST_F1_INH_REC, ST_U_INH_REC, ST_SID_U, @@ -29,6 +30,7 @@ E_ONSET, E_FACCH, E_COMPL, + E_FIRST, E_INHIB, E_SID_F, E_SID_U, diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 55e8475..7ddbe88 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -37,6 +37,7 @@ void dtx_dispatch(struct gsm_lchan *lchan, enum dtx_dl_amr_fsm_events e); bool dtx_recursion(const struct gsm_lchan *lchan); void dtx_int_signal(struct gsm_lchan *lchan); +bool dtx_is_first_p1(const struct gsm_lchan *lchan); void dtx_cache_payload(struct gsm_lchan *lchan, const uint8_t *l1_payload, size_t length, uint32_t fn, int update); int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl, diff --git a/src/common/bts.c b/src/common/bts.c index 9c2f0e0..d249137 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -45,6 +45,7 @@ #include #include #include +#include #define MIN_QUAL_RACH 5.0f /* at least 5 dB C/I */ #define MIN_QUAL_NORM -0.5f /* at least -1 dB C/I */ diff --git a/src/common/dtx_dl_amr_fsm.c b/src/common/dtx_dl_amr_fsm.c index d903b0c..832e8b4 100644 --- a/src/common/dtx_dl_amr_fsm.c +++ b/src/common/dtx_dl_amr_fsm.c @@ -47,7 +47,7 @@ Was observed during testing, let's just ignore it for now */ break; case E_SID_U: - osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); + osmo_fsm_inst_state_chg(fi, ST_U_NOINH, 0, 0); break; case E_VOICE: osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); @@ -55,7 +55,7 @@ case E_FACCH: osmo_fsm_inst_state_chg(fi, ST_ONSET_F, 0, 0); break; - case E_COMPL: + case E_FIRST: osmo_fsm_inst_state_chg(fi, ST_SID_F2, 0, 0); break; case E_INHIB: @@ -74,7 +74,7 @@ void dtx_fsm_sid_f2(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_SID_U: + case E_COMPL: osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); break; case E_VOICE: @@ -145,6 +145,33 @@ } } +void dtx_fsm_u_noinh(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case E_FACCH: + osmo_fsm_inst_state_chg(fi, ST_ONSET_F, 0, 0); + break; + case E_VOICE: + osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); + break; + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); + break; + case E_SID_U: + case E_SID_F: +/* FIXME: what shall we do if we get SID-FIRST _after_ sending SID-UPDATE? + Was observed during testing, let's just ignore it for now */ + break; + case E_ONSET: + osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); + break; + default: + LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); + OSMO_ASSERT(0); + break; + } +} + void dtx_fsm_sid_upd(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -159,11 +186,7 @@ break; case E_SID_U: case E_SID_F: -/* FIXME: what shall we do if we get SID-FIRST _after_ sending SID-UPDATE? - Was observed during testing, let's just ignore it for now */ - break; - case E_ONSET: - osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); + osmo_fsm_inst_state_chg(fi, ST_U_NOINH, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -255,15 +278,15 @@ /* SID-FIRST or SID-FIRST-P1 in case of AMR HR: start of silence period (might be interrupted in case of AMR HR) */ [ST_SID_F1]= { - .in_event_mask = X(E_SID_F) | X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_COMPL) | X(E_INHIB) | X(E_ONSET), - .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_SID_F2) | X(ST_F1_INH) | X(ST_ONSET_V), + .in_event_mask = X(E_SID_F) | X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_FIRST) | X(E_INHIB) | X(E_ONSET), + .out_state_mask = X(ST_U_NOINH) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_SID_F2) | X(ST_F1_INH) | X(ST_ONSET_V), .name = "SID-FIRST (P1)", .action = dtx_fsm_sid_f1, }, /* SID-FIRST P2 (only for AMR HR): actual start of silence period in case of AMR HR */ [ST_SID_F2]= { - .in_event_mask = X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), + .in_event_mask = X(E_COMPL) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_ONSET_V), .name = "SID-FIRST (P2)", .action = dtx_fsm_sid_f2, @@ -281,6 +304,13 @@ .out_state_mask = X(ST_U_INH_REC), .name = "SID-UPDATE (Inh)", .action = dtx_fsm_u_inh, + }, + /* SID-UPDATE: Inhibited not allowed (only for AMR HR) */ + [ST_U_NOINH]= { + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_COMPL) | X(E_SID_U) | X(E_SID_F) | X(E_ONSET), + .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_SID_U) | X(ST_ONSET_V), + .name = "SID-UPDATE (NoInh)", + .action = dtx_fsm_u_noinh, }, /* SID-FIRST Inhibition recursion in progress: Inhibit itself was already sent, now have to send the voice that caused it */ @@ -300,9 +330,9 @@ }, /* Silence period with periodic comfort noise data updates */ [ST_SID_U]= { - .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_INHIB) | X(E_SID_U) | X(E_SID_F) | X(E_ONSET), - .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_U_INH) | X(ST_SID_U) | X(ST_ONSET_V), - .name = "SID-UPDATE", + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_INHIB) | X(E_SID_U) | X(E_SID_F), + .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_U_INH) | X(ST_U_NOINH), + .name = "SID-UPDATE (AMR/HR)", .action = dtx_fsm_sid_upd, }, /* ONSET - end of silent period due to incoming SPEECH frame */ @@ -350,6 +380,7 @@ { E_ONSET, "ONSET" }, { E_FACCH, "FACCH" }, { E_COMPL, "Complete" }, + { E_FIRST, "FIRST P1->P2" }, { E_INHIB, "Inhibit" }, { E_SID_F, "SID-FIRST" }, { E_SID_U, "SID-UPDATE" }, diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index 9de9b6d..062f5e3 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -93,6 +93,28 @@ return type; } +/* check that DTX is in the middle of silence */ +static inline bool dtx_is_update(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U || + lchan->tch.dtx.dl_amr_fsm->state == ST_U_NOINH) + return true; + return false; +} + +/* check that DTX is in the beginning of silence for AMR HR */ +bool dtx_is_first_p1(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + if ((lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1)) + return true; + return false; +} + /* update lchan SID status */ void lchan_set_marker(bool t, struct gsm_lchan *lchan) { @@ -123,9 +145,7 @@ if (update == 0) { lchan->tch.dtx.is_update = false; /* Mark SID FIRST explicitly */ /* for non-AMR case - always update FN for incoming SID FIRST */ - if (!amr || - (dtx_dl_amr_enabled(lchan) && - lchan->tch.dtx.dl_amr_fsm->state != ST_SID_U)) + if (!amr || !dtx_is_update(lchan)) lchan->tch.dtx.fn = fn; /* for AMR case - do not update FN if SID FIRST arrives in a middle of silence: this should not be happening according to @@ -157,12 +177,24 @@ int rc; if (dtx_dl_amr_enabled(lchan)) { - if (lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { - *len = 3; /* SID-FIRST P1 -> P2 completion */ - memcpy(l1_payload, lchan->tch.dtx.cache, 2); - dtx_dispatch(lchan, E_SID_U); - return 0; + if (lchan->type == GSM_LCHAN_TCH_H && !rtp_pl) { + /* we're called by gen_empty_tch_msg() to handle states + specific to AMR HR DTX */ + switch (lchan->tch.dtx.dl_amr_fsm->state) { + case ST_SID_F2: + *len = 3; /* SID-FIRST P1 -> P2 completion */ + memcpy(l1_payload, lchan->tch.dtx.cache, 2); + rc = 0; + dtx_dispatch(lchan, E_COMPL); + break; + case ST_SID_U: + rc = -EBADMSG; + dtx_dispatch(lchan, E_SID_U); + break; + default: + rc = -EBADMSG; + } + return rc; } } @@ -171,8 +203,8 @@ rc = osmo_amr_rtp_dec(rtp_pl, rtp_pl_len, &cmr, &cmi, &ft, &bfi, &sti); if (rc < 0) { - LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu)\n", - rtp_pl_len); + LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu, " + "%p)\n", rtp_pl_len, rtp_pl); return rc; } @@ -197,19 +229,29 @@ return 0; if (osmo_amr_is_speech(ft)) { - /* AMR HR - Inhibition */ - if (lchan->type == GSM_LCHAN_TCH_H && marker && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) + /* AMR HR - SID-FIRST_P1 Inhibition */ + if (marker && dtx_is_first_p1(lchan)) return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_INHIB, (void *)lchan); + + /* AMR HR - SID-UPDATE Inhibition */ + if (marker && lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_INHIB, (void *)lchan); + /* AMR FR & HR - generic */ if (marker && (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 || lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 || - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U )) + lchan->tch.dtx.dl_amr_fsm->state == ST_U_NOINH)) return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_ONSET, (void *)lchan); - return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_VOICE, - (void *)lchan); + + if (lchan->tch.dtx.dl_amr_fsm->state != ST_VOICE) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_VOICE, (void *)lchan); + + return 0; } if (ft == AMR_SID) { @@ -220,8 +262,11 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, false); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_F, (void *)lchan); - } else + } else if (lchan->tch.dtx.dl_amr_fsm->state != ST_FACCH) dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, sti); + if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_COMPL, (void *)lchan); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, sti ? E_SID_U : E_SID_F, (void *)lchan); @@ -357,6 +402,7 @@ return false; if (lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH || + lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH_REC || lchan->tch.dtx.dl_amr_fsm->state == ST_F1_INH || lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F || lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_V || @@ -389,9 +435,7 @@ if (!dtx_dl_amr_enabled(lchan)) return; - if ((lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) || - dtx_recursion(lchan)) + if (dtx_is_first_p1(lchan) || dtx_recursion(lchan)) dtx_dispatch(lchan, E_COMPL); } @@ -425,12 +469,17 @@ osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_U, (void *)lchan); dtx_sti_unset(lchan); - } else if (lchan->tch.dtx.dl_amr_fsm->state == - ST_SID_U) { + } else if (dtx_is_update(lchan)) { /* enforce SID UPDATE for next repetition: it might have been altered by FACCH handling */ dtx_sti_set(lchan); - lchan->tch.dtx.is_update = true; + if (lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == + ST_U_NOINH) + osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_COMPL, + (void *)lchan); + lchan->tch.dtx.is_update = true; } } memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len); diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index d959338..99533d7 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -416,6 +416,7 @@ } if (sapi == GsmL1_Sapi_FacchH) { sapi = GsmL1_Sapi_TchH; + subCh = L1SAP_CHAN2SS_TCHH(chan_nr); } if (sapi == GsmL1_Sapi_TchH || sapi == GsmL1_Sapi_TchF) { /* FACCH interruption of DTX silence */ @@ -542,7 +543,10 @@ } /* send message to DSP's queue */ osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg); - dtx_int_signal(lchan); + if (dtx_is_first_p1(lchan)) + dtx_dispatch(lchan, E_FIRST); + else + dtx_int_signal(lchan); if (dtx_recursion(lchan)) /* DTX: send voice after ONSET was sent */ return ph_tch_req(trx, l1sap->oph.msg, l1sap, true, false); diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c index de3c7e3..a47a88f 100644 --- a/src/osmo-bts-litecell15/tch.c +++ b/src/osmo-bts-litecell15/tch.c @@ -322,6 +322,7 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, 0); return 1; case ST_SID_U: + case ST_U_NOINH: return -EAGAIN; case ST_FACCH: return -EBADMSG; diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 16c2cf3..bc495d9 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -420,6 +420,7 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, 0); return 1; case ST_SID_U: + case ST_U_NOINH: return -EAGAIN; case ST_FACCH: return -EBADMSG; -- To view, visit https://gerrit.osmocom.org/1508 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jean-Francois Dionne Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 30 10:01:19 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 10:01:19 +0000 Subject: [PATCH] osmo-bts[master]: DTX AMR HR: fix inhibition In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1508 to look at the new patch set (#3). DTX AMR HR: fix inhibition * Unlike in AMR FR, in AMR HR incoming ONSET have to be treated differently depending on whether we've recently sent SID UPDATE or EMPTY frame. Split ST_SID_U FSM state into 2 states to accommodate for that and make sure that additional states specific to AMR HR are not used for AMR FR. * Avoid sending E_VOICE and E_SID_U in corresponding states as those do not initiate FSM state transitions anyway. This decrease extra load from FSM signalling which otherwise would be triggered on per-frame basis. * Introduce separate signal for SID First P1 -> P2 transition to avoid confusion with E_COMPL and E_SID_U initiated transitions from P1 state. Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Related: OS#1801 --- M include/osmo-bts/dtx_dl_amr_fsm.h M include/osmo-bts/msg_utils.h M src/common/bts.c M src/common/dtx_dl_amr_fsm.c M src/common/msg_utils.c M src/osmo-bts-litecell15/l1_if.c M src/osmo-bts-litecell15/tch.c M src/osmo-bts-sysmo/l1_if.c M src/osmo-bts-sysmo/tch.c 9 files changed, 134 insertions(+), 40 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/08/1508/3 diff --git a/include/osmo-bts/dtx_dl_amr_fsm.h b/include/osmo-bts/dtx_dl_amr_fsm.h index 4fb2f25..f747f9f 100644 --- a/include/osmo-bts/dtx_dl_amr_fsm.h +++ b/include/osmo-bts/dtx_dl_amr_fsm.h @@ -14,6 +14,7 @@ ST_SID_F2, ST_F1_INH, ST_U_INH, + ST_U_NOINH, ST_F1_INH_REC, ST_U_INH_REC, ST_SID_U, @@ -29,6 +30,7 @@ E_ONSET, E_FACCH, E_COMPL, + E_FIRST, E_INHIB, E_SID_F, E_SID_U, diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 55e8475..7ddbe88 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -37,6 +37,7 @@ void dtx_dispatch(struct gsm_lchan *lchan, enum dtx_dl_amr_fsm_events e); bool dtx_recursion(const struct gsm_lchan *lchan); void dtx_int_signal(struct gsm_lchan *lchan); +bool dtx_is_first_p1(const struct gsm_lchan *lchan); void dtx_cache_payload(struct gsm_lchan *lchan, const uint8_t *l1_payload, size_t length, uint32_t fn, int update); int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl, diff --git a/src/common/bts.c b/src/common/bts.c index 9c2f0e0..d249137 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -45,6 +45,7 @@ #include #include #include +#include #define MIN_QUAL_RACH 5.0f /* at least 5 dB C/I */ #define MIN_QUAL_NORM -0.5f /* at least -1 dB C/I */ diff --git a/src/common/dtx_dl_amr_fsm.c b/src/common/dtx_dl_amr_fsm.c index d903b0c..832e8b4 100644 --- a/src/common/dtx_dl_amr_fsm.c +++ b/src/common/dtx_dl_amr_fsm.c @@ -47,7 +47,7 @@ Was observed during testing, let's just ignore it for now */ break; case E_SID_U: - osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); + osmo_fsm_inst_state_chg(fi, ST_U_NOINH, 0, 0); break; case E_VOICE: osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); @@ -55,7 +55,7 @@ case E_FACCH: osmo_fsm_inst_state_chg(fi, ST_ONSET_F, 0, 0); break; - case E_COMPL: + case E_FIRST: osmo_fsm_inst_state_chg(fi, ST_SID_F2, 0, 0); break; case E_INHIB: @@ -74,7 +74,7 @@ void dtx_fsm_sid_f2(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { - case E_SID_U: + case E_COMPL: osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); break; case E_VOICE: @@ -145,6 +145,33 @@ } } +void dtx_fsm_u_noinh(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case E_FACCH: + osmo_fsm_inst_state_chg(fi, ST_ONSET_F, 0, 0); + break; + case E_VOICE: + osmo_fsm_inst_state_chg(fi, ST_VOICE, 0, 0); + break; + case E_COMPL: + osmo_fsm_inst_state_chg(fi, ST_SID_U, 0, 0); + break; + case E_SID_U: + case E_SID_F: +/* FIXME: what shall we do if we get SID-FIRST _after_ sending SID-UPDATE? + Was observed during testing, let's just ignore it for now */ + break; + case E_ONSET: + osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); + break; + default: + LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); + OSMO_ASSERT(0); + break; + } +} + void dtx_fsm_sid_upd(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -159,11 +186,7 @@ break; case E_SID_U: case E_SID_F: -/* FIXME: what shall we do if we get SID-FIRST _after_ sending SID-UPDATE? - Was observed during testing, let's just ignore it for now */ - break; - case E_ONSET: - osmo_fsm_inst_state_chg(fi, ST_ONSET_V, 0, 0); + osmo_fsm_inst_state_chg(fi, ST_U_NOINH, 0, 0); break; default: LOGP(DL1P, LOGL_ERROR, "Unexpected event %d\n", event); @@ -255,15 +278,15 @@ /* SID-FIRST or SID-FIRST-P1 in case of AMR HR: start of silence period (might be interrupted in case of AMR HR) */ [ST_SID_F1]= { - .in_event_mask = X(E_SID_F) | X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_COMPL) | X(E_INHIB) | X(E_ONSET), - .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_SID_F2) | X(ST_F1_INH) | X(ST_ONSET_V), + .in_event_mask = X(E_SID_F) | X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_FIRST) | X(E_INHIB) | X(E_ONSET), + .out_state_mask = X(ST_U_NOINH) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_SID_F2) | X(ST_F1_INH) | X(ST_ONSET_V), .name = "SID-FIRST (P1)", .action = dtx_fsm_sid_f1, }, /* SID-FIRST P2 (only for AMR HR): actual start of silence period in case of AMR HR */ [ST_SID_F2]= { - .in_event_mask = X(E_SID_U) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), + .in_event_mask = X(E_COMPL) | X(E_VOICE) | X(E_FACCH) | X(E_ONSET), .out_state_mask = X(ST_SID_U) | X(ST_VOICE) | X(ST_ONSET_F) | X(ST_ONSET_V), .name = "SID-FIRST (P2)", .action = dtx_fsm_sid_f2, @@ -281,6 +304,13 @@ .out_state_mask = X(ST_U_INH_REC), .name = "SID-UPDATE (Inh)", .action = dtx_fsm_u_inh, + }, + /* SID-UPDATE: Inhibited not allowed (only for AMR HR) */ + [ST_U_NOINH]= { + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_COMPL) | X(E_SID_U) | X(E_SID_F) | X(E_ONSET), + .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_SID_U) | X(ST_ONSET_V), + .name = "SID-UPDATE (NoInh)", + .action = dtx_fsm_u_noinh, }, /* SID-FIRST Inhibition recursion in progress: Inhibit itself was already sent, now have to send the voice that caused it */ @@ -300,9 +330,9 @@ }, /* Silence period with periodic comfort noise data updates */ [ST_SID_U]= { - .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_INHIB) | X(E_SID_U) | X(E_SID_F) | X(E_ONSET), - .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_U_INH) | X(ST_SID_U) | X(ST_ONSET_V), - .name = "SID-UPDATE", + .in_event_mask = X(E_FACCH) | X(E_VOICE) | X(E_INHIB) | X(E_SID_U) | X(E_SID_F), + .out_state_mask = X(ST_ONSET_F) | X(ST_VOICE) | X(ST_U_INH) | X(ST_U_NOINH), + .name = "SID-UPDATE (AMR/HR)", .action = dtx_fsm_sid_upd, }, /* ONSET - end of silent period due to incoming SPEECH frame */ @@ -350,6 +380,7 @@ { E_ONSET, "ONSET" }, { E_FACCH, "FACCH" }, { E_COMPL, "Complete" }, + { E_FIRST, "FIRST P1->P2" }, { E_INHIB, "Inhibit" }, { E_SID_F, "SID-FIRST" }, { E_SID_U, "SID-UPDATE" }, diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index 9de9b6d..062f5e3 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -93,6 +93,28 @@ return type; } +/* check that DTX is in the middle of silence */ +static inline bool dtx_is_update(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U || + lchan->tch.dtx.dl_amr_fsm->state == ST_U_NOINH) + return true; + return false; +} + +/* check that DTX is in the beginning of silence for AMR HR */ +bool dtx_is_first_p1(const struct gsm_lchan *lchan) +{ + if (!dtx_dl_amr_enabled(lchan)) + return false; + if ((lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1)) + return true; + return false; +} + /* update lchan SID status */ void lchan_set_marker(bool t, struct gsm_lchan *lchan) { @@ -123,9 +145,7 @@ if (update == 0) { lchan->tch.dtx.is_update = false; /* Mark SID FIRST explicitly */ /* for non-AMR case - always update FN for incoming SID FIRST */ - if (!amr || - (dtx_dl_amr_enabled(lchan) && - lchan->tch.dtx.dl_amr_fsm->state != ST_SID_U)) + if (!amr || !dtx_is_update(lchan)) lchan->tch.dtx.fn = fn; /* for AMR case - do not update FN if SID FIRST arrives in a middle of silence: this should not be happening according to @@ -157,12 +177,24 @@ int rc; if (dtx_dl_amr_enabled(lchan)) { - if (lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 && !rtp_pl) { - *len = 3; /* SID-FIRST P1 -> P2 completion */ - memcpy(l1_payload, lchan->tch.dtx.cache, 2); - dtx_dispatch(lchan, E_SID_U); - return 0; + if (lchan->type == GSM_LCHAN_TCH_H && !rtp_pl) { + /* we're called by gen_empty_tch_msg() to handle states + specific to AMR HR DTX */ + switch (lchan->tch.dtx.dl_amr_fsm->state) { + case ST_SID_F2: + *len = 3; /* SID-FIRST P1 -> P2 completion */ + memcpy(l1_payload, lchan->tch.dtx.cache, 2); + rc = 0; + dtx_dispatch(lchan, E_COMPL); + break; + case ST_SID_U: + rc = -EBADMSG; + dtx_dispatch(lchan, E_SID_U); + break; + default: + rc = -EBADMSG; + } + return rc; } } @@ -171,8 +203,8 @@ rc = osmo_amr_rtp_dec(rtp_pl, rtp_pl_len, &cmr, &cmi, &ft, &bfi, &sti); if (rc < 0) { - LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu)\n", - rtp_pl_len); + LOGP(DRTP, LOGL_ERROR, "failed to decode AMR RTP (length %zu, " + "%p)\n", rtp_pl_len, rtp_pl); return rc; } @@ -197,19 +229,29 @@ return 0; if (osmo_amr_is_speech(ft)) { - /* AMR HR - Inhibition */ - if (lchan->type == GSM_LCHAN_TCH_H && marker && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) + /* AMR HR - SID-FIRST_P1 Inhibition */ + if (marker && dtx_is_first_p1(lchan)) return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_INHIB, (void *)lchan); + + /* AMR HR - SID-UPDATE Inhibition */ + if (marker && lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_INHIB, (void *)lchan); + /* AMR FR & HR - generic */ if (marker && (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1 || lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2 || - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U )) + lchan->tch.dtx.dl_amr_fsm->state == ST_U_NOINH)) return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_ONSET, (void *)lchan); - return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_VOICE, - (void *)lchan); + + if (lchan->tch.dtx.dl_amr_fsm->state != ST_VOICE) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_VOICE, (void *)lchan); + + return 0; } if (ft == AMR_SID) { @@ -220,8 +262,11 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, false); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_F, (void *)lchan); - } else + } else if (lchan->tch.dtx.dl_amr_fsm->state != ST_FACCH) dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, sti); + if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F2) + return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_COMPL, (void *)lchan); return osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, sti ? E_SID_U : E_SID_F, (void *)lchan); @@ -357,6 +402,7 @@ return false; if (lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH || + lchan->tch.dtx.dl_amr_fsm->state == ST_U_INH_REC || lchan->tch.dtx.dl_amr_fsm->state == ST_F1_INH || lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_F || lchan->tch.dtx.dl_amr_fsm->state == ST_ONSET_V || @@ -389,9 +435,7 @@ if (!dtx_dl_amr_enabled(lchan)) return; - if ((lchan->type == GSM_LCHAN_TCH_H && - lchan->tch.dtx.dl_amr_fsm->state == ST_SID_F1) || - dtx_recursion(lchan)) + if (dtx_is_first_p1(lchan) || dtx_recursion(lchan)) dtx_dispatch(lchan, E_COMPL); } @@ -425,12 +469,17 @@ osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_U, (void *)lchan); dtx_sti_unset(lchan); - } else if (lchan->tch.dtx.dl_amr_fsm->state == - ST_SID_U) { + } else if (dtx_is_update(lchan)) { /* enforce SID UPDATE for next repetition: it might have been altered by FACCH handling */ dtx_sti_set(lchan); - lchan->tch.dtx.is_update = true; + if (lchan->type == GSM_LCHAN_TCH_H && + lchan->tch.dtx.dl_amr_fsm->state == + ST_U_NOINH) + osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, + E_COMPL, + (void *)lchan); + lchan->tch.dtx.is_update = true; } } memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len); diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index d959338..99533d7 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -416,6 +416,7 @@ } if (sapi == GsmL1_Sapi_FacchH) { sapi = GsmL1_Sapi_TchH; + subCh = L1SAP_CHAN2SS_TCHH(chan_nr); } if (sapi == GsmL1_Sapi_TchH || sapi == GsmL1_Sapi_TchF) { /* FACCH interruption of DTX silence */ @@ -542,7 +543,10 @@ } /* send message to DSP's queue */ osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg); - dtx_int_signal(lchan); + if (dtx_is_first_p1(lchan)) + dtx_dispatch(lchan, E_FIRST); + else + dtx_int_signal(lchan); if (dtx_recursion(lchan)) /* DTX: send voice after ONSET was sent */ return ph_tch_req(trx, l1sap->oph.msg, l1sap, true, false); diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c index de3c7e3..a47a88f 100644 --- a/src/osmo-bts-litecell15/tch.c +++ b/src/osmo-bts-litecell15/tch.c @@ -322,6 +322,7 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, 0); return 1; case ST_SID_U: + case ST_U_NOINH: return -EAGAIN; case ST_FACCH: return -EBADMSG; diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 2a3caf9..ad9aa64 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -411,6 +411,7 @@ } if (sapi == GsmL1_Sapi_FacchH) { sapi = GsmL1_Sapi_TchH; + subCh = L1SAP_CHAN2SS_TCHH(chan_nr); } if (sapi == GsmL1_Sapi_TchH || sapi == GsmL1_Sapi_TchF) { /* FACCH interruption of DTX silence */ @@ -537,7 +538,10 @@ } /* send message to DSP's queue */ osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg); - dtx_int_signal(lchan); + if (dtx_is_first_p1(lchan)) + dtx_dispatch(lchan, E_FIRST); + else + dtx_int_signal(lchan); if (dtx_recursion(lchan)) /* DTX: send voice after ONSET was sent */ return ph_tch_req(trx, l1sap->oph.msg, l1sap, true, false); diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 16c2cf3..bc495d9 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -420,6 +420,7 @@ dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, 0); return 1; case ST_SID_U: + case ST_U_NOINH: return -EAGAIN; case ST_FACCH: return -EBADMSG; -- To view, visit https://gerrit.osmocom.org/1508 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jean-Francois Dionne Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 30 11:59:43 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 11:59:43 +0000 Subject: osmo-pcu[master]: Enable padding support for retransmission in EGPRS DL TBF In-Reply-To: References: Message-ID: Patch Set 1: How exactly "padding cases were failing"? We should be able to check the other 2 bts models to see if it's working or not. -- To view, visit https://gerrit.osmocom.org/1513 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idaf956244aa029c4bef70ecf94163044a3c85f59 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No From gerrit-no-reply at lists.osmocom.org Fri Dec 30 12:03:17 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 12:03:17 +0000 Subject: [PATCH] osmo-pcu[master]: PDCH allocation across two TRX In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1512 to look at the new patch set (#2). PDCH allocation across two TRX Implementation: PCU keeps track of number PDCH across all the TRXs at BTS context and also keeps number of active PDCHs in each TRX context. This ratio gives the CAPACITY of each TRX. 1st Phase: While selection of TRX, functions get_possible_trxs(for multiple TS) and get_possible_trxs_sba(Single block allocation, Ex: during RACH) gets possible TRXs based on TFIs availability. 2nd Phase: outcome of TRXs(from get_possible_trxs, get_possible_trxs_sba) will be fed to get_suitable_trx function. Which does actual load balancing on each TRX. And selects the best fit TRX, based on below equation PROBABILITY = MAX_PROBABILITY ? ((LOAD * 100)/CAPACITY); If same PROBABILITY Select the one with higher capacity Else Find the TRX with higher PROBABILITY MAX_PROBABILITY = 65535; LOAD: Initialized to 0, Later gets incremented with number of TS allocated. and decremented while TBF deletion, based on number of TS allocated Below are the test executed on Unit test environment 1) 2 TRXs, with same Capacity 2) 2 TRX with ? capacity 3) 2 TRXs with ? capacity 4) 2 TRX with UL and DL allocation to ensure Tbfs on both direction is hosted on same TRX 5) 2 TRX with same Capacity and DL TBF creation and deletion scenarios to ensure proper load balancing criteria for actual Load. Below are the Test executed on Integration setup with Ettus B200 setup with 2 TRXs with same CAPACITY. 1) TRX allocation during RACH procedure(SBA allocation) 2) TRX allocation during DL TBF creation with multi time slots(4 time slots) 3) TRX allocation while Ping Test 4) TRX allocation while UDP test 5) TRX allocation for web browsing. 6) 2 MS test with each TRX sharing 1 MS. Received aggregate throughput of 446 kbps(223 Kbps each) Limitation: 1) BSSGP flow control needs to be tuned since test with 2 MS with each MS on different TRX runs for 20 mins 2) USF resource availibility is not checked while selecting the TRX as existing implementation Change-Id: I222c3340872ffa1dd6e8fabe5276d793e660f67d Related: OS# 1775 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac_ts_alloc.cpp M src/sba.cpp M src/tbf.cpp M tests/tbf/TbfTest.cpp M tests/tbf/TbfTest.err M tests/tbf/TbfTest.ok 8 files changed, 1,995 insertions(+), 40 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/12/1512/2 diff --git a/src/bts.cpp b/src/bts.cpp index a47d7d8..cd13862 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -188,11 +188,13 @@ { memset(&m_bts, 0, sizeof(m_bts)); m_bts.bts = this; - + m_total_pdch = 0; /* initialize back pointers */ for (size_t trx_no = 0; trx_no < ARRAY_SIZE(m_bts.trx); ++trx_no) { struct gprs_rlcmac_trx *trx = &m_bts.trx[trx_no]; trx->trx_no = trx_no; + trx->num_pdch = 0; + trx->current_load = 0; trx->bts = this; for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ++ts_no) { @@ -417,9 +419,82 @@ uint8_t *_trx, int8_t use_trx) { struct gprs_rlcmac_pdch *pdch; - uint32_t free_tfis; + uint32_t free_tfis = 0xffffffff; + uint8_t ts, tfi; + bool possible_trx[8]; + int ret; + + /* This function will get list of possible TRXs */ + ret = get_possible_trxs(dir, possible_trx, use_trx); + if (ret < 0) + return -EBUSY; + + + if (use_trx >= 0) + *_trx = use_trx; + else + *_trx = get_suitable_trx(possible_trx); + + LOGP(DRLCMAC, LOGL_DEBUG, + "Searching for first unallocated TFI: TRX=%d\n", *_trx); + + for (ts = 0; ts < 8; ts++) { + pdch = &m_bts.trx[*_trx].pdch[ts]; + free_tfis &= ~pdch->assigned_tfi(dir); + } + /* find the first */ + for (tfi = 0; tfi < 32; tfi++) { + if (free_tfis & 1 << tfi) + break; + } + + OSMO_ASSERT(tfi < 32); + + LOGP(DRLCMAC, LOGL_DEBUG, " Found TFI=%d.\n", tfi); + + return tfi; +} + +/* + * Search for free TFI and return TFI, TRX. + * This method returns the first TFI that is currently not used in any PDCH of + * a TRX. The first TRX that contains such an TFI is returned. Negative values + * indicate errors. + */ +int BTS::get_possible_trxs_sba( + bool *_trx) +{ + uint8_t trx; bool has_pdch = false; - uint8_t trx_from, trx_to, trx, ts, tfi; + + for (trx = 0; trx < 8; trx++) { + if (bts_data()->trx[trx].num_pdch) { + _trx[trx] = true; + has_pdch = true; + LOGP(DRLCMAC, LOGL_DEBUG, " Valid TRX=%d.\n", trx); + } else { + _trx[trx] = false; + LOGP(DRLCMAC, LOGL_DEBUG, " Not valid TRX=%d.\n", trx); + } + } + if (has_pdch) + return 0; + + return -EINVAL; +} + +/* + * This method loops through all possible TRX and + * returns subset of possible TRXs based on availability. + */ +int BTS::get_possible_trxs(enum gprs_rlcmac_tbf_direction dir, + bool *_trx, int8_t use_trx) +{ + struct gprs_rlcmac_pdch *pdch; + uint32_t free_tfis; + uint32_t is_tfis_available = false; + bool has_pdch = false; + uint8_t trx_from, trx_to, trx, ts; if (use_trx >= 0 && use_trx < 8) trx_from = trx_to = use_trx; @@ -442,8 +517,12 @@ trx_has_pdch = true; has_pdch = true; } - if (trx_has_pdch && free_tfis) - break; + if (trx_has_pdch && free_tfis) { + _trx[trx] = true; + is_tfis_available = true; + } else { + _trx[trx] = false; + } free_tfis = 0; } @@ -452,26 +531,69 @@ return -EINVAL; } - if (!free_tfis) { + if (!is_tfis_available) { LOGP(DRLCMAC, LOGL_NOTICE, "No TFI available.\n"); return -EBUSY; } + return 0; +} +/* + * This method loops through all subset of TRXs provided by + * get_possible_trxs and does the load balancing algorithm. and + * selects best TRX possible based on load and capacity + */ +int BTS::get_suitable_trx(bool *avail_trx) +{ + uint8_t trx_from, trx_to, trx; + uint32_t select_probability = 0; + uint32_t temp_probability = 0; + int selected_trx = -1; + bool is_better_trx = false; - LOGP(DRLCMAC, LOGL_DEBUG, - "Searching for first unallocated TFI: TRX=%d\n", trx); + trx_from = 0; + trx_to = 7; - /* find the first */ - for (tfi = 0; tfi < 32; tfi++) { - if (free_tfis & 1 << tfi) - break; + for (trx = trx_from; trx <= trx_to; trx++) { + /* Check if this TRX is in possible list */ + if (!avail_trx[trx]) + continue; + + is_better_trx = false; + + temp_probability = MAX_LOAD_PROBABILITY - + (get_num_pdch() * 100 * + m_bts.trx[trx].current_load) + / m_bts.trx[trx].num_pdch; + + LOGP(DRLCMAC, LOGL_DEBUG, "trx(%d) cur load(%d)" + " numpdch(%d) prob1(%u) seleprob(%u)" + " btsnumpdch(%d)\n", trx, + m_bts.trx[trx].current_load, + m_bts.trx[trx].num_pdch, + temp_probability, select_probability, + get_num_pdch()); + + if (temp_probability >= select_probability) { + if (temp_probability > select_probability) + is_better_trx = true; + else if (temp_probability == select_probability) + if (selected_trx >= 0 || selected_trx < 8) + if (m_bts.trx[selected_trx].num_pdch + < m_bts.trx[trx].num_pdch) + is_better_trx = true; + } + if (is_better_trx) { + selected_trx = trx; + select_probability = + temp_probability; + LOGP(DRLCMAC, LOGL_DEBUG, "selected pro(%u)" + "selected_trx(%d)\n", + select_probability, selected_trx); + } } - OSMO_ASSERT(tfi < 32); - - LOGP(DRLCMAC, LOGL_DEBUG, " Found TFI=%d.\n", tfi); - *_trx = trx; - return tfi; + return selected_trx; } int BTS::rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn) @@ -783,13 +905,17 @@ { /* TODO: Check if there are still allocated resources.. */ INIT_LLIST_HEAD(&paging_list); + trx->num_pdch++; m_is_enabled = 1; + bts()->increment_num_pdch(); } void gprs_rlcmac_pdch::disable() { /* TODO.. kick free_resources once we know the TRX/TS we are on */ m_is_enabled = 0; + trx->num_pdch--; + bts()->decrement_num_pdch(); } void gprs_rlcmac_pdch::free_resources() diff --git a/src/bts.h b/src/bts.h index 636c7ec..00ec72b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -44,6 +44,7 @@ #define LLC_CODEL_USE_DEFAULT (-1) #define MAX_GPRS_CS 9 +#define MAX_LOAD_PROBABILITY 0xffffffff struct BTS; struct GprsMs; @@ -136,7 +137,8 @@ /* back pointers */ struct BTS *bts; uint8_t trx_no; - + uint8_t current_load; + uint8_t num_pdch; #ifdef __cplusplus void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); @@ -345,6 +347,9 @@ gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts); int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx); + int get_possible_trxs(enum gprs_rlcmac_tbf_direction dir, + bool *_trx, int8_t use_trx); + int get_suitable_trx(bool *suitable_trx); 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, @@ -451,6 +456,10 @@ void ms_present(int32_t n); int32_t ms_present_get(); + void increment_num_pdch(); + void decrement_num_pdch(); + uint8_t get_num_pdch() const; + int get_possible_trxs_sba(bool *_trx); /* * Below for C interface for the VTY @@ -476,6 +485,8 @@ /* list of downlink TBFs */ LListHead m_dl_tbfs; + /* The summation of all the PDCH across all TRX for this BTS*/ + uint8_t m_total_pdch; private: /* disable copying to avoid slicing */ BTS(const BTS&); @@ -487,6 +498,21 @@ return m_cur_fn; } +inline void BTS::increment_num_pdch() +{ + m_total_pdch++; +} + +inline void BTS::decrement_num_pdch() +{ + m_total_pdch--; +} + +inline uint8_t BTS::get_num_pdch() const +{ + return m_total_pdch; +} + inline SBAController *BTS::sba() { return &m_sba; diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 57197b2..0300134 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -383,8 +383,11 @@ int tfi; uint8_t trx_no; - if (use_trx == -1 && ms->current_trx()) + LOGP(DRLCMAC, LOGL_DEBUG, " Use trx = %d \n",use_trx); + if (use_trx == -1 && ms->current_trx()) { use_trx = ms->current_trx()->trx_no; + LOGP(DRLCMAC, LOGL_DEBUG, " MS alive = %d \n",use_trx); + } tfi = bts->tfi_find_free(dir, &trx_no, use_trx); if (tfi < 0) @@ -392,6 +395,8 @@ if (trx_no_) *trx_no_ = trx_no; + + LOGP(DRLCMAC, LOGL_DEBUG, " TREE trx = %d TFI = %d\n", *trx_no_, tfi); return tfi; } @@ -479,6 +484,7 @@ } tbf_->trx = trx; + trx->current_load++; /* the only one TS is the common TS */ tbf_->first_ts = tbf_->first_common_ts = ts; ms_->set_reserved_slots(trx, 1 << ts, 1 << ts); @@ -1000,6 +1006,7 @@ if (!(dl_slots & (1 << ts))) continue; + trx->current_load++; LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning DL TS " "%d\n", ts); assign_dlink_tbf(&trx->pdch[ts], dl_tbf, tfi); @@ -1012,6 +1019,7 @@ continue; OSMO_ASSERT(usf[ts] >= 0); + trx->current_load++; LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS " "%d\n", ts); diff --git a/src/sba.cpp b/src/sba.cpp index 46c1431..b4d9723 100644 --- a/src/sba.cpp +++ b/src/sba.cpp @@ -46,11 +46,29 @@ int SBAController::alloc( uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta) { - struct gprs_rlcmac_pdch *pdch; struct gprs_rlcmac_sba *sba; - int8_t trx, ts; + int8_t ts; uint32_t fn; + bool trxs[8]; + int selected_trx; + int ret; + + ret = m_bts.get_possible_trxs_sba(trxs); + + if (ret == -EINVAL) + return -EINVAL; + + selected_trx = m_bts.get_suitable_trx(trxs); + + for (ts = 7; ts >= 0; ts--) { + pdch = &m_bts.bts_data()->trx[selected_trx].pdch[ts]; + if (!pdch->is_enabled()) + continue; + break; + } + if (ts < 0) + return -EINVAL; sba = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_sba); if (!sba) @@ -59,25 +77,10 @@ if (!gsm48_ta_is_valid(ta)) return -EINVAL; - for (trx = 0; trx < 8; trx++) { - for (ts = 7; ts >= 0; ts--) { - pdch = &m_bts.bts_data()->trx[trx].pdch[ts]; - if (!pdch->is_enabled()) - continue; - break; - } - if (ts >= 0) - break; - } - if (trx == 8) { - LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH available.\n"); - talloc_free(sba); - return -EINVAL; - } fn = (pdch->last_rts_fn + AGCH_START_OFFSET) % 2715648; - sba->trx_no = trx; + sba->trx_no = selected_trx; sba->ts_no = ts; sba->fn = fn; sba->ta = ta; @@ -85,9 +88,11 @@ llist_add(&sba->list, &m_sbas); m_bts.sba_allocated(); - *_trx = trx; + *_trx = selected_trx; *_ts = ts; *_fn = fn; + LOGP(DRLCMAC, LOGL_DEBUG, " sba fn=%d ts = %d trx = %d\n", fn, ts, selected_trx); + return 0; } diff --git a/src/tbf.cpp b/src/tbf.cpp index 0e4d6cc..0ad6490 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -395,7 +395,7 @@ for (ts = 0; ts < 8; ts++) { if (!tbf->pdch[ts]) continue; - + tbf->trx->current_load--; tbf->pdch[ts]->detach_tbf(tbf); tbf->pdch[ts] = NULL; } diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index bebb6ef..c5d85ba 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -2833,6 +2833,263 @@ ARRAY_SIZE(default_categories), }; +void test_multi_trx_test_same_capacity() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + the_bts.bts_data()->trx[1].pdch[4].enable(); + the_bts.bts_data()->trx[1].pdch[5].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); + +} + +void test_multi_trx_test_1_2_capacity() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->trx[1].pdch[4].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + + printf("=== end %s ===\n", __func__); + +} + +void test_multi_trx_test_1_4_capacity() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->trx[0].pdch[6].enable(); + the_bts.bts_data()->trx[0].pdch[7].enable(); + the_bts.bts_data()->trx[1].pdch[0].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); +} + +void test_multi_trx_test_release_alloc() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + + the_bts.bts_data()->trx[0].pdch[5].enable(); + the_bts.bts_data()->trx[1].pdch[0].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + tbf_free(dl_tbf); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + tbf_free(dl_tbf); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + tbf_free(dl_tbf); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); +} + +void test_multi_trx_test_same_capacity_dl_ul_combined() +{ + BTS the_bts; + static gprs_rlcmac_dl_tbf *dl_tbf; + static gprs_rlcmac_ul_tbf *ul_tbf; + uint8_t trx_no = 0xff; + uint8_t ms_class = 1; + uint8_t egprs_ms_class = 1; + + printf("=== start %s ===\n", __func__); + + setup_bts(&the_bts, 4); + the_bts.bts_data()->alloc_algorithm = alloc_algorithm_b; + the_bts.bts_data()->trx[1].pdch[4].enable(); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + ul_tbf = tbf_alloc_ul(the_bts.bts_data(), + dl_tbf->trx->trx_no, + dl_tbf->ms_class(), dl_tbf->ms()->egprs_ms_class(), + dl_tbf->tlli(), dl_tbf->ta(), dl_tbf->ms()); + OSMO_ASSERT(ul_tbf->trx->trx_no == 0); + + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 1); + dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, + ms_class, egprs_ms_class, 1); + OSMO_ASSERT(dl_tbf->trx->trx_no == 0); + ul_tbf = tbf_alloc_ul(the_bts.bts_data(), + dl_tbf->trx->trx_no, + dl_tbf->ms_class(), dl_tbf->ms()->egprs_ms_class(), + dl_tbf->tlli(), dl_tbf->ta(), dl_tbf->ms()); + OSMO_ASSERT(ul_tbf->trx->trx_no == 0); + + printf("=== end %s ===\n", __func__); + +} + +void test_multi_trx_test() +{ + printf("=== start %s ===\n", __func__); + test_multi_trx_test_same_capacity(); + test_multi_trx_test_1_2_capacity(); + test_multi_trx_test_1_4_capacity(); + test_multi_trx_test_release_alloc(); + test_multi_trx_test_same_capacity_dl_ul_combined(); + printf("=== end %s ===\n", __func__); + +} void test_packet_access_rej_epdan() { BTS the_bts; @@ -2900,6 +3157,7 @@ test_tbf_epdan_out_of_rx_window(); test_immediate_assign_rej(); test_packet_access_rej_epdan(); + test_multi_trx_test(); if (getenv("TALLOC_REPORT_FULL")) talloc_report_full(tall_pcu_ctx, stderr); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 2647551..2166776 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -35,6 +35,8 @@ The MS object cannot fully confirm an unexpected TLLI: 0x00004232, partly confirmed Modifying MS object, TLLI: 0x00002342 -> 0x00004232, already confirmed partly Modifying MS object, TLLI = 0x00004232, TA 4 -> 6 +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -123,6 +125,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=1 TLLI=0xffeeddcc DIR=DL STATE=RELEASING) ********** TBF ends here ********** Destroying MS object, TLLI = 0xffeeddcc +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -211,6 +215,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING) ********** TBF ends here ********** Destroying MS object, TLLI = 0xffeeddcc +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -514,6 +520,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -535,6 +543,8 @@ Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 Modifying MS object, TLLI = 0x00000000, TA 220 -> 0 TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to FLOW +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=1. ********** TBF starts here ********** @@ -1508,6 +1518,8 @@ Polling cannot be scheduled in this TS 7 (first control TS 4) msg block (BSN 2, CS-1): 07 01 04 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 MSG = 07 01 04 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. MS requests UL TBF on RACH, so we provide one @@ -1588,10 +1600,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -1674,10 +1699,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -1809,10 +1847,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654232 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(2) numpdch(1) prob1(4294967095) seleprob(0) btsnumpdch(1) +selected pro(4294967095)selected_trx(0) + sba fn=2654335 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654232 (17,39,22), SBFn=2654335 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8c f6 07 00 c0 0c 68 ab 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(2) numpdch(1) prob1(4294967095) seleprob(0) btsnumpdch(1) +selected pro(4294967095)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=1. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED) poll timeout for FN=2654292, TS=7 (curr FN 2654335) @@ -1886,10 +1937,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -1980,10 +2044,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654224 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) + sba fn=2654327 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654224 (17,31,14), SBFn=2654327 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b ee 07 00 c0 0c 60 6b 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -2065,10 +2142,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -2155,6 +2245,8 @@ PDCH(TS 7, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW), 0 TBFs, USFs = 00, TFIs = 00000000. Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) ********** TBF ends here ********** +trx(0) cur load(1) numpdch(1) prob1(4294967195) seleprob(0) btsnumpdch(1) +selected pro(4294967195)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. MS requests UL TBF on RACH, so we provide one @@ -2221,10 +2313,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -3279,8 +3384,10 @@ Allocating DL TBF: MS_CLASS=12/0 Creating MS object, TLLI = 0x00000000 Modifying MS object, TLLI = 0x00000000, MS class 0 -> 12 + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 Slot Allocation (Algorithm B) for class 12 - Rx=4 Tx=4 Sum Rx+Tx=5 Tta=2 Ttb=1 Tra=2 Trb=1 Type=1 - Skipping TS 0, because not enabled @@ -3318,8 +3425,10 @@ Modifying MS object, TLLI = 0x00000000, MS class 0 -> 12 Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 12 Enabled EGPRS for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), mode EGPRS + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 Slot Allocation (Algorithm B) for class 12 - Rx=4 Tx=4 Sum Rx+Tx=5 Tta=2 Ttb=1 Tra=2 Trb=1 Type=1 - Skipping TS 0, because not enabled @@ -3356,10 +3465,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -3449,10 +3571,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -3701,6 +3836,8 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL EGPRS) changes state from NULL to ASSIGN TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) starting timer 0. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) append +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4035,6 +4172,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4314,6 +4453,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4552,6 +4693,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4754,6 +4897,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -4934,6 +5079,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5095,6 +5242,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5252,6 +5401,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5396,6 +5547,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5541,6 +5694,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5592,6 +5747,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5643,6 +5800,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5694,6 +5853,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5764,6 +5925,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5834,6 +5997,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5904,6 +6069,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -5974,6 +6141,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6031,6 +6200,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6088,6 +6259,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6145,6 +6318,8 @@ Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Destroying MS object, TLLI = 0xffeeddcc ********** TBF ends here ********** +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6212,10 +6387,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -6337,8 +6525,10 @@ Modifying MS object, TLLI = 0x00000000, MS class 0 -> 11 Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 11 Enabled EGPRS for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), mode EGPRS + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 Slot Allocation (Algorithm B) for class 11 - Rx=4 Tx=3 Sum Rx+Tx=5 Tta=3 Ttb=1 Tra=2 Trb=1 Type=1 - Skipping TS 0, because not enabled @@ -6358,8 +6548,10 @@ DL TBF slots: 0x10, N: 1, WS: 192 ********** TBF update ********** PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL EGPRS), 0 TBFs, USFs = 00, TFIs = 00000000. + Use trx = 0 Searching for first unallocated TFI: TRX=0 Found TFI=0. + TREE trx = 0 TFI = 0 - Selected DL slots: (TS=0)"..DDDD.."(TS=7) Using 4 slots for DL - Assigning DL TS 2 @@ -6385,10 +6577,23 @@ MS requests UL TBF on RACH, so we provide one ra=0x73 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation + Valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) + sba fn=2654270 ts = 7 trx = 0 RX: [PCU <- BTS] RACH qbit-ta=31 ra=0x73, Fn=2654167 (17,25,9), SBFn=2654270 TX: Immediate Assignment Uplink (AGCH) - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=-1 USF=7 Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8b 29 07 00 c0 0c 5a 43 2b 2b 2b 2b 2b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. Got RLC block, coding scheme: CS-1, length: 23 (23)) @@ -6492,6 +6697,8 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL EGPRS) changes state from NULL to ASSIGN TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) starting timer 0. TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN EGPRS) append +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6844,9 +7051,18 @@ MS requests UL TBF on RACH, so we provide one ra=0x70 Fn=2654167 qta=31 is_11bit=0: MS requests single block allocation -No PDCH available. + Not valid TRX=0. + Not valid TRX=1. + Not valid TRX=2. + Not valid TRX=3. + Not valid TRX=4. + Not valid TRX=5. + Not valid TRX=6. + Not valid TRX=7. No PDCH resource for single block allocation.sending Immediate Assignment Uplink (AGCH) reject Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=4d 06 3a 10 70 8b 29 14 70 8b 29 14 70 8b 29 14 70 8b 29 14 0b 2b 2b +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(1) +selected pro(4294967295)selected_trx(0) Searching for first unallocated TFI: TRX=0 Found TFI=0. ********** TBF starts here ********** @@ -6871,3 +7087,1307 @@ TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to FLOW The MS object cannot fully confirm an unexpected TLLI: 0xffeeddcc, partly confirmed TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) append +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(4) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(2) prob1(4294967295) seleprob(4294967295) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967095) seleprob(0) btsnumpdch(4) +selected pro(4294967095)selected_trx(0) +trx(1) cur load(0) numpdch(2) prob1(4294967295) seleprob(4294967095) btsnumpdch(4) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967095) seleprob(0) btsnumpdch(4) +selected pro(4294967095)selected_trx(0) +trx(1) cur load(1) numpdch(2) prob1(4294967095) seleprob(4294967095) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(2) prob1(4294966895) seleprob(0) btsnumpdch(4) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(1) numpdch(2) prob1(4294967095) seleprob(4294966895) btsnumpdch(4) +selected pro(4294967095)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(2) prob1(4294966895) seleprob(0) btsnumpdch(4) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(2) numpdch(2) prob1(4294966895) seleprob(4294966895) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=2. + TREE trx = 0 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000005. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966695) seleprob(0) btsnumpdch(4) +selected pro(4294966695)selected_trx(0) +trx(1) cur load(2) numpdch(2) prob1(4294966895) seleprob(4294966695) btsnumpdch(4) +selected pro(4294966895)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=2. + TREE trx = 1 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000005. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966695) seleprob(0) btsnumpdch(4) +selected pro(4294966695)selected_trx(0) +trx(1) cur load(3) numpdch(2) prob1(4294966695) seleprob(4294966695) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=3. + TREE trx = 0 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 0000000a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(2) prob1(4294966495) seleprob(0) btsnumpdch(4) +selected pro(4294966495)selected_trx(0) +trx(1) cur load(3) numpdch(2) prob1(4294966695) seleprob(4294966495) btsnumpdch(4) +selected pro(4294966695)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=3. + TREE trx = 1 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 1): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 0000000a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(2) prob1(4294966495) seleprob(0) btsnumpdch(4) +selected pro(4294966495)selected_trx(0) +trx(1) cur load(4) numpdch(2) prob1(4294966495) seleprob(4294966495) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=4. + TREE trx = 0 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000015. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966295) seleprob(0) btsnumpdch(4) +selected pro(4294966295)selected_trx(0) +trx(1) cur load(4) numpdch(2) prob1(4294966495) seleprob(4294966295) btsnumpdch(4) +selected pro(4294966495)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=4. + TREE trx = 1 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000015. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966295) seleprob(0) btsnumpdch(4) +selected pro(4294966295)selected_trx(0) +trx(1) cur load(5) numpdch(2) prob1(4294966295) seleprob(4294966295) btsnumpdch(4) +Searching for first unallocated TFI: TRX=0 + Found TFI=5. + TREE trx = 0 TFI = 5 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 0000002a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(3) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967145) btsnumpdch(3) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294967145) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(2) prob1(4294966995) seleprob(0) btsnumpdch(3) +selected pro(4294966995)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294966995) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=2. + TREE trx = 0 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000005. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966845) seleprob(0) btsnumpdch(3) +selected pro(4294966845)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294966845) btsnumpdch(3) +selected pro(4294966995)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(2) prob1(4294966845) seleprob(0) btsnumpdch(3) +selected pro(4294966845)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966695) seleprob(4294966845) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=3. + TREE trx = 0 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 0000000a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(2) prob1(4294966695) seleprob(0) btsnumpdch(3) +selected pro(4294966695)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966695) seleprob(4294966695) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=4. + TREE trx = 0 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000015. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966545) seleprob(0) btsnumpdch(3) +selected pro(4294966545)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966695) seleprob(4294966545) btsnumpdch(3) +selected pro(4294966695)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=2. + TREE trx = 1 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000007. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(2) prob1(4294966545) seleprob(0) btsnumpdch(3) +selected pro(4294966545)selected_trx(0) +trx(1) cur load(3) numpdch(1) prob1(4294966395) seleprob(4294966545) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=5. + TREE trx = 0 TFI = 5 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 0000002a. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(6) numpdch(2) prob1(4294966395) seleprob(0) btsnumpdch(3) +selected pro(4294966395)selected_trx(0) +trx(1) cur load(3) numpdch(1) prob1(4294966395) seleprob(4294966395) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=6. + TREE trx = 0 TFI = 6 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL), 4 TBFs, USFs = 00, TFIs = 00000055. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(7) numpdch(2) prob1(4294966245) seleprob(0) btsnumpdch(3) +selected pro(4294966245)selected_trx(0) +trx(1) cur load(3) numpdch(1) prob1(4294966395) seleprob(4294966245) btsnumpdch(3) +selected pro(4294966395)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=3. + TREE trx = 1 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 4 TBFs, USFs = 00, TFIs = 0000000f. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(4) prob1(4294967295) seleprob(0) btsnumpdch(5) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(4) prob1(4294967170) seleprob(0) btsnumpdch(5) +selected pro(4294967170)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967170) btsnumpdch(5) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(4) prob1(4294967170) seleprob(0) btsnumpdch(5) +selected pro(4294967170)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294967170) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(4) prob1(4294967045) seleprob(0) btsnumpdch(5) +selected pro(4294967045)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294967045) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=2. + TREE trx = 0 TFI = 2 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"......D."(TS=7), single +Using single slot at TS 6 for DL +- Reserved DL/UL slots: (TS=0)"......C."(TS=7) +- Assigning DL TS 6 +PDCH(TS 6, TRX 0): Attaching TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000004. +- Setting Control TS 6 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=2 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 40, dl_slots = 40 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(3) numpdch(4) prob1(4294966920) seleprob(0) btsnumpdch(5) +selected pro(4294966920)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294966920) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=3. + TREE trx = 0 TFI = 3 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".......D"(TS=7), single +Using single slot at TS 7 for DL +- Reserved DL/UL slots: (TS=0)".......C"(TS=7) +- Assigning DL TS 7 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000008. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=3 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(4) numpdch(4) prob1(4294966795) seleprob(0) btsnumpdch(5) +selected pro(4294966795)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294966795) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=4. + TREE trx = 0 TFI = 4 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000011. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=4 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(4) prob1(4294966670) seleprob(0) btsnumpdch(5) +selected pro(4294966670)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966795) seleprob(4294966670) btsnumpdch(5) +selected pro(4294966795)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000003. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(5) numpdch(4) prob1(4294966670) seleprob(0) btsnumpdch(5) +selected pro(4294966670)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966670) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=5. + TREE trx = 0 TFI = 5 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000022. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=5 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(6) numpdch(4) prob1(4294966545) seleprob(0) btsnumpdch(5) +selected pro(4294966545)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966545) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=6. + TREE trx = 0 TFI = 6 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"......D."(TS=7), single +Using single slot at TS 6 for DL +- Reserved DL/UL slots: (TS=0)"......C."(TS=7) +- Assigning DL TS 6 +PDCH(TS 6, TRX 0): Attaching TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000044. +- Setting Control TS 6 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=6 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 40, dl_slots = 40 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(7) numpdch(4) prob1(4294966420) seleprob(0) btsnumpdch(5) +selected pro(4294966420)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966420) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=7. + TREE trx = 0 TFI = 7 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)".......D"(TS=7), single +Using single slot at TS 7 for DL +- Reserved DL/UL slots: (TS=0)".......C"(TS=7) +- Assigning DL TS 7 +PDCH(TS 7, TRX 0): Attaching TBF(TFI=7 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000088. +- Setting Control TS 7 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=7 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=7 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(8) numpdch(4) prob1(4294966295) seleprob(0) btsnumpdch(5) +selected pro(4294966295)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966295) seleprob(4294966295) btsnumpdch(5) +Searching for first unallocated TFI: TRX=0 + Found TFI=8. + TREE trx = 0 TFI = 8 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Possible DL/UL slots: (TS=0)"....CCCC"(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=8 TLLI=0x00000000 DIR=DL STATE=NULL), 3 TBFs, USFs = 00, TFIs = 00000111. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=8 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=8 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(3) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to RELEASING +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) free +PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) +Destroying MS object, TLLI = 0x00000000 +********** TBF ends here ********** +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(2) prob1(4294967295) seleprob(0) btsnumpdch(3) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967145) btsnumpdch(3) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to RELEASING +TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) free +PDCH(TS 0, TRX 1): Detaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=RELEASING) +Destroying MS object, TLLI = 0x00000000 +********** TBF ends here ********** +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967145) btsnumpdch(3) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 4, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"C......."(TS=7) +- Selected DL slots: (TS=0)"D......."(TS=7), single +Using single slot at TS 0 for DL +- Reserved DL/UL slots: (TS=0)"C......."(TS=7) +- Assigning DL TS 0 +PDCH(TS 0, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 0 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 01, dl_slots = 01 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294967145) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to RELEASING +TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=RELEASING) free +PDCH(TS 5, TRX 0): Detaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000. +Detaching TBF from MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=RELEASING) +Destroying MS object, TLLI = 0x00000000 +********** TBF ends here ********** +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(1) numpdch(2) prob1(4294967145) seleprob(0) btsnumpdch(3) +selected pro(4294967145)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294966995) seleprob(4294967145) btsnumpdch(3) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....CC.."(TS=7) +- Selected DL slots: (TS=0)".....D.."(TS=7), single +Using single slot at TS 5 for DL +- Reserved DL/UL slots: (TS=0)".....C.."(TS=7) +- Assigning DL TS 5 +PDCH(TS 5, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000002. +- Setting Control TS 5 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 20, dl_slots = 20 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(0) numpdch(1) prob1(4294967295) seleprob(0) btsnumpdch(2) +selected pro(4294967295)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294967295) btsnumpdch(2) +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=1/1 + Use trx = 0 +Searching for first unallocated TFI: TRX=0 + Found TFI=0. + TREE trx = 0 TFI = 0 +- Selected UL slots: (TS=0)"....U..."(TS=7) +Using 1 slots for UL +- Assigning UL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL), 1 TBFs, USFs = 01, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 00 +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to ASSIGN +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=ASSIGN) starting timer 3169. +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(1) prob1(4294966895) seleprob(0) btsnumpdch(2) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(0) numpdch(1) prob1(4294967295) seleprob(4294966895) btsnumpdch(2) +selected pro(4294967295)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=0. + TREE trx = 1 TFI = 0 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 00, TFIs = 00000001. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(1) prob1(4294966895) seleprob(0) btsnumpdch(2) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(1) numpdch(1) prob1(4294967095) seleprob(4294966895) btsnumpdch(2) +selected pro(4294967095)selected_trx(1) +Searching for first unallocated TFI: TRX=1 + Found TFI=1. + TREE trx = 1 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 1): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 00, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 1, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1/1 +Creating MS object, TLLI = 0x00000000 +Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 +Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 1 + Use trx = -1 +trx(0) cur load(2) numpdch(1) prob1(4294966895) seleprob(0) btsnumpdch(2) +selected pro(4294966895)selected_trx(0) +trx(1) cur load(2) numpdch(1) prob1(4294966895) seleprob(4294966895) btsnumpdch(2) +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +Slot Allocation (Algorithm B) for class 1 +- Rx=1 Tx=1 Sum Rx+Tx=2 Tta=3 Ttb=2 Tra=4 Trb=2 Type=1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Skipping TS 5, because not enabled +- Skipping TS 6, because not enabled +- Skipping TS 7, because not enabled +- Possible DL/UL slots: (TS=0)"....C..."(TS=7) +- Selected DL slots: (TS=0)"....D..."(TS=7), single +Using single slot at TS 4 for DL +- Reserved DL/UL slots: (TS=0)"....C..."(TS=7) +- Assigning DL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 01, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 10 +********** TBF starts here ********** +Allocating UL TBF: MS_CLASS=1/1 + Use trx = 0 +Searching for first unallocated TFI: TRX=0 + Found TFI=1. + TREE trx = 0 TFI = 1 +- Selected UL slots: (TS=0)"....U..."(TS=7) +Using 1 slots for UL +- Assigning UL TS 4 +PDCH(TS 4, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL), 2 TBFs, USFs = 03, TFIs = 00000003. +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL) +Allocated TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL): trx = 0, ul_slots = 10, dl_slots = 00 +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=NULL) changes state from NULL to ASSIGN +TBF(TFI=1 TLLI=0x00000000 DIR=UL STATE=ASSIGN) starting timer 3169. diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok index dc07fc7..f9dc63e 100644 --- a/tests/tbf/TbfTest.ok +++ b/tests/tbf/TbfTest.ok @@ -75,3 +75,15 @@ === start test_packet_access_rej_epdan === packet reject: 40 84 7f f7 6e e6 41 4b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b === end test_packet_access_rej_epdan === +=== start test_multi_trx_test === +=== start test_multi_trx_test_same_capacity === +=== end test_multi_trx_test_same_capacity === +=== start test_multi_trx_test_1_2_capacity === +=== end test_multi_trx_test_1_2_capacity === +=== start test_multi_trx_test_1_4_capacity === +=== end test_multi_trx_test_1_4_capacity === +=== start test_multi_trx_test_release_alloc === +=== end test_multi_trx_test_release_alloc === +=== start test_multi_trx_test_same_capacity_dl_ul_combined === +=== end test_multi_trx_test_same_capacity_dl_ul_combined === +=== end test_multi_trx_test === -- To view, visit https://gerrit.osmocom.org/1512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I222c3340872ffa1dd6e8fabe5276d793e660f67d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Fri Dec 30 13:44:10 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 13:44:10 +0000 Subject: osmo-pcu[master]: PDCH allocation across two TRX In-Reply-To: References: Message-ID: Patch Set 2: Code-Review-1 (5 comments) The same comments apply to pretty much all files. https://gerrit.osmocom.org/#/c/1512/2/src/bts.cpp File src/bts.cpp: Line 417: */ Add doxygen with explanation of the meaning of each function parameter and return value. Line 422: uint32_t free_tfis = 0xffffffff; Where does this magic value comes from? Can you use some define instead? Line 433: if (use_trx >= 0) If it only used as true/false than it should be bool. Line 435: else If I got this right than you can check _trx for NULL and use 1 function parameter instead of 2. Line 554: trx_from = 0; You can put this directly into for () if it's not used anywhere else. -- To view, visit https://gerrit.osmocom.org/1512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I222c3340872ffa1dd6e8fabe5276d793e660f67d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Fri Dec 30 14:14:33 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 14:14:33 +0000 Subject: [PATCH] libosmo-abis[master]: Remove code duplication, extend logging Message-ID: Review at https://gerrit.osmocom.org/1515 Remove code duplication, extend logging Call function to obtain IPA address once and use the result. Also, log explicitly IP address and ports to which IPA is bound. Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae --- M src/input/ipaccess.c 1 file changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/15/1515/1 diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 35465e3..09c9ec5 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -839,11 +839,13 @@ switch(line->ops->cfg.ipa.role) { case E1INP_LINE_R_BSC: { struct ipa_server_link *oml_link, *rsl_link; + const char *ipa = e1inp_ipa_get_bind_addr(); - LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BSC mode\n"); + LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BSC mode on %s " + "with OML %u and RSL %u TCP ports\n", ipa, + IPA_TCP_PORT_OML, IPA_TCP_PORT_RSL); - oml_link = ipa_server_link_create(tall_ipa_ctx, line, - e1inp_ipa_get_bind_addr(), + oml_link = ipa_server_link_create(tall_ipa_ctx, line, ipa, IPA_TCP_PORT_OML, ipaccess_bsc_oml_cb, NULL); if (oml_link == NULL) { @@ -857,8 +859,7 @@ ipa_server_link_destroy(oml_link); return -EIO; } - rsl_link = ipa_server_link_create(tall_ipa_ctx, line, - e1inp_ipa_get_bind_addr(), + rsl_link = ipa_server_link_create(tall_ipa_ctx, line, ipa, IPA_TCP_PORT_RSL, ipaccess_bsc_rsl_cb, NULL); if (rsl_link == NULL) { -- To view, visit https://gerrit.osmocom.org/1515 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae Gerrit-PatchSet: 1 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max From gerrit-no-reply at lists.osmocom.org Fri Dec 30 14:38:32 2016 From: gerrit-no-reply at lists.osmocom.org (Max) Date: Fri, 30 Dec 2016 14:38:32 +0000 Subject: [PATCH] libosmo-abis[master]: Remove code duplication, extend logging In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1515 to look at the new patch set (#2). Remove code duplication, extend logging Call function to obtain IPA address once and use the result. Log explicitly IP address and ports to which IPA is bound or connected. Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae --- M src/input/ipaccess.c 1 file changed, 9 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/15/1515/2 diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 35465e3..675f07a 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -839,11 +839,13 @@ switch(line->ops->cfg.ipa.role) { case E1INP_LINE_R_BSC: { struct ipa_server_link *oml_link, *rsl_link; + const char *ipa = e1inp_ipa_get_bind_addr(); - LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BSC mode\n"); + LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BSC mode on %s " + "with OML %u and RSL %u TCP ports\n", ipa, + IPA_TCP_PORT_OML, IPA_TCP_PORT_RSL); - oml_link = ipa_server_link_create(tall_ipa_ctx, line, - e1inp_ipa_get_bind_addr(), + oml_link = ipa_server_link_create(tall_ipa_ctx, line, ipa, IPA_TCP_PORT_OML, ipaccess_bsc_oml_cb, NULL); if (oml_link == NULL) { @@ -857,8 +859,7 @@ ipa_server_link_destroy(oml_link); return -EIO; } - rsl_link = ipa_server_link_create(tall_ipa_ctx, line, - e1inp_ipa_get_bind_addr(), + rsl_link = ipa_server_link_create(tall_ipa_ctx, line, ipa, IPA_TCP_PORT_RSL, ipaccess_bsc_rsl_cb, NULL); if (rsl_link == NULL) { @@ -878,7 +879,9 @@ case E1INP_LINE_R_BTS: { struct ipa_client_conn *link; - LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BTS mode\n"); + LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BTS mode, " + "OML connecting to %s:%u\n", line->ops->cfg.ipa.addr, + IPA_TCP_PORT_OML); link = ipa_client_conn_create(tall_ipa_ctx, &line->ts[E1INP_SIGN_OML-1], -- To view, visit https://gerrit.osmocom.org/1515 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae Gerrit-PatchSet: 2 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sat Dec 31 13:10:30 2016 From: gerrit-no-reply at lists.osmocom.org (Vadim Yanitskiy) Date: Sat, 31 Dec 2016 13:10:30 +0000 Subject: libosmocore[master]: libosmocoding: migrate transcoding routines from OsmoBTS In-Reply-To: References: Message-ID: Patch Set 9: > @Vadim: What does it take to move this forward? It saddens me that > your work looks like "almost complete" for months but still not > ready to merge. Hi Harald! Thanks for your attention! Sorry for delayed answer... Regarding to me, I am currently a bit busy with my educational process. Earlier the next month, I'll try to finish this change. Regarding to the change, there is a problem: despite all tests pass without any problems on my machine, some tests fail on Jenkins. I will try to find out, what's wrong. Also, there is a question, which isn't answered so far. As I already mentioned, the migrated code applies puncture for GPRS specific codes itself. So, I need to know, which approach is better: 1) To write additional non-punctured code definitions, and use them. As Tom said, this approach is better in terms of performance. 2) Rewrite the code to use shared code definitions from libosmocore/ src/gsm0503_conv.c. PS: Holiday greetings! -- 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: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder 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 Sat Dec 31 17:27:40 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 31 Dec 2016 17:27:40 +0000 Subject: [PATCH] openbsc[master]: fix 'osmo-nitb --version' segfault In-Reply-To: References: Message-ID: Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1509 to look at the new patch set (#2). fix 'osmo-nitb --version' segfault Call vty_init() before handle_options() to make sure the host.app_info is populated before --version potentially tries to print it. The segfault was introduced by 2c05f75bbf3d9a69eee1fe78eb5552acf1d7671d in a recent MSC-split merge. Change-Id: Ice91256d72b9eabd52709352ba6cc6a42af2921b --- M openbsc/src/osmo-nitb/bsc_hack.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/09/1509/2 diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 992d4c8..bbcdd1b 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -269,6 +269,7 @@ osmo_init_logging(&log_info); osmo_stats_init(tall_bsc_ctx); bts_init(); + vty_init(&vty_info); /* Parse options */ handle_options(argc, argv); @@ -282,7 +283,6 @@ } /* Initialize VTY */ - vty_init(&vty_info); bsc_vty_init(&log_info, bsc_gsmnet); ctrl_vty_init(tall_bsc_ctx); -- To view, visit https://gerrit.osmocom.org/1509 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ice91256d72b9eabd52709352ba6cc6a42af2921b Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max From gerrit-no-reply at lists.osmocom.org Sat Dec 31 18:09:00 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 31 Dec 2016 18:09:00 +0000 Subject: osmo-pcu[master]: PDCH allocation across two TRX In-Reply-To: References: Message-ID: Patch Set 2: (8 comments) just a few remarks... https://gerrit.osmocom.org/#/c/1512/2/src/bts.cpp File src/bts.cpp: Line 417: */ > Add doxygen with explanation of the meaning of each function parameter and though this particular one is not being added by this patch, I agree that this as well as the new functions could use more detailed docs. Line 422: uint32_t free_tfis = 0xffffffff; > Where does this magic value comes from? Can you use some define instead? (makes sense to me: all bits set in a uint32_t flagging all as free) Line 433: if (use_trx >= 0) > If it only used as true/false than it should be bool. use_trx indicates a TRX number, so it's not bool Line 435: else > If I got this right than you can check _trx for NULL and use 1 function par no, _trx needs to be returned in all cases. Also not related to this patch... Line 462: * indicate errors. document the size of the *_trx array https://gerrit.osmocom.org/#/c/1512/2/src/gprs_rlcmac_ts_alloc.cpp File src/gprs_rlcmac_ts_alloc.cpp: Line 386: LOGP(DRLCMAC, LOGL_DEBUG, " Use trx = %d \n",use_trx); what with the whitespaces at start and end of log lines? https://gerrit.osmocom.org/#/c/1512/2/tests/tbf/TbfTest.cpp File tests/tbf/TbfTest.cpp: Line 2852: dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, trx_no, store the_bts.bts_data() in a local var with a short name Line 2856: ms_class, egprs_ms_class, 1); it would be far more readable to declare a macro containing the tbf_alloc and assert, and just call that macro repeatedly with alternating argument. ASSERT_TBF_ALLOC_ON_TRX(0); ASSERT_TBF_ALLOC_ON_TRX(1); ASSERT_TBF_ALLOC_ON_TRX(0); ASSERT_TBF_ALLOC_ON_TRX(1); ... -- To view, visit https://gerrit.osmocom.org/1512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I222c3340872ffa1dd6e8fabe5276d793e660f67d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: arvind.sirsikar Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Sat Dec 31 18:33:43 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 31 Dec 2016 18:33:43 +0000 Subject: osmo-gsm-manuals[master]: Diagrams of relationship between osmo-{pcu, bts, nitb, sgsn} ar... In-Reply-To: References: Message-ID: Patch Set 1: Code-Review-1 (9 comments) https://gerrit.osmocom.org/#/c/1514/1//COMMIT_MSG Commit Message: Line 7: Diagrams of relationship between osmo-{pcu,bts,nitb,sgsn} are added commit log conventions: * have one summary line at the top, less than 80 chars (even better: less than 60 chars) * use present tense imperative, e.g. "add diagrams" * prefix the general area: "OsmoBSC, OsmoBTS:..." e.g. "BSC,BTS: add diagrams of PCU-BTS-NITB-SGSN relationships" https://gerrit.osmocom.org/#/c/1514/1/OsmoBSC/chapters/overview.adoc File OsmoBSC/chapters/overview.adoc: Line 16: The difference between classic The difference between classic GSM network please read your own text. This is clearly some copy paste bug. No whitespace at ends of lines. Line 18: in next figures. rather use direct references: in <> and <>. Line 33: HLR [label="HLR/AUC"] BSC, EIR and SMSC are not declared. That may be the reason for differening ordering of the rightmost elements in the rendered graphs. Line 69: HLR [label="HLR/AUC"] again EIR, SMSC missing Line 70: BSC->MSC [label="A"] well, it would be nice to have an actual A interface, but we don't. What else could we write here? "internal API"? Or maybe rather don't label the arrows within the NITB at all? Line 74: } should we add indicators for an external MNCC? https://gerrit.osmocom.org/#/c/1514/1/OsmoBTS/chapters/interfaces.adoc File OsmoBTS/chapters/interfaces.adoc: Line 116: The GPRS network architecture including PCU in BTS is presented below. "to present" is more like someone talking. Rather say "shown". You can't rely on the ordering. Some layouts may put the diagrams on other pages. Rather use a reference: ...is shown in <>. Line 125: MS1 [label="MS"] BTS, BSC, MSC, PCU, SGSN not declared. It seems to work to just declare them implicitly, but IIUC by explicit declaration the ordering of the graph items will remain fixed. -- To view, visit https://gerrit.osmocom.org/1514 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0eb09706efb768fa4f6810872fb6568cbc9838cb Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Owner: ikostov Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes From gerrit-no-reply at lists.osmocom.org Sat Dec 31 18:41:43 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 31 Dec 2016 18:41:43 +0000 Subject: [PATCH] libosmo-abis[master]: ipaccess_line_update(): log connection IP addresses and ports In-Reply-To: References: Message-ID: Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1515 to look at the new patch set (#3). ipaccess_line_update(): log connection IP addresses and ports Remove dup: call function to obtain IPA address only once. Log explicitly IP address and ports to which IPA is bound or connected. Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae --- M src/input/ipaccess.c 1 file changed, 9 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/15/1515/3 diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 35465e3..675f07a 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -839,11 +839,13 @@ switch(line->ops->cfg.ipa.role) { case E1INP_LINE_R_BSC: { struct ipa_server_link *oml_link, *rsl_link; + const char *ipa = e1inp_ipa_get_bind_addr(); - LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BSC mode\n"); + LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BSC mode on %s " + "with OML %u and RSL %u TCP ports\n", ipa, + IPA_TCP_PORT_OML, IPA_TCP_PORT_RSL); - oml_link = ipa_server_link_create(tall_ipa_ctx, line, - e1inp_ipa_get_bind_addr(), + oml_link = ipa_server_link_create(tall_ipa_ctx, line, ipa, IPA_TCP_PORT_OML, ipaccess_bsc_oml_cb, NULL); if (oml_link == NULL) { @@ -857,8 +859,7 @@ ipa_server_link_destroy(oml_link); return -EIO; } - rsl_link = ipa_server_link_create(tall_ipa_ctx, line, - e1inp_ipa_get_bind_addr(), + rsl_link = ipa_server_link_create(tall_ipa_ctx, line, ipa, IPA_TCP_PORT_RSL, ipaccess_bsc_rsl_cb, NULL); if (rsl_link == NULL) { @@ -878,7 +879,9 @@ case E1INP_LINE_R_BTS: { struct ipa_client_conn *link; - LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BTS mode\n"); + LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BTS mode, " + "OML connecting to %s:%u\n", line->ops->cfg.ipa.addr, + IPA_TCP_PORT_OML); link = ipa_client_conn_create(tall_ipa_ctx, &line->ts[E1INP_SIGN_OML-1], -- To view, visit https://gerrit.osmocom.org/1515 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae Gerrit-PatchSet: 3 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder From gerrit-no-reply at lists.osmocom.org Sat Dec 31 18:41:47 2016 From: gerrit-no-reply at lists.osmocom.org (Neels Hofmeyr) Date: Sat, 31 Dec 2016 18:41:47 +0000 Subject: libosmo-abis[master]: ipaccess_line_update(): log connection IP addresses and ports In-Reply-To: References: Message-ID: Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/1515 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I841c40abdcba0fdd695a43231391c5d7cee20fae Gerrit-PatchSet: 3 Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No