Commit Graph

74 Commits

Author SHA1 Message Date
Harald Welte a7263b6474 Fix license headers.
We have licensed the code under GNU Afffero Public License,
and state that in the first paragraph as well as in the link
to the license.  However, a paragraph in the middle stated
"see the GNU General Public License", which is somewhat misleading.

Let's fix that.

Change-Id: I37e503b195fe43e1da42c080900504ca8e682e76
2024-02-17 10:21:30 +01:00
Pau Espin c4e836838d Move trx->rsl_link to trx->bb_transc.rsl.link
The RSL link is configured/set up by the BBTRANSC NM object, hence move
it to the appropiate substruct.

Related: OS#5253
Change-Id: I62937cbd81c27274b9f5f70d454d5319a6898c7b
2023-09-19 09:15:08 +00:00
Pau Espin 9aaaacc7aa oml: Store RSL connect related fields in bb_transc
This is a preparation commit towards delaying connection of RSL tcp
socket until the BBTRANSC object is OPSTARTed, as it is the case already
in nanoBTS.

Related: OS#5253
Change-Id: Ia571ec19e9e8f8a6d7c2554642aab0afe1b4b917
2023-09-19 09:15:08 +00:00
Pau Espin cd3d71b318 abis: Avoid TCP/IPA RSL sockets continue conn establishment while shutting down
when something fails in osmo-bts during startup and it goes into SHUTDOWN state,
it is desirable to close new RSL links (sockets) which are in progress to connect,
while it waits for a while to complete shutdown (power ramping down, etc.).
This way we don't end up with new interactions and new state against a BSC if we
are shutting down.

The new libosmo-abis API is used since the higher layer struct e1inp_sign_link assigned
to each struct gsm_bts_trx is not provided to the osmo-bts code layer by libosmo-abis API
until the TCP+IPA handshake in the socket becomes fully established (sign_link_up()
callback).

Depends: libosmo-abis.git Ia6418321f3b6f1f7274efd414625a4b10a09a362
Change-Id: I599d074f51f490b43c9a89b105d1823391926947
2022-09-16 20:56:00 +02:00
Pau Espin 5c705a676d abis: Try one reconnect to previously connected BSC before trying next one
This way we keep all BTS connected to the same BSC if there was a
spurious network problem.

Related: SYS#4971
Change-Id: I16b75da5987584d099edc3a640f3a5cd61f3ad69
2021-11-03 20:21:28 +01:00
Pau Espin 84dceb5245 abis: Drop unneded if condition in else clause
priv->current_bsc will for sure be != last, otherwise it would have
entered the if clause above it.

Change-Id: I0a6519f7b93f0b45c67d19fef4f50daeeefc7340
2021-11-03 20:14:38 +01:00
Vadim Yanitskiy 61349d6f14 abis: fix memory leak in abis_oml_sendmsg()
Change-Id: Ifc46b94b4540705f7d9b4678a7398158f3aaf7c5
Fixes: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-10-04 12:44:04 +00:00
Pau Espin 1c3431db95 Delay abis reconnect while bts is shutting down
Avoid re-connecting to a new BSC while BTS is in shutting down. All the
FSMs are complex enough to even try to re-start when stopping has not
yet finished...

Change-Id: I1727828a16f4ec8043b00cc6b2e02a4c35f71377
2021-09-30 13:15:24 +02:00
Pau Espin 27f42205ea abis: Fix line leaked & recreated upon every reconnect
Previous code creating a new line was really a workaround to have it
working while previous lines were being stacked internally inside
libosmo-abis.
Let's handle reference counts for the line properly and keep using the
same line always (since it can be further configured by libosmo-abis' VTY).
Recent patches to libosmo-abis fixed a bug where e1inp_line_update()
would only work the first time it was called on a e1np_line, and follow
up calls would be no-ops. This fix allows re-configuring and hence
reusing the same line to reconnect to BSC.

Depends: libosmo-abis Change-Id: Iff8092f88726cf238dac2abb99e135ac5864272d
Change-Id: Id7fd3ef81bbc517821def31f1a60f905a0e2fb52
2021-09-30 11:12:43 +00:00
Pau Espin e12f911bbb Revert "abis: Fix line leaked & recreated upon every reconnect"
This reverts commit bc6d35f52d.

Change-Id: I15063f0156ed8910795cd5ffe045e2d0cbca6276
2021-09-23 22:48:41 +02:00
Pau Espin bc6d35f52d abis: Fix line leaked & recreated upon every reconnect
Previous code creating a new line was really a workaroudn to have it
working while previous lines were being stacked internally inside
libosmo-abis.
Let's handle reference counts for the line properly and erase +
re-create it every time.
Recent patches to libosmo-abis fixed a crash happening when refcount
being 0 and destroying the object (object was not removed from a global
llist).

Depends: libosmo-abis Change-Id I1314d6b917ecb622994507475eb894e649a1a2ad
Change-Id: Ic37ae5bf657247e8cce99182c40d9adf890a5e41
2021-09-23 14:07:53 +02:00
Pau Espin 127e8fc416 abis: Fix memory leak of bts->osmo_link upon link going down
Commit below (see "Fixes" section) wrongly erased the code re-introduced
in this commit, due to not spotting different between "oml_link" and
"osmo_link". This commit is hence a revert of such commit, updated to
current code.

Fixes: c2ba34d9c1
Change-Id: Id436116e5cd0bec024b2f9943fbff8d0bdc956ac
2021-09-23 14:07:53 +02:00
Pau Espin 2e90e0f756 Avoid sending Load Indications when BTS is not RSL-connected
Change-Id: I97e8dd7dd58ee2ec90c3a38d45dfd944db44c412
2021-09-23 14:07:53 +02:00
Pau Espin 130e2e59c6 bts_trx: Drop non-executed path in trx_link_estab()
This function is only called during sign_link_up() e1inp callback, hence
only the link!=NULL condition (UP) is ever executed. Let's drop the DOWN
path and make it a function only used to trigger events when link
becomes up, similar to what bts_link_estab() does with OML.

Here it becomes clear the NM_EV_RSL_DOWN was never sent. It's not much
of an issue though since it would only make transition RCARRIER/BBTRANSC
Enabled->DisabledOffline. However, since due to libosmo-abis limitation
we receive a sign_link_down() for the entire line when 1 of its links
goes down, we don't care much since we go for shutdown of the entire BTS
anyway. Ideally, libosmo-abis would support simply telling us 1 of the
links in the line went down and if it was not OML and not RSL TRX==C0,
then we could keep on running and simply disable the related TRX.

Change-Id: Iac553c68339c0da32fd313676995747eb4344087
2021-09-23 12:07:29 +00:00
Pau Espin 49979bb794 abis: Call bts_model_abis_close() when Abis link goes down
This way based on BTS model features it can attempt to reconnect or
simply exit the process.

Change-Id: I42b43a0128bd4b579d9695e6dd2bccf6dc7e1d41
2021-09-23 12:07:29 +00:00
Pau Espin 5a2d8716ef abis: Drop internal OML msg queue
There's no real use for this queue. If the link is gone, it makes no
sense to keep old messages. Instead, BTS should generate new messages
sharing current state when link becomes established (it actually does
so already).

Change-Id: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-09-20 16:25:47 +02:00
Pau Espin 8dd699e545 abis.c: Loop over list of BSCs until connection succeeds
Do not exit if all BSCs in the list fail to connect, keep trying
forever. This commit still doesn't change the logic after BTS has
successfully connected to a BSC. In that situation, if the link goes
down, BTS will exit in order to reset all state and let the user/system
restart it.

Related: SYS#4971
Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51
2021-09-20 12:22:53 +02:00
Pau Espin 3f7bd192a6 abis.c: Fix mess with priv->bsc_oml_host
The pointer was used as "struct bsc_oml_host" sometimes, and other times
as "struct llist_head". It just worked because bsc_oml_host->list is the
first item in the script. The code was really confusing, also because
the bts list of items has a name really similar to the one currently
assigned. Let's rename the currently assigned address to "current_bsc",
store it always as "struct bsc_oml_host*" and finally use llist_entry
helpers when needed.

The related code is also moved to a helper function to enclose there the
logic to get next BSC in list. This change actually changes the logic
where a remote address is removed from VTY, since now the next address
in list is picked at the time, and later when reconnecting the list is
forwarded another time, meaning one address will be skipped.
This could be considered a bug, but this situation is really special
and anyway the entire logic will be changed in new commits where we'll
keep reconnecting in loop without exiting when reaching the end of the
list, so we are fine with it. Think of this commit as a preparation
commit for next ones.

Change-Id: I3cc8a4148b3d63bc185b72dab8108105a6644910
2021-09-20 12:22:53 +02:00
Pau Espin 65c0341f3d abis.c: Transition to CONNECTED state only when OML link is up
This clarifies the different states and transitions between them:
OML LINK UP: CONNECTING->CONNECTED
ANY LINK DOWN: CONNECTING->CONNECTING, CONNECTED->FAILED
In follow up commits, support to reconnect instead of exit after the BTS
has already connected will be added, so only the last transition needs
to be changed.

Related: SYS#4971
Change-Id: I43e83b1b04fbaa1f87818c096e6ad3920801b1f6
2021-09-20 12:22:53 +02:00
Pau Espin 79a92cfc50 abis: Shorten string names of events
Change-Id: I7a5dab3d38e917a8f37c72765e27f263c324ed96
2021-09-20 12:22:53 +02:00
Pau Espin 5831512c2c abis: Move FSM registration to constructor function
We commonly do it this way since there's only need to call it once at
the startup of the program.

Change-Id: I6ee5b89175ee32bc12a8afc9682a8f90d1713291
2021-09-20 12:22:53 +02:00
Pau Espin 3f51571a2f abis.c: Convert early return to assert()
This should simply not happen. If other event is received, something is
terribly wrong, so we should exit immediately instead of silently
failing.

Change-Id: I5f4953be735f526bb8b926979233b3c26ba67ce9
2021-09-15 16:17:37 +02:00
Pau Espin daadbc33aa abis.c: Rearrange code to follow logic state order
CONNECTING state comes first in logical order of states (as properly
seen in enum of states), however, the FSM struct definition and state
action functions are swapped. Let's put them in order.

Change-Id: I0cae561926b460dc5882390db969b7c925903e5d
2021-09-15 16:17:37 +02:00
Pau Espin a17043f2b4 cosmetic: fix typo in comment
Change-Id: I0e4fdad66c0bad849a7b960cf78f9f45b56fcb95
2021-09-15 16:17:37 +02:00
Pau Espin c2ba34d9c1 abis: Clear code and drop code not executed
abis_init() sets "g_bts = bts;", hence bts object is the same as g_bts
(since we only have 1 BTS object in osmo-bts). As a result, dropping
checking first bts->... and later g_bts->... makes no sense: the later
condition will always be false.

Change-Id: I5018199221fb3c3329a59d0b91e827f077cef85d
2021-09-15 16:17:37 +02:00
Philipp Maier 6611e7f305 allow to configure multiple oml remote-ip addresses
At the moment we can only configure a single BSC in the BTS
configuration. This also means that if this single BSC fails for some
reason the BTS has no alternate BSC to connect to. Lets extend the
remote-ip parameter so that it can be used multiple times so that an
operater can configure any number of BSCs that are tried one after
another during BTS startup.

Change-Id: I205f68a3a7f35fee4c38a7cfba2b014237df2727
Related: SYS#4971
2021-07-19 10:39:06 +02:00
Pau Espin 8bf5cbea49 Support forwarding proto IPAC_PROTO_EXT_PCU BSC<->PCU
This new extension protocol is used to forward Osmocom PCUIF messages
BSC<->BTS<->PCU.
It will be sent re-using the IPA multiplex of the OML link between
BSC and BTS. BTS is responsible for forwarding the message over the unix
socket to the PCU.

PCUIF existing RX path needs to be reworked in order to accept
variable-size messages, in order to be able to transparently forward
messages without knowing about them (the new container message is
variable-length).

Related: SYS#5303
Change-Id: I73fdb17107494ade9263a62d1f729e67303fce87
2021-06-30 08:13:21 +00:00
Philipp Maier 91054e78ef main,abis: change model name from sysmoBTS to osmo-bts
The model name when used when abis_open() is called is sysmoBTS, since
we recently decided to deprecate the type name "sysmobts" in osmo-bsc we
might consider the same thing here.

Change-Id: I3c61d92f5527ae0145316b5ff92660f8b467a8dc
2021-06-02 17:53:02 +02:00
Pau Espin 1cad2f51c6 Fix regression in 'bts: Clean up TS selection in sign_link_up'
Fixes: 518ada9414
Change-Id: I63af96235eb6e0a7334936f65e1f44d4422198a5
2021-05-26 19:05:58 +02:00
Pau Espin 518ada9414 bts: Clean up TS selection in sign_link_up
Change-Id: I0c92dfd05bf2ae40887980ef10b7e4c679213b6a
2021-05-25 11:36:35 +00:00
Vadim Yanitskiy 38cdafd656 common/abis: fix the use of deprecated e1inp_line_get() API
We need curly braces becausee1inp_line_get2() is basically a macro
that calls OSMO_ASSERT(), which in its turn contains an 'if' stmt.

Change-Id: I41a5fd13a7fa40e16bcf1a8099624b654274cee3
2021-04-30 21:07:41 +02:00
Pau Espin ca5d1e6ba6 Drop unused param in oml_init()
Change-Id: I96d8359f4ae13c9f47cc87d87fde6d2047169a49
2020-10-13 08:54:36 +00:00
Pau Espin 122ff83dd0 Move struct gsm_bts_trx: gsm_data.* & bts.* => bts_trx.*
Move all struct gsm_bts_trx references from bulky gsm_data to its own
file containing all related definitions and implementations. Also move a
few functions clearly related to that object which were placed in bts.*

Change-Id: Iebaf5b221c48b571f45408af867ce6f9c0cd9f4a
2020-07-14 09:44:06 +00:00
Pau Espin 580a27e97c abis.c: Use LOGPIL when logging signalling link down
Change-Id: Icedd533046853f67da5da84aae28b895a8cdb0bf
2020-06-23 13:18:38 +02:00
Pau Espin c8086c317e abis.c: Grab reference to e1inp_line_get if already created
Since we are returning the pointer, it should always be grabbing a
reference (find doesn't do it).
In practice it's not much important since it is always created and not
found.

Change-Id: Ib84636663be2df33d497131c780b010b57f17e32
2020-06-12 15:16:41 +02:00
Vadim Yanitskiy e5711efbb5 common/abis.c: make use of RSL TEI from OML IPA RSL Connect
Change-Id: I5927f59a49724170a63e87be604973f7c9d5d8be
2020-01-11 00:51:43 +01:00
Vadim Yanitskiy bd3eabc13e common/abis.c: use tall_bts_ctx as talloc-context for libosmo_abis_init()
This way it's much easier to introspect the library internal
talloc allocations from the VTY interface.

Change-Id: Ic8d9fc7ce3da8abf0ea73d2b20366133cd801c37
2019-12-02 23:21:27 +00:00
Vadim Yanitskiy 6bb700e9d2 common/abis.c: pass gsm_bts_trx to e1inp_sign_link_create()
Change-Id: I8a6242d3e02f9bd19d287ecad18e001a5991175f
2019-12-02 08:46:43 +00:00
Martin Hauke b378fccef1 Fix common misspellings and typos
Change-Id: I403b9029f57fec3fdec2c1e2cbeac0f6eab53f24
2019-10-17 08:05:35 +00:00
Pau Espin 2d21c9ff22 abis: inp_s_cbfn: Improve logging signal related information
Change-Id: Ia63b69882c74155bcae2e027a21ea7e319647256
2018-10-03 14:39:38 +02:00
Neels Hofmeyr 08062e6dcc cosmetic: abis.c: typo "exixt"
Change-Id: I678ae63626f05a5bb6d890ff37a09e09739bc104
2018-08-24 18:33:13 +02:00
Stefan Sperling 5a0f85d00b let osmo-bts log a special notice if OML connection is closed early
A frequent configuration file error is that the unit_id settings of
osmo-bts and osmo-bsc don't match. The BSC already prints an error
in this case. Let the BTS print an error as well.

We use a heuristic for this purpose: If the OML link is dropped within
10 seconds after being established, log a special warning which alerts
the user and recommend a manual configuration file check.

Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Related: OS#3143
2018-05-15 20:58:06 +00:00
Harald Welte 5b51fe78b4 omldummy: Suppress RSL transmission errors
In omldummy, we don't have a RSL link and hence any transmission
attempts to RSL should silently go to /dev/null rather than printing
error messages via libosmo-abis.  So check for the OMLDUMMY variant and
silently discard any RSL message that the code may want to transmit.

Change-Id: I04a9ec7e416822cc1e45c533e6a66628689615ad
2018-03-17 16:45:37 +01:00
Harald Welte d8cd756da4 Get rid of 'struct gsm_bts_role_bts'
gsm_bts_role_bts was introduced at a time when we still shared
gsm_data_shared.[ch] between BSC and BTS, and where we then subsequently
needed a BTS-private structure.  Since that sharing was abandoned quite
some time ago, we can merge gsm_bts_role_bts into gsm_bts and do away
with the bts/btsb dualism in a lot of the code.

Change-Id: I4fdd601ea873d9697f89a748cc77bcf7c978fa3e
2018-03-17 13:40:03 +01:00
Max 871e0bec7e OML: internalize failure reporting
* make oml_tx_failure_event_rep() static and use osmo_signal_dispatch()
  wrapped into oml_fail_rep() to trigger event reports outside of oml.c
  instead of directly calling into OML layer
* remove unnecessary formatting from text messages

Related: OS#1615
Change-Id: I738555c547926e97b325ab53763c0076c42309bc
2017-01-25 13:24:52 +01:00
Minh-Quang Nguyen 3f3f34ba52 common/abis.c: fix 100% CPU usage after disconnecting OML/RSL link (Bug #1703)
Change-Id: I24605b8a6d4e778a3280ffba8bc1fc7a284ce12d
2016-06-14 21:57:57 +00:00
Harald Welte b1d2dd316f abis.c: Fix segfault on OML link loss
When the OML signalling link is lost, first set bts->oml_link = NULL,
then iterate over the RSL links and close them.  Closing the RSL link
will cause a OML state change message to be sent, which in turn tries
to use the no-longer-existing OML link.

The code should be cleaned up further to distinguish which signalling
link was lost, and actually communicate a RSL(only) loss to OML.

But for now, it's best to simply close down all links and terminate
osmo-bts to ensure all state is properly reset and recovered.
2016-02-15 14:23:18 +01:00
Harald Welte 131ab36e3a abis: Add a queue of OML messages
When the oml_link is down or not yet established, we currently lost
any OML messages that were scheduled for transmission to the BSC.  Let's
prevent that by keeping a queue of OML messages, which is drained at the
time the OML link comes up again.
2016-02-03 18:45:39 +01:00
Andreas Eversberg 69fc57b028 ABIS: Support for multiple RSL connections 2016-01-22 09:09:02 +01:00
Andreas Eversberg 7a0d11dd68 ABIS: Introduce bts_model_abis_close to indicate ABIS link failure.
sysmocom-bts model shuts down on link loss, but other models may not want
this, so shutdown is moved tor bts_model_abis_close of osmo-bts-sysmo.
2015-09-22 16:41:25 +02:00