[PATCH] libosmocore[master]: Log lapd_datalink state on errors

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Jan 16 16:08:06 UTC 2018


Review at  https://gerrit.osmocom.org/5829

Log lapd_datalink state on errors

It's not very useful to get just the raw pointer address in case of
lapd_datalink receive error. Log it's state in addition.

Change-Id: Ie8c5df262312f886f509113f2707e36811df3bd5
---
M src/gsm/lapd_core.c
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/29/5829/1

diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index 5d87154..a2ff230 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -1505,7 +1505,7 @@
 	/* G.2.2 Wrong value of the C/R bit */
 	if (lctx->cr == dl->cr.rem2loc.resp) {
 		LOGP(DLLAPD, LOGL_ERROR,
-		     "I frame response not allowed (dl=%p)\n", dl);
+		     "I frame response not allowed (dl=%p state %s)\n", dl, lapd_state_name(dl->state));
 		msgb_free(msg);
 		mdl_error(MDL_CAUSE_FRM_UNIMPL, lctx);
 		return -EINVAL;
@@ -1517,7 +1517,7 @@
 		 * primitive with cause "I frame with incorrect length"
 		 * is sent to the mobile management entity. */
 		LOGP(DLLAPD, LOGL_ERROR,
-		     "I frame length not allowed (dl=%p)\n", dl);
+		     "I frame length not allowed (dl=%p state %s)\n", dl, lapd_state_name(dl->state));
 		msgb_free(msg);
 		mdl_error(MDL_CAUSE_IFRM_INC_LEN, lctx);
 		return -EIO;
@@ -1529,7 +1529,7 @@
 	 * mobile management entity. */
 	if (lctx->more && length < lctx->n201) {
 		LOGP(DLLAPD, LOGL_ERROR,
-		     "I frame with M bit too short (dl=%p)\n", dl);
+		     "I frame with M bit too short (dl=%p state %s)\n", dl, lapd_state_name(dl->state));
 		msgb_free(msg);
 		mdl_error(MDL_CAUSE_IFRM_INC_MBITS, lctx);
 		return -EIO;
@@ -1545,7 +1545,7 @@
 	case LAPD_STATE_SABM_SENT:
 	case LAPD_STATE_DISC_SENT:
 		LOGP(DLLAPD, LOGL_NOTICE,
-		     "I frame ignored in this state (dl=%p)\n", dl);
+		     "I frame ignored in state %s (dl=%p)\n", lapd_state_name(dl->state), dl);
 		msgb_free(msg);
 		return 0;
 	}
@@ -1553,7 +1553,7 @@
 	/* 5.7.1: N(s) sequence error */
 	if (ns != dl->v_recv) {
 		LOGP(DLLAPD, LOGL_NOTICE, "N(S) sequence error: N(S)=%u, "
-		     "V(R)=%u (dl=%p)\n", ns, dl->v_recv, dl);
+		     "V(R)=%u (dl=%p state %s)\n", ns, dl->v_recv, dl, lapd_state_name(dl->state));
 		/* discard data */
 		msgb_free(msg);
 		if (dl->seq_err_cond != 1) {

-- 
To view, visit https://gerrit.osmocom.org/5829
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8c5df262312f886f509113f2707e36811df3bd5
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list