Change in libosmocore[master]: NS: log address:port on error

Max gerrit-no-reply at lists.osmocom.org
Tue Nov 6 16:04:54 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/11636


Change subject: NS: log address:port on error
......................................................................

NS: log address:port on error

Change-Id: If2dc533a6dc150254f5d44b672f04bb728e7e927
---
M src/gb/gprs_ns.c
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/36/11636/1

diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 198ead1..34bbfde 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1510,6 +1510,8 @@
 	struct msgb *msg = gprs_ns_msgb_alloc();
 	int ret = 0;
 	socklen_t saddr_len = sizeof(*saddr);
+	uint16_t port, addr_len = 32;
+	char addr[addr_len];
 
 	if (!msg) {
 		*error = -ENOMEM;
@@ -1519,8 +1521,9 @@
 	ret = recvfrom(bfd->fd, msg->data, NS_ALLOC_SIZE - NS_ALLOC_HEADROOM, 0,
 			(struct sockaddr *)saddr, &saddr_len);
 	if (ret < 0) {
-		LOGP(DNS, LOGL_ERROR, "recv error %s during NSIP recv\n",
-			strerror(errno));
+		osmo_sockaddr_to_str_and_uint(addr, addr_len, &port, (const struct sockaddr*)saddr);
+		LOGP(DNS, LOGL_ERROR, "recv error %s during NSIP recvfrom %s:%u\n",
+		     strerror(errno), addr, port);
 		msgb_free(msg);
 		*error = ret;
 		return NULL;

-- 
To view, visit https://gerrit.osmocom.org/11636
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2dc533a6dc150254f5d44b672f04bb728e7e927
Gerrit-Change-Number: 11636
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181106/6730d9be/attachment.html>


More information about the gerrit-log mailing list