From 11b48101426b43312c733900635eb37e24976872 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 16 Oct 2018 15:45:56 +0200 Subject: [PATCH] osmux_send_dummy: Avoid logging incorrectly and sending if osmux not enabled Port from openbsc 37a0307b6193c9b108cfd1aa2a88517a8b5cb907. Change-Id: Iabc84cb482a425d4a6c2bb08c20b2e02a5a86b36 --- src/libosmo-mgcp/mgcp_osmux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index bc9eca216..2e58c55d1 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -641,12 +641,20 @@ int osmux_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn) LOGP(DLMGCP, LOGL_ERROR, "Could not activate osmux for conn:%s\n", mgcp_conn_dump(conn->conn)); + return 0; } LOGP(DLMGCP, LOGL_ERROR, "Osmux CID %u for %s:%u is now enabled\n", conn->osmux.cid, inet_ntoa(conn->end.addr), endp->cfg->osmux_port); } + if(conn->osmux.state != OSMUX_STATE_ENABLED) { + LOGP(DLMGCP, LOGL_ERROR, + "OSMUX dummy to %s CID %u: Osmux not enabled on endpoint 0x%x state %d\n", + inet_ntoa(conn->end.addr), conn->osmux.cid, + ENDPOINT_NUMBER(endp), conn->osmux.state); + return 0; + } LOGP(DLMGCP, LOGL_DEBUG, "sending OSMUX dummy load to %s CID %u\n", inet_ntoa(conn->end.addr), conn->osmux.cid);