Commit Graph

92 Commits

Author SHA1 Message Date
Harald Welte 6c8ca97546 Support building with -Werror=strict-prototypes / -Werror=old-style-definition
Unfortunately "-std=c99" is not sufficient to make gcc ignore cold that
uses constructs of earlier C standards, which were abandoned in C99.

See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for
some related discussion.

Change-Id: Ic92aa70d569778a776f4c5d24c455f71fd50b61b
2022-11-10 00:28:46 +00:00
Pau Espin fe5fefa4ac ipaccess-config: Fix writing pcap output to fd=0 (stdin)
It ended up in seeing lots of garbage in my terminal every time I run
the program.

Change-Id: I9ee0a4c51f4f10bf71390f884d67d87b623773df
2022-09-20 10:16:41 +00:00
Pau Espin cb2c6fc0ba ipaccess: Remove unused stub
function on_gsm_ts_init() doesn't exist at all in the repository, so it
can be dropped from here.

Change-Id: I863ccad044960d3ba267fa2bbf3c697abdf596a8
2022-09-20 10:16:41 +00:00
Pau Espin 5ec3eccdf5 ipacces-config: override gsm_bts_check_cfg() to void checking unset bts configuration
the shared code in libbsc checks for sane config being set, but this
doesn't really apply to ipaccess-config, wihich doesn't set such config
fields internally.

Change-Id: I22ff0d22d6dcf9b0f715bfa4e0daeb52c4028308
2022-09-20 10:16:41 +00:00
Pau Espin 79701ebd25 ipaccess-config: Exit program with error if OML link is dropped
Change-Id: Ic96635f618f2efbe29ca6c59eedd1dc1f90c1a1d
2022-09-19 14:07:31 +00:00
Pau Espin 13a58385a4 ipaccess-config: use available API to set e1inp_line_ops
Change-Id: Ic0d248fc5d1481ad96f7af20a1a80144137c626a
2022-09-19 14:07:31 +00:00
Pau Espin ea2367f4ab ipaccess-config: Initialize RSL ts driver fd to proper value
ipaccess-config sets up the entire line in a fake way.
That requires also setting the fd of each TS used to -1 in order to
avoid library code interacting with it during tear down if an error
occurs.

Change-Id: I19eb23a46f89b96dd8d63742ca2078ecd5c9ab6b
2022-09-19 14:07:31 +00:00
Pau Espin b87b676fb2 ipaccess-config: Initiate missing IPA osmo_link
Since this is created by osmo-bsc, it is also expected to be there by
ipaccess_drop_oml() in the shared libbsc code. But ipaccess-config was
not creating it, so let's do so.

Let's explicitly assert this condition in the code path expecting the
pointer to be instantiated in shared code, to easily track related
issues in the future.

Change-Id: I3f63f6827f7c5d7a21ac125b7ca6b35244efbb65
2022-09-19 14:07:31 +00:00
Pau Espin 30bdf9a4c7 oml: Integrate signal S_NM_IPACC_SET_ATTR_ACK inside S_NM_IPACC_ACK
It makes no sense to have duplicate signals. Let's simply clean up
S_NM_IPACC_ACK and pass the required info for higher layers to do
whatever is needed based on the information.
This allows reusing same signal infrastructure for different types of
messages instead of having to implement new signals for each message
(which can be done at a higher point in the stack).

Change-Id: I18ae3d320d00077fc13bb9903903de2a17767302
2022-09-16 13:00:58 +02:00
Vadim Yanitskiy a12cc72fcd ipaccess-config: check value returned by abis_nm_tlv_parse()
Change-Id: I38cd35506964efb1441555d16cea998f415e9394
Fixes: CID#272995
2022-06-28 18:18:05 +07:00
Pau Espin b978d1582f nm_statechg_signal_data: Convert state ptr to data
There's no need to use pointers there, it is only asking for errors from
code handling the data structe from the signal by attempting to change
them. Even for mem size point of view it doesn't make sense, since it's
3 byte vs a 4 byte pointer.

Furthermore, this is a preparation for new commit, where the NM object
current state will be updated before emitting the signal. This patch
eases a lot the follow up mentioned patch.

Change-Id: I9b648dfd8392b7b40bfe2b38f3345017481f5129
2022-05-06 14:50:24 +02:00
Pau Espin 7d621e0a79 constify state pointers of struct gsm_nm_state
This makes sure code accessing those fields is not changing its values,
since it would make no sense to change those. Follow up commit will make
convert those pointers to be full structs instead, as there's no need to
have pointers there.

Change-Id: I9979e62eac861e25bbe2161ab187ddb2b40fd097
2022-05-05 14:51:13 +02:00
Pau Espin 633523167d abis_nm: Merge signals S_NM_STATECHG_ADM and S_NM_STATECHG_OPER
Having 2 signals makes all code handling them more complex, specially
because S_NM_STATE_CHG_OPER could actually provide any change in
admin/oper/availability.
Both signals already provided the same kind of data (the whole
admin/oper/avail state change), so let's simply merge the signals
themselves. Current code really doesn't act differently for those 2
signals anyway.

Change-Id: Ia86d20a42b859063d0327b940ba528ec1438b04a
2022-05-05 14:51:10 +02:00
Pau Espin 5cc9ed5567 ipaccess-config: Use proper define for nm availability value
Change-Id: I368646c54f434094319c72492c616aeda5e09e6a
2022-05-04 15:39:02 +02:00
Pau Espin 8ba95b4d5a Move struct gsm_bts_paging_state to paging.h
Change-Id: I8c058d308fc816828b5e6a86e7c5a1f629a2d7c4
2022-04-25 08:35:57 +00:00
Vadim Yanitskiy cc7bdbe62e ipaccess-config: request and print NM_ATT_IPACC_NV_FLAGS
Below is an example output:

"""
  Received SIGNAL S_NM_GET_ATTR_REP
  {
      "primary_oml_ip": "192.168.100.100",
      "primary_oml_port": "0",
      "unit_id": "6969/0/0",
      "nv_flags": {
          "static-ip": "no",
          "static-gw": "no",
          "no-dhcp-vsi": "no",
          "dhcp-enabled": "yes",
          "led-enabled": "yes",
          "secondary-oml-enabled": "yes",
          "diag-enabled": "yes",
          "cli-enabled": "yes",
          "http-enabled": "no",
          "post-enabled": "yes",
          "snmp-enabled": "yes"
      }
  }
"""

Change-Id: Ic901910878529e6d8b152b3417463bae60644b82
2021-11-27 04:51:09 +03:00
Vadim Yanitskiy d260020aa6 ipaccess-config: improve readability of printed attribute response
Change-Id: If99ec89081af4ebd65152fc0a31ebdec491f3876
2021-11-27 04:34:42 +03:00
Vadim Yanitskiy 16b3b50830 ipaccess-config: warn about unknown flag name
Change-Id: Iab3bae3af9e1cac992b1f8947cda25fcff647992
2021-11-08 18:32:43 +00:00
Vadim Yanitskiy dd4af6ac0b ipaccess-config: fix wrong flag name in ipa_nvflag_strs[]
Change-Id: Idf8e3a9ee6d9a8801d53254c772548586d4a9c60
2021-11-08 18:32:43 +00:00
Vadim Yanitskiy 148e00a991 ipaccess-config: reduce verbosity of the OML logging
Change-Id: Ie52db9236da15da540e14cad56e01c2246b3e82e
2021-11-08 18:32:43 +00:00
Pau Espin eb36819b4d Get rid of lots of stubs [4/4]
These are not needed anymore since we re-introduced libbsc, specially to
avoid all this churn.

Some specific methods are explicitly required to be overwritten by
tests, so we specificially mark those with __attribute__((weak)) in
order to be able to overwrite them.

This is the last step towards fixing interdependency mess of symbols and
stubs, and requires previous patches in order to have tests apssing
fine.

Change-Id: Ic7401b8a6eb903882e30fda1cf091ac99a254ef0
2021-10-07 14:08:29 +02:00
Pau Espin 12adbeaba3 Move global var bsc_gsmnet into libbsc [2/4]
This is used inside group of files forming libbsc (shared files used by
several apps). Let's instantie only once inside a file from libbsc
instead of doing so on each binary.

This is one further step towards fixing interdependency mess of symbols
and stubs.

Change-Id: I9b287aa492ca6aae5fc56133e1510aff3146fe25
2021-10-07 14:08:15 +02:00
Pau Espin 8e3320ac48 Introduce libbsc to avoid linking long lists of .o files
Every time a new file is added in osmo-bsc, it ends up being a pain
because its .o file has to be included to other tests/util binaries, or
stubs need to be added.
Let's instead bundle all .o files together in an .la file and pass that
around.

Change-Id: If91dc589ea1e476da105b58846d1c3e720a439e1
2021-07-23 13:35:22 +02:00
Pau Espin a23eebb9a2 Support proto IPAC_PROTO_EXT_PCU BSC<->PCU
Related: SYS#5303
Change-Id: I4b3919f3098b9468e5e024db1e45427af24c1ad4
2021-06-30 08:13:37 +00:00
Neels Hofmeyr 1b277ec2a2 RSL link: explicitly select rsl_link based on lchan
Prepare for VAMOS, where there will be secondary "shadow" lchans serving
secondary MS on the same timeslots. For those, RSL messages will need to
reflect a different stream ID aka TEI, via an rsl_link_vamos.

Make sure that every code path that sends an RSL message for a specific
lchan selects the RSL link via the new function rsl_chan_link(). When
VAMOS is implemented, this function can select the proper RSL stream.

Rename gsm_bts_trx.rsl_link to rsl_link_primary. This makes sure I'm not
missing any uses of the RSL link, and clarifies the code.

Related: SYS#5315 OS#4940
Change-Id: Ifbf16bb296e91f151d19e15e39f5c953ad77ff17
2021-05-28 17:22:59 +00:00
Pau Espin c328cade9b ipaccess-config: Clean up sign_link setup helper
Change-Id: I7a5231690c9f2f1c2378b1035900c6c246deb994
2021-05-23 10:30:44 +00:00
Alexander Couzens d74bb1e3b0 Introduce NM GPRS NSVC FSM
Related: OS#4870
Change-Id: I381472532c2622a8dba7c81ae00ea873c2e58ae1
2020-12-04 14:44:40 +01:00
Pau Espin aab54b44e4 Introduce NM GPRS CELL FSM
Related: OS#4870
Change-Id: I074f4496aa153b5f84e6ce85f413754efe64d831
2020-12-03 19:56:19 +01:00
Pau Espin ee9f02f2df Introduce NM GPRS NSE FSM
Related: OS#4870
Change-Id: I91a5f40324d5373eac885032295690cec97214a6
2020-12-03 18:46:27 +01:00
Pau Espin 64c422858d Store GPRS MOs directly under BTS SiteMgr object
The only real 1-1 relationship between BTS NM objects is the one between
GPRS Cell and BTS (which is actually a BTS cell).
In our current osmo-bts implementation we don't care much since we only
handle 1-cell BTSses, but let's make the data structure organization
more generic.

Implementation notes:
The gsm_bts_sm is moved to its own file, APIs to allocate are added and
the new public object is hooked correctly in the allocation process of
osmo-bsc.

Change-Id: I06461b7784fa2a78de37383406e35beae85fbad8
2020-12-03 16:31:36 +01:00
Pau Espin 9402d1eeb7 ipaccess-proxy: generate coredump and exit upon SIGABRT received
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.

Change-Id: Iff920ff3dbeb48bd871b7578470f27fe9d0f9516
Fixes: OS#4865
2020-11-30 14:32:32 +00:00
Harald Welte eb77a2971b Use osmo_fd_*_{disable,enable}
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
Change-Id: I4e228399d21098cc9a99b9cc1aa42b24ec609159
2020-11-11 20:15:22 +00:00
Harald Welte 806e7a37dd use osmo_fd_setup() whenever applicable
Change-Id: Iee26d14e997cc77c49b8fc1a9f388e4e2f783105
2020-10-19 12:05:17 +02:00
Pau Espin 09544ab436 Introduce Radio Channel FSM
Change-Id: Iddc008c5737afb2fddd32c628bc5278056a64d89
2020-10-15 05:55:36 +00:00
Pau Espin d9d105c1f7 Introduce NM RadioCarrier FSM
Change-Id: Ieed61d1fb1e896db42545c2c3421b20cb41ad549
2020-10-15 05:55:36 +00:00
Pau Espin 95486f248a Introduce NM BaseBand Transceiver FSM
Change-Id: Ib4d35316c52eb4c71ea0d352a1e06fd5e600fe08
2020-10-15 05:55:36 +00:00
Pau Espin 6adeb607d0 Introduce NM BTS FSM
Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
2020-10-15 05:55:36 +00:00
Pau Espin 4338de5f51 Introduce NM BTS Site Manager FSM
Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
2020-10-15 05:55:36 +00:00
Pau Espin 02f2056ccf rename files acc_ramp.* -> acc.c*
With upcoming next commit, the file will contain far more code that
simply ramping, so rename it to be more generic.

Change-Id: I8c368ab87e264439dea4ccf556821a44664cdbb0
2020-07-20 16:21:59 +02:00
Pau Espin bd5b92fa7d Move acc_ramp_init inside gsm_bts_alloc
The function initializes the struct owned by a bts, so it makes sense to
have it done there instead of somewhere else later.

It was most probably put in bsc_vty when it was initially introduced
because of all the data structure and object file mess I untangled
during last set of patches.

Change-Id: I66c4b208583e92070793183b83b3a7b7edf6ba00
2020-07-18 21:45:32 +00:00
Pau Espin 8d4f94a176 Move gsm_bts_{trx_}set_system_infos APIs to bts{_trx}.*
Change-Id: I2aa83b499d6e5d06a0fa1001fee3111f7e639c94
2020-07-18 21:45:32 +00:00
Pau Espin aca53203d1 Move struct gsm_bts_trx: gsm-data.* => bts_trx.*
See rant fro similar recent commit moving stuff to bts.*.

Change-Id: I11758ca3d255d849d77bd068f24bb68bde1f89a5
2020-07-18 21:45:32 +00:00
Pau Espin 388ed58482 Move struct gsm_bts: gsm_data.* => bts.*
Place all code related to the object into the related file.

Having all the data model in one file made sense in early stage of
development to make progress quickly, but nowadays it hurts more than
helps, due to constantly growing size and more and more bits being
added to the model, gaining in complexity.

Currently, having lots of different objects mixed up in gsm_data.h is a hole
of despair, where nobody can make any sense were to properly put new stuff
in, ending up with functions related to same object in different files
or with wrong prefixes, declarations of non-existing functions, etc.
because people cannot make up their mind on strict relation to objects
in the data model.
Splitting them in files really helps finding code operating on a
specific object and helping with logically splitting in the future.

Change-Id: I00c15f5285b5c1a0109279b7ab192d5467a04ece
2020-07-18 21:45:32 +00:00
Pau Espin 8e9f40a912 Use OSMO_FD_* instead of deprecated BSC_FD_*
New define is available since libosmocore 1.1.0, and we already require
1.3.0, so no need to update dependenices.
Let's change it to avoid people re-using old BSC_FD_* symbols when
copy-pasting somewhere else.

Change-Id: Ia5a656567d212fa265aef1375d714d0c5fee5dd6
2020-07-15 18:38:11 +02:00
Harald Welte 2ca002f4af exit(2) on unsupported positional arguments on command line
Change-Id: I3b8781e220326387f1c437c39aff8661326f1e0a
2019-12-03 21:49:31 +01:00
Pau Espin f8d0389c70 bsc: Send MS Power Control msg upon max MS power change
Lots of times, the MS power class is unknown until after the first
channel has been activated, at which point the MS power class is
received in messages such as LU update or CM Service Requet.
Since the MS Power level is sent upon CHAN ACT, the only way to
communicate the change of maximum MS Power (based on MS power class)
after CHAN ACT is to send a MS Power Control msg. Let's do that.

Related: OS#4244
Change-Id: I3d6b75578e5cb9b2ad474a0ad01362d846ebe135
2019-11-20 15:35:05 +01:00
Martin Hauke a29affda98 Fix some typos
Fix typos and common misspellings in code comments and in the manual.

Change-Id: I46fc9d424620c77ae9ccf78b58081bd303386d7c
2019-11-13 22:10:41 +01:00
Neels Hofmeyr a6078fe1d8 use libosmocore osmo_tdef
Move the T_defs API to libosmocore as osmo_tdefs: remove the local T_defs API
and use libosmocore's osmo_tdef* API instead.

The root reason is moving the mgw_endpoint_fsm to libosmo-mgcp-client to be
able to use it in osmo-msc for inter-MSC handover.

When adding osmo_tdef, the new concept of timer groups was added to the API. It
would make sense to apply group names here as well, but do not modify the VTY
configuration for timers. The future might bring separate groups (or not).

Depends: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5 (libosmocore)
Change-Id: I66674a5d8403d820038762888c846bae10ceac58
2019-04-23 21:57:44 +02:00
Vadim Yanitskiy e94ce889f0 ipaccess-config: use POSIX regex for Unit ID format check
Instead of counting digits and slashes of the IPA Unit ID manually,
use POSIX regex functions, so the code is easier to maintain and
read. As a bonus, this fixes CID#188854: variable 'remain_slash'
was of type 'uint8_t', so it could never be lower than zero.

Change-Id: Id613bf650833dd38eaad08fdfffdf8dbe2f002b1
Related: CID#188854 Unsigned integer overflow
2019-04-08 07:30:45 +00:00
Pau Espin 39e9f07d23 ipaccess/Makefile.am: Remove unneeded libosmo-sigtran dep
Change-Id: Idc26f178fa8942fe407ca01e23b0a21955727dca
2019-03-14 17:07:45 +01:00