Commit Graph

37 Commits

Author SHA1 Message Date
Harald Welte fb48de8968 server: Log connection establishment from bankd/client; warn on localhost
If a bankd connects to the server from 127.0.0.0/8, then clients will
not be able to reach it unless they also run on localhost.  Warn the
user.

Change-Id: I5446752961b039dad54aec981c1df4814779f765
2022-04-27 09:15:43 +02:00
Harald Welte a9d7ad1175 switch to libosmocore multihread-logging
When osmo-remsim was originally developed, libosmocore logging was
not yet thread-safe.  This meant that the worker threads of remsim-bankd
and remsim-server could not log via the libosmocore logging framework
but directly used stderr/stdout, which produced rather inconsistent log
output.

However, since 1.3.0, libosmocore has received support for
multi-threaded applications.  Let's make use of this and consistently
use it in remsim-server and remsim-bankd.  This obviously also means
adding some more log categories.

Change-Id: I7bd5264c559b756927046563a2d00c54826bee9b
2021-12-08 21:17:15 +01:00
Harald Welte 73bbd54cdb logging: Print category + level, disable category-hex
Change-Id: I9ae27b78b965d173146583b030fd93e2d70b845e
2021-12-08 21:15:49 +01:00
Harald Welte a5daec426e Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ice73ab253ae038848c791871693ba2e5c3352ffc
2020-10-18 22:40:42 +02:00
Harald Welte 80a0110f77 add '-d' command line argument to configure stderr logging verbosity
The '-d' option is pretty much tradition in most osmocom programs,
particularly for those without a VTY / config file it is the only
option to configure per-subsystem logging verbosity.

Change-Id: I0abecc26a5d8b6a5607e1eb8982af4c05909afed
2020-05-25 15:49:33 +02:00
Harald Welte f43babac56 server: Don't accept out-of-range bank/client/slot numbers on REST
Change-Id: Id0c9dcda58d1f85df431a74bbfba06cfaa0af69d
2020-02-20 18:52:24 +01:00
Harald Welte 3598c58eb8 server: Send ConfigClientBankReq with bankd_port == 0 on map delete
If a slotmap is deleted via the REST API, don't only remove it from
the bankd, but also remove it from the client.

Change-Id: Ia2fc2a098471add56cb35e74639417d865704989
Closes: OS#4399
2020-02-16 15:46:19 +01:00
Harald Welte ea3eefe433 server: don't dereference map before OSMO_ASSERT() in _update_client_for_slotmap()
Change-Id: Ib36d2ba7928ea17a508cb68748e6c50f22784227
2020-02-16 15:46:19 +01:00
Harald Welte cd7fcd717c Add "--version" to all executables to print compile-time version info
Change-Id: I9ae504ff95beeefb9e90e02a576861351ea9e143
2019-12-04 21:13:24 +00:00
Harald Welte 4ccd2fca84 Check for osmo_fsm_register() error return value
Change-Id: Idda1a4050cf9d285225ae48a4ba6f48c04f9598b
2019-12-01 13:34:32 +01:00
Harald Welte 3591382ffa server: rest_api: Fix memory leak in slotmap post
We need to decrement the refcount on the json_req object.

Change-Id: I1a550eff76e6a72013ab47ef8f240a72d7a7d9cb
2019-07-21 20:42:21 +02:00
Harald Welte 0c50c34f18 track libulfius and jansson memory allocations with talloc
Change-Id: I0ad63a79a806b420ea0de42b67726da36ebac828
2019-07-21 20:42:15 +02:00
Harald Welte 6b990f914f rspro_server.c: Fix memory leak in processing inbound RSPRO
We need to unconditionally free the msgb that gets handed into
sock_read_cb() by the ipa server.

Closes: OS#4096
Change-Id: I12b4a22854eea79c9e9c3e565dd4803e4dc0ed5a
2019-07-18 19:02:31 +02:00
Harald Welte 92fd7343e3 remsim_server: Enable talloc tracking of msgb allocations
Change-Id: Ia8c729756da6bb85e61a65addae4d4c83e7b6fde
2019-07-18 19:02:31 +02:00
Harald Welte 51cfec03b1 rename executables to include osmo- name prefix
Change-Id: I4498a004519499cc4b897a68c7f33efe29a63425
2019-04-03 09:50:04 +02:00
Harald Welte 5345f3d43f Makefile.am: Fix dependency of server on libosmo-rspro.la
Change-Id: I0a1badfa44479ff771be7062a19fd842f3d56b41
2019-04-03 08:42:47 +02:00
Harald Welte f51166790e cosmetic: remove some FIXME that actually are already fixed
Change-Id: I62ac36aae6da374b83e27b71ff52b0c3d52bf346
2019-04-02 20:56:16 +02:00
Harald Welte 56298ca4e0 server: Fix dependency on libosmo-rspro.la
Change-Id: Ia05a5f0f01999b32fd10d76694e95df9b1ccb207
2019-04-01 10:57:08 +02:00
Harald Welte b54a51eec2 improve talloc memory leak debugging
* switch to talloc_report_full() on SIGUSR1
* include asn1-internal allocations in talloc report

Change-Id: I14fff863449971024002e0d5465fb7a964d67095
2019-03-31 15:57:59 +02:00
Harald Welte 35ded29788 rspro_server: Fix Warnings about unused variables
Change-Id: Id8615062772c09d7396254fa5d1f42dd029e8a22
2019-03-31 15:13:09 +02:00
Harald Welte 4c37f66048 rspro_server: Configure client's bankd parameters (nr/slot/ip/port)
Change-Id: I821d0b2ba4390b9772097ddd3d610ba2c9393399
2019-03-31 15:00:00 +02:00
Harald Welte a8b86ceff2 client/server: log failed attempts to transmit/encode RSPRO
Change-Id: Iac56ddf7417fdee637660db34a7f0e6bdb9c4ab5
2019-03-31 14:59:20 +02:00
Harald Welte 10f7a76373 rspro_server: Treat keepalive timeouts (by closing connection)
Change-Id: I42f2d5c6c7a4387cb61cb8b46d01b7dfb86b927b
2019-03-31 12:38:47 +02:00
Harald Welte 1c691b173a rspro_server: Give proper name to IPA_KEEPALIVE FSMs
Once we know the Client / Bankd Identity, update not only the connection
FSM with that identity, but also the IPA keepalive FSM.  This will
provide proper context when logging.

Change-Id: I92bf47b6b0072c8062449ed3bb51ddf0b7aaf9a1
2019-03-31 10:58:11 +02:00
Harald Welte 19dee08862 rspro_server: Print human-readable message type instead of numeric value
Change-Id: I0c26e1be1ae9ddee663fee582a44d4449e6beea7
2019-03-31 10:53:45 +02:00
Harald Welte f30ff9eeb0 rspro_server: Add client_conn_by_slot() API function
Change-Id: Ie2eefad358b45541cf90d0cacac2d03953f0c367
2019-03-30 19:17:37 +01:00
Harald Welte 0a64da6e2d rspro_server: Split CONNECTED into CLIENT and BANKD specific states
Change-Id: I5b2205393de62b16439b49fb7a39ee640f750cc5
2019-03-30 17:38:04 +01:00
Harald Welte 1b07f7fbc9 rspro_server: Add more comments
Change-Id: Iafe8674161a117b70e97ffeac4e988ba9a45db93
2019-03-30 17:33:07 +01:00
Harald Welte ba781c065f rspro_server: Fix log output in client_conn_send()
Change-Id: I4b089011dcdc261837d1d9a7dc184568027f6df0
2019-03-30 17:32:53 +01:00
Harald Welte ce638d8fd7 client, bankd: Add SIGUSR1 handling for talloc context debugging
Change-Id: I9153f4cc89b3911a4f9ea4f02fe1b108420d2eed
2019-03-17 09:36:04 +01:00
Harald Welte cf8b89ad84 Move client/bank slot conversion functions to rspro_util.c
Change-Id: I18f1d1cb1fb712b01a0991419743db52338688af
2019-03-11 22:16:22 +01:00
Harald Welte d571a3e2e1 RSPRO: split ConfigClient into ConfigClientId and ConfigClientBank
The point is that the ClientId is only set once at start-up (and
also only optionally), while the Bank IP/port/ID/slot can be changed
any number of times during a RSPRO connection.

Change-Id: Ic76207c7dd7c18fe93bc5133b29c5f9438a9fb0e
2019-03-11 22:09:50 +01:00
Harald Welte b49ac9c6bb rspro_util: Add rspro_msgt_name() to get RSPRO message type name + use it
Change-Id: I4b270addd024f9766923183a75381b71ffe1cfae
2019-03-09 20:36:07 +01:00
Harald Welte 15b75e1e5c remsim-server: Add support for keepalive
This ensures that any RSPRO client (remsim-client or remsim-bankd) is
disconnected if he's no longer responding to IPA PING requests.

Change-Id: I324f0f2a0613d6310e1d191103b136c539b6ec05
Depends: libosmocore Change-Id I2763da49a74de85046ac07d53592c89973314ca6
2019-03-08 17:09:07 +01:00
Harald Welte 7bfcc65227 slotmap: restructure read_cb()
Change-Id: I7fb457f028f9aabc7b4b53bf036e5eac9d785299
2019-03-08 16:55:01 +01:00
Harald Welte e5c7773c7f client slot
Change-Id: I40f0589b2014a1df5ce4de745ec46642c68ad0c5
2019-03-07 23:58:24 +01:00
Harald Welte f5a0fa37c4 Initial version of remsim-server
Change-Id: I1caadc528d5e61a4129c32c53283250cd37f3a3c
2019-03-07 21:35:48 +01:00