gtphub: log: limit length of hex dumps.
The debug log prints the received/sent bytes in hex. When this data surpasses
the buffer size available for the log string (4096), the log is truncated
and lacks a newline character. Limit the amount of dumped bytes to 1000.
Sponsored-by: On-Waves ehi
diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index a68fa65..f26a56a 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -942,9 +942,10 @@
return 0;
}
- LOG(LOGL_DEBUG, "Received %d bytes from %s: %s\n",
+ LOG(LOGL_DEBUG, "Received %d bytes from %s: %s%s\n",
(int)received, osmo_sockaddr_to_str(from_addr),
- osmo_hexdump(buf, received));
+ osmo_hexdump(buf, received > 1000? 1000 : received),
+ received > 1000 ? "..." : "");
return received;
}