summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c8
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c5
-rw-r--r--openbsc/tests/bsc-nat/bsc_data.c4
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c2
4 files changed, 11 insertions, 8 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 84dbc1f52..689c91f54 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -208,7 +208,7 @@ static int write_response_sdp(struct mgcp_endpoint *endp,
len = snprintf(sdp_record, size,
"v=0\r\n"
- "o=- %u 23 IN IP4 %s\r\n"
+ "o=- %x 23 IN IP4 %s\r\n"
"s=-\r\n"
"c=IN IP4 %s\r\n"
"t=0 0\r\n",
@@ -285,7 +285,7 @@ static struct msgb *create_response_with_sdp(struct mgcp_endpoint *endp,
}
len = snprintf(sdp_record, sizeof(sdp_record),
- "I: %u%s\n\n", endp->ci, osmux_extension);
+ "I: %x%s\n\n", endp->ci, osmux_extension);
if (len < 0)
return NULL;
@@ -512,7 +512,7 @@ static int verify_ci(const struct mgcp_endpoint *endp,
uint32_t ci = strtoul(_ci, NULL, 10);
if (ci != endp->ci) {
- LOGP(DMGCP, LOGL_ERROR, "ConnectionIdentifiers do not match on 0x%x. %u != %s\n",
+ LOGP(DMGCP, LOGL_ERROR, "ConnectionIdentifiers do not match on 0x%x. %x != %x\n",
ENDPOINT_NUMBER(endp), endp->ci, _ci);
return -1;
}
@@ -891,7 +891,7 @@ mgcp_header_done:
osmo_jibuf_set_dequeue_cb(endp->bts_jb, mgcp_dejitter_udp_send, &endp->net_end);
}
- LOGP(DMGCP, LOGL_DEBUG, "Creating endpoint on: 0x%x CI: %u port: %u/%u\n",
+ LOGP(DMGCP, LOGL_DEBUG, "Creating endpoint on: 0x%x CI: %x port: %u/%u\n",
ENDPOINT_NUMBER(endp), endp->ci,
endp->net_end.local_port, endp->bts_end.local_port);
if (p->cfg->change_cb)
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 311ab94cc..17dc659bb 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -812,11 +812,14 @@ uint32_t bsc_mgcp_extract_ci(const char *str)
return CI_UNUSED;
}
- if (sscanf(res, "I: %u", &ci) != 1) {
+ if (sscanf(res, "I: %x", &ci) != 1) {
LOGP(DMGCP, LOGL_ERROR, "Failed to parse CI in msg '%s'\n", str);
return CI_UNUSED;
}
+ if (ci == CI_UNUSED)
+ LOGP(DMGCP, LOGL_ERROR, "CI field '%s' parsed as reserved value CI_UNUSED\n", str);
+
return ci;
}
diff --git a/openbsc/tests/bsc-nat/bsc_data.c b/openbsc/tests/bsc-nat/bsc_data.c
index 71d53914d..d29caef88 100644
--- a/openbsc/tests/bsc-nat/bsc_data.c
+++ b/openbsc/tests/bsc-nat/bsc_data.c
@@ -157,8 +157,8 @@ static const char crcx_patched[] = "CRCX 23265295 1e@mgw MGCP 1.0\r\nC: 394b0439
/* patch the ip and port */
-static const char crcx_resp[] = "200 23265295\r\nI: 1\r\n\r\nv=0\r\nc=IN IP4 172.16.18.2\r\nm=audio 4002 RTP/AVP 98 3\r\na=rtpmap:98 AMR/8000\r\n";
-static const char crcx_resp_patched[] = "200 23265295\r\nI: 1\r\n\r\nv=0\r\nc=IN IP4 10.0.0.1\r\nm=audio 999 RTP/AVP 98 3\r\na=rtpmap:98 AMR/8000\r\na=fmtp:98 mode-set=2 octet-align=1\r\n";
+static const char crcx_resp[] = "200 23265295\r\nI: 0F\r\n\r\nv=0\r\nc=IN IP4 172.16.18.2\r\nm=audio 4002 RTP/AVP 98 3\r\na=rtpmap:98 AMR/8000\r\n";
+static const char crcx_resp_patched[] = "200 23265295\r\nI: 0F\r\n\r\nv=0\r\nc=IN IP4 10.0.0.1\r\nm=audio 999 RTP/AVP 98 3\r\na=rtpmap:98 AMR/8000\r\na=fmtp:98 mode-set=2 octet-align=1\r\n";
/* patch the ip and port */
static const char mdcx[] = "MDCX 23330829 8@mgw MGCP 1.0\r\nC: 394b0439fb\r\nI: 1\r\nL: p:20, a:AMR, nt:IN\r\nM: recvonly\r\n\r\nv=0\r\no=- 1049380491 0 IN IP4 172.16.18.2\r\ns=-\r\nc=IN IP4 172.16.18.2\r\nt=0 0\r\nm=audio 4410 RTP/AVP 126\r\na=rtpmap:126 AMR/8000/1\r\na=fmtp:126 mode-set=2 octet-align=1;start-mode=0\r\na=ptime:20\r\na=recvonly\r\nm=image 4412 udptl t38\r\na=T38FaxVersion:0\r\na=T38MaxBitRate:14400\r\n";
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 2914a01b5..e0d0051ba 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -683,7 +683,7 @@ static void test_mgcp_parse(void)
}
ci = bsc_mgcp_extract_ci(crcx_resp);
- if (ci != 1) {
+ if (ci != 0x0F) {
printf("Failed to parse the CI. Got: %d\n", ci);
abort();
}