osmo-mgw/tests
Neels Hofmeyr c8f37cb4d6 mgcp_client: add transaction cleanup
So far, if an MGCP message is sent, the transaction gets enqueued, but there is
no way to end the transaction other than receiving a valid reply. So, if the
caller decides that the transaction timed out and tears down the priv pointer
passed to mgcp_client_tx, and if then a late reply arrives, the callback will
dereference the invalid priv pointer and cause a segfault. Hence it is possible
to crash an mgcp_client program by sending a late response.

Furthermore, if no reply ever arrives, we would keep the pending response in
the list forever, amounting to a "memory leak".

Add mgcp_client_cancel() to discard a pending transaction. The caller can now
decide to discard a pending response when it sees fit (e.g. the caller's
timeout expired). This needs to be added to OsmoMSC and OsmoBSC.

Add mgcp_msg_trans_id() to provide an obvious way to obtain the transaction id
from a generated MGCP message.

No public API is broken; but refine the negative return code from
mgcp_client_rx(): return -ENOENT if no such transaction ID is found, and still
-1 if decoding failed. This is mainly for mgcp_client_test.

Implement a test for mgcp_client_cancel() in mgcp_client_test.c.

Tweak internal mgcp_client_response_pending_get() to take only the transaction
id as argument instead of the entire mgcp message struct.

Found-by: dexter
Related: OS#2695 OS#2696
Change-Id: I16811e168a46a82a05943252a737b3434143f4bd
2017-12-03 22:47:01 +00:00
..
legacy_mgcp legacy_mgcp: mgcp_test: sanitize: free msgb_ctx 2017-11-18 21:26:27 +01:00
mgcp libosmo-mgcp: Connection Identifiers are allocated by MGW, not CA 2017-12-01 11:58:24 +00:00
mgcp_client mgcp_client: add transaction cleanup 2017-12-03 22:47:01 +00:00
Makefile.am Initially implement the new osmo-mgw and libosmo-mgcp 2017-10-05 01:40:43 +00:00
atlocal.in move openbsc/* to repos root 2017-08-27 17:44:55 +02:00
testsuite.at Initially implement the new osmo-mgw and libosmo-mgcp 2017-10-05 01:40:43 +00:00
vty_test_runner.py split off osmo-mgw: remove files, apply build, rename 2017-08-30 15:04:52 +02:00