Commit Graph

227 Commits

Author SHA1 Message Date
Pau Espin 4b8175d189 Add sbcap library
This commit adds initial support to encode/decode SBc-AP messages in the
form of a library, under src/sbcap/ (includes in
include/osmocom/sbcap/).
asn1c is used to generate all suport code and structures for ASN.1 APER
encoding/decoding, based on asn files obtained from 3GPP TS 29.168 and
stored under src/sbcap/asn1/.
Currently, mainstream asn1c doesn't yet support ASN.1 APER
encoding/decoding, hence mouse07410 's fork is used [1]. Furthermore,
several encdoing/decoding bugs where found during the process and fixed,
which means asn1.c git >= 30219de2d3da888b4f1eea0dd79f2a505000401a must
be used to generate proper code.

A new "make -C src/ gen" target is added which can be used to regenerate
all C code from the available ASN.1 files in src/sbcap/asn1/*.asn (after
properly setting configure.ac ASN_* variables if needed).

[1] https://github.com/mouse07410/asn1c

Related: OS#4945
Change-Id: If76f8619a9b2d46af6d94b8ae49348b8514e53aa
2022-07-15 15:53:35 +02:00
Oliver Smith 98d5b6143a checkpatch.conf: ignore sbcap generated files
Prepare to add sbcap library in
If76f8619a9b2d46af6d94b8ae49348b8514e53aa.

Change-Id: Icc5150b2c835f8a9c6b584da5e01ab2fd938ee45
2022-07-15 09:17:36 +00:00
Oliver Smith 4b19583188 gitreview: add new file
Change-Id: Ie1539f23b67dadce29d03f1e6542eb8077b25504
2022-07-15 09:14:07 +00:00
Pau Espin cc599727c7 rest_api: Fix cbs.data_user_len not set in 'payload_encoded'
This is later used in cbcmsg_to_cbsp(), but only set for type
'payload_decoded' in parse_payload_decoded().

Change-Id: I519cf300cd01e8c2728babeaa77b8486f47115be
2022-07-12 19:42:45 +02:00
Pau Espin a12affbc0f cbsp: Clean up conn closed paths
Change-Id: I08d1da97f0a2d83f7f48c59bc4dbd669f4f814b3
2022-07-07 16:22:36 +02:00
Pau Espin 2eb9c116d9 Improve error handling when forwarding ECBE msg to CBSP
Change-Id: Ie411409b3af8f7dd6913b522ea9ed3b58736dc9f
2022-07-06 16:37:54 +02:00
Pau Espin 8dc5648176 Move header files to include/osmocom/cbc/ dir
Change-Id: Id6c9f99805169d624a2c6e001fe1983e24fdc5c3
2022-07-04 13:35:47 +02:00
Pau Espin 18f144662e cbsp_server: Exit process gracefully if binding socket fails
Change-Id: I6fac793aa6975cacfeffc3389167bd00864a8a08
2022-07-01 17:24:28 +02:00
Pau Espin 9f2a1e3013 main: remove newline char in perror() call
perror() appends ":" immediatelly afterwards in order to append the
error string, so having a newline breaks the format.

Change-Id: I14874c2c86495c83030fa40c7060706e9dfe1968
2022-07-01 17:22:36 +02:00
Pau Espin b38bc5cb38 Fix typos in error messages
Change-Id: I42b201127535ae9fc61adbdc37e1d23897fd81d8
2022-07-01 17:15:26 +02:00
Pau Espin b1ab55d887 Move peer to DELETED state before signalling parent FSM with DELETE_(N)ACK
When receiving SMSCB_E_CBSP_DELETE_(N)ACK, smscb_message_fsm will iterate
over all peers to find out if some of them has still not ended, and in
that case delay sending an HTTP result.
However, the peer was sending the signal before moving to DELETED state,
and hence smscb_message_fsm would never send the HTTP result until T3
(T_WAIT_DELETE_ACK) would time out after it:
"""
20220629104312596 DCBSP INFO SMSCB-PEER(TTCN-3-44-ttcn3)[0x560b46c1f770]{WAIT_DELETE_ACK}: Received Event DELETE_ACK (cbsp_server_fsm.c:348)
20220629104312596 DCBSP INFO SMSCB(TTCN-3-44)[0x560b46c1f090]{WAIT_DELETE_ACK}: Received Event DELETE_ACK (smscb_peer_fsm.c:423)
20220629104312596 DCBSP INFO SMSCB-PEER(TTCN-3-44-ttcn3)[0x560b46c1f770]{WAIT_DELETE_ACK}: state_chg to DELETED (smscb_peer_fsm.c:424)
20220629104327599 DCBSP INFO SMSCB(TTCN-3-44)[0x560b46c1f090]{WAIT_DELETE_ACK}: Timeout of T3 (fsm.c:317)
20220629104327599 DREST DEBUG rest_it_op_complete(op=0x7fd09c001490) complete (rest_it_op.c:129)
20220629104327599 DCBSP INFO SMSCB(TTCN-3-44)[0x560b46c1f090]{WAIT_DELETE_ACK}: state_chg to DELETED (smscb_message_fsm.c:294)
20220629104327599 DREST DEBUG rest_it_op completed with 0 (HTTP 0) (rest_it_op.c:68)
"""

Change-Id: Idb418728e1242fc5436355ccf73f20b1419e1eb8
2022-06-30 16:46:31 +02:00
Pau Espin 14b862099e Configure libosmocore logging system as multithread
OsmoCBC uses libulfius, which creates its own thread(s).
Hence, we must set up osmocom logging system appropiately so that
relevant stuff is protected by locks.

Related: OS#5598
Change-Id: Ic06edc19d22b90e2b6b7de3a25d62cda5001f46e
2022-06-30 16:21:50 +02:00
Pau Espin 61f2f7123c Bump version: 0.2.3.13-aeea-dirty → 0.3.0
Change-Id: I3cbf26467dd90c3fc56dae76324f5eb9cdd0f4ef
2022-06-29 12:00:03 +02:00
Pau Espin aeea8b1145 .gitignore: add configure~
Change-Id: I2b4327fd78914b63040fb3e7d5e00b92bdb5e1c1
2022-06-23 14:09:14 +02:00
Pau Espin 5b25874c2b cbsp_server: Reorder logged message
log macro needs to be changed since it uses cbsp_cbc_client_name() which
accesses client->conn which is NULL in there.

Change-Id: Ic444c749476bb1626df5494c00021c5e1a9f24b9
2022-06-21 12:11:49 +02:00
Pau Espin b3ee9ca764 Rework cbsp_cbc_create() params
There's no need to pass the specific params. Let's simply get whatever
need from the global config in the function.
This makes it easier to extend it to more params if needed.
Also, when we add SBc-AP support, the params that have to be passed to
the counter part function are different, so let's simplify param
passing here.

While at it, rename also the callback function to contain "cbsp" on it,
since it is cbsp specific.

Change-Id: Ia2362757275e7cbce82b64c7c2a0798276d964c3
2022-06-21 12:11:49 +02:00
Pau Espin 6c7d06a50a cbsp_server.h: Move function to the proper section
Change-Id: I47f694c2ffa1df50394ff01977ddb85768657062
2022-06-21 09:39:21 +00:00
Harald Welte 9514e3e4ba update git URLs (git -> https; gitea)
Change-Id: Ife8212bcd6db51f5d4533c7bd8a52f9a21a8d144
2022-06-18 11:41:07 +02:00
Pau Espin fb6f123daf src/Makefile: Reformat files one per line
Change-Id: I666d6cd1461117397e05ac573c834a82abb2807d
2022-06-16 16:10:14 +02:00
Pau Espin 2029fbaf6a vty. Fix several typos and missing param descriptions
Change-Id: I798ba4663247018a61d6f392961af11871c6152b
2022-06-16 16:08:29 +02:00
Harald Welte 8b12076f97 cbc: Don't crash if peer->remote_host is NULL
As the peer->remote_host is initially NULL when creating a CBC peer,
the code should tolerate this.  The situation arises in two cases:

* if a peer is created by VTY but without any subequent 'remote-ip'
  statement
* if a peer is auto-created by 'unknown-peers accept'

Closes: OS#5506
Change-Id: I455e61f379f042680cdd2600a08d57a1ea22897c
2022-05-06 10:44:26 +02:00
Harald Welte 4db977919c CBSP: Append/store results in KILL COMPLETE + KILL FAIL
When the BSC returns a KILL COMPLETE or KILL FAIL, append the contained
lists (number of broadcasts completed list, fail list, ...) to update
the state of the CBC.

Change-Id: Iabe5b4e6a238597455294bf91759d4dc6e90d660
2022-04-29 13:34:50 +02:00
Harald Welte a7a5270814 CBSP: Set Channel Indication IE in KILL for CBS
The channel Indicator IE shall be present if the KILL relates to a
CBS message.  Its absence indicates KILL for ETWS/PWS.

Change-Id: I11bfac3236d7cf1e30ae5bae0abcbd72531ab5cd
Related: SYS#5906, OS#5540, OS#5541
2022-04-29 13:16:03 +02:00
Vadim Yanitskiy f492acf37f VTY: fix incomplete 'remote-ip' command description
Change-Id: I2f98285bda4a482ac1af04f71eafa19daee5137f
2022-03-30 23:11:50 +03:00
Vadim Yanitskiy 6e3f0abd89 VTY: cosmetic: use VTY_IPV46_CMD in the command string
Change-Id: I3088aed936b936d36a550f766031328143481064
2022-03-30 23:08:56 +03:00
Vadim Yanitskiy cfb35a8c5b doc/examples: make osmo-cbc.cfg file more informative
This example is not any better than just using '-c /dev/null'.
Add some default parameters taken from 'show running-config'.

Change-Id: I6dca38a2220c32fad96237d7522a300f12b4469e
2022-03-30 23:04:04 +03:00
Pau Espin 78f4cc85a4 Bump version: 0.2.2.1-cf3c → 0.2.3
Change-Id: I145e8f4292f582b2656a66832e522e6010998828
2021-11-16 18:05:21 +01:00
Harald Welte cf3c47d6bc varaible for atoi() result shouild be signed integer
... otherwise we won't detect < 0 cases.

Fixes: CID#240731
Change-Id: I650fce5bd64752823ee57d8b528d2b371fada857
2021-10-25 08:09:16 +02:00
Harald Welte 35b230f2bf Bump version: 0.2.1.4-88b5 → 0.2.2
Change-Id: If4919093a0569b81bfd95f76763f8b4b2fddaada
2021-02-23 20:40:44 +01:00
Harald Welte 88b5f3bb04 Update dependencies to current libosmocore & co
So far we couldn't depend on proper versions as they had not been
released yet.  Now they do, so we can add the respective dependencies

Change-Id: I0573a151f55488599a01ea9dfdcfa02396cd6c35
2021-02-23 20:36:25 +01:00
Harald Welte 3ae1a77bbc fix encoding of CBSP cell identifiers
We need to use the matching enum values if we actually want to
match correctly.  Before this patch, the Cell List Items in CBSP
were encoded wrongly.

Change-Id: Iea3e2a28573baaead308eb9c8475c6b8093d0b48
2021-02-20 20:04:21 +01:00
Harald Welte 1c3cfd2ccc bring JSON schema in sync with reality
Change-Id: I80f394e76d8c57f367f0049ee52df02d943ad105
2021-02-20 18:07:37 +01:00
Harald Welte 13385443a3 rest_api.c: Add missing \n in log line after error message
Change-Id: If2e9134d827891468df7ae35b89d6dfb798eb0dc
2021-02-20 17:34:30 +01:00
Harald Welte 493845d8e4 Bump version: 0.2.0.3-d6a3 → 0.2.1
Change-Id: I305be54bf1abadeabfa77b7c3a2879e824075afe
2021-02-16 22:39:23 +01:00
Harald Welte d6a3728bce cbc-apitool: compatibility with python < 3.7
The "required" parameter to argparse.add_subparsers() was only
added in python 3.7.  However, given that it defaults to 'required'
and was always unconditionally required even in python 2.x,
we can safely remove it.

Change-Id: Ia0ffca055f47016fb29ef009acecac2a139e4077
2021-02-16 22:12:10 +01:00
Oliver Smith e8ab2f3148 configure.ac: set -std=gnu11
Change-Id: I8fe45ab98a2a000a428a17d586f4dd4f1ba5f2d6
2021-01-28 10:48:47 +00:00
Harald Welte e74594b247 VTY: don't save dynamically-allocated "unknown" peers
The VTY code should write/save only those peers that were configured
using the VTY.

Closes: OS#4929
Change-Id: If02694be4e4cb9cb27e7d9d07e533bfed4a999a9
2021-01-24 23:29:03 +01:00
Harald Welte fa4826bfa6 Bump version: 0.1.0.25-287a → 0.2.0
Change-Id: I01298571913ea29cb98b58cdc0b1f92352622585
2021-01-24 16:15:50 +01:00
Harald Welte 287a6aaeb0 osmo-cbc.spec: License is AGPLv3-or-later + MIT
Change-Id: Id193997a2883189a2f3451203523a901f9f64fd4
2021-01-24 16:06:54 +01:00
Harald Welte 557fcbc110 contrib/osmo-cbc.spec: Add sub-package osmo-cbc-utils
This sub-package contains cbc-apitool.py

Change-Id: Id1ba3a26f3b40a42c69c61e844f00f2ddc70941b
2021-01-24 16:05:02 +01:00
Harald Welte bc80894f0e debian: Package cbc-apitool.py as a sub-package
We don't want osmo-cbc to depend on python3 at runtime, so let's use
a sub-package for osmo-cbc-apitool.py

Change-Id: Id16613811993a2baa06ebc2da6c6591ace70a3f9
2021-01-24 15:54:43 +01:00
Harald Welte 2b158c3b2d manual: Document cbc-apitool.py
Change-Id: I2a65e7a582c8bb72d80731fb6e77a796ae4f9b4c
2021-01-24 15:54:43 +01:00
Harald Welte 071a60e465 manual: Add dotty graph on position of CBC in network
Change-Id: I0216ebb34b2efc218628341495d026bf4ec0f026
2021-01-24 15:54:43 +01:00
Harald Welte 24507ffd0d manual: Document ECBE; include JSON schema; cross-references
Change-Id: I358f72331aa9832cc56c67396eb41b62307a3258
2021-01-24 15:54:43 +01:00
Harald Welte 6467dfdb9c Makefile.am: add *.json to EXTRA_DIST
Otherwise the source tarballs would not contain the json schema

Change-Id: I1a3685bcff0e50a644e904c221d7d285f6215da1
2021-01-24 15:54:40 +01:00
Harald Welte f80d53068a Makefile.am: cosmetic changes
Change-Id: Ib667fcf37413d15cd9b1cf53931e3360214b049e
2021-01-24 15:02:29 +01:00
Harald Welte 367cdb3697 cbc-apitool: Fix parsing if no argument is goven
Change-Id: I3abd7a22dc5df2bf7c926fb0e1ba09e60628f55d
2021-01-24 14:05:47 +01:00
Harald Welte 8e1093e244 terminate if CBSP or ECBE ports cannot be bound
Change-Id: I748648a0bd5a06da26cddc34ff0d9b6000e71370
2021-01-24 14:05:47 +01:00
Harald Welte 78fd4efa81 Make ECBE (REST interface) local bind IP + port VTY-configurable
Change-Id: I656d0d1c7b21db90b62e71109d9844476a2e3215
2021-01-24 14:05:47 +01:00
Harald Welte 5180d5ffae Make CBSP local bind IP+port VTY-configurable
Change-Id: I9ba3f4cf129d6df4468defc92697f1df62348719
2021-01-24 12:11:22 +01:00