From 75d7aa72ed14177eb22957cec3e2d9c048dfec63 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Thu, 14 Jan 2016 21:24:46 +0100
Subject: [PATCH] net_verbose: print the socket on tx/rx of frame

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 lib/net.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/net.c b/lib/net.c
index d4c04d2e7..869bfbc5d 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -286,6 +286,10 @@ int ptpd_netif_sendto(struct wrpc_socket * sock, struct wr_sockaddr *to, void *d
 	memcpy(hdr.dstmac, to->mac, 6);
 	memcpy(hdr.srcmac, s->local_mac, 6);
 	hdr.ethtype = sock->bind_addr.ethertype;
+	net_verbose("TX: socket %04x:%04x, len %i\n",
+		    ntohs(s->bind_addr.ethertype),
+		    s->bind_addr.udpport,
+		    data_length);
 
 	rval =
 	    minic_tx_frame((uint8_t *) & hdr, (uint8_t *) data,
@@ -372,6 +376,9 @@ void update_rx_queues()
 		   q->head, hdr.srcmac[0], hdr.srcmac[1], hdr.srcmac[2],
 		   hdr.srcmac[3], hdr.srcmac[4], hdr.srcmac[5]);
 
-	net_verbose("%s: saved packet to queue [avail %d n %d size %d]\n",
-		   __FUNCTION__, q->avail, q->n, q_required);
+	net_verbose("%s: saved packet to socket %04x:%04x "
+		    "[avail %d n %d size %d]\n", __FUNCTION__,
+		    ntohs(s->bind_addr.ethertype),
+		    s->bind_addr.udpport,
+		    q->avail, q->n, q_required);
 }
-- 
GitLab