shithub: musw

Download patch

ref: 0a15926abc589c372acf404765862bb22febd64d
parent: a5c44d9c396b02c013c9d76709382d7e67aee458
author: rodri <rgl@antares-labs.eu>
date: Wed Jun 8 09:22:25 EDT 2022

show the ports on the debugging output when receiving.

--- a/muswd.c
+++ b/muswd.c
@@ -17,6 +17,7 @@
 {
 	uchar buf[1024], *p, *e;
 	int fd, n;
+	ushort rport, lport;
 	ulong kdown;
 	Ioproc *io;
 	Udphdr *udp;
@@ -32,9 +33,14 @@
 		p = buf+Udphdrsize;
 		e = buf+n;
 
+		rport = udp->rport[0]<<8 | udp->rport[1];
+		lport = udp->lport[0]<<8 | udp->lport[1];
+
 		unpack(p, e-p, "k", &kdown);
-		fprint(2, "%I → %I | %d (%d) rcvd %.*lub\n",
-			udp->raddr, udp->laddr, threadid(), getpid(), sizeof(kdown)*8, kdown);}
+		if(debug)
+			fprint(2, "%I!%d → %I!%d | %d (%d) rcvd %.*lub\n",
+				udp->raddr, rport, udp->laddr, lport, threadid(), getpid(), sizeof(kdown)*8, kdown);
+	}
 	closeioproc(io);
 }