Commit Graph

242 Commits

Author SHA1 Message Date
Harald Welte 3e9860bb77 Replace bankd_client_fsm with rspro_client_fsm
There was a lot of similarity between the bankd_client_fsm (for the
client->bankd RSPRO connection) and the rspro_client_fsm (for the
client->server and the bankd->server RSPRO connections).

With the last few commits introducing the missing features to
rspro_client_fsm, we can completely obsolete bankd_client_fsm and
further simplify the codebase.

Change-Id: Icbe9881a0391fcd0c47e5d930dc764fc0cb1dfbf
2019-12-15 00:06:09 +01:00
Harald Welte a3b14d1890 rspro_client_fsm: Make RSPRO transmit use FSM event
This way we can easily guarantee that RSPRO transmit will only happen
in the fully established state, and that violations of that rule will
generate error logs by means of osmo_fsm core logging code.

Change-Id: I3c403507fa11c068d7503107857fbd5676ce135f
2019-12-05 08:56:27 +01:00
Harald Welte d2192e27ce rspro_client_fsm: Disable automatic connect on FSM allocation
So far, the rspor_client_fsm immediately attempted to establish a
TCP connection to the RSPRO server when calling server_conn_fsm_alloc().

Let's make this implicit auto-connect an explicit request to connect
using the newly-introduced SRVC_E_ESTABLISH.

Let's also change all three existing users of server_conn_fsm_alloc()
to send SRVC_E_ESTABLISH after calling it.

The rationale of this change is to use the same rspro_client_fsm also
for the client->bankd RSPRO connection, where we don't want to
automatically connect at startup, but connect only at a later point, after the
server a has told us to do so.

Change-Id: Icd882405f2ef54e10a66054829c089e4985f1d1f
2019-12-05 08:56:27 +01:00
Harald Welte 4b75f0dc3c add missing debian/libosmo-rspro1.install
In Change-Id I77c86455f9c36c16271bc8e7f8f3f72d682d23fd for some
reason libosmo-rspro0.install was not renamed/moved but deleted,
causing failures to build debian packages

Change-Id: I825d70abbbd067955d7038377692beea87545ce0
2019-12-05 08:56:26 +01:00
Harald Welte a8d945e191 bankd: No need to handle SIGMAPDEL if we're not mapped yet
Change-Id: I187b833a9b7ec3d3763e21b5c88a3fa39ba0c4c7
2019-12-04 22:25:37 +01:00
Harald Welte f34fb79cc1 bankd: Implement new ResetStateReq
Change-Id: Ib794e605162903a2b2c4f4516887ec91fc8d139a
2019-12-04 22:25:37 +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 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
Kevin Redon 3119c2eb1f remsim-apitool.py: pass IDs as integer
currently the bankId, clientId, and slotNr are passed as strings.
this is not the format expected by the server, which returns 400
"Bad Request".
the issue was that the python tool did not parse the arguments as
integer.

Change-Id: I8baab1b516067f47a7d230213e44d8f85e6d9919
2019-09-17 11:37:39 +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 fc0fff1880 remsim-apitool: Fix slotmap-create (integer needed, not string!)
Change-Id: If3237de7cf08be49645dfac2e3f7173d43a47e53
2019-09-12 19:59:29 +02:00
Joachim Steiger a008e62523 add contrib/remsim-apitool.py to control the REST-interface of osmo-remsim-server
Change-Id: Ia01b0a89e21af18b898becd8f5440c32936772b7
2019-07-30 11:39:15 +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 6478cdac2d Bump version: 0.2.0.4-573d → 0.2.1
Change-Id: I70d67eddd474f7f738ec1a032e438a6211e2daa3
2019-07-23 20:37:00 +02:00
Harald Welte 573ddfdce1 debian: build manuals as osmo-remsim-doc package
Change-Id: If5812983d319a32864f5f34b160978533465d185
2019-07-23 20:27:47 +02:00
Harald Welte 32e204c83d doc/manuals: Use correct path (osmo-remsim-doc)
Change-Id: I16a56af66a450e6bb19a53c652d6f93d35aacb8e
2019-07-23 20:27:46 +02:00
Harald Welte bb9e32ea1a usermanual: disable non-existant architecture chapter
Change-Id: I897fb528990d8cf47bd0796603b79bff5fd94bc0
2019-07-23 20:21:58 +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 2f238cfac9 Bump version: 0.1.0.29-e7f7 → 0.2.0
Change-Id: Id486c05b6564c77df9f04a051ef508fecd7885d6
2019-07-21 21:12:25 +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
Oliver Smith fed6d1591e contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: I619499ce68c8e0ddef597021329d9bfd4d2f1a77
2019-07-10 13:23:49 +02:00
Joachim Steiger c8bc5e707c add examples to remsim-server (json output)
Change-Id: I102a79a5d1f0055586a9fa1f9688acd4258f585b
2019-07-09 16:55:17 +02:00
Joachim Steiger 68f95100bf add examples to the command line options for remsim-bankd and remsim-client
Change-Id: Idfa6352ce90dd36dd27306d6c8a2023935ed822d
2019-07-09 16:55:17 +02:00
Joachim Steiger 293c114629 osmo-remsim-client: add systemd service script template and etc/default configs
Change-Id: I243f3d8e090d49ca3a1d0a8cf568750b76273c03
2019-06-13 09:37:18 +00:00
Harald Welte 33a3e8779c doc: Describe how to obtains PC/SC reader string names
Change-Id: Ic99d9561281080c6865f512c2b819cf6cfc7a1e2
2019-05-29 20:14:59 +02:00
Joachim Steiger 6d8ad47644 osmo-remsim-bankd: add systemd service script and etc/default config
Change-Id: Iefa6e65c7a03b232a124758cf8890b660abf6885
2019-05-28 18:27:09 +02:00
Joachim Steiger 07e0db317e osmo-remsim-server: add systemd service script
Change-Id: I310a78b49a8a17e4f954179553ed2a3376e3bd50
2019-05-28 17:01:25 +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 3afbf73564 doc: REST API url is /banks, not /bankds
The documentation didn't agree with the code. Let's fix it

Change-Id: I63771c7ecc975435b8b7415ffb5e0a51fb5acef0
Closes: OS#3963
2019-05-08 17:23:58 +02:00
Harald Welte f0184cb4af README.md: add 'osmo-' prefix to remsim-{server,bankd,client}
Change-Id: I42df660d8c7f696a12118d4e4c38f7ee9e48d2e8
2019-04-03 17:24:42 +02:00
Harald Welte 942f0f981f update .gitignore
Change-Id: I3b58f79b65e552f835f10abedb287d87941d6f9e
2019-04-03 13:15:53 +02:00