Don't segfault or use heap after free if osmo-remsim-server cannot
fully initialize, e.g. due to ports already in use.
Change-Id: I558e6a0ea089a779f916aa5576341d1c55da1271
The RSPRO ComponentIdentity includes a 'name' for each remsim component.
So far we always used "fixme-name" instead of something meaningful.
Let's use the hostname of the system instead.
Change-Id: I14925f16ae242dae89fa853a2fe31c5c1b32981d
If something goes wrong during startup (missing CSV file, ...)
let's print a more human-readable error message than just asserting.
Change-Id: I95222d44eefc60ad3857fa70ccebbacce60820df
we're dropping the current (new) connection as we don't really know which
is the "right" one. Dropping the new gives the old connection time to
timeout, or to continue to operate. If we were to drop the old
connection, this could interrupt a perfectly working connection and opens
some kind of DoS.
Related: OS#5527
Change-Id: I00387dbc19d689415470e2f08df08a47a78b81c0
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
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
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
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
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
Raw Rx/Tx of messages should be LOGL_DEBUG, while connection
establishment/loss should be something like LOGL_NOTICE.
Change-Id: I1bc6d491a8a748cbd729cbdeede60d32bd760a15
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
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
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
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
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
this typo was breaking operating with simtrace2 for all responses
that contained more than just a status word.
Change-Id: Id8195d6650c3306e1a39f59d78d1348671ad062d
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
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
This way we have consistent logging from all parts of the code via
the common libosmocore logging infrastructure.
Change-Id: I9ace31d781dd3e50f9a5d9239bafa87a01abb0d6
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
Change-Id: Ic863dc2f7fe7b435c9ea19c9cb97b691411dc0f5
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-remsim-client-st2/usr/bin/osmo-remsim-client-st2 was not linked against libosmosim.so.0 (it uses none of the library's symbols)
Change-Id: I015b1a49dbdd19d030acd929b5a935021b77cefa
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-remsim-bankd/usr/bin/osmo-remsim-bankd was not linked against libosmosim.so.0 (it uses none of the library's symbols)
Change-Id: I124003dafb7b90664e6614965990243771be62a9
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/libosmo-rspro1/usr/lib/x86_64-linux-gnu/libosmo-rspro.so.1.0.0 was not linked against libosmoabis.so.6 (it uses none of the library's symbols)
We don't want to link everything against libvsv. Only bankd needs it.
Change-Id: I288c27611b042fef76101e247b41c7a2f6c7483b
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/libosmo-rspro1/usr/lib/x86_64-linux-gnu/libosmo-rspro.so.1.0.0 was not linked against libcsv.so.3 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-remsim-server/usr/bin/osmo-remsim-server was not linked against libcsv.so.3 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-remsim-client/usr/bin/osmo-remsim-client-shell debian/osmo-remsim-client/usr/bin/osmo-remsim-client-st2 were not linked against libcsv.so.3 (they use none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/libifd-osmo-remsim-client0/usr/lib/pcsc/drivers/libifd-osmo-remsim-client.bundle/Contents/Linux/libifd_remsim_client.so.0.0.0 was not linked against libcsv.so.3 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/libosmo-rspro1/usr/lib/x86_64-linux-gnu/libosmo-rspro.so.1.0.0 was not linked against libosmogsm.so.13 (it uses none of the library's symbols)
Change-Id: I6ed59e4b1a23625653be2647f271a5d993535800
The remsim_client code already used FSMs for the connections
to both remsim-server and remsim-bankd. However the 'main' part of the
program was not yet implemented as a FSM, making it somewhat difficult
to perform the right actions in every possible situation.
This commit re-structures the code around a central main_fsm, which
gets notified from the per-connection FSMs and which handles the common
processing. It also handles the execution of external script commands,
and hence further unifies the code base between the different backends
(simtrace2, ifd_handler, shell)
Closes: #4414
Change-Id: I44a430bc5674dea00ed72a0b28729ac8bcb4e022
This will be useful once we introduce a 'main' client FSM that is a
parent to the rspro_client_fsms.
Change-Id: Ifddb8e0b5c991e5348392c9e44612669ce207bc4