aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-03-26 15:45:21 +0700
committerpespin <pespin@sysmocom.de>2020-03-27 14:55:22 +0000
commitd71c566ee68c7e39b7e1869d3a453f24f253ef92 (patch)
treeb787965fb4e517df037eefcc5f76bcb742110086
parent0b25f693b3cf9401687b418ca44e5ece905d1aa3 (diff)
pdch: fix packet_paging_request(): properly print paging MI
This problem problem was discovered by the Undefined Behavior Sanitizer: pdch.cpp:210:4: runtime error: load of misaligned address 0x60c00002abf2 for type 'uint32_t', which requires 4 byte alignment Do not convert TMSI to number, use osmo_mi_name() from libosmocore. Also use this function to print other MI types (IMSI or IMEISV). Change-Id: Icf8836f216793e342b239c8e6645aac1e82bf324
-rw-r--r--src/pdch.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 519028d4..99109741 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -39,6 +39,7 @@
extern "C" {
#include <osmocom/core/talloc.h>
#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/gsmtap.h>
@@ -204,11 +205,12 @@ struct msgb *gprs_rlcmac_pdch::packet_paging_request()
/* loop until message is full */
while (pag) {
+ LOGP(DRLCMAC, LOGL_DEBUG, "Paging MI - %s\n",
+ osmo_mi_name(pag->identity_lv + 1, pag->identity_lv[0]));
+
/* try to add paging */
if ((pag->identity_lv[1] & 0x07) == 4) {
/* TMSI */
- LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n",
- ntohl(*((uint32_t *)(pag->identity_lv + 1))));
len = 1 + 1 + 1 + 32 + 2 + 1;
if (pag->identity_lv[0] != 5) {
LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with "
@@ -217,9 +219,6 @@ struct msgb *gprs_rlcmac_pdch::packet_paging_request()
}
} else {
/* MI */
- LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n",
- osmo_hexdump(pag->identity_lv + 1,
- pag->identity_lv[0]));
len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1;
if (pag->identity_lv[0] > 8) {
LOGP(DRLCMAC, LOGL_ERROR, "Paging with "