From 0a15926abc589c372acf404765862bb22febd64d Mon Sep 17 00:00:00 2001 From: rodri Date: Wed, 8 Jun 2022 13:22:25 +0000 Subject: show the ports on the debugging output when receiving. --- muswd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/muswd.c b/muswd.c index e6999b2..8e07272 100644 --- a/muswd.c +++ b/muswd.c @@ -17,6 +17,7 @@ threadlisten(void *arg) { uchar buf[1024], *p, *e; int fd, n; + ushort rport, lport; ulong kdown; Ioproc *io; Udphdr *udp; @@ -32,9 +33,14 @@ threadlisten(void *arg) 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); } -- cgit v1.2.3