summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-01-21 06:15:19 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-01-21 06:15:19 +0000
commit500dd4da2ebd701acda23e68e8d6478c69ef8b89 (patch)
tree8d9c95b22d61b4a2d855ba3600395979e94278eb /usr.sbin/tcpdump
parente5ec70f79145184b48c6b16fdb09972be5929547 (diff)
Clean up pfsync output: print source address by default, pass -vv correctly
to pf_print_state(), and other minor cleanup.
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/print-ip.c8
-rw-r--r--usr.sbin/tcpdump/print-pfsync.c20
2 files changed, 17 insertions, 11 deletions
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c
index 5541bea1a93..0f9d92b21c5 100644
--- a/usr.sbin/tcpdump/print-ip.c
+++ b/usr.sbin/tcpdump/print-ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ip.c,v 1.21 2003/12/17 21:36:17 mcbride Exp $ */
+/* $OpenBSD: print-ip.c,v 1.22 2004/01/21 06:15:18 mcbride Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ip.c,v 1.21 2003/12/17 21:36:17 mcbride Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ip.c,v 1.22 2004/01/21 06:15:18 mcbride Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -561,10 +561,6 @@ ip_print(register const u_char *bp, register u_int length)
#define IPPROTO_PFSYNC 240
#endif
case IPPROTO_PFSYNC:
- if (vflag)
- (void)printf("pfsync %s > %s: ",
- ipaddr_string(&ip->ip_src),
- ipaddr_string(&ip->ip_dst));
pfsync_ip_print(cp, len, (const u_char *)ip);
break;
diff --git a/usr.sbin/tcpdump/print-pfsync.c b/usr.sbin/tcpdump/print-pfsync.c
index d6cac3ed3e4..0c89101977e 100644
--- a/usr.sbin/tcpdump/print-pfsync.c
+++ b/usr.sbin/tcpdump/print-pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-pfsync.c,v 1.20 2004/01/04 00:29:14 pvalchev Exp $ */
+/* $OpenBSD: print-pfsync.c,v 1.21 2004/01/21 06:15:18 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pfsync.c,v 1.20 2004/01/04 00:29:14 pvalchev Exp $";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pfsync.c,v 1.21 2004/01/21 06:15:18 mcbride Exp $";
#endif
#include <sys/param.h>
@@ -92,6 +92,13 @@ void
pfsync_ip_print(const u_char *bp, u_int len, const u_char *bp2)
{
struct pfsync_header *hdr = (struct pfsync_header *)bp;
+ struct ip *ip = (struct ip *)bp2;
+
+ if (vflag)
+ printf("%s > %s: ", ipaddr_string(&ip->ip_src),
+ ipaddr_string(&ip->ip_dst));
+ else
+ printf("%s: ", ipaddr_string(&ip->ip_src));
if (len < PFSYNC_HDRLEN)
printf("[|pfsync]");
@@ -121,6 +128,8 @@ pfsync_print(struct pfsync_header *hdr, int len)
flags = 0;
if (vflag)
flags |= PF_OPT_VERBOSE;
+ if (vflag > 1)
+ flags |= PF_OPT_VERBOSE2;
if (!nflag)
flags |= PF_OPT_USEDNS;
@@ -160,6 +169,7 @@ pfsync_print(struct pfsync_header *hdr, int len)
st.proto = s->proto;
st.direction = s->direction;
st.log = s->log;
+ st.timeout = s->timeout;
st.allow_opts = s->allow_opts;
st.sync_flags = s->sync_flags;
@@ -170,21 +180,21 @@ pfsync_print(struct pfsync_header *hdr, int len)
for (i = 1, u = (void *)((char *)hdr + PFSYNC_HDRLEN);
i <= hdr->count && i * sizeof(*u) <= len; i++, d++) {
printf("\tid: %016llx creatorid: %08x\n",
- betoh64(u->id), htonl(u->creatorid));
+ betoh64(u->id), ntohl(u->creatorid));
}
break;
case PFSYNC_ACT_DEL_C:
for (i = 1, d = (void *)((char *)hdr + PFSYNC_HDRLEN);
i <= hdr->count && i * sizeof(*d) <= len; i++, d++) {
printf("\tid: %016llx creatorid: %08x\n",
- betoh64(d->id), htonl(d->creatorid));
+ betoh64(d->id), ntohl(d->creatorid));
}
break;
case PFSYNC_ACT_UREQ:
for (i = 1, r = (void *)((char *)hdr + PFSYNC_HDRLEN);
i <= hdr->count && i * sizeof(*r) <= len; i++, d++) {
printf("\tid: %016llx creatorid: %08x\n",
- betoh64(r->id), htonl(r->creatorid));
+ betoh64(r->id), ntohl(r->creatorid));
}
break;
default: