path: root/openbsc/src/libmgcp/mgcp_protocol.c
diff options
authorDaniel Willmann <dwillmann@sysmocom.de>2019-04-23 16:58:52 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2019-04-23 17:18:16 +0200
commitbe0e831fa33a2590348952ed35df5e9b9b8caf85 (patch)
tree83e82c31915743d85240dafd4c7d5b2170399f76 /openbsc/src/libmgcp/mgcp_protocol.c
parent86950a3754b3beabde8d3f69286d0dd7cacecc4e (diff)
osmo-bsc_nat: Parse MGCP Connection ID as hex
Our ttcn3-bscnat-tests would randomly fail. After the CRCX ACK returns from the MSC the bsc-nat reports it could not find a CI it it and deletes the connection on the BSC-side. This happens because the field is parsed as a decimal value instead of hexadecimal. So a value of 00FED122 is parsed as '0' which is a reserved value in our program. This fix parses the field as hexadecimal value and also logs an error if the value happens to be 0. make check will now test if a hexadecimal CI is parsed correctly. Fixes: OS#3951 Change-Id: I49b8b61644bf706162102dce268cae2265536fc5
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_protocol.c')
1 files changed, 4 insertions, 4 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,
- "o=- %u 23 IN IP4 %s\r\n"
+ "o=- %x 23 IN IP4 %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)