osmux: Don't process regular osmux frames if disabled by cfg
Prior to this commit, the check was only done on legacy dummy frames.
Port from openbsc a42d4584fd01c9cd1021fab609bdaaafe859c13a.
Change-Id: I5b6606d72a9f5ae593a8e3ab5fbbe7e1e5a0ae11
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 2e58c55..2e6307e 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -331,6 +331,12 @@
if (!msg)
return -1;
+ if (!cfg->osmux) {
+ LOGP(DLMGCP, LOGL_ERROR,
+ "bsc-nat wants to use Osmux but bsc did not request it\n");
+ goto out;
+ }
+
/* not any further processing dummy messages */
if (msg->data[0] == MGCP_DUMMY_LOAD)
goto out;
@@ -382,12 +388,6 @@
LOGP(DLMGCP, LOGL_DEBUG, "Received Osmux dummy load from %s\n",
inet_ntoa(addr->sin_addr));
- if (!cfg->osmux) {
- LOGP(DLMGCP, LOGL_ERROR,
- "bsc wants to use Osmux but bsc-nat did not request it\n");
- goto out;
- }
-
/* extract the osmux CID from the dummy message */
memcpy(&osmux_cid, &msg->data[1], sizeof(osmux_cid));
@@ -433,6 +433,12 @@
if (!msg)
return -1;
+ if (!cfg->osmux) {
+ LOGP(DLMGCP, LOGL_ERROR,
+ "bsc wants to use Osmux but bsc-nat did not request it\n");
+ goto out;
+ }
+
/* not any further processing dummy messages */
if (msg->data[0] == MGCP_DUMMY_LOAD)
return osmux_handle_dummy(cfg, &addr, msg);