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
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) {