summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/tcpdump.c
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>1996-03-04 15:58:52 +0000
committermickey <mickey@openbsd.org>1996-03-04 15:58:52 +0000
commit0cd0aa1a484cfafda4854fc93ed6a98937975928 (patch)
treed8f77919abf5ae7f1735049a2876d11ef796d703 /usr.sbin/tcpdump/tcpdump.c
parentUpdate to the latest LBL release. (diff)
downloadwireguard-openbsd-0cd0aa1a484cfafda4854fc93ed6a98937975928.tar.xz
wireguard-openbsd-0cd0aa1a484cfafda4854fc93ed6a98937975928.zip
Updating to the latest LBL release.
Sun's SKIP support added.
Diffstat (limited to 'usr.sbin/tcpdump/tcpdump.c')
-rw-r--r--usr.sbin/tcpdump/tcpdump.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index fc6b153c80a..db5ba53a932 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: tcpdump.c,v 1.2 1996/03/04 15:59:46 mickey Exp $ */
/* $NetBSD: tcpdump.c,v 1.3 1995/04/24 13:27:48 cgd Exp $ */
/*
@@ -20,11 +21,35 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+
+/*
+ * Copyright (c) 1995 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+
+ * IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+
+ * SUN MICROSYSTEMS, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+ * THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND SUN
+ * MICROSYSTEMS, INC. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
+ * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994\nThe Regents of the University of California. All rights reserved.\n";
static char rcsid[] =
- "@(#)Header: tcpdump.c,v 1.93 94/06/10 17:01:44 mccanne Exp (LBL)";
+ "@(#)Header: tcpdump.c,v 1.93 94/06/10 17:01:44 mccanne Exp $ (LBL)";
#endif
/*
@@ -64,6 +89,7 @@ int xflag; /* print packet in hex */
int Oflag = 1; /* run filter code optimizer */
int Sflag; /* print raw TCP sequence numbers */
int packettype;
+int skipflag; /* Print out SKIP packets */
int dflag; /* print filter code */
@@ -153,7 +179,7 @@ main(int argc, char **argv)
program_name = argv[0];
opterr = 0;
- while ((op = getopt(argc, argv, "c:defF:i:lnNOpqr:s:StT:vw:xY")) != EOF)
+ while ((op = getopt(argc, argv, "c:defF:i:klnNOpqr:s:StT:vw:xY")) != EOF)
switch (op) {
case 'c':
cnt = atoi(optarg);
@@ -179,6 +205,10 @@ main(int argc, char **argv)
device = optarg;
break;
+ case 'k':
+ skipflag++;
+ break;
+
case 'l':
setlinebuf(stdout);
break;
@@ -323,7 +353,11 @@ main(int argc, char **argv)
fprintf(stderr, "%s: listening on %s\n", program_name, device);
fflush(stderr);
}
- pcap_loop(pd, cnt, printer, pcap_userdata);
+ if (pcap_loop(pd, cnt, printer, pcap_userdata) < 0) {
+ (void)fprintf(stderr, "%s: pcap_loop: %s\n",
+ program_name, pcap_geterr(pd));
+ exit(1);
+ }
pcap_close(pd);
exit(0);
}