path: root/openbsc/src/osmo-bsc_nat
diff options
authorDaniel Willmann <>2019-04-23 16:58:52 +0200
committerDaniel Willmann <>2019-04-23 17:18:16 +0200
commitbe0e831fa33a2590348952ed35df5e9b9b8caf85 (patch)
tree83e82c31915743d85240dafd4c7d5b2170399f76 /openbsc/src/osmo-bsc_nat
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/osmo-bsc_nat')
1 files changed, 4 insertions, 1 deletions
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;