summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtrace
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2004-02-26 20:48:29 +0000
committertedu <tedu@openbsd.org>2004-02-26 20:48:29 +0000
commit9497624f1d65c13838673aa66842d00aaafa978b (patch)
tree6bc5606bb25c29f0a1212302da913f3745e0b9f9 /usr.sbin/mtrace
parentDeal correctly with printing interfaces with multiple trailing digits. (diff)
downloadwireguard-openbsd-9497624f1d65c13838673aa66842d00aaafa978b.tar.xz
wireguard-openbsd-9497624f1d65c13838673aa66842d00aaafa978b.zip
fix datalen, from Esben Norby. ok deraadt itojun
Diffstat (limited to 'usr.sbin/mtrace')
-rw-r--r--usr.sbin/mtrace/mtrace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/mtrace/mtrace.c b/usr.sbin/mtrace/mtrace.c
index 57264be50af..092614c7820 100644
--- a/usr.sbin/mtrace/mtrace.c
+++ b/usr.sbin/mtrace/mtrace.c
@@ -52,7 +52,7 @@
#ifndef lint
static char rcsid[] =
- "@(#) $Id: mtrace.c,v 1.21 2003/11/26 01:17:12 millert Exp $";
+ "@(#) $Id: mtrace.c,v 1.22 2004/02/26 20:48:29 tedu Exp $";
#endif
#include <netdb.h>
@@ -493,7 +493,7 @@ send_recv(dst, type, code, tries, save)
continue;
iphdrlen = ip->ip_hl << 2;
- ipdatalen = ntohs(ip->ip_len);
+ ipdatalen = ntohs(ip->ip_len) - iphdrlen;
if (iphdrlen + ipdatalen != recvlen) {
fprintf(stderr,
"packet shorter (%u bytes) than hdr+data len (%u+%u)\n",
@@ -647,7 +647,7 @@ passive_mode(void)
continue;
iphdrlen = ip->ip_hl << 2;
- ipdatalen = ntohs(ip->ip_len);
+ ipdatalen = ntohs(ip->ip_len) - iphdrlen;
if (iphdrlen + ipdatalen != recvlen) {
fprintf(stderr,
"packet shorter (%u bytes) than hdr+data len (%u+%u)\n",