Commit Graph

54 Commits

Author SHA1 Message Date
Max 34be86b93c 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
2017-01-06 11:37:52 +00:00
Neels Hofmeyr e235441f73 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
2016-12-02 12:09:15 +00:00
Neels Hofmeyr 2d521a0296 move to libcommon-cs: net init 2: move bsc_network_init decl to new .h
bsc_network_init() is more fit to live in a BSC specific header, move it to new
common_bsc.h. It will probably also absorb the BSC-specific part of gsm_network
in the future.

Adjust header includes across the board. Particularly, fix abis_nm.h by
explicitly including gsm_data.h: it so far relied on other headers to do that,
which now is no longer always given.

Change-Id: I9edfb1e748bb1cb484fadd48b0406f5b3098e89b
2016-11-24 16:58:31 +01:00
Neels Hofmeyr 27681a3407 move to libcommon-cs: net init 1: rename to bsc_network_init
The gsm_network_init() function initializes a whole lot of BSC specific stuff.
Aiming to move some of it to libcommon-cs, first rename it to bsc_network_init().
This will retain the BSC specific stuff when the move is done.

Adjust all callers.

Future: osmo-cscn will call the more generic part and not the BSC specific
part.

Change-Id: I4816ae19374390fc5c64972f7cad2e9ec3d8bcc3
2016-11-24 16:58:31 +01:00
Neels Hofmeyr 402006dfdf define mncc_recv_cb_t to avoid code dup
Put mncc_recv_cb_t in common_cs.h to avoid header include complications: if placing
right above struct gsm_network, one must include gsm_data.h to use
mncc_recv_cb_t as function parameter in a header, which will include
gsm_data_shared.h, which will include common_cs.h (future knowledge). Since I will
need to use mncc_recv_cb_t in common_cs.h, including gsm_data.h from there would
introduce an #include loop. Avoid that and define mncc_recv_cb_t in common_cs.h to
begin with.

Change-Id: I2e64cffa563750ce9f3172ffba6f9cf5b9280e9c
2016-11-24 16:58:30 +01:00
Max b6591072d8 Log use of incompatible BS-AG-BLKS-RES value
There's "channel-descrption bs-ag-blks-res" vty command which sets
BS-AG-BLKS-RES which might be too high if CCCH is combined with
SDCCHs. Previously proper value was silently enforced. Log this
situation explicitly and add spec reference to the comment.

Change-Id: I53e2b881fc28472d6709f063fb265a4e6a0fffcd
2016-10-13 08:35:24 +00:00
Neels Hofmeyr dab3e34d0b log VTY telnet bind only once
After libosmocore 55dc2edc89c1a85187ef8aafc09f7d922383231f which outputs
'telnet at <ip> <port>' from telnet_init_dynif(), there's no need to log the
telnet VTY bind here anymore.

Change-Id: I97a730b28759df1d549a5049f47a3da1c16a3447
2016-09-27 05:00:18 +00:00
Neels Hofmeyr 77c8d5ffb5 mscsplit: gsm_network_init(): add explicit root talloc ctx
Decouple the root talloc context from libbsc's global talloc_bsc_ctx.

This allows to define the root talloc ctx from a main() scope, which in turn
helps decouple libmsc from libbsc.

Change-Id: I92f6b47b1eeea2e8f3fba66f25d7e708e5659f8a
2016-09-26 02:25:46 +02:00
Neels Hofmeyr 0ce98c749a mscsplit: bsc_init: don't pass telnet dummy conn
We want to create the telnet for VTY only after reading the config file, and
the dummy_conn was a workaround to be able to do so, but is not needed:
gsmnet_from_vty() used to expect vty->priv to point to a gsm_network struct,
but that is not actually the case anymore. It is using a static pointer to
store the gsm_network struct instead.

Change-Id: I51e7224c5a4cd5baf564bee871cf2fa6e885cda7
2016-09-26 02:25:46 +02:00
Alexander Couzens b847a21fa4 libmsc/bsc: split rate counters into bsc and msc group
Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de>
Change-Id: I7361033cd1eb919ec3c2ea2652f40ab8c75b2f99
2016-08-29 18:56:20 +02:00
Alexander Couzens 20423ea6cf libbsc/libmsc: convert old osmo counter into rate_ctrgs
rate counters support the export to statsd and can have a delta value.

Change-Id: Ie749cebd53a0bb618d0e23d375885712078bf8dd
2016-08-27 01:58:19 +00:00
Neels Hofmeyr b8afb5fda2 dyn PDCH: send PDCH ACT for each TCH/F_PDCH on TS Enable
Add dyn_pdch_init() in new file bsc_dyn_pdch.c (new file to avoid linking
issues; bsc_init.c would create undefined references, and putting in a new file
is the easiest solution).

Call dyn_pdch_init() from nm_statechg_event() whenever a TS is enabled.

Revert the |= TS_F_PDCH_MODE chunk from previous commit, since this flag will
now be set after dyn_pdch_init() sent out the PDCH ACT and when subsequently
the PDCH ACT ACK messages are received in rsl_rx_pdch_act_ack().

Change-Id: I0cad93dec59d546b3f3b19e332e0833496031575
2016-06-14 10:18:19 +00:00
Andreas Eversberg 9df268e217 dyn PDCH: Automatically deactivate/activate PDCH on TCH/F+PDCH channel
Handle shared TCH/F+PDCH channels as regular TCH/F channels. Prior to
activation, deactivate PDCH mode.

After deactivation, restore PDCH mode.

Change-Id: I59712b8769cc3959ef114a6e12e77801816fe8b6
2016-06-14 10:18:19 +00:00
Max c08ee71bff Move DTX settings to BTS
* Add per-BTS DTX settings
* Configure Uplink and Downlink DTX separately
* Deprecate global DTX option (it was never tested/used anyway)
* Use libosmocore function for DTX indicator in System
  Information (previously it was incorrectly assigned for half-rate
  channels)

Related: OS#22
Change-Id: I3d55168475ad47044b6238b55846ea22bdd518a4
Reviewed-on: https://gerrit.osmocom.org/40
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-17 16:17:54 +00:00
Max 59a1bf3dae Add basic SI2quater support
* support for sending arbitrary static SI2quater.
* vty interface for neightbor EARFCNs specific to SI2quater.
* dynamic generation of SI2quater messages.
* unit test for SI2quater messages.

Fixes: OS#1630
2016-04-16 13:47:56 +02:00
Max f3f3505f49 Add SI2quater support to SI3
Advertise SI2 quater presence and location (if available) using SI3
according to 3GPP TS 44.018 § 10.5.2.34
2016-04-16 13:47:52 +02:00
Max 687f048ab0 Fix segfault with broken config
Fixes OS#1691
2016-04-11 10:22:55 +02:00
Neels Hofmeyr fa0f71526c enable telnet VTY bind address config for various programs
Following the 'line vty'/'bind A.B.C.D' command added in libosmocore, use the
configured address to set the telnet bind for the VTY line. It is now possible
to publish the VTY on a specific local interface (including 0.0.0.0 aka "any").

Implement in all of:
  osmo-gbproxy
  osmo-gtphub
  osmo-sgsn
  osmo-bsc
  osmo-bsc_nat
  osmo-bsc_mgcp
  osmo-nitb

In some of these main programs, move the telnet initialization below the
configuration parsing.

Historically, this was not a good idea for programs using bsc_init.c (aka
bsc_bootstrap_network()), since they expected a gsm_network struct pointer in
((struct telnet_connection*)vty->priv)->priv, so that telnet had to be either
initialized or replaced by a dummy struct. In the meantime, the gsm_network
struct is not actually looked up in a priv pointer but in the static bsc_vty.c
scope (bsc_gsmnet), so this limitation is mere legacy (even though said legacy
is still there in an "#if 0" chunk).

In the other binaries I have briefly looked at the init sequence dependencies
and found no reason to initialize telnet above the config file parsing. In any
case, I have tested every single one of abovementioned binaries to verify that
they still parse the example config successfully and launch, allowing VTY
connections on the configured address(es). I hope this suffices.

In all of the above, log VTY address and port. LOGL_INFO is disabled by default
in some of the logging scopes, and since it is a single log message right at
program launch, I decided for the slightly more aggressive LOGL_NOTICE.
2016-02-25 12:18:03 +01:00
Harald Welte a2bbc5ec0e Fix TSC/BSIC handling bug and remove bts->tsc
This fixes a bug in the following circumstances:
* BSIC is set to 0 in the config file
* No TSC is explicitly specified at the BST level in the config file

In this case, we ended up using BSIC=0 and TSC=7, as TSC=7 is our
default initialization value.

The TSC of the CCCH/BCCH must always be the BCC, which is the lower 3
bits of the BSIC.  Having configuration options for both the BSIC _and_
the TSC at the BTS level therefore makes no sense, as it only adds ways
in which users can configure non-oprational configurations.  So we
remove the bts->tsc member, and keep only the ts->tsc members that allow
us to configure a timeslot-specific TSC that's different from the BTS
TSC (= BCC).
2015-11-20 10:43:31 +01:00
Andreas Eversberg 4d4944a07d Add option to set RADIO LINK TIMEOUT value via VTY 2015-08-17 16:31:35 +02:00
Holger Hans Peter Freyther 57ee780789 bts: Arfcn can never be smaller than 0
Remove the condition because it can never be true.

Fixes: Coverity CID#1307793
2015-06-20 18:45:35 +02:00
Michael McTernan c58a1e573b Fix GSM900 ARFCN range check
Allow ARFCN 0 to be used in GSM900 band.
2015-06-19 20:51:43 +02:00
Alexander Chemeris c36a13b073 libbsc: Move SIs update/generation for a BTS into a separate function.
The code to do that doesn't belong to the control interface, so
abstract it out to a separate function gsm_bts_set_system_infos().

[hfreyther: Fix the coding style...]
2015-06-02 08:43:29 +02:00
Holger Hans Peter Freyther a49b2c010e bsc: Allow to generate new system information online
Increase the bcch_change_mark and generate a new copy of the
system information. Make the method public, add a small test
case. Manually verified using the FakeBTS. I don't know if
the MS will re-read these SIs.

Related: SYS#739
2014-11-21 11:23:47 +01:00
Harald Welte 55dc31e781 Use port number #defines for VTY and CTRL ports
.. as defined in libosmocore
2014-08-24 17:54:49 +02:00
Holger Hans Peter Freyther f0167ddfc2 hsl: Remove the support for the HSL bts from OpenBSC
The support has been implemented for an old model, we were told that
newer versions would be made incompatible with OpenBSC. Ther are
various warnings in the code and coverity has found some new ones.

Just remove the code as we don't know of anyone using this code.
2013-07-03 16:19:41 +02:00
Andreas Eversberg f2621e506d si: Do not schedule SI1 to SI4 on the second TRX 2013-01-08 19:34:24 +01:00
Holger Hans Peter Freyther de1674ab02 bts: Really drop the BTS in case of an OML NACK
The previous code didn't work as expected. The trx and dst pointer
are located in an union and in the case of the Abis code the dst
is used to point to the signalling link timeslot and not the TRX.

The is_ipaccess_bts always returned false because the dst was casted
to a trx while it was no trx.

This fix was tested with the nack_test/NACKTest.st of the test repo.
2012-11-11 18:33:17 +01:00
Andreas Eversberg 2ee7ecddeb Allow setting of Control Channel Description parameters via VTY 2012-10-18 12:01:32 +02:00
Holger Hans Peter Freyther 94c2b0578b bsc: Do not print "SI 18" but SI2ter when the SI generation fails 2012-10-09 11:54:00 +02:00
Harald Welte d9173c3fce bsc_init: Don't drop all BTSs because a single BTS had an error 2012-10-08 21:17:51 +02:00
Holger Hans Peter Freyther d98136d25c bsc_init: Initialize rc on all paths to address a compiler warning
bsc_init.c:203:6: warning: ‘rc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
bsc_init.c:101:6: note: ‘rc’ was declared here
2012-09-11 12:41:23 +02:00
Andreas Eversberg c50543b18a Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.

A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-03-01 08:29:56 +01:00
Harald Welte 1fe73a19cd ARFCNs are in the range of 0..1023, not 0..1024
I'm sure I read somewhere that it actually was 0..1024, as I kept
wondering how stupid it was to use 10bit+1.  However, that source
was incorrect, as GSM TS 05.05 quite clearly states 0..1023
2012-01-29 13:24:12 +01:00
Holger Hans Peter Freyther df82b72375 bsc: Drop the BTS instead of exiting the application
When the BTS reboots it might not want to accept our BTS Attr,
do not leave the bsc_msc_ip/bsc_nitb but simply drop the BTS
connection.

Manually cherry-picked from: 54e6c8b3400b376ed36fe84f28f7930d2d9ff24b
2011-10-12 08:30:22 +02:00
Alexander Huemer e1d2e1c74c fix some "implicit declaration" warnings in libbsc 2011-09-06 09:32:14 +02:00
Pablo Neira Ayuso ed5cacb240 src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.

The main changes are:

- The directory libabis/ has been removed as it now lives in
  libosmo-abis.

- new configuration file format for nanoBTS and HSL femto, we
  need to define the virtual e1_line and attach it to the OML
  link.

- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
  BS11 and rbs2000) now use the new libosmo-abis framework.

- use r232 input driver available in libosmo-abis for bs11_config.

- use ipa_msg_recv instead of old ipaccess_read_msg function.

- delete definition of gsm_e1_subslot and input_signal_data.
  These structures now lives in libosmo-abis.

Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.

This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:

- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node

This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-19 22:38:35 +02:00
Dieter Spaar 1664602476 Initial version of Support for Nokia *Site BTS
This includes the MetroSite, but also other Nokia BTS models.
2011-08-10 10:51:01 +02:00
Holger Hans Peter Freyther fe1ca353bb bts-init: Initialize the BTS like it will look after a reset
Reset the BTS MO State on BTS bootstrap. This way we will always
test the BTS disconnect/reconnect case of the BTS.

Do not reset the administrative state of objects. The BSC might
have set these and wants to maintain them across disconnect/
reconnect. Right now this is true for the TRX state.
2011-07-18 11:35:56 +02:00
Harald Welte b7849987e5 properly reset the MO state of all MO on Abis disconnect
When we loose the A-bis link, we should properly re-set the
administrative, operational and availability state of all MOs
2011-06-29 16:49:03 +02:00
Harald Welte d64c0bca17 gsm_data_shared: introduce 'struct gsm_abis_mo'
... as a common wrapper around nm_attr and nm_state
2011-06-03 14:03:27 +02:00
Harald Welte 80cffaf323 Move system information related defines and code to libosmocore
This brings openbsc in sync with the following libosmocore commit:
b5503136fa234690d5493b19a8aee3a4ef74190d
2011-05-24 15:02:20 +02:00
Pablo Neira Ayuso 0d2881ad58 bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.

This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.

I added two new attributes to the gsm_bts object, they are:

* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.

* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().

Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.

While I was at it, I added several changes/cleanups to this patch:

* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.

* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.

* Add missing e1inp_init() in osmo-bsc.

* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-22 21:03:35 +02:00
Pablo Neira Ayuso 6e52b88a17 bsc: fix bail out in case of problems bootstrapping BTS or E1 input
The error message was missing in case of problems bootstrapping the BTS.
The E1 input driver initialization was displayed in the standard output,
now this error is reported via logs.
2011-05-22 21:02:04 +02:00
Pablo Neira Ayuso c0d17f2266 src: use namespace prefix osmo_* for misc utils
Summary of changes:

s/bcd2char/osmo_bcd2char/g
s/char2bcd/osmo_char2bcd/g
s/hexparse/osmo_hexparse/g
s/hexdump/osmo_hexdump/g
s/hexdump_nospc/osmo_hexdump_nospc/g
s/ubit_dump/osmo_ubit_dump/g
s/static_assert/osmo_static_assert/g
2011-05-07 12:58:59 +02:00
Pablo Neira Ayuso dfb342c19a src: use namespace prefix osmo_counter*
Summary of changes:

s/struct counter/struct osmo_counter/g
s/counter_inc/osmo_counter_inc/g
s/counter_get/osmo_counter_get/g
s/counter_reset/osmo_counter_reset/g
s/counter_alloc/osmo_counter_alloc/g
s/counter_free/osmo_counter_free
2011-05-06 12:14:16 +02:00
Pablo Neira Ayuso bbc5b99a6b src: use namespace prefix osmo_signal*
Summary of changes:

s/signal_cbfn/osmo_signal_cbfn/g
s/register_signal_handler/osmo_signal_register_handler/g
s/unregister_signal_handler/osmo_signal_unregister_handler/g
s/dispatch_signal/osmo_signal_dispatch/g
2011-05-06 12:12:31 +02:00
Holger Hans Peter Freyther 5a081bbb1d paging: Initialize structs internally to avoid a crash
The code to create the struct gsm_bts is in libcommon right now
and we can not call paging_init from there. Right now it appears
to be the easiest of doing the init internally.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther b326100b12 misc: Fix compiler warnings in the code 2011-04-07 23:34:54 +02:00
Pablo Neira Ayuso 136f453dd2 src: use new library libosmogsm and new path to headers in libosmocore
libosmogsm is a new library that is distributed in the libosmocore.
Now, openbsc depends on it. This patch gets openbsc with this
change.

This patch also rewrites all include path to the new
osmocom/[gsm|core]

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:17:56 +01:00