| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * | | 20 | * |
21 | * Support for splitting captures into multiple files with a maximum | | 21 | * Support for splitting captures into multiple files with a maximum |
22 | * file size: | | 22 | * file size: |
23 | * | | 23 | * |
24 | * Copyright (c) 2001 | | 24 | * Copyright (c) 2001 |
25 | * Seth Webster <swebster@sst.ll.mit.edu> | | 25 | * Seth Webster <swebster@sst.ll.mit.edu> |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | #ifndef lint | | 29 | #ifndef lint |
30 | static const char copyright[] _U_ = | | 30 | static const char copyright[] _U_ = |
31 | "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ | | 31 | "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ |
32 | The Regents of the University of California. All rights reserved.\n"; | | 32 | The Regents of the University of California. All rights reserved.\n"; |
33 | __RCSID("$NetBSD: tcpdump.c,v 1.13 2017/01/24 23:29:14 christos Exp $"); | | 33 | __RCSID("$NetBSD: tcpdump.c,v 1.14 2017/01/30 13:15:43 christos Exp $"); |
34 | #endif | | 34 | #endif |
35 | | | 35 | |
36 | /* | | 36 | /* |
37 | * tcpdump - dump traffic on a network | | 37 | * tcpdump - dump traffic on a network |
38 | * | | 38 | * |
39 | * First written in 1987 by Van Jacobson, Lawrence Berkeley Laboratory. | | 39 | * First written in 1987 by Van Jacobson, Lawrence Berkeley Laboratory. |
40 | * Mercilessly hacked and occasionally improved since then via the | | 40 | * Mercilessly hacked and occasionally improved since then via the |
41 | * combined efforts of Van, Steve McCanne and Craig Leres of LBL. | | 41 | * combined efforts of Van, Steve McCanne and Craig Leres of LBL. |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #ifdef HAVE_CONFIG_H | | 44 | #ifdef HAVE_CONFIG_H |
45 | #include "config.h" | | 45 | #include "config.h" |
46 | #endif | | 46 | #endif |
| @@ -185,36 +185,38 @@ RETSIGTYPE requestinfo(int); | | | @@ -185,36 +185,38 @@ RETSIGTYPE requestinfo(int); |
185 | #endif | | 185 | #endif |
186 | | | 186 | |
187 | #if defined(USE_WIN32_MM_TIMER) | | 187 | #if defined(USE_WIN32_MM_TIMER) |
188 | #include <MMsystem.h> | | 188 | #include <MMsystem.h> |
189 | static UINT timer_id; | | 189 | static UINT timer_id; |
190 | static void CALLBACK verbose_stats_dump(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); | | 190 | static void CALLBACK verbose_stats_dump(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); |
191 | #elif defined(HAVE_ALARM) | | 191 | #elif defined(HAVE_ALARM) |
192 | static void verbose_stats_dump(int sig); | | 192 | static void verbose_stats_dump(int sig); |
193 | #endif | | 193 | #endif |
194 | | | 194 | |
195 | static void info(int); | | 195 | static void info(int); |
196 | static u_int packets_captured; | | 196 | static u_int packets_captured; |
197 | | | 197 | |
| | | 198 | #ifdef HAVE_PCAP_FINDALLDEVS |
198 | static const struct tok status_flags[] = { | | 199 | static const struct tok status_flags[] = { |
199 | #ifdef PCAP_IF_UP | | 200 | #ifdef PCAP_IF_UP |
200 | { PCAP_IF_UP, "Up" }, | | 201 | { PCAP_IF_UP, "Up" }, |
201 | #endif | | 202 | #endif |
202 | #ifdef PCAP_IF_RUNNING | | 203 | #ifdef PCAP_IF_RUNNING |
203 | { PCAP_IF_RUNNING, "Running" }, | | 204 | { PCAP_IF_RUNNING, "Running" }, |
204 | #endif | | 205 | #endif |
205 | { PCAP_IF_LOOPBACK, "Loopback" }, | | 206 | { PCAP_IF_LOOPBACK, "Loopback" }, |
206 | { 0, NULL } | | 207 | { 0, NULL } |
207 | }; | | 208 | }; |
| | | 209 | #endif |
208 | | | 210 | |
209 | static pcap_t *pd; | | 211 | static pcap_t *pd; |
210 | | | 212 | |
211 | static int supports_monitor_mode; | | 213 | static int supports_monitor_mode; |
212 | | | 214 | |
213 | extern int optind; | | 215 | extern int optind; |
214 | extern int opterr; | | 216 | extern int opterr; |
215 | extern char *optarg; | | 217 | extern char *optarg; |
216 | | | 218 | |
217 | struct dump_info { | | 219 | struct dump_info { |
218 | char *WFileName; | | 220 | char *WFileName; |
219 | char *CurrentFileName; | | 221 | char *CurrentFileName; |
220 | pcap_t *pd; | | 222 | pcap_t *pd; |