From 9c31cfc3a23bf1218800da6ddebd083817ef20d4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 6 Aug 2010 08:19:05 +0800 Subject: nat: Provide information of when a msg does not contain a CI When we fail to find a CI in a message that should contain it then print the message so we can analyze the issue and improve the code later on. --- openbsc/src/nat/bsc_mgcp_utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c index f03834264..05963d3df 100644 --- a/openbsc/src/nat/bsc_mgcp_utils.c +++ b/openbsc/src/nat/bsc_mgcp_utils.c @@ -348,11 +348,16 @@ int bsc_mgcp_extract_ci(const char *str) { int ci; char *res = strstr(str, "I: "); - if (!res) + if (!res) { + LOGP(DMGCP, LOGL_ERROR, "No CI in msg '%s'\n", str); return CI_UNUSED; + } - if (sscanf(res, "I: %d", &ci) != 1) + if (sscanf(res, "I: %d", &ci) != 1) { + LOGP(DMGCP, LOGL_ERROR, "Failed to parse CI in msg '%s'\n", str); return CI_UNUSED; + } + return ci; } -- cgit v1.2.3