2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * Support for splitting captures into multiple files with a maximum
25 * Seth Webster <swebster@sst.ll.mit.edu>
29 static const char copyright
[] _U_
=
30 "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
31 The Regents of the University of California. All rights reserved.\n";
32 static const char rcsid
[] _U_
=
33 "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.7 2004-01-14 03:25:28 guy Exp $ (LBL)";
37 * tcpdump - monitor tcp/ip traffic on an ethernet.
39 * First written in 1987 by Van Jacobson, Lawrence Berkeley Laboratory.
40 * Mercilessly hacked and occasionally improved since then via the
41 * combined efforts of Van, Steve McCanne and Craig Leres of LBL.
48 #include <tcpdump-stdinc.h>
53 extern int strcasecmp (const char *__s1
, const char *__s2
);
65 #include "interface.h"
66 #include "addrtoname.h"
68 #include "setsignal.h"
69 #include "gmt2local.h"
70 #include "pcap-missing.h"
72 int dflag
; /* print filter code */
73 int eflag
; /* print ethernet header */
74 int fflag
; /* don't translate "foreign" IP address */
75 int Lflag
; /* list available data link types and exit */
76 int nflag
; /* leave addresses as numbers */
77 int Nflag
; /* remove domains from printed host names */
78 int Oflag
= 1; /* run filter code optimizer */
79 int pflag
; /* don't go promiscuous */
80 int qflag
; /* quick (shorter) output */
81 int Rflag
= 1; /* print sequence # field in AH/ESP*/
82 int sflag
= 0; /* use the libsmi to translate OIDs */
83 int Sflag
; /* print raw TCP sequence numbers */
84 int tflag
= 1; /* print packet arrival time */
85 int Uflag
= 0; /* "unbuffered" output of dump files */
86 int uflag
= 0; /* Print undecoded NFS handles */
87 int vflag
; /* verbose */
88 int xflag
; /* print packet in hex */
89 int Xflag
; /* print packet in ascii as well as hex */
90 off_t Cflag
= 0; /* rotate dump files after this many bytes */
91 int Aflag
= 0; /* print packet only in ascii observing LF, CR, TAB, SPACE */
92 int dlt
= -1; /* if != -1, ask libpcap for the DLT it names */
94 const char *dlt_name
= NULL
;
96 char *espsecret
= NULL
; /* ESP secret key */
100 static int infodelay
;
101 static int infoprint
;
105 int32_t thiszone
; /* seconds offset from gmt to local time */
108 static RETSIGTYPE
cleanup(int);
109 static void usage(void) __attribute__((noreturn
));
110 static void show_dlts_and_exit(pcap_t
*pd
) __attribute__((noreturn
));
112 static void print_packet(u_char
*, const struct pcap_pkthdr
*, const u_char
*);
113 static void dump_packet_and_trunc(u_char
*, const struct pcap_pkthdr
*, const u_char
*);
114 static void dump_packet(u_char
*, const struct pcap_pkthdr
*, const u_char
*);
117 RETSIGTYPE
requestinfo(int);
120 static void info(int);
121 static u_int packets_captured
;
123 /* Length of saved portion of packet. */
124 int snaplen
= DEFAULT_SNAPLEN
;
126 typedef u_int (*if_printer
)(const struct pcap_pkthdr
*, const u_char
*);
133 static struct printer printers
[] = {
134 { arcnet_if_print
, DLT_ARCNET
},
135 #ifdef DLT_ARCNET_LINUX
136 { arcnet_linux_if_print
, DLT_ARCNET_LINUX
},
138 { ether_if_print
, DLT_EN10MB
},
139 { token_if_print
, DLT_IEEE802
},
141 { lane_if_print
, DLT_LANE8023
},
144 { cip_if_print
, DLT_CIP
},
147 { cip_if_print
, DLT_ATM_CLIP
},
149 { sl_if_print
, DLT_SLIP
},
150 #ifdef DLT_SLIP_BSDOS
151 { sl_bsdos_if_print
, DLT_SLIP_BSDOS
},
153 { ppp_if_print
, DLT_PPP
},
155 { ppp_bsdos_if_print
, DLT_PPP_BSDOS
},
157 { fddi_if_print
, DLT_FDDI
},
158 { null_if_print
, DLT_NULL
},
160 { null_if_print
, DLT_LOOP
},
162 { raw_if_print
, DLT_RAW
},
163 { atm_if_print
, DLT_ATM_RFC1483
},
165 { chdlc_if_print
, DLT_C_HDLC
},
168 { chdlc_if_print
, DLT_HDLC
},
170 #ifdef DLT_PPP_SERIAL
171 { ppp_hdlc_if_print
, DLT_PPP_SERIAL
},
174 { pppoe_if_print
, DLT_PPP_ETHER
},
177 { sll_if_print
, DLT_LINUX_SLL
},
179 #ifdef DLT_IEEE802_11
180 { ieee802_11_if_print
, DLT_IEEE802_11
},
183 { ltalk_if_print
, DLT_LTALK
},
186 { pflog_if_print
, DLT_PFLOG
},
189 { fr_if_print
, DLT_FR
},
192 { fr_if_print
, DLT_FRELAY
},
195 { sunatm_if_print
, DLT_SUNATM
},
197 #ifdef DLT_IP_OVER_FC
198 { ipfc_if_print
, DLT_IP_OVER_FC
},
200 #ifdef DLT_PRISM_HEADER
201 { prism_if_print
, DLT_PRISM_HEADER
},
203 #ifdef DLT_IEEE802_11_RADIO
204 { ieee802_11_radio_if_print
, DLT_IEEE802_11_RADIO
},
207 { enc_if_print
, DLT_ENC
},
213 lookup_printer(int type
)
217 for (p
= printers
; p
->f
; ++p
)
242 show_dlts_and_exit(pcap_t
*pd
)
246 const char *dlt_name
;
248 n_dlts
= pcap_list_datalinks(pd
, &dlts
);
250 error("%s", pcap_geterr(pd
));
251 else if (n_dlts
== 0 || !dlts
)
252 error("No data link types.");
254 (void) fprintf(stderr
, "Data link types (use option -y to set):\n");
256 while (--n_dlts
>= 0) {
257 dlt_name
= pcap_datalink_val_to_name(dlts
[n_dlts
]);
258 if (dlt_name
!= NULL
) {
259 (void) fprintf(stderr
, " %s (%s)", dlt_name
,
260 pcap_datalink_val_to_description(dlts
[n_dlts
]));
263 * OK, does tcpdump handle that type?
265 if (lookup_printer(dlts
[n_dlts
]) == NULL
)
266 (void) fprintf(stderr
, " (not supported)");
269 (void) fprintf(stderr
, " DLT %d (not supported)\n",
278 * Set up flags that might or might not be supported depending on the
279 * version of libpcap we're using.
283 #define B_FLAG_USAGE " [ -B size ]"
289 #ifdef HAVE_PCAP_FINDALLDEVS
295 #ifdef HAVE_PCAP_DUMP_FLUSH
302 main(int argc
, char **argv
)
304 register int cnt
, op
, i
;
305 bpf_u_int32 localnet
, netmask
;
306 register char *cp
, *infile
, *cmdbuf
, *device
, *RFileName
, *WFileName
;
307 pcap_handler callback
;
309 struct bpf_program fcode
;
311 RETSIGTYPE (*oldhandler
)(int);
313 struct print_info printinfo
;
314 struct dump_info dumpinfo
;
315 u_char
*pcap_userdata
;
316 char ebuf
[PCAP_ERRBUF_SIZE
];
317 #ifdef HAVE_PCAP_FINDALLDEVS
318 pcap_if_t
*devpointer
;
323 u_int UserBufferSize
= 1000000;
324 if(wsockinit() != 0) return 1;
332 if ((cp
= strrchr(argv
[0], '/')) != NULL
)
333 program_name
= cp
+ 1;
335 program_name
= argv
[0];
337 if (abort_on_misalignment(ebuf
, sizeof(ebuf
)) < 0)
346 (op
= getopt(argc
, argv
, "aA" B_FLAG
"c:C:d" D_FLAG
"eE:fF:i:lLm:nNOpqr:Rs:StT:u" U_FLAG
"vw:xXy:Y")) != -1)
350 /* compatibility for old -a */
361 UserBufferSize
= atoi(optarg
)*1024;
362 if (UserBufferSize
< 0)
363 error("invalid packet buffer size %s", optarg
);
370 error("invalid packet count %s", optarg
);
374 Cflag
= atoi(optarg
) * 1000000;
376 error("invalid file size %s", optarg
);
383 #ifdef HAVE_PCAP_FINDALLDEVS
385 if (pcap_findalldevs(&devpointer
, ebuf
) < 0)
388 for (i
= 0; devpointer
!= 0; i
++) {
389 printf("%d.%s", i
+1, devpointer
->name
);
390 if (devpointer
->description
!= NULL
)
391 printf(" (%s)", devpointer
->description
);
393 devpointer
= devpointer
->next
;
397 #endif /* HAVE_PCAP_FINDALLDEVS */
408 #ifndef HAVE_LIBCRYPTO
409 warning("crypto code not compiled in");
423 if (optarg
[0] == '0' && optarg
[1] == 0)
424 error("Invalid adapter index");
426 #ifdef HAVE_PCAP_FINDALLDEVS
428 * If the argument is a number, treat it as
429 * an index into the list of adapters, as
430 * printed by "tcpdump -D".
432 * This should be OK on UNIX systems, as interfaces
433 * shouldn't have names that begin with digits.
434 * It can be useful on Windows, where more than
435 * one interface can have the same name.
437 if ((devnum
= atoi(optarg
)) != 0) {
439 error("Invalid adapter index");
441 if (pcap_findalldevs(&devpointer
, ebuf
) < 0)
444 for (i
= 0; i
< devnum
-1; i
++){
445 devpointer
= devpointer
->next
;
446 if (devpointer
== NULL
)
447 error("Invalid adapter index");
450 device
= devpointer
->name
;
453 #endif /* HAVE_PCAP_FINDALLDEVS */
460 * _IOLBF is the same as _IOFBF in Microsoft's C
461 * libraries; the only alternative they offer
464 * XXX - this should really be checking for MSVC++,
465 * not WIN32, if, for example, MinGW has its own
466 * C library that is more UNIX-compatible.
468 setvbuf(stdout
, NULL
, _IONBF
, 0);
470 #ifdef HAVE_SETLINEBUF
473 setvbuf(stdout
, NULL
, _IOLBF
, 0);
488 if (smiLoadModule(optarg
) == 0) {
489 error("could not load MIB module %s", optarg
);
493 (void)fprintf(stderr
, "%s: ignoring option `-m %s' ",
494 program_name
, optarg
);
495 (void)fprintf(stderr
, "(no libsmi support)\n");
522 snaplen
= strtol(optarg
, &end
, 0);
523 if (optarg
== end
|| *end
!= '\0'
524 || snaplen
< 0 || snaplen
> 65535)
525 error("invalid snaplen %s", optarg
);
526 else if (snaplen
== 0)
540 if (strcasecmp(optarg
, "vat") == 0)
542 else if (strcasecmp(optarg
, "wb") == 0)
544 else if (strcasecmp(optarg
, "rpc") == 0)
546 else if (strcasecmp(optarg
, "rtp") == 0)
548 else if (strcasecmp(optarg
, "rtcp") == 0)
549 packettype
= PT_RTCP
;
550 else if (strcasecmp(optarg
, "snmp") == 0)
551 packettype
= PT_SNMP
;
552 else if (strcasecmp(optarg
, "cnfp") == 0)
553 packettype
= PT_CNFP
;
554 else if (strcasecmp(optarg
, "tftp") == 0)
555 packettype
= PT_TFTP
;
556 else if (strcasecmp(optarg
, "aodv") == 0)
557 packettype
= PT_AODV
;
559 error("unknown packet type `%s'", optarg
);
566 #ifdef HAVE_PCAP_DUMP_FLUSH
591 dlt
= pcap_datalink_name_to_val(dlt_name
);
593 error("invalid data link type %s", dlt_name
);
596 #if defined(HAVE_PCAP_DEBUG) || defined(HAVE_YYDEBUG)
599 /* Undocumented flag */
600 #ifdef HAVE_PCAP_DEBUG
601 extern int pcap_debug
;
616 thiszone
= gmt2local(0);
618 if (RFileName
!= NULL
) {
620 const char *dlt_name
;
624 * We don't need network access, so relinquish any set-UID
625 * or set-GID privileges we have (if any).
627 * We do *not* want set-UID privileges when opening a
628 * trace file, as that might let the user read other
629 * people's trace files (especially if we're set-UID
634 pd
= pcap_open_offline(RFileName
, ebuf
);
637 dlt
= pcap_datalink(pd
);
638 dlt_name
= pcap_datalink_val_to_name(dlt
);
639 if (dlt_name
== NULL
) {
640 fprintf(stderr
, "reading from file %s, link-type %u\n",
644 "reading from file %s, link-type %s (%s)\n",
646 pcap_datalink_val_to_description(dlt
));
651 error("-f and -r options are incompatible");
653 if (device
== NULL
) {
654 device
= pcap_lookupdev(ebuf
);
659 if(IsTextUnicode(device
,
660 wcslen((short*)device
), // Device always ends with a double \0, so this way to determine its
661 // length should be always valid
664 fprintf(stderr
, "%s: listening on %ws\n", program_name
, device
);
668 fprintf(stderr
, "%s: listening on %s\n", program_name
, device
);
674 pd
= pcap_open_live(device
, snaplen
, !pflag
, 1000, ebuf
);
680 if(UserBufferSize
!= 1000000)
681 if(pcap_setbuff(pd
, UserBufferSize
)==-1){
682 error("%s", pcap_geterr(pd
));
686 show_dlts_and_exit(pd
);
688 #ifdef HAVE_PCAP_SET_DATALINK
689 if (pcap_set_datalink(pd
, dlt
) < 0)
690 error("%s", pcap_geterr(pd
));
693 * We don't actually support changing the
694 * data link type, so we only let them
695 * set it to what it already is.
697 if (dlt
!= pcap_datalink(pd
)) {
698 error("%s is not one of the DLTs supported by this device\n",
702 (void)fprintf(stderr
, "%s: data link type %s\n",
703 program_name
, dlt_name
);
704 (void)fflush(stderr
);
706 i
= pcap_snapshot(pd
);
708 warning("snaplen raised from %d to %d", snaplen
, i
);
711 if (pcap_lookupnet(device
, &localnet
, &netmask
, ebuf
) < 0) {
717 * Let user own process after socket has been opened.
724 cmdbuf
= read_infile(infile
);
726 cmdbuf
= copy_argv(&argv
[optind
]);
728 if (pcap_compile(pd
, &fcode
, cmdbuf
, Oflag
, netmask
) < 0)
729 error("%s", pcap_geterr(pd
));
731 bpf_dump(&fcode
, dflag
);
735 init_addrtoname(localnet
, netmask
);
738 (void)setsignal(SIGPIPE
, cleanup
);
740 (void)setsignal(SIGTERM
, cleanup
);
741 (void)setsignal(SIGINT
, cleanup
);
742 /* Cooperate with nohup(1) */
744 if ((oldhandler
= setsignal(SIGHUP
, cleanup
)) != SIG_DFL
)
745 (void)setsignal(SIGHUP
, oldhandler
);
748 if (pcap_setfilter(pd
, &fcode
) < 0)
749 error("%s", pcap_geterr(pd
));
751 pcap_dumper_t
*p
= pcap_dump_open(pd
, WFileName
);
753 error("%s", pcap_geterr(pd
));
755 callback
= dump_packet_and_trunc
;
756 dumpinfo
.WFileName
= WFileName
;
759 pcap_userdata
= (u_char
*)&dumpinfo
;
761 callback
= dump_packet
;
762 pcap_userdata
= (u_char
*)p
;
765 type
= pcap_datalink(pd
);
766 printinfo
.printer
= lookup_printer(type
);
767 if (printinfo
.printer
== NULL
) {
768 dlt_name
= pcap_datalink_val_to_name(type
);
769 if (dlt_name
!= NULL
)
770 error("unsupported data link type %s", dlt_name
);
772 error("unsupported data link type %d", type
);
774 callback
= print_packet
;
775 pcap_userdata
= (u_char
*)&printinfo
;
778 (void)setsignal(SIGINFO
, requestinfo
);
781 if (RFileName
== NULL
) {
783 const char *dlt_name
;
785 if (!vflag
&& !WFileName
) {
786 (void)fprintf(stderr
,
787 "%s: verbose output suppressed, use -v or -vv for full protocol decode\n",
790 (void)fprintf(stderr
, "%s: ", program_name
);
791 dlt
= pcap_datalink(pd
);
792 dlt_name
= pcap_datalink_val_to_name(dlt
);
793 if (dlt_name
== NULL
) {
794 (void)fprintf(stderr
, "listening on %s, link-type %u, capture size %u bytes\n",
795 device
, dlt
, snaplen
);
797 (void)fprintf(stderr
, "listening on %s, link-type %s (%s), capture size %u bytes\n",
799 pcap_datalink_val_to_description(dlt
), snaplen
);
801 (void)fflush(stderr
);
804 status
= pcap_loop(pd
, cnt
, callback
, pcap_userdata
);
805 if (WFileName
== NULL
) {
807 * We're printing packets. Flush the printed output,
808 * so it doesn't get intermingled with error output.
812 * We got interrupted, so perhaps we didn't
813 * manage to finish a line we were printing.
814 * Print an extra newline, just in case.
818 (void)fflush(stdout
);
824 (void)fprintf(stderr
, "%s: pcap_loop: %s\n",
825 program_name
, pcap_geterr(pd
));
827 if (RFileName
== NULL
) {
829 * We're doing a live capture. Report the capture
835 exit(status
== -1 ? 1 : 0);
838 /* make a clean exit on interrupts */
840 cleanup(int signo _U_
)
842 #ifdef HAVE_PCAP_BREAKLOOP
844 * We have "pcap_breakloop()"; use it, so that we do as little
845 * as possible in the signal handler (it's probably not safe
846 * to do anything with standard I/O streams in a signal handler -
847 * the ANSI C standard doesn't say it is).
852 * We don't have "pcap_breakloop()"; this isn't safe, but
853 * it's the best we can do. Print the summary if we're
854 * not reading from a savefile - i.e., if we're doing a
855 * live capture - and exit.
857 if (pd
!= NULL
&& pcap_file(pd
) == NULL
) {
859 * We got interrupted, so perhaps we didn't
860 * manage to finish a line we were printing.
861 * Print an extra newline, just in case.
864 (void)fflush(stdout
);
872 info(register int verbose
)
874 struct pcap_stat stat
;
876 if (pcap_stats(pd
, &stat
) < 0) {
877 (void)fprintf(stderr
, "pcap_stats: %s\n", pcap_geterr(pd
));
882 fprintf(stderr
, "%s: ", program_name
);
884 (void)fprintf(stderr
, "%u packets captured", packets_captured
);
889 (void)fprintf(stderr
, "%d packets received by filter", stat
.ps_recv
);
894 (void)fprintf(stderr
, "%d packets dropped by kernel\n", stat
.ps_drop
);
903 for (i
= 0, j
= strlen(s
) - 1; i
< j
; i
++, j
--) {
912 swebitoa(unsigned int n
, char *s
)
918 s
[i
++] = n
% 10 + '0';
919 } while ((n
/= 10) > 0);
926 dump_packet_and_trunc(u_char
*user
, const struct pcap_pkthdr
*h
, const u_char
*sp
)
928 struct dump_info
*dump_info
;
936 dump_info
= (struct dump_info
*)user
;
939 * XXX - this won't prevent capture files from getting
940 * larger than Cflag - the last packet written to the
941 * file could put it over Cflag.
943 if (ftell((FILE *)dump_info
->p
) > Cflag
) {
944 name
= (char *) malloc(strlen(dump_info
->WFileName
) + 4);
946 error("dump_packet_and_trunc: malloc");
947 strcpy(name
, dump_info
->WFileName
);
948 swebitoa(cnt
, name
+ strlen(dump_info
->WFileName
));
950 pcap_dump_close(dump_info
->p
);
951 dump_info
->p
= pcap_dump_open(dump_info
->pd
, name
);
953 if (dump_info
->p
== NULL
)
954 error("%s", pcap_geterr(pd
));
957 pcap_dump((u_char
*)dump_info
->p
, h
, sp
);
958 #ifdef HAVE_PCAP_DUMP_FLUSH
960 pcap_dump_flush(dump_info
->p
);
969 dump_packet(u_char
*user
, const struct pcap_pkthdr
*h
, const u_char
*sp
)
975 pcap_dump(user
, h
, sp
);
976 #ifdef HAVE_PCAP_DUMP_FLUSH
978 pcap_dump_flush((pcap_dumper_t
*)user
);
987 print_packet(u_char
*user
, const struct pcap_pkthdr
*h
, const u_char
*sp
)
989 struct print_info
*print_info
;
997 print_info
= (struct print_info
*)user
;
1000 * Some printers want to check that they're not walking off the
1001 * end of the packet.
1002 * Rather than pass it all the way down, we set this global.
1004 snapend
= sp
+ h
->caplen
;
1006 hdrlen
= (*print_info
->printer
)(h
, sp
);
1009 * Print the raw packet data.
1013 * Include the link-layer header.
1015 default_print(sp
, h
->caplen
);
1018 * Don't include the link-layer header - and if
1019 * we have nothing past the link-layer header,
1022 if (h
->caplen
> hdrlen
)
1023 default_print(sp
+ hdrlen
,
1024 h
->caplen
- hdrlen
);
1037 * XXX - there should really be libpcap calls to get the version
1038 * number as a string (the string would be generated from #defines
1039 * at run time, so that it's not generated from string constants
1040 * in the library, as, on many UNIX systems, those constants would
1041 * be statically linked into the application executable image, and
1042 * would thus reflect the version of libpcap on the system on
1043 * which the application was *linked*, not the system on which it's
1046 * That routine should be documented, unlike the "version[]"
1047 * string, so that UNIX vendors providing their own libpcaps
1048 * don't omit it (as a couple of vendors have...).
1050 * Packet.dll should perhaps also export a routine to return the
1051 * version number of the Packet.dll code, to supply the
1052 * "Wpcap_version" information on Windows.
1054 char WDversion
[]="current-cvs.tcpdump.org";
1055 char version
[]="current-cvs.tcpdump.org";
1056 char pcap_version
[]="current-cvs.tcpdump.org";
1057 char Wpcap_version
[]="3.0 alpha";
1061 * By default, print the specified data out in hex.
1064 default_print(register const u_char
*bp
, register u_int length
)
1066 ascii_print("\n\t", bp
, length
); /* pass on lf and identation string */
1070 RETSIGTYPE
requestinfo(int signo _U_
)
1082 extern char version
[];
1083 #ifndef HAVE_PCAP_LIB_VERSION
1084 #if defined(WIN32) || defined(HAVE_PCAP_VERSION)
1085 extern char pcap_version
[];
1086 #else /* defined(WIN32) || defined(HAVE_PCAP_VERSION) */
1087 static char pcap_version
[] = "unknown";
1088 #endif /* defined(WIN32) || defined(HAVE_PCAP_VERSION) */
1089 #endif /* HAVE_PCAP_LIB_VERSION */
1091 #ifdef HAVE_PCAP_LIB_VERSION
1092 (void)fprintf(stderr
, "%s version %s\n", program_name
, version
);
1093 (void)fprintf(stderr
, "%s\n", pcap_lib_version());
1094 #else /* HAVE_PCAP_LIB_VERSION */
1096 (void)fprintf(stderr
, "%s version %s, based on tcpdump version %s\n", program_name
, WDversion
, version
);
1097 (void)fprintf(stderr
, "WinPcap version %s, based on libpcap version %s\n",Wpcap_version
, pcap_version
);
1099 (void)fprintf(stderr
, "%s version %s\n", program_name
, version
);
1100 (void)fprintf(stderr
, "libpcap version %s\n", pcap_version
);
1102 #endif /* HAVE_PCAP_LIB_VERSION */
1103 (void)fprintf(stderr
,
1104 "Usage: %s [-aAd" D_FLAG
"eflLnNOpqRStu" U_FLAG
"vxX]" B_FLAG_USAGE
" [-c count] [ -C file_size ]\n", program_name
);
1105 (void)fprintf(stderr
,
1106 "\t\t[ -E algo:secret ] [ -F file ] [ -i interface ] [ -r file ]\n");
1107 (void)fprintf(stderr
,
1108 "\t\t[ -s snaplen ] [ -T type ] [ -w file ] [ -y datalinktype ]\n");
1109 (void)fprintf(stderr
,
1110 "\t\t[ expression ]\n");