* link -> srv_link to avoid confusing with cbsp/sbcap links
* clients -> links, since it holds links, which in the future will be
both TCP/SCTP clients and servers.
Change-Id: I4717f49413af45b45059c1601a667f4161b4ca8a
Rename osmo_*_cbc -> cbc_*_mgr:
Now they only hold TCP/SCTP server related conns, but will also hold
TCP/SCTP client conns in the near future.
Rename osmo_cbc_*_client -> cbc_*_link:
The term "client" is confusing, since it doesn't exist in CBSP/SBcAP,
and will later support connecting to server at TCP/SCTP level.
Let's use "link" instead, similar to what's used in osmo-bsc which
already supports both TCP client and server modes.
Change-Id: Ia9d26dc1593c8ee08dce348fe9f5f4c9398ea2a5
Let's create missing header files and move stuff around to have a clear
view of who implements what.
Change-Id: Ib32091d716b33bca58e2d3acf8840b52824c0bd3
In sbcap_cbc_read_cb(), if sctp_recvmsg() fails and we end up calling
osmo_stream_srv_destroy(conn), then both conn and client will end up
being freed by sbcap_cbc_closed_cb(), so we cannot use them anymore
after calling osmo_stream_srv_destroy(conn).
Furthermore, since msg was allocated with "client" ctx as parent, it
would also be freed when "client" was freed.
Let's make the logic easier and alloc it under g_cbc, which is
guaranteed to always be kept there.
Change-Id: I201f44efa24a514e0087b6dcd01115b9b2b8e9db
Update skeleton files using newest asn1c with APER support [1],
commit eb4cd0c2a891a7dbfe90b4cb8cca545879b6d622.
This contains APER fixes for 32bit architectures.
[1] https://github.com/mouse07410/asn1c/tree/vlm_master/
Change-Id: I9ca556dec639223a8d37badb908fab254826192e
"""
osmo-cbc/src/cbc_vty.c:61:3: error: format not a string literal and no format arguments [-Werror=format-security]
61 | OSMO_STRBUF_PRINTF(sb, peer->remote_host[i]);
"""
Change-Id: I90e7bdbe9f01dae9269ae4850bc2d7391fee71ec
This patch makes use of the newly introduced sbcap library, and
introduces new code (and extends existing one) to handle all the aspects
of MME peers talking SBc-AP and its underlaying SCTP connection.
This commit doesn't aim to implement all the SBc-AP features, but to
implement a minimal subset of features already available for CBSP in
osmo-cbc, in order to have similar support level for both 2G and 4G
networks.
Related: OS#4945
Change-Id: Ib278bc1d1a74459814016fef7a8fe21cc29d46c9
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
This is later used in cbcmsg_to_cbsp(), but only set for type
'payload_decoded' in parse_payload_decoded().
Change-Id: I519cf300cd01e8c2728babeaa77b8486f47115be
perror() appends ":" immediatelly afterwards in order to append the
error string, so having a newline breaks the format.
Change-Id: I14874c2c86495c83030fa40c7060706e9dfe1968
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
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
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
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
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
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
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
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
The VTY code should write/save only those peers that were configured
using the VTY.
Closes: OS#4929
Change-Id: If02694be4e4cb9cb27e7d9d07e533bfed4a999a9
USSD messages are sent in pages of 82 bytes, and there is no way to
indicate a shorter payload length inside the page. Hence, we always
must pad up to the end of the page, using <CR> characters.
Change-Id: I9950431e920579e6c3a0d12348573f51d21739ec
* when the message_peer FSM times out, we msut notify the message_fsm
* when waiting for DELETE_ACK, require all message_peer FSM instances to
enter DELETE state before signaling completion
Change-Id: Ibff5e25ebb34843c4b3165329f432892ac6a6ef5
Whatever you do sucks:
* gettid() doens't have a glibc wrapper function in Debian <= 9
* pthrad_self() returns an opaque pthread_t where we shouldn't really
make the assumption it's an unsigned long
Change-Id: Ida200de75333e0d35997158000def3cac89759b1
Using this state we can actually successfully add mesasges via
the REST interface and see them being sent via CBSP to the BSCs,
who then transmit to BTSs who send it to MSs and the MSs show them...
Change-Id: If29bd4bbbf88a0ca58de9ff29ad524b0a7262a8e
If we know the peer of a client, and that peer has a name, log lines
shall use that name as context, rather than the somewhat difficult
to read osmo_sock_get_name2() result.
Change-Id: I183cbfa4b541fa4e2b96a00635cb17d91a34ae83
This way we serialize access to core data structures and also allow
future per-message FSMs in the main thread to first communicate to the
RAN peers before permitting the REST/HTTP worker thread to return
any response back to the external REST interface user.
Change-Id: Ia9f656733cf16412926a6d6dc9e1ff4243d941af