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
This commit is contained in:
parent
1c407aa993
commit
b4f0e8089d
|
@ -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),
|
rc = gprs_gb_parse_bssgp(msgb_bssgph(msg), msgb_bssgp_len(msg),
|
||||||
&parse_ctx);
|
&parse_ctx);
|
||||||
|
|
||||||
if (!rc) {
|
if (!rc && !parse_ctx.need_decryption) {
|
||||||
if (!parse_ctx.need_decryption) {
|
LOGP(DGPRS, LOGL_ERROR,
|
||||||
LOGP(DGPRS, LOGL_ERROR,
|
"NSEI=%u(BSS) patching: failed to parse invalid %s message\n",
|
||||||
"NSEI=%u(BSS) patching: "
|
msgb_nsei(msg), gprs_gb_message_name(&parse_ctx, "NS_UNITDATA"));
|
||||||
"failed to parse BSSGP/GMM message\n",
|
gprs_gb_log_parse_context(LOGL_NOTICE, &parse_ctx, "NS_UNITDATA");
|
||||||
msgb_nsei(msg));
|
LOGP(DGPRS, LOGL_NOTICE,
|
||||||
return 0;
|
"NSEI=%u(BSS) invalid message was: %s\n",
|
||||||
}
|
msgb_nsei(msg), msgb_hexdump(msg));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get peer */
|
/* 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),
|
rc = gprs_gb_parse_bssgp(msgb_bssgph(msg), msgb_bssgp_len(msg),
|
||||||
&parse_ctx);
|
&parse_ctx);
|
||||||
|
|
||||||
if (!rc) {
|
if (!rc && !parse_ctx.need_decryption) {
|
||||||
if (!parse_ctx.need_decryption) {
|
LOGP(DGPRS, LOGL_ERROR,
|
||||||
LOGP(DGPRS, LOGL_ERROR,
|
"NSEI=%u(SGSN) patching: failed to parse invalid %s message\n",
|
||||||
"NSEI=%u(SGSN) patching: "
|
msgb_nsei(msg), gprs_gb_message_name(&parse_ctx, "NS_UNITDATA"));
|
||||||
"failed to parse BSSGP/GMM message\n",
|
gprs_gb_log_parse_context(LOGL_NOTICE, &parse_ctx, "NS_UNITDATA");
|
||||||
msgb_nsei(msg));
|
LOGP(DGPRS, LOGL_NOTICE,
|
||||||
return;
|
"NSEI=%u(SGSN) invalid message was: %s\n",
|
||||||
}
|
msgb_nsei(msg), msgb_hexdump(msg));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get peer */
|
/* Get peer */
|
||||||
|
|
Loading…
Reference in New Issue