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
This commit is contained in:
parent
4d2b3ff6a2
commit
36948bf7c7
|
@ -942,9 +942,10 @@ static int gtphub_read(const struct osmo_fd *from,
|
||||||
return 0;
|
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),
|
(int)received, osmo_sockaddr_to_str(from_addr),
|
||||||
osmo_hexdump(buf, received));
|
osmo_hexdump(buf, received > 1000? 1000 : received),
|
||||||
|
received > 1000 ? "..." : "");
|
||||||
|
|
||||||
return received;
|
return received;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,10 @@ int gtphub_write(const struct osmo_fd *to,
|
||||||
LOG(LOGL_ERROR, "sent(%d) != data_len(%d)\n",
|
LOG(LOGL_ERROR, "sent(%d) != data_len(%d)\n",
|
||||||
(int)sent, (int)buf_len);
|
(int)sent, (int)buf_len);
|
||||||
else
|
else
|
||||||
LOG(LOGL_DEBUG, "Sent %d: %s\n",
|
LOG(LOGL_DEBUG, "Sent %d: %s%s\n",
|
||||||
(int)sent, osmo_hexdump(buf, sent));
|
(int)sent,
|
||||||
|
osmo_hexdump(buf, sent > 1000? 1000 : sent),
|
||||||
|
sent > 1000 ? "..." : "");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue