Commit Graph

199 Commits

Author SHA1 Message Date
Harald Welte 3f9663215f RSPRO: Add new ResetState{Req,Res}
These commands are introduced to enable the server to request the
full reset of all state in a client or bankd.  This is particularly
useful in TTCN-3 tests, where we typically want to reset the state
between tests.

Change-Id: I442bab523486bbdf2faa8028f8972cd0af795303
2019-12-04 21:52:58 +01:00
Harald Welte 602b6f7763 bankd: initialize bank_id/slot_nr to 0xffff for unmapped workers
Otherwise the loop for SIGMAPDEL delivery code will match any
unused worker for bank_id=0/slot_nr=0, which is not what we want.

This also makes repeated RemsimBankd_Tests.TC_removeMapping_connected
runs work reliably.

Change-Id: I6976eb96feae6a3b66bacf787e436a2df29f9ce0
2019-12-04 21:52:58 +01:00
Harald Welte d9fb93991b bankd: Reject removeSlotmap when ClientID doesn't match
It's a bit of a matter of taste whether we should simply log + ignore
if the Client of a removeMappingReq doesn't match what the bankd
currently has configured.  I chose to reject it, as a new createMapping
for the same bandk+slot will overwrite any existing mapping anyway,
at least as of I83e319d22896b881c0d882542842f500075aa546

Change-Id: I892282821f4650614d1d08ed4bdf11eaabf947c0
2019-12-04 21:24:10 +01:00
Harald Welte e6fa46acd5 bankd: createMapping should implicitly delete existing mappings
As explained in OS#4278, a remsim-bankd currently doesn't recover after
a remsim-server resetart, since old mappings remain in the bankd, and
the server has no chance of removing them.

To avoid this problem, a createMapping now always implicitly removes
any existing mapping that may exist for the given bankdSlot.

Change-Id: I83e319d22896b881c0d882542842f500075aa546
Closes: OS#4278
2019-12-04 21:24:10 +01:00
Harald Welte 550b2958d3 bankd: Fix log print during removeMapping
We need to dereference 'rreq' nor 'creq' in the remove handling.

Change-Id: I04e9e2447336f7d1aaeb932928a79bb705aa0c5a
2019-12-04 21:24:10 +01:00
Harald Welte c650a4daec bankd_main: Refactor code: bankd_srvc_remove_mapping()
Change-Id: Iceb1d015e0ea760cce2cd99bc22ae0149bdb42f1
2019-12-04 15:08:10 +01:00
Harald Welte b2a00776a0 Bump version: 0.2.1.10-35d9-dirty → 0.2.2
Change-Id: I77c86455f9c36c16271bc8e7f8f3f72d682d23fd
2019-12-03 20:38:18 +01:00
Harald Welte 667d694a38 bankd: send IPA CCM ID_ACK after receiving ID_ACK
It is customary in the IPA protocol that a a server side
responds with an ID_ACK if the client sends an ID_ACK.  Due
to the lack of any protocol specification, it's unclear why
exactly, but we know it does happen.

osmo-remsim-bankd so far failed to implement this, which is
not directly a problem as the only user (osmo-remsim-client)
didn't care.  However, when executing TTCN3 test cases,
the IPA_Emulation expects that ID_ACK and related test fail.

Change-Id: Ie55c9d5c435df786e97ec3900837bb21ab80140a
2019-12-03 16:42:47 +01:00
Harald Welte 0a68497324 cosmetic: more comments; spelling fixes in comments
Change-Id: I4939a386ac48e4e66bce9784d9a1539426c41aae
2019-12-02 23:10:31 +01: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 13ebf436ac bankd_client_fsm: close IPA client connection before re-establishing it
ipa_client_conn_destroy() really only destroys the object, but not close
the underlying file descriptor.  This leads to old connections
lingering around, which in turn (in case of the remsim client) will
occupy banksim worker threads.

Change-Id: If87f4bbc133e4dc812fa96a75e8495bad65275aa
2019-11-07 13:00:39 +01:00
Kevin Redon da1854c2d7 client: fix help strings
for the osmo-remsim-client-st2 client,
the command line arguments bankd-port and slot-nr have been renamed
to server-port and client-slot in the opts options, but not in the
help output.
this is now fixed.

Change-Id: Ie23fdc443f2f90f4baf36f8aca237c9994cce8ad
2019-09-17 14:17:14 +02:00
Harald Welte 573a5b9ed9 rspro_dec_msg: Simplify msgb ownership handling
Initially it seemed like a good idea that rspro_dec_msg() takes care
of freeing the input msgb when generating a new decoded output
structure.  However, in reality this made the implementation of
every caller more complicated, as it had to treat messages going into
rspro_dec_msg() differently than messages going elsewhere.

Adding to that, not every caller got it right, and the comments were
disagreeing about what happens to msgb ownership in erroneous cases.

Change-Id: I55d5d61922053fd94e2b5a8cdf0d799b29feec98
2019-09-12 20:27:58 +02:00
Harald Welte cacbc2b37d rspro_client_fsm: Fix another memory leak
We basically must ensure that all code paths *except* the path leading
to rspro_dec_msg() must call msgb_free(msg).  This was not the case
in two situations, as fixed now.

Change-Id: I29f8413bb43b3ebf827be0bceda1a4db1e6e2b7c
2019-07-24 18:42:02 +02:00
Harald Welte 9392e08011 rspro_client_fsm/remsim_client: Fix double-free
respro_dec_msg() takes ownership of the input msgb in both
successful and unsuccessful cases, so we must not call talloc_free
on the resulting msgb.

Change-Id: Id54d1b73395da1329a998d213c190da49eb90a93
2019-07-23 18:16:40 +02: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 1b86ba81a0 rspro_client_fsm: Fix memory leak processing RSPRO
Change-Id: I2c3710d152ce31d293a3693a70718c8712e2ac2b
Closes: OS#4097
2019-07-18 19:05:33 +02:00
Harald Welte 80df20e055 remsim_client: Fix memory leak receiving RSPRO messages
Change-Id: Ic3b5b7b03d557557a245fcd5c31bd687e11c7477
Closes: OS#4119
2019-07-18 19:02:31 +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 f7442b5125 remsim_client: Enable talloc tracking of msgb allocations
Change-Id: I45f90f1a841b5b1f29bdb41671085eeebf934a6f
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
Martin Hauke 4e87bebcc7 Fix common misspellings and typos
Change-Id: I8152acaccd33a4b646d56cba0748aeefa0c16b35
2019-07-17 22:11:52 +02:00
Joachim Steiger 9c963dca66 osmo-remsim-bankd: Fix typo in help for --num-slots
Change-Id: If09833f0d0ba46d7bb204ac9b3b7f8128b4b3799
2019-05-25 00:49:32 +02:00
Harald Welte e89fecda6a bankd: Don't read CSV file until _after_ handling options
Otherwise "--help" won't work if the CSV cannot be found/read.

Change-Id: I162c40e267ea64a52baf2b5c819d9d2658daf77d
2019-05-08 17:23:58 +02:00
Harald Welte d7468e0b8c configure.ac: Add --disable-remsim-bankd
This allows builds on small/embedded platforms to avoid all the
dependencies required by remsim-bankd, including libpcsc-lite

Change-Id: I29a1a0131fdfea6742ec12d81228879066b1ff7e
2019-04-03 13:11:57 +02:00
Harald Welte 9353c607fc configure.ac: Add --disable-remsim-server
This allows builds on small/embedded platforms to avoid all the
dependencies required by remsim-server, including ulfius, yder, etc.

Closes: OS#3896
Change-Id: I2b1ec8a9a88b931ac56a63df88886e37c580a92b
2019-04-03 12:49:10 +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 4fa407a750 bankd: Use configured bank_id/nr_slots in ConnectBankReq
The code used hard-coded defaults instead of the user-configured values.

Change-Id: I86383aed4d5bb08ac1540eaecc0975a18e560baa
2019-04-01 21:07:02 +02:00
Harald Welte 2513d81625 bankd: move bank_id / num_slots from g_bankd to remsim_srv_conn
... and make num_slots configurable via command line argument

Change-Id: Id8f15085b397186d3470f4d943979857b6811a52
2019-04-01 21:07:02 +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 b6b7bd1dff remsim_client: Reduce simtrace timeout from 100s to 1s
As we're waiting in blocking mode (and hence block things like the
IPA keepalive FSM), we cannot afford to block for 100s in one shot.

Change-Id: If316018d89367d54167fde021649fb3cfe218744
2019-04-01 10:52:17 +02:00
Harald Welte 05dc39e391 rspro_util.c: Disable printf debugging
Change-Id: I69b6f62fc3e4fc8aabb230ab9a69891894e3f7a3
2019-04-01 10:52:17 +02:00
Harald Welte 5bae20b64d bankd: Add command-line arguments for IP/port/etc configuration
Change-Id: Ifafdd7ea005347f39d9adad2b50cf81609b41cba
2019-04-01 10:48:17 +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 3f09f634e0 fixup warnings
Change-Id: I73262ebf04640782859c5fa43b9172de3c788e3d
2019-03-31 15:51:13 +02:00
Harald Welte 13d0f8c3d3 disable slotmap debugging
Change-Id: I7f672adc1fef6616d7244f73214273236b42a0ca
2019-03-31 15:13:29 +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 24a3e32db7 bankd: Don't fail on RsproPDUchoice_PR_setAtrRes
Change-Id: Iaacd1d46a646de469ea5bb2c75323472cfe3635d
2019-03-31 13:08:30 +02:00
Harald Welte 736e831cc3 bankd: log incoming RSPRO
Change-Id: I276fffd6f7bad3fc38a0151ba935fd39ac1245d9
2019-03-31 13:08:16 +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 697141223e rspro_util: We don't deal with network byte order, asn1c takes care of that
Change-Id: I12523c748298a23c23bba81acc97e5f6d346dbef
2019-03-30 19:16:30 +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