Commit Graph

362 Commits

Author SHA1 Message Date
Harald Welte 5ae0f31c31 Check RSPRO component type; print error if type doesn't match
If one component connects to another component, verify that the
remote component type (bank/server/client) matches our expectation.

This is important in order to detect a misconfiguration of port numbers,
for example.

Closes: OS#5548
Change-Id: I89a4fc4331e8a0622f8f146c7fc235d34d990497
2022-04-25 16:15:41 +02:00
Harald Welte 55f12b8e38 Fix client_id/bank_id/slot_nr range in manual + --help output
The RSPRO.asn protocol defines the ranges 0..1023 for slot, bank
and client IDs.  Don't make misleading claims in manual and/or
help messages.

Change-Id: Id383b2bea4c014e7b61ae02e7062ba4db5c2dc20
2022-01-16 14:35:25 +01:00
Oliver Smith 0c832fe737 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I2e98f89f6738d03c45a2106820af0912692093f3
2021-12-14 12:20:35 +01:00
Harald Welte 7f9ebce8b5 manual: Update changelog, copyright, version
Change-Id: I25f249a81f24f161fb2cf6df37ae217a5d425f8b
2021-12-09 15:40:37 +01:00
Harald Welte f5f30e2de8 manual: update remsim-client options to match --help output
* remove options that have been removed from code
* re-order options to match the order of the --help ouptut

Change-Id: Id4436b980c6a4691f3403ece400b90695a786e09
2021-12-09 15:40:15 +01:00
Harald Welte 6a93cfb1e9 manual: Document the logging configuration
Change-Id: I66f5fe2e55c7e4cb6cc8ce09dcd8a636c717a5a0
2021-12-09 15:12:05 +01:00
Harald Welte 5a3a0b16a0 Bump version: 0.2.2.126-7382 → 1.0.0
Change-Id: I069535801e32d045e7e42796b8ba28fa7d97e0c3
2021-12-09 09:09:49 +01:00
Harald Welte 7382eb343a Depend on libosmo-simtrace >= 0.8.0
Change-Id: I60ae1e097c4182d948ed807ee4ca37f91d32cfae
2021-12-09 08:18:46 +01:00
Harald Welte 507070dcb4 increase required libosmocore version
osmo-remsim depends on a variety of modern libosmocore features,
and now that libosmocore 1.6.0 has been tagged, we can finally depend
on a more recent minimum version.

Change-Id: Ic3cb86b5be524f15d118bcb7ec1947608fbbb034
2021-12-09 08:01:05 +01:00
Harald Welte 7293e7bcec logging: Replace remaining fprintf() calls with libosmocore logging
Change-Id: I2a772b3180131923d4e2ee7311670b938cb50fe0
2021-12-09 07:58:15 +01: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 46122ab94e Add separate log category for RSPRO protocol
Change-Id: I2e158f5181a24ae2256aae12d26865c4907eabad
2021-12-08 21:16:00 +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 f8c6eeb5cd [cosmetic] bankd: mark handle_options() as static
Change-Id: I991542d8fb52cc86e850bf5d20352c802f77c392
2021-12-08 20:45:30 +01:00
Harald Welte 0c7f7d45ca Change default log level to INFO
this will drop printing DEBUG level messages by default.

Change-Id: I8ecb17674d480988847d7fa23b586b66fa52010a
2021-12-08 20:45:26 +01:00
Harald Welte 8934412ce5 rspro_client_fsm: Differentiate different log levels
Raw Rx/Tx of messages should be LOGL_DEBUG, while connection
establishment/loss should be something like LOGL_NOTICE.

Change-Id: I1bc6d491a8a748cbd729cbdeede60d32bd760a15
2021-12-08 20:44:26 +01:00
Harald Welte 50a0972a87 bankd_pcsc: Don't log every successful SCardTransmit
Contrary to other operations, SCardTransmit has a much higher frequency
and the logs should not be clobbered with "OK" lines all over the place.

Change-Id: Icf87b61d71722b2998ae78f9aee7c4ad94c46da7
2021-12-08 20:44:23 +01:00
Harald Welte 9f7ca61bb5 bankd_main: Improve log usefulness
Right now we get duplicate log lines like

[000 CONN_CLIENT_MAPPED_CARD] bankd_main.c:662 Rx RSPRO tpduModemToCard
[000 CONN_CLIENT_MAPPED_CARD] bankd_main.c:623 tpduModemToCard(0070000001)

Where the first line is printed by the generic receive handler for RSPRO
messages, while the second line is from the specific handler function
handling the specific message type.

Let's only print from the generic message handler if no specific
handler function exists.

Change-Id: I992c847e0081bd1cd8a0b70212618c4980d9db81
2021-12-08 15:57:57 +01:00
Harald Welte 168d72478e bankd_pcsc: Improve logging in non-error case
Before this commit, the PCSC operation (e.g. SCardStatus) is only
printed in the error case, but not in the debug case.  Let's fix that.

[000 CONN_CLIENT_MAPPED_CARD] bankd_pcsc.c:196 : OK

	will become

[000 CONN_CLIENT_MAPPED_CARD] bankd_pcsc.c:196 SCardTransmit: OK

Change-Id: I3c77655c5d1f76be778cb8873d8acf1343c87b05
2021-12-08 15:57:52 +01:00
Harald Welte 7b87ba1e38 client: request card-remove and sim-local when no bankd/slot is set
When the client leaves the OPERATIONAL state, do the inverse of what
happens when entering that state:
* request "card insert" no longer to be generated towards modem
* request switch back to local SIM
* reset the modem to notice the change

This way entering remote-sim operation due to adding a slotmap
and leaving remote-sim due to removing the slotmap should be
symmetrical.

Change-Id: Ifaa4b60474bf8585bfbe0288062f581821bd3faa
Closes: OS#5216
2021-09-08 21:50:28 +02:00
Oliver Smith eb9f6e7228 debian/control: remove dh-systemd build-depend
Related: OS#5223
Change-Id: I769bf61a2f3a97d55c65999436d2cb079c9170a0
2021-09-01 16:07:06 +02:00
Oliver Smith 694e3b5782 contrib/osmo-remsim.spec.in: fix build on opensuse
It was not enough to verify that the rpm builds on centos.

Set --docdir to install examples to /usr/share/doc/packages instead of
/usr/share/doc in opensuse. Fix for:
  File not found: .../usr/share/doc/packages/osmo-remsim/examples/bankd_pcsc_slots.csv

Add missing %dir statements to fix:
  osmo-remsim-bankd-0.2.2.113.f2a1.202106230026-lp151.1.1.x86_64.rpm: directories not owned by a package:
   - /etc/osmocom
   - /usr/share/doc/packages/osmo-remsim
   - /usr/share/doc/packages/osmo-remsim/examples

Fixes: 905bc4d2 ("doc/examples: install bankd_pcsc_slots.csv")
Change-Id: Ie5bbb25f8aa87edcea8b952d3c29aab29ac31b19
2021-06-23 12:49:31 +02:00
Oliver Smith 588ec1a619 distro packaging: fix missing path for example
The boilerplate code for installing configs used in other Osmocom
projects doesn't only install the example configs to /etc/osmocom, but
also to /usr/share/doc/. Add the missing path.

Fixes: 905bc4d2 ("doc/examples: install bankd_pcsc_slots.csv")
Change-Id: I95e4aa34d54bb485ff7ebb5e44d9c1db92ad8fe0
2021-06-23 11:36:51 +02:00
Oliver Smith 90b48a1fae gitignore: add osmo-remsim-client-reader_conf
Change-Id: I1064aaf523ae368122a5fcc56ea1aa303ff0842e
2021-06-22 17:40:08 +02:00
Oliver Smith 905bc4d2b1 doc/examples: install bankd_pcsc_slots.csv
Related: SYS#5187
Change-Id: Iba0b98729ae2a830e05d1b337b33259dcae25d15
2021-06-22 17:27:55 +02:00
Oliver Smith debcd86e40 etc_default: change bankd, client ip to 127.0.0.1
Related: OS#5187
Change-Id: I8dffe950b0f041a231708521d11b027bfbd304e3
2021-06-22 17:06:27 +02:00
Harald Welte a06d77f073 manual: fix formating of a bullet point list in bankd csv file part
Change-Id: Ib56dbfae4ebf14321bfed855291341a50f862148
2021-02-19 19:04:12 +01:00
Harald Welte 753c8aa87a bankd: regex matching of reader names
So far, bankd did a 1:1 string match of the CSV file line against
the reader name.  As pcsc-lite reader names unfortunately tend to
change at times, we introduce matching by regular expressions in
this patch.

Change-Id: I58b71f9562e152e7ed21b55d7b876bba481b01f8
2021-02-03 08:46:21 +00:00
Oliver Smith 4f5c79d627 configure.ac: set -std=gnu11
Change-Id: I1c3682bfd50cfb43df041b6ca9a1cc7472a862dd
2021-01-28 10:48:42 +00:00
Oliver Smith fadaeec795 contrib/jenkins: don't build osmo-gsm-manuals
Related: OS#4912
Change-Id: Ic4f26705854a0987aa72a9064a5278b01b4d078d
# ---
2021-01-13 13:17:08 +01:00
Harald Welte dc34764648 remsim-client: Avoid zombies when scripts terminate
This avoids the OS from keeping terminated children (scripts) around
as zombies.

Change-Id: If7d45bda160987a26c7b101db6152142dc432fe7
2020-10-20 19:16:09 +02: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 3f65972ed6 remsim-client-shell: Terminate if STDIN has been closed
Change-Id: I39937224b06b6bb6f23c002023141882797ee6a6
2020-07-19 09:54:37 +02:00
Harald Welte b80fcf0bd7 *.spec.in: Use %config(noreplace) to retain current config file
Change-Id: I4bf84faef873ef18797d08bbf789ae260922a1e2
2020-06-22 15:21:58 +02:00
Harald Welte 57b21d479b user_simtrace2: Fix typo in frontend_handle_card2modem()
this typo was breaking operating with simtrace2 for all responses
that contained more than just a status word.

Change-Id: Id8195d6650c3306e1a39f59d78d1348671ad062d
2020-05-28 16:29:39 +02:00
Harald Welte aa66d91eda user_shell: Dispatch all events via main_fsm.c
... avoid calling server_conn_send_rspro() directly from user code.

Change-Id: I7f589ea1b1610e6d716ed0d9f4078b185bc6401d
2020-05-25 23:07:04 +02:00
Harald Welte dd33725c8f Enable async use of libosmo-simtrace2
libosmo-simtrace2 traditionally had only supported blocking, synchronous
I/O, while remsim-client used asynchronous USB I/O.  Using async USB I/O
for IRQ + IN transfers while using blocking I/O for OUT transfers
doesn't seem to work reliably, so we have to switch OUT also to async.

Depends: simtrace2.git Ib8939bdb7f533cd20a34a30a97f12b782b9816c2
Change-Id: I18bf166a95bd4318d700b3e93401b2db5188acfc
2020-05-25 22:56:41 +02:00
Harald Welte 1eec53dbfb simtrace2: use correct event when dispatching modem data to main_fsm
Change-Id: I35e20a577544bde7ad7440a617dc3ed4d2572abf
2020-05-25 22:56:41 +02:00
Harald Welte eea6135f61 contrib/owhw-event-script.sh: Update to working version for OWHWv5
Change-Id: I347dc9d3a7a7e762323fff5bf252c27e169ba271
2020-05-25 19:17:51 +02:00
Harald Welte e04382610b simtrace2: Set transp->udp_fd to -1 to indicate USB transport
Change-Id: Ie97f1d449509777661f7fcc2bd0c799711861184
2020-05-25 18:16:01 +02:00
Harald Welte 06fff2aec1 simtrace2: Fix missing LF at end of log output in process_do_rx_da()
Change-Id: I9ecda9f47711e24bf5d3d57e3d9e117add29f4cc
2020-05-25 18:16:01 +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 e580c93169 avoid talloc abort in simtrace2 frontend_append_script_env()
talloc requires a valid context for the allocation, we cannot use
env[i] as context.

Change-Id: I82b5e6b91b39d6f5c2a7492adb8c6193083e0d70
2020-05-24 16:06:32 +02:00
Oliver Smith 5c860acbb5 Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
Change-Id: Ifbd7b8d726c558f40b12bf864bec8b8c819b6094
2020-05-22 14:13:21 +02:00
Oliver Smith 54797c44ec contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to @VERSION@, make it build
with CentOS 8 etc.

Related: OS#4550
Change-Id: Ib2da03980d99f12ab36ca5d5fdde92ddbefb040b
2020-05-22 14:13:18 +02:00
Harald Welte b91e88d800 only depend on libcsv if remsim-bankd is to be built
Change-Id: I87d758972b6d2b509c7ef1216d4b61a01b9cdae0
2020-05-20 13:51:28 +02:00
Oliver Smith 81022c859d contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: I51eaae80a9bf198247d2812d65ab5ea64a8fca14
2020-05-14 11:51:40 +02:00
Harald Welte b97e2fb573 user_simtrace2: Stop using printf, use libosmocore logging
This way we have consistent logging from all parts of the code via
the common libosmocore logging infrastructure.

Change-Id: I9ace31d781dd3e50f9a5d9239bafa87a01abb0d6
2020-03-14 18:26:26 +01:00
Harald Welte a3ab5f20d7 introduce --disable-remsim-client-{st2,ifdhanndler}
Change-Id: I4aaeeedc9df873f2e7edfbfab587fec2dfad85c4
2020-03-14 18:26:26 +01:00
Harald Welte afc6c6881d rspro_util.c: Use %zu for size_t
Fix the following warning in 32bit builds on ARM:

rspro_util.c:92:53: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]

Change-Id: I7ea17f8b9fdd68cdac442bf4d4e518f92292f6fc
2020-03-14 18:26:26 +01:00