diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-10-09 12:28:15 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-10-09 18:17:06 +0200 |
commit | b4f0e8089d6ee18a282fb839f240ea65a3d89b63 (patch) | |
tree | c947490a11d199311fcad2cbd5197521295ad06c /openbsc/src/gprs/gb_proxy.c | |
parent | 1c407aa99398db56cc88e87c887528d11b5cb936 (diff) |
gbproxy: Log more information on parse errors
To get a clue which message caused the error without having to enable
LOGL_DEBUG, information about how far the parser came (message name,
parsed fields) is logged with LOGL_NOTICE along with a full hexdump
of the message.
Ticket: OW#1307
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs/gb_proxy.c')
-rw-r--r-- | openbsc/src/gprs/gb_proxy.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index 59771fa82..9d2c774ee 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -542,14 +542,15 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg, rc = gprs_gb_parse_bssgp(msgb_bssgph(msg), msgb_bssgp_len(msg), &parse_ctx); - if (!rc) { - if (!parse_ctx.need_decryption) { - LOGP(DGPRS, LOGL_ERROR, - "NSEI=%u(BSS) patching: " - "failed to parse BSSGP/GMM message\n", - msgb_nsei(msg)); - return 0; - } + if (!rc && !parse_ctx.need_decryption) { + LOGP(DGPRS, LOGL_ERROR, + "NSEI=%u(BSS) patching: failed to parse invalid %s message\n", + msgb_nsei(msg), gprs_gb_message_name(&parse_ctx, "NS_UNITDATA")); + gprs_gb_log_parse_context(LOGL_NOTICE, &parse_ctx, "NS_UNITDATA"); + LOGP(DGPRS, LOGL_NOTICE, + "NSEI=%u(BSS) invalid message was: %s\n", + msgb_nsei(msg), msgb_hexdump(msg)); + return 0; } /* Get peer */ @@ -637,14 +638,15 @@ static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg, rc = gprs_gb_parse_bssgp(msgb_bssgph(msg), msgb_bssgp_len(msg), &parse_ctx); - if (!rc) { - if (!parse_ctx.need_decryption) { - LOGP(DGPRS, LOGL_ERROR, - "NSEI=%u(SGSN) patching: " - "failed to parse BSSGP/GMM message\n", - msgb_nsei(msg)); - return; - } + if (!rc && !parse_ctx.need_decryption) { + LOGP(DGPRS, LOGL_ERROR, + "NSEI=%u(SGSN) patching: failed to parse invalid %s message\n", + msgb_nsei(msg), gprs_gb_message_name(&parse_ctx, "NS_UNITDATA")); + gprs_gb_log_parse_context(LOGL_NOTICE, &parse_ctx, "NS_UNITDATA"); + LOGP(DGPRS, LOGL_NOTICE, + "NSEI=%u(SGSN) invalid message was: %s\n", + msgb_nsei(msg), msgb_hexdump(msg)); + return; } /* Get peer */ |