Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/tcpdump we shouldn't use "(ip + 1)" to detect inter...
details: https://anonhg.NetBSD.org/src/rev/4bac1554800c
branches: trunk
changeset: 495611:4bac1554800c
user: itojun <itojun%NetBSD.org@localhost>
date: Tue Aug 01 17:39:46 2000 +0000
description:
we shouldn't use "(ip + 1)" to detect intermediate headers (AH/ESP).
we should use ip_p == IPPROTO_TCP/UDP.
diffstat:
usr.sbin/tcpdump/print-tcp.c | 9 ++++-----
usr.sbin/tcpdump/print-udp.c | 8 ++++----
2 files changed, 8 insertions(+), 9 deletions(-)
diffs (75 lines):
diff -r 6c46e320a5e8 -r 4bac1554800c usr.sbin/tcpdump/print-tcp.c
--- a/usr.sbin/tcpdump/print-tcp.c Tue Aug 01 17:35:18 2000 +0000
+++ b/usr.sbin/tcpdump/print-tcp.c Tue Aug 01 17:39:46 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print-tcp.c,v 1.18 2000/08/01 17:34:00 itojun Exp $ */
+/* $NetBSD: print-tcp.c,v 1.19 2000/08/01 17:39:46 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
static const char rcsid[] =
"@(#) Header: print-tcp.c,v 1.55 97/06/15 13:20:28 leres Exp (LBL)";
#else
-__RCSID("$NetBSD: print-tcp.c,v 1.18 2000/08/01 17:34:00 itojun Exp $");
+__RCSID("$NetBSD: print-tcp.c,v 1.19 2000/08/01 17:39:46 itojun Exp $");
#endif
#endif
@@ -266,10 +266,9 @@
return;
}
}
-
#ifdef INET6
if (ip6) {
- if (bp == (u_char *)(ip6 + 1)) {
+ if (ip6->ip6_nxt == IPPROTO_TCP) {
(void)printf("%s.%s > %s.%s: ",
ip6addr_string(&ip6->ip6_src),
tcpport_string(sport),
@@ -282,7 +281,7 @@
} else
#endif /*INET6*/
{
- if (bp == (u_char *)(ip + 1)) {
+ if (ip->ip_p == IPPROTO_TCP) {
(void)printf("%s.%s > %s.%s: ",
ipaddr_string(&ip->ip_src),
tcpport_string(sport),
diff -r 6c46e320a5e8 -r 4bac1554800c usr.sbin/tcpdump/print-udp.c
--- a/usr.sbin/tcpdump/print-udp.c Tue Aug 01 17:35:18 2000 +0000
+++ b/usr.sbin/tcpdump/print-udp.c Tue Aug 01 17:39:46 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print-udp.c,v 1.14 2000/08/01 17:35:18 itojun Exp $ */
+/* $NetBSD: print-udp.c,v 1.15 2000/08/01 17:39:46 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
static const char rcsid[] =
"@(#) Header: print-udp.c,v 1.60 97/07/27 21:58:48 leres Exp (LBL)";
#else
-__RCSID("$NetBSD: print-udp.c,v 1.14 2000/08/01 17:35:18 itojun Exp $");
+__RCSID("$NetBSD: print-udp.c,v 1.15 2000/08/01 17:39:46 itojun Exp $");
#endif
#endif
@@ -541,7 +541,7 @@
#else
#ifdef INET6
if (ip6) {
- if (bp == (u_char *)(ip6 + 1)) {
+ if (ip6->ip6_nxt == IPPROTO_UDP) {
(void)printf("%s.%s > %s.%s: ",
ip6addr_string(&ip6->ip6_src),
udpport_string(sport),
@@ -554,7 +554,7 @@
} else
#endif /*INET6*/
{
- if (bp == (u_char *)(ip + 1)) {
+ if (ip->ip_p == IPPROTO_UDP) {
(void)printf("%s.%s > %s.%s: ",
ipaddr_string(&ip->ip_src),
udpport_string(sport),
Home |
Main Index |
Thread Index |
Old Index