osmo-mgw/src
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
..
libosmo-legacy-mgcp cosmetic: fix whitespaces; we use tabs for indentation 2017-11-17 14:18:24 +01:00
libosmo-mgcp cosmetic: clearly mark endpoint numbers as hex 2017-12-01 11:58:24 +00:00
libosmo-mgcp-client mgcp_client: add transaction cleanup 2017-12-03 22:47:01 +00:00
osmo-bsc_mgcp cosmetic: fix whitespaces; we use tabs for indentation 2017-11-17 14:18:24 +01:00
osmo-mgw cosmetic: use correct VTY port number constant 2017-11-24 12:40:51 +01:00
Makefile.am Initially implement the new osmo-mgw and libosmo-mgcp 2017-10-05 01:40:43 +00:00