Commit e9f1a0b6 authored by Gerald Combs's avatar Gerald Combs

One more step in privilege separation.

Add a capture_interface_list(), which works similar to
get_interface_list() except that it forks dumpcap instead of calling
the pcap routines directly.  Use it in the GUI.

Add a "-I" flag to dumpcap, which prints out verbose interface
information.

Tested under Windows and Linux.

svn path=/trunk/; revision=22071
parent f07a01dd
......@@ -69,9 +69,10 @@ typedef struct {
GList *get_interface_list(int *err, char **err_str);
/* Error values from "get_interface_list()". */
#define CANT_GET_INTERFACE_LIST 0 /* error getting list */
#define NO_INTERFACES_FOUND 1 /* list is empty */
/* Error values from "get_interface_list()/capture_interface_list()". */
#define CANT_GET_INTERFACE_LIST 1 /* error getting list */
#define NO_INTERFACES_FOUND 2 /* list is empty */
#define CANT_RUN_DUMPCAP 3 /* problem running 'dumpcap -I l' */
void free_interface_list(GList *if_list);
......
......@@ -40,6 +40,18 @@
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include <signal.h>
#include <errno.h>
......@@ -47,6 +59,7 @@
#include <epan/packet.h>
#include <epan/dfilter/dfilter.h>
#include <epan/ws_strsplit.h>
#include "file.h"
#include "capture.h"
#include "capture_sync.h"
......@@ -69,7 +82,7 @@
/**
/**
* Start a capture.
*
* @return TRUE if the capture starts successfully, FALSE otherwise.
......@@ -142,7 +155,7 @@ capture_kill_child(capture_options *capture_opts)
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_INFO, "Capture Kill");
/* kill the capture child */
sync_pipe_kill(capture_opts);
sync_pipe_kill(capture_opts->fork_child);
}
......@@ -209,7 +222,7 @@ guint32 drops)
break;
case CF_READ_ABORTED:
/* User wants to quit program. Exit by leaving the main loop,
/* User wants to quit program. Exit by leaving the main loop,
so that any quit functions we registered get called. */
main_window_nested_quit();
return FALSE;
......@@ -217,7 +230,7 @@ guint32 drops)
/* if we didn't captured even a single packet, close the file again */
if(cf_get_packet_count(capture_opts->cf) == 0 && !capture_opts->restart) {
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
"%sNo packets captured!%s\n"
"\n"
"As no data was captured, closing the %scapture file!\n"
......@@ -283,7 +296,7 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file)
case CF_OK:
break;
case CF_ERROR:
/* Don't unlink (delete) the save file - leave it around,
/* Don't unlink (delete) the save file - leave it around,
for debugging purposes. */
g_free(capture_opts->save_file);
capture_opts->save_file = NULL;
......@@ -307,7 +320,7 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file)
return TRUE;
}
/* capture child tells us we have new packets to read */
void
capture_input_new_packets(capture_options *capture_opts, int to_read)
......@@ -339,7 +352,7 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
}
} else {
/* increase capture file packet counter by the number or incoming packets */
cf_set_packet_count(capture_opts->cf,
cf_set_packet_count(capture_opts->cf,
cf_get_packet_count(capture_opts->cf) + to_read);
cf_callback_invoke(cf_cb_live_capture_fixed_continue, capture_opts->cf);
......@@ -479,7 +492,7 @@ capture_input_closed(capture_options *capture_opts)
/* XXX: If -Q (quit-after-cap) then cf->count clr'd below so save it first */
packet_count_save = cf_get_packet_count(capture_opts->cf);
/* Tell the GUI, we are not doing a capture any more.
Must be done after the cf_finish_tail(), so file lengths are displayed
Must be done after the cf_finish_tail(), so file lengths are displayed
correct. */
cf_callback_invoke(cf_cb_live_capture_update_finished, capture_opts->cf);
......@@ -488,7 +501,7 @@ capture_input_closed(capture_options *capture_opts)
case CF_READ_OK:
if ((packet_count_save == 0) && !capture_opts->restart) {
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
"%sNo packets captured!%s\n"
"\n"
"As no data was captured, closing the %scapture file!\n"
......@@ -526,7 +539,7 @@ capture_input_closed(capture_options *capture_opts)
/* this is a normal mode capture and if no error happened, read in the capture file data */
if(capture_opts->save_file != NULL) {
capture_input_read_all(capture_opts, cf_is_tempfile(capture_opts->cf),
capture_input_read_all(capture_opts, cf_is_tempfile(capture_opts->cf),
cf_get_drops_known(capture_opts->cf), cf_get_drops(capture_opts->cf));
}
}
......@@ -563,5 +576,107 @@ capture_input_closed(capture_options *capture_opts)
}
}
/**
* Fetch the interface list from a child process (dumpcap).
*
* @return A GList containing if_info_t structs if successful, NULL otherwise.
*/
/* XXX - We parse simple text output to get our interface list. Should
* we use "real" data serialization instead, e.g. via XML? */
GList *
capture_interface_list(int *err, char **err_str)
{
GList *if_list = NULL;
int i, j;
gchar *msg;
gchar **raw_list, **if_parts, **addr_parts;
gchar *name;
if_info_t *if_info;
if_addr_t *if_addr;
struct addrinfo *ai;
struct sockaddr_in *sa4;
struct sockaddr_in6 *sa6;
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List ...");
/* Try to get our interface list */
*err = sync_interface_list_open(&msg);
if(*err != 0) {
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List failed!");
if (*err_str)
*err_str = msg;
else
g_free(msg);
return NULL;
}
/* Split our lines */
raw_list = g_strsplit(msg, "\n", 0);
g_free(msg);
for (i = 0; raw_list[i] != NULL; i++) {
if_parts = g_strsplit(raw_list[i], "\t", 4);
if (if_parts[0] == NULL || if_parts[1] == NULL || if_parts[2] == NULL ||
if_parts[3] == NULL) {
g_strfreev(if_parts);
continue;
}
/* Number followed by the name, e.g "1. eth0" */
name = strchr(if_parts[0], ' ');
if (name) {
name++;
} else {
g_strfreev(if_parts);
continue;
}
if_info = g_malloc0(sizeof(if_info_t));
if_info->name = g_strdup(name);
if (strlen(if_parts[1]) > 0)
if_info->description = g_strdup(if_parts[1]);
addr_parts = g_strsplit(if_parts[2], ",", 0);
for (j = 0; addr_parts[j] != NULL; j++) {
/* XXX - We're failing to convert IPv6 addresses (on Ubuntu, at least) */
if (getaddrinfo(addr_parts[j], NULL, NULL, &ai) == 0) {
if_addr = NULL;
switch (ai->ai_family) {
case AF_INET:
if_addr = g_malloc0(sizeof(if_addr_t));
if_addr->type = AT_IPv4;
sa4 = (struct sockaddr_in *) ai->ai_addr;
if_addr->ip_addr.ip4_addr = sa4->sin_addr.s_addr;
break;
case AF_INET6:
if_addr = g_malloc0(sizeof(if_addr_t));
if_addr->type = AT_IPv6;
sa6 = (struct sockaddr_in6 *) ai->ai_addr;
memcpy(&if_addr->ip_addr.ip6_addr, sa6->sin6_addr.s6_addr, 16);
break;
}
if (if_addr) {
if_info->ip_addr = g_slist_append(if_info->ip_addr, if_addr);
}
freeaddrinfo(ai);
}
}
if (strcmp(if_parts[3], "loopback") == 0)
if_info->loopback = TRUE;
g_strfreev(if_parts);
g_strfreev(addr_parts);
if_list = g_list_append(if_list, if_info);
}
g_strfreev(raw_list);
/* Check to see if we built a list */
if (if_list == NULL) {
if (*err_str)
*err_str = g_strdup("No interfaces found");
*err = NO_INTERFACES_FOUND;
}
return if_list;
}
#endif /* HAVE_LIBPCAP */
......@@ -33,7 +33,7 @@
#include "capture_opts.h"
/**
/**
* Start a capture session.
*
* @param capture_opts the numerous capture options
......@@ -81,5 +81,10 @@ extern void capture_input_cfilter_error_message(capture_options *capture_opts, c
*/
extern void capture_input_closed(capture_options *capture_opts);
/**
* Fetch the interface list from a child process.
*/
extern GList *capture_interface_list(int *err, char **err_str);
#endif /* capture.h */
......@@ -31,6 +31,10 @@
#include <string.h>
#include <ctype.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include <glib.h>
#include <epan/packet.h>
......@@ -51,7 +55,7 @@ static gboolean capture_opts_output_to_pipe(const char *save_file, gboolean *is_
void
capture_opts_init(capture_options *capture_opts, void *cfile)
{
capture_opts->cf = cfile;
capture_opts->cf = cfile;
capture_opts->cfilter = g_strdup(""); /* No capture filter string specified */
capture_opts->iface = NULL; /* Default is "pick the first interface" */
#ifdef _WIN32
......@@ -77,7 +81,7 @@ capture_opts_init(capture_options *capture_opts, void *cfile)
capture_opts->has_autostop_files = FALSE;
capture_opts->autostop_files = 1;
capture_opts->has_autostop_packets = FALSE;
capture_opts->has_autostop_packets = FALSE;
capture_opts->autostop_packets = 0;
capture_opts->has_autostop_filesize = FALSE;
capture_opts->autostop_filesize = 1024; /* 1 MB */
......@@ -425,8 +429,9 @@ int capture_opts_list_link_layer_types(capture_options *capture_opts)
return 0;
}
int capture_opts_list_interfaces()
/* Return an ASCII-formatted list of interfaces. */
int
capture_opts_list_interfaces(gboolean verbose)
{
GList *if_list;
GList *if_entry;
......@@ -434,12 +439,11 @@ int capture_opts_list_interfaces()
int err;
gchar *err_str;
int i;
#if 0
GSList *ip_addr;
if_addr_t *if_addr;
guint8 ipv4[4];
#endif
char addr_str[NI_MAXHOST];
struct sockaddr_in sa4;
struct sockaddr_in6 sa6;
if_list = get_interface_list(&err, &err_str);
if (if_list == NULL) {
......@@ -453,7 +457,7 @@ int capture_opts_list_interfaces()
cmdarg_err("There are no interfaces on which a capture can be done");
break;
}
return 2;
return err;
}
i = 1; /* Interface id number */
......@@ -461,28 +465,62 @@ int capture_opts_list_interfaces()
if_entry = g_list_next(if_entry)) {
if_info = if_entry->data;
printf("%d. %s", i++, if_info->name);
if (if_info->description != NULL)
printf(" (%s)", if_info->description);
#if 0
for(ip_addr = g_slist_nth(if_info->ip_addr, 0); ip_addr != NULL;
ip_addr = g_slist_next(ip_addr)) {
if_addr = ip_addr->data;
switch(if_addr->type) {
case AT_IPv4:
memcpy(ipv4, (void *) &if_addr->ip_addr.ip4_addr, 4);
printf(" %u.%u.%u.%u", ipv4[0], ipv4[1], ipv4[2], ipv4[3]);
break;
case AT_IPv6:
/* XXX - display the IPv6 address without using stuff from epan */
printf(" XXX-IPv6");
break;
default:
printf(" unknown address type %u", if_addr->type);
if (!verbose) {
/* Add the description if it exists */
if (if_info->description != NULL)
printf(" (%s)", if_info->description);
} else {
/*
* Add the contents of the if_entry struct in a parseable format.
* Each if_entry element is tab-separated. Addresses are comma-
* separated.
*/
/* XXX - Make sure our description doesn't contain a tab */
if (if_info->description != NULL)
printf("\t%s\t", if_info->description);
else
printf("\t\t");
for(ip_addr = g_slist_nth(if_info->ip_addr, 0); ip_addr != NULL;
ip_addr = g_slist_next(ip_addr)) {
if (ip_addr != g_slist_nth(if_info->ip_addr, 0))
printf(",");
if_addr = ip_addr->data;
switch(if_addr->type) {
case AT_IPv4:
sa4.sin_family = AF_INET;
sa4.sin_addr.s_addr = if_addr->ip_addr.ip4_addr;
if (getnameinfo((struct sockaddr *) &sa4, sizeof(sa4),
addr_str, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) {
printf(addr_str);
} else {
printf("<unknown IPv4>");
}
break;
case AT_IPv6:
sa6.sin6_family = AF_INET6;
memcpy(&sa6.sin6_addr.s6_addr, &if_addr->ip_addr.ip6_addr, 16);
if (getnameinfo((struct sockaddr *) &sa6, sizeof(sa6),
addr_str, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) {
printf(addr_str);
} else {
printf("<unknown IPv6>");
}
break;
default:
printf("<type unknown %u>", if_addr->type);
}
}
}
#endif
printf("\n");
if (if_info->loopback)
printf("\tloopback");
else
printf("\tnetwork");
}
printf("\n");
}
free_interface_list(if_list);
......
......@@ -24,7 +24,7 @@
/** @file
*
*
* Capture options (all parameters needed to do the actual capture)
*
*/
......@@ -118,14 +118,14 @@ capture_opts_list_link_layer_types(capture_options *capture_opts);
/* list interfaces */
extern int
capture_opts_list_interfaces(void);
capture_opts_list_interfaces(gboolean verbose);
/* trim the snaplen entry */
extern void
extern void
capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min);
/* trim the ring_num_files entry */
extern void
extern void
capture_opts_trim_ring_num_files(capture_options *capture_opts);
/* trim the interface entry */
......
This diff is collapsed.
......@@ -24,10 +24,10 @@
/** @file
*
*
* Sync mode capture (internal interface).
*
* Will start a new Wireshark child instance which will do the actual capture
* Will start a new Wireshark child instance which will do the actual capture
* work.
*/
......@@ -35,10 +35,10 @@
#define __CAPTURE_SYNC_H__
/**
/**
* Start a new capture session.
* Create a capture child which is doing the real capture work.
* The various capture_input_... functions will be called, if something had
* The various capture_input_... functions will be called, if something had
* happened.
*
* Most of the parameters are passed through the global capture_opts.
......@@ -46,7 +46,7 @@
* @param capture_opts the options
* @return TRUE if a capture could be started, FALSE if not
*/
extern gboolean
extern gboolean
sync_pipe_start(capture_options *capture_opts);
/** User wants to stop capturing, gracefully close the capture child */
......@@ -55,12 +55,17 @@ sync_pipe_stop(capture_options *capture_opts);
/** User wants to stop the program, just kill the child as soon as possible */
extern void
sync_pipe_kill(capture_options *capture_opts);
sync_pipe_kill(int fork_child);
/** does the parent signalled the child to stop */
/** Has the parent signalled the child to stop? */
#ifdef _WIN32
extern gboolean
signal_pipe_check_running(void);
#endif
/** Get an interface list using dumpcap */
extern int
sync_interface_list_open(gchar **msg);
#endif /* capture_sync.h */
......@@ -14,6 +14,7 @@ S<[ B<-D> ]>
S<[ B<-f> E<lt>capture filterE<gt> ]>
S<[ B<-h> ]>
S<[ B<-i> E<lt>capture interfaceE<gt>|- ]>
S<[ B<-I> E<lt>l|sE<gt> ]>
S<[ B<-L> ]>
S<[ B<-p> ]>
S<[ B<-s> E<lt>capture snaplenE<gt> ]>
......@@ -155,6 +156,14 @@ standard libpcap format.
Note: the Win32 version of B<Dumpcap> doesn't support capturing from
pipes or stdin!
=item -I
If run with the B<l> argument, print a verbose, machine-readable interface
list, similar to the B<-D> flag.
If run with the B<s> argument, print statistics for each interface every
second until the program terminates.
=item -L
List the data link types supported by the interface and exit. The reported
......
......@@ -115,6 +115,7 @@ print_usage(gboolean print_ver) {
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
fprintf(output, " -D print list of interfaces and exit\n");
fprintf(output, " -L print list of link-layer types of iface and exit\n");
fprintf(output, " -I [l|s] print a detailed interface list (l) or interface statistics (s).\n");
fprintf(output, "\n");
fprintf(output, "Stop conditions:\n");
fprintf(output, " -c <packet count> stop after n packets (def: infinite)\n");
......@@ -161,7 +162,10 @@ cmdarg_err(const char *fmt, ...)
va_list ap;
if(capture_child) {
/* XXX - convert to g_log */
/* Print a bare error */
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
} else {
va_start(ap, fmt);
fprintf(stderr, "dumpcap: ");
......@@ -245,7 +249,7 @@ main(int argc, char *argv[])
gboolean list_link_layer_types = FALSE;
int status;
#define OPTSTRING_INIT "a:b:c:Df:hi:Lps:vw:y:Z"
#define OPTSTRING_INIT "a:b:c:Df:hI:i:Lps:vw:y:Z"
#ifdef _WIN32
#define OPTSTRING_WIN32 "B:"
......@@ -275,7 +279,7 @@ main(int argc, char *argv[])
/* the default_log_handler will use stdout, which makes trouble in */
/* capture child mode, as it uses stdout for it's sync_pipe */
/* so do the filtering in the console_log_handler and not here */
log_flags =
log_flags =
G_LOG_LEVEL_ERROR|
G_LOG_LEVEL_CRITICAL|
G_LOG_LEVEL_WARNING|
......@@ -297,7 +301,7 @@ main(int argc, char *argv[])
log_flags,
console_log_handler, NULL /* user_data */);
/* Set the initial values in the capture_opts. This might be overwritten
/* Set the initial values in the capture_opts. This might be overwritten
by the command line parameters. */
capture_opts_init(capture_opts, NULL);
......@@ -326,7 +330,7 @@ main(int argc, char *argv[])
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
get_runtime_version_info(runtime_info_str, NULL);
get_runtime_version_info(runtime_info_str, NULL);
show_version(comp_info_str, runtime_info_str);
g_string_free(comp_info_str, TRUE);
g_string_free(runtime_info_str, TRUE);
......@@ -362,9 +366,15 @@ main(int argc, char *argv[])
/*** all non capture option specific ***/
case 'D': /* Print a list of capture devices and exit */
status = capture_opts_list_interfaces();
status = capture_opts_list_interfaces(FALSE);
exit_main(status);
break;
/* XXX - We might want to use 'D' for this. Do we use GNU
* getopt on every platform (which supports optional arguments)? */
/* XXX - Implement interface stats */
case 'I':
status = capture_opts_list_interfaces(TRUE);
exit_main(status);
case 'L': /* Print list of link-layer types and exit */
list_link_layer_types = TRUE;
break;
......@@ -473,7 +483,7 @@ console_log_handler(const char *log_domain, GLogLevelFlags log_level,
/* create a "timestamp" */
time(&curr);
today = localtime(&curr);
today = localtime(&curr);
switch(log_level & G_LOG_LEVEL_MASK) {
case G_LOG_LEVEL_ERROR:
......@@ -558,7 +568,7 @@ report_cfilter_error(const char *cfilter, const char *errmsg)
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Capture filter error: %s", errmsg);
pipe_write_block(1, SP_BAD_FILTER, errmsg);
} else {
fprintf(stderr,
fprintf(stderr,
"Invalid capture filter: \"%s\"!\n"
"\n"
"That string isn't a valid capture filter (%s).\n"
......@@ -571,9 +581,9 @@ void
report_capture_error(const char *error_msg, const char *secondary_error_msg)
{
if(capture_child) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"Primary Error: %s", error_msg);
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"Secondary Error: %s", secondary_error_msg);
sync_pipe_errmsg_to_parent(error_msg, secondary_error_msg);
} else {
......
......@@ -236,7 +236,7 @@ set_link_type_list(GtkWidget *linktype_om, GtkWidget *entry)
/*
* Try to get the list of known interfaces.
*/
if_list = get_interface_list(&err, NULL);
if_list = capture_interface_list(&err, NULL);
if (if_list != NULL) {
/*
* We have the list - check it.
......@@ -627,7 +627,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
}
#endif
if_list = get_interface_list(&err, &err_str);
if_list = capture_interface_list(&err, &err_str);
if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_str);
g_free(err_str);
......
......@@ -397,7 +397,7 @@ combo_channel_new(void)
gint if_list_comparator_alph (const void *first_arg, const void *second_arg){
const if_info_t *first = first_arg, *second = second_arg;
if (first != NULL && first->description != NULL &&
if (first != NULL && first->description != NULL &&
second != NULL && second->description != NULL) {
return g_strcasecmp(first->description, second->description);
} else {
......@@ -458,7 +458,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
#endif
/* LOAD THE INTERFACES */
if_list = get_interface_list(&err, &err_str);
if_list = capture_interface_list(&err, &err_str);
if_list = g_list_sort (if_list, if_list_comparator_alph);
if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_str);
......
This diff is collapsed.
......@@ -2568,7 +2568,7 @@ main(int argc, char *argv[])
/*** all non capture option specific ***/
case 'D': /* Print a list of capture devices and exit */
#ifdef HAVE_LIBPCAP
capture_opts_list_interfaces();
capture_opts_list_interfaces(FALSE);
exit(0);
#else
capture_option_specified = TRUE;
......
......@@ -740,7 +740,7 @@ main(int argc, char *argv[])
*/
opterr = 0;
optind_initial = optind;
while ((opt = getopt(argc, argv, optstring)) != -1) {
switch (opt) {
case 'X':
......@@ -750,7 +750,7 @@ main(int argc, char *argv[])
break;
}
}
optind = optind_initial;
opterr = 1;
......@@ -948,7 +948,7 @@ main(int argc, char *argv[])
break;
case 'D': /* Print a list of capture devices and exit */
#ifdef HAVE_LIBPCAP
status = capture_opts_list_interfaces();
status = capture_opts_list_interfaces(FALSE);
exit(status);
#else
capture_option_specified = TRUE;
......@@ -1146,7 +1146,7 @@ main(int argc, char *argv[])
"specified with \"-e\".");
exit(1);
}
}
/* If no capture filter or read filter has been specified, and there are
still command-line arguments, treat them as the tokens of a capture
......@@ -1269,7 +1269,7 @@ main(int argc, char *argv[])
"a capture isn't being done.");
exit(1);
}
/* Note: TShark now allows the restriction of a _read_ file by packet count
* and byte count as well as a write file. Other autostop options remain valid
* only for a write file.
......@@ -1486,7 +1486,7 @@ main(int argc, char *argv[])
/* Process the packets in the file */
#ifdef HAVE_LIBPCAP
err = load_cap_file(&cfile, capture_opts.save_file, out_file_type,
err = load_cap_file(&cfile, capture_opts.save_file, out_file_type,
capture_opts.has_autostop_packets ? capture_opts.autostop_packets : 0,
capture_opts.has_autostop_filesize ? capture_opts.autostop_filesize : 0);
#else
......@@ -2114,7 +2114,7 @@ report_counts_siginfo(int signum _U_)
#endif /* HAVE_LIBPCAP */
static int
load_cap_file(capture_file *cf, char *save_file, int out_file_type,
load_cap_file(capture_file *cf, char *save_file, int out_file_type,
int max_packet_count, gint64 max_byte_count)
{
gint linktype;
......@@ -2401,7 +2401,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
}
if (passed) {
/* Keep the time of the current packet if the packet passed
/* Keep the time of the current packet if the packet passed
the read filter so that the delta time since last displayed
packet can be calculated */
prev_dis_ts = fdata.abs_ts;
......@@ -2809,7 +2809,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
case WRITE_FIELDS:
proto_tree_write_fields(output_fields, edt, stdout);
printf("\n");
return !ferror(stdout);
return !ferror(stdout);
}
} else {
/* Just fill in the columns. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment