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
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 59771fa..9d2c774 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -542,14 +542,15 @@
 	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 @@
 	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 */