summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-02-26 20:48:30 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-02-26 20:48:30 +0000
commite895248babca3545346064ebd563740c78101c94 (patch)
tree1aaf23ea05d746d520fd7958161d83678c36ee7b
parente917533ebed150d458a7466d8e9400b35b6434f4 (diff)
fix datalen, from Esben Norby. ok deraadt itojun
-rw-r--r--usr.sbin/mrinfo/mrinfo.c4
-rw-r--r--usr.sbin/mtrace/mtrace.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c
index 895a933cf5a..05b8ee76132 100644
--- a/usr.sbin/mrinfo/mrinfo.c
+++ b/usr.sbin/mrinfo/mrinfo.c
@@ -76,7 +76,7 @@
#ifndef lint
static char rcsid[] =
- "@(#) $OpenBSD: mrinfo.c,v 1.18 2003/11/26 01:17:12 millert Exp $";
+ "@(#) $OpenBSD: mrinfo.c,v 1.19 2004/02/26 20:48:29 tedu Exp $";
/* original rcsid:
"@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)";
*/
@@ -480,7 +480,7 @@ main(int argc, char *argv[])
src = ip->ip_src.s_addr;
dst = ip->ip_dst.s_addr;
iphdrlen = ip->ip_hl << 2;
- ipdatalen = ntohs(ip->ip_len);
+ ipdatalen = ntohs(ip->ip_len) - iphdrlen;
if (iphdrlen + ipdatalen != recvlen) {
logit(LOG_WARNING, 0,
"packet shorter (%u bytes) than "
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",