forked from osmocom/wireshark
Checking in Stigs changes from
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=475 BUT not activating the check for pcap_create() pcap_set_buffer_size() This should make it possible to build with support for setting the buffersize if not capturing 802.11 traffic. The code for handling the 'B' option should be OK in any case. svn path=/trunk/; revision=32688
This commit is contained in:
parent
c911b0101b
commit
f9981411f1
|
@ -513,6 +513,9 @@ and did you also install that package?]]))
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
|
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
|
||||||
|
# Don't activate this check yet
|
||||||
|
# https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=475
|
||||||
|
# AC_CHECK_FUNCS(pcap_create pcap_set_buffer_size)
|
||||||
#
|
#
|
||||||
# pcap_breakloop may be present in the library but not declared
|
# pcap_breakloop may be present in the library but not declared
|
||||||
# in the pcap.h header file. If it's not declared in the header
|
# in the pcap.h header file. If it's not declared in the header
|
||||||
|
|
|
@ -97,7 +97,7 @@ capture_opts_init(capture_options *capture_opts, void *cf)
|
||||||
capture_opts->sampling_param = 0;
|
capture_opts->sampling_param = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
capture_opts->buffer_size = 1; /* 1 MB */
|
capture_opts->buffer_size = 1; /* 1 MB */
|
||||||
#endif
|
#endif
|
||||||
capture_opts->has_snaplen = FALSE;
|
capture_opts->has_snaplen = FALSE;
|
||||||
|
@ -173,7 +173,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
|
||||||
g_log(log_domain, log_level, "No capture RPCAP : %u", capture_opts->nocap_rpcap);
|
g_log(log_domain, log_level, "No capture RPCAP : %u", capture_opts->nocap_rpcap);
|
||||||
g_log(log_domain, log_level, "No capture local : %u", capture_opts->nocap_local);
|
g_log(log_domain, log_level, "No capture local : %u", capture_opts->nocap_local);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
g_log(log_domain, log_level, "BufferSize : %u (MB)", capture_opts->buffer_size);
|
g_log(log_domain, log_level, "BufferSize : %u (MB)", capture_opts->buffer_size);
|
||||||
#endif
|
#endif
|
||||||
g_log(log_domain, log_level, "SnapLen (%u): %u", capture_opts->has_snaplen, capture_opts->snaplen);
|
g_log(log_domain, log_level, "SnapLen (%u): %u", capture_opts->has_snaplen, capture_opts->snaplen);
|
||||||
|
@ -464,7 +464,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
case 'B': /* Buffer size */
|
case 'B': /* Buffer size */
|
||||||
capture_opts->buffer_size = get_positive_int(optarg_str_p, "buffer size");
|
capture_opts->buffer_size = get_positive_int(optarg_str_p, "buffer size");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -105,7 +105,7 @@ typedef struct capture_options_tag {
|
||||||
int sampling_param; /**< PCAP packet sampling parameter */
|
int sampling_param; /**< PCAP packet sampling parameter */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
int buffer_size; /**< the capture buffer size (MB) */
|
int buffer_size; /**< the capture buffer size (MB) */
|
||||||
#endif
|
#endif
|
||||||
gboolean has_snaplen; /**< TRUE if maximum capture packet length
|
gboolean has_snaplen; /**< TRUE if maximum capture packet length
|
||||||
|
|
|
@ -257,8 +257,10 @@ sync_pipe_start(capture_options *capture_opts) {
|
||||||
#ifdef HAVE_PCAP_SETSAMPLING
|
#ifdef HAVE_PCAP_SETSAMPLING
|
||||||
char ssampling[ARGV_NUMBER_LEN];
|
char ssampling[ARGV_NUMBER_LEN];
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
char buffer_size[ARGV_NUMBER_LEN];
|
char buffer_size[ARGV_NUMBER_LEN];
|
||||||
|
#endif
|
||||||
|
#ifdef _WIN32
|
||||||
HANDLE sync_pipe_read; /* pipe used to send messages from child to parent */
|
HANDLE sync_pipe_read; /* pipe used to send messages from child to parent */
|
||||||
HANDLE sync_pipe_write; /* pipe used to send messages from child to parent */
|
HANDLE sync_pipe_write; /* pipe used to send messages from child to parent */
|
||||||
HANDLE signal_pipe; /* named pipe used to send messages from parent to child (currently only stop) */
|
HANDLE signal_pipe; /* named pipe used to send messages from parent to child (currently only stop) */
|
||||||
|
@ -396,7 +398,7 @@ sync_pipe_start(capture_options *capture_opts) {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
argv = sync_pipe_add_arg(argv, &argc, "-B");
|
argv = sync_pipe_add_arg(argv, &argc, "-B");
|
||||||
#ifdef HAVE_PCAP_REMOTE
|
#ifdef HAVE_PCAP_REMOTE
|
||||||
if (capture_opts->src_type == CAPTURE_IFREMOTE)
|
if (capture_opts->src_type == CAPTURE_IFREMOTE)
|
||||||
|
|
|
@ -175,6 +175,9 @@
|
||||||
/* Define to 1 if you have the `pcap_breakloop' function. */
|
/* Define to 1 if you have the `pcap_breakloop' function. */
|
||||||
#cmakedefine HAVE_PCAP_BREAKLOOP 1
|
#cmakedefine HAVE_PCAP_BREAKLOOP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pcap_create' function. */
|
||||||
|
#cmakedefine HAVE_PCAP_CREATE 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `pcap_datalink_name_to_val' function. */
|
/* Define to 1 if you have the `pcap_datalink_name_to_val' function. */
|
||||||
#cmakedefine HAVE_PCAP_DATALINK_NAME_TO_VAL 1
|
#cmakedefine HAVE_PCAP_DATALINK_NAME_TO_VAL 1
|
||||||
|
|
||||||
|
@ -206,6 +209,9 @@
|
||||||
/* Define to 1 if you have the `pcap_open_dead' function. */
|
/* Define to 1 if you have the `pcap_open_dead' function. */
|
||||||
#cmakedefine HAVE_PCAP_OPEN_DEAD 1
|
#cmakedefine HAVE_PCAP_OPEN_DEAD 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pcap_set_buffer_size' function. */
|
||||||
|
#define HAVE_PCAP_SET_BUFFER_SIZE 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `pcap_set_datalink' function. */
|
/* Define to 1 if you have the `pcap_set_datalink' function. */
|
||||||
#cmakedefine HAVE_PCAP_SET_DATALINK 1
|
#cmakedefine HAVE_PCAP_SET_DATALINK 1
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# Only "win32" and "win64" are valid (for now).
|
# Only "win32" and "win64" are valid (for now).
|
||||||
# This can be defined in the system environment.
|
# This can be defined in the system environment.
|
||||||
!IFNDEF WIRESHARK_TARGET_PLATFORM
|
!IFNDEF WIRESHARK_TARGET_PLATFORM
|
||||||
WIRESHARK_TARGET_PLATFORM=win32
|
WIRESHARK_TARGET_PLATFORM=win64
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
##### Versions #####
|
##### Versions #####
|
||||||
|
|
67
dumpcap.c
67
dumpcap.c
|
@ -322,7 +322,7 @@ print_usage(gboolean print_ver) {
|
||||||
fprintf(output, " -f <capture filter> packet filter in libpcap filter syntax\n");
|
fprintf(output, " -f <capture filter> packet filter in libpcap filter syntax\n");
|
||||||
fprintf(output, " -s <snaplen> packet snapshot length (def: 65535)\n");
|
fprintf(output, " -s <snaplen> packet snapshot length (def: 65535)\n");
|
||||||
fprintf(output, " -p don't capture in promiscuous mode\n");
|
fprintf(output, " -p don't capture in promiscuous mode\n");
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
fprintf(output, " -B <buffer size> size of kernel buffer (def: 1MB)\n");
|
fprintf(output, " -B <buffer size> size of kernel buffer (def: 1MB)\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
|
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
|
||||||
|
@ -1460,19 +1460,39 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
||||||
the error buffer, and check if it's still a null string. */
|
the error buffer, and check if it's still a null string. */
|
||||||
open_err_str[0] = '\0';
|
open_err_str[0] = '\0';
|
||||||
#ifdef HAVE_PCAP_OPEN
|
#ifdef HAVE_PCAP_OPEN
|
||||||
auth.type = capture_opts->auth_type == CAPTURE_AUTH_PWD ?
|
if (strncmp (capture_opts->iface, "rpcap://", 8) == 0) {
|
||||||
RPCAP_RMTAUTH_PWD : RPCAP_RMTAUTH_NULL;
|
auth.type = capture_opts->auth_type == CAPTURE_AUTH_PWD ?
|
||||||
auth.username = capture_opts->auth_username;
|
RPCAP_RMTAUTH_PWD : RPCAP_RMTAUTH_NULL;
|
||||||
auth.password = capture_opts->auth_password;
|
auth.username = capture_opts->auth_username;
|
||||||
|
auth.password = capture_opts->auth_password;
|
||||||
|
|
||||||
ld->pcap_h = pcap_open(capture_opts->iface,
|
ld->pcap_h = pcap_open(capture_opts->iface,
|
||||||
capture_opts->has_snaplen ? capture_opts->snaplen :
|
capture_opts->has_snaplen ? capture_opts->snaplen :
|
||||||
WTAP_MAX_PACKET_SIZE,
|
WTAP_MAX_PACKET_SIZE,
|
||||||
/* flags */
|
/* flags */
|
||||||
(capture_opts->promisc_mode ? PCAP_OPENFLAG_PROMISCUOUS : 0) |
|
(capture_opts->promisc_mode ? PCAP_OPENFLAG_PROMISCUOUS : 0) |
|
||||||
(capture_opts->datatx_udp ? PCAP_OPENFLAG_DATATX_UDP : 0) |
|
(capture_opts->datatx_udp ? PCAP_OPENFLAG_DATATX_UDP : 0) |
|
||||||
(capture_opts->nocap_rpcap ? PCAP_OPENFLAG_NOCAPTURE_RPCAP : 0),
|
(capture_opts->nocap_rpcap ? PCAP_OPENFLAG_NOCAPTURE_RPCAP : 0),
|
||||||
CAP_READ_TIMEOUT, &auth, open_err_str);
|
CAP_READ_TIMEOUT, &auth, open_err_str);
|
||||||
|
} else
|
||||||
|
#elif defined(HAVE_PCAP_CREATE)
|
||||||
|
{
|
||||||
|
ld->pcap_h = pcap_create(capture_opts->iface, open_err_str);
|
||||||
|
if (ld->pcap_h != NULL) {
|
||||||
|
pcap_set_snaplen(ld->pcap_h, capture_opts->has_snaplen ? capture_opts->snaplen : WTAP_MAX_PACKET_SIZE);
|
||||||
|
pcap_set_promisc(ld->pcap_h, capture_opts->promisc_mode);
|
||||||
|
pcap_set_timeout(ld->pcap_h, CAP_READ_TIMEOUT);
|
||||||
|
|
||||||
|
if (capture_opts->buffer_size > 1) {
|
||||||
|
pcap_set_buffer_size(ld->pcap_h, capture_opts->buffer_size * 1024 * 1024);
|
||||||
|
}
|
||||||
|
if (pcap_activate(ld->pcap_h) != 0) {
|
||||||
|
/* Failed to activate, set to NULL */
|
||||||
|
pcap_close(ld->pcap_h);
|
||||||
|
ld->pcap_h = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
ld->pcap_h = pcap_open_live(capture_opts->iface,
|
ld->pcap_h = pcap_open_live(capture_opts->iface,
|
||||||
capture_opts->has_snaplen ? capture_opts->snaplen :
|
capture_opts->has_snaplen ? capture_opts->snaplen :
|
||||||
|
@ -1499,7 +1519,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
||||||
if (capture_opts->buffer_size > 1 &&
|
if (capture_opts->buffer_size > 1 &&
|
||||||
pcap_setbuff(ld->pcap_h, capture_opts->buffer_size * 1024 * 1024) != 0) {
|
pcap_setbuff(ld->pcap_h, capture_opts->buffer_size * 1024 * 1024) != 0) {
|
||||||
sync_secondary_msg_str = g_strdup_printf(
|
sync_secondary_msg_str = g_strdup_printf(
|
||||||
"The capture buffer size of %luMB seems to be too high for your machine,\n"
|
"The capture buffer size of %dMB seems to be too high for your machine,\n"
|
||||||
"the default of 1MB will be used.\n"
|
"the default of 1MB will be used.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Nonetheless, the capture is started.\n",
|
"Nonetheless, the capture is started.\n",
|
||||||
|
@ -1511,7 +1531,8 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_PCAP_REMOTE) && defined(HAVE_PCAP_SETSAMPLING)
|
#if defined(HAVE_PCAP_REMOTE) && defined(HAVE_PCAP_SETSAMPLING)
|
||||||
if (capture_opts->sampling_method != CAPTURE_SAMP_NONE)
|
if ((capture_opts->sampling_method != CAPTURE_SAMP_NONE) &&
|
||||||
|
(strncmp (capture_opts->iface, "rpcap://", 8) == 0))
|
||||||
{
|
{
|
||||||
struct pcap_samp *samp;
|
struct pcap_samp *samp;
|
||||||
|
|
||||||
|
@ -2682,14 +2703,14 @@ main(int argc, char *argv[])
|
||||||
#define OPTSTRING_INIT "a:b:c:Df:hi:LMnpSs:vw:y:Z:"
|
#define OPTSTRING_INIT "a:b:c:Df:hi:LMnpSs:vw:y:Z:"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
#define OPTSTRING_WIN32 "B:"
|
#define OPTSTRING_EXTRA "B:"
|
||||||
#else
|
#else
|
||||||
#define OPTSTRING_WIN32 ""
|
#define OPTSTRING_EXTRA ""
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
|
||||||
|
|
||||||
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_WIN32) - 1] =
|
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_EXTRA) - 1] =
|
||||||
OPTSTRING_INIT OPTSTRING_WIN32;
|
OPTSTRING_INIT OPTSTRING_EXTRA;
|
||||||
|
|
||||||
#ifdef DEBUG_CHILD_DUMPCAP
|
#ifdef DEBUG_CHILD_DUMPCAP
|
||||||
if ((debug_log = ws_fopen("dumpcap_debug_log.tmp","w")) == NULL) {
|
if ((debug_log = ws_fopen("dumpcap_debug_log.tmp","w")) == NULL) {
|
||||||
|
@ -2956,9 +2977,9 @@ main(int argc, char *argv[])
|
||||||
#ifdef HAVE_PCAP_SETSAMPLING
|
#ifdef HAVE_PCAP_SETSAMPLING
|
||||||
case 'm': /* Sampling */
|
case 'm': /* Sampling */
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
case 'B': /* Buffer size */
|
case 'B': /* Buffer size */
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
|
||||||
status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
|
status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
|
||||||
if(status != 0) {
|
if(status != 0) {
|
||||||
exit_main(status);
|
exit_main(status);
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
#define E_CAP_SNAP_CB_KEY "cap_snap_cb"
|
#define E_CAP_SNAP_CB_KEY "cap_snap_cb"
|
||||||
#define E_CAP_LT_OM_KEY "cap_lt_om"
|
#define E_CAP_LT_OM_KEY "cap_lt_om"
|
||||||
#define E_CAP_LT_OM_LABEL_KEY "cap_lt_om_label"
|
#define E_CAP_LT_OM_LABEL_KEY "cap_lt_om_label"
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
#define E_CAP_BUFFER_SIZE_SB_KEY "cap_buffer_size_sb"
|
#define E_CAP_BUFFER_SIZE_SB_KEY "cap_buffer_size_sb"
|
||||||
#endif
|
#endif
|
||||||
#define E_CAP_SNAP_SB_KEY "cap_snap_sb"
|
#define E_CAP_SNAP_SB_KEY "cap_snap_sb"
|
||||||
|
@ -1471,7 +1471,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
||||||
int row;
|
int row;
|
||||||
int err;
|
int err;
|
||||||
gchar *err_str;
|
gchar *err_str;
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
GtkAdjustment *buffer_size_adj;
|
GtkAdjustment *buffer_size_adj;
|
||||||
GtkWidget *buffer_size_lb, *buffer_size_sb, *buffer_size_hb;
|
GtkWidget *buffer_size_lb, *buffer_size_sb, *buffer_size_hb;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1658,7 +1658,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(left_vb), 0);
|
gtk_container_set_border_width(GTK_CONTAINER(left_vb), 0);
|
||||||
gtk_box_pack_start(GTK_BOX(main_hb), left_vb, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(main_hb), left_vb, TRUE, TRUE, 0);
|
||||||
|
|
||||||
#if defined (HAVE_AIRPCAP) || defined (HAVE_PCAP_REMOTE) || defined (_WIN32)
|
#if defined (HAVE_AIRPCAP) || defined (HAVE_PCAP_REMOTE) || defined (HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
/* Avoid adding the right vbox if not needed, because it steals 3 pixels */
|
/* Avoid adding the right vbox if not needed, because it steals 3 pixels */
|
||||||
right_vb = gtk_vbox_new(FALSE, 3);
|
right_vb = gtk_vbox_new(FALSE, 3);
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(right_vb), 0);
|
gtk_container_set_border_width(GTK_CONTAINER(right_vb), 0);
|
||||||
|
@ -1820,7 +1820,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
||||||
gtk_widget_show(remote_bt);
|
gtk_widget_show(remote_bt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
buffer_size_hb = gtk_hbox_new(FALSE, 3);
|
buffer_size_hb = gtk_hbox_new(FALSE, 3);
|
||||||
buffer_size_lb = gtk_label_new("Buffer size:");
|
buffer_size_lb = gtk_label_new("Buffer size:");
|
||||||
gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
|
||||||
|
@ -2179,7 +2179,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
||||||
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SNAP_CB_KEY, snap_cb);
|
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SNAP_CB_KEY, snap_cb);
|
||||||
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SNAP_SB_KEY, snap_sb);
|
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SNAP_SB_KEY, snap_sb);
|
||||||
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_LT_OM_KEY, linktype_om);
|
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_LT_OM_KEY, linktype_om);
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_BUFFER_SIZE_SB_KEY, buffer_size_sb);
|
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_BUFFER_SIZE_SB_KEY, buffer_size_sb);
|
||||||
#endif
|
#endif
|
||||||
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_PROMISC_KEY, promisc_cb);
|
g_object_set_data(G_OBJECT(cap_open_w), E_CAP_PROMISC_KEY, promisc_cb);
|
||||||
|
@ -2547,7 +2547,7 @@ capture_dlg_prep(gpointer parent_w) {
|
||||||
#ifdef HAVE_PCAP_REMOTE
|
#ifdef HAVE_PCAP_REMOTE
|
||||||
GtkWidget *iftype_cbx;
|
GtkWidget *iftype_cbx;
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
GtkWidget *buffer_size_sb;
|
GtkWidget *buffer_size_sb;
|
||||||
#endif
|
#endif
|
||||||
gchar *entry_text;
|
gchar *entry_text;
|
||||||
|
@ -2566,7 +2566,7 @@ capture_dlg_prep(gpointer parent_w) {
|
||||||
snap_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SNAP_CB_KEY);
|
snap_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SNAP_CB_KEY);
|
||||||
snap_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SNAP_SB_KEY);
|
snap_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SNAP_SB_KEY);
|
||||||
linktype_om = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_LT_OM_KEY);
|
linktype_om = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_LT_OM_KEY);
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
buffer_size_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_BUFFER_SIZE_SB_KEY);
|
buffer_size_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_BUFFER_SIZE_SB_KEY);
|
||||||
#endif
|
#endif
|
||||||
promisc_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_PROMISC_KEY);
|
promisc_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_PROMISC_KEY);
|
||||||
|
@ -2627,7 +2627,7 @@ capture_dlg_prep(gpointer parent_w) {
|
||||||
global_capture_opts.src_type = CAPTURE_IFREMOTE;
|
global_capture_opts.src_type = CAPTURE_IFREMOTE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
global_capture_opts.buffer_size =
|
global_capture_opts.buffer_size =
|
||||||
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_sb));
|
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_sb));
|
||||||
#endif
|
#endif
|
||||||
|
|
16
gtk/main.c
16
gtk/main.c
|
@ -1161,7 +1161,7 @@ print_usage(gboolean print_ver) {
|
||||||
fprintf(output, " -Q quit Wireshark after capturing\n");
|
fprintf(output, " -Q quit Wireshark after capturing\n");
|
||||||
fprintf(output, " -S update packet display when new packets are captured\n");
|
fprintf(output, " -S update packet display when new packets are captured\n");
|
||||||
fprintf(output, " -l turn on automatic scrolling while -S is in use\n");
|
fprintf(output, " -l turn on automatic scrolling while -S is in use\n");
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
fprintf(output, " -B <buffer size> size of kernel buffer (def: 1MB)\n");
|
fprintf(output, " -B <buffer size> size of kernel buffer (def: 1MB)\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
|
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
|
||||||
|
@ -2021,14 +2021,14 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
#define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:jJ:kK:lLm:nN:o:P:pQr:R:Ss:t:u:vw:X:y:z:"
|
#define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:jJ:kK:lLm:nN:o:P:pQr:R:Ss:t:u:vw:X:y:z:"
|
||||||
|
|
||||||
#if defined HAVE_LIBPCAP && defined _WIN32
|
#if defined HAVE_LIBPCAP && defined HAVE_PCAP_SET_BUFFER_SIZE
|
||||||
#define OPTSTRING_WIN32 "B:"
|
#define OPTSTRING_EXTRA "B:"
|
||||||
#else
|
#else
|
||||||
#define OPTSTRING_WIN32 ""
|
#define OPTSTRING_EXTRA ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_WIN32) - 1] =
|
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_EXTRA) - 1] =
|
||||||
OPTSTRING_INIT OPTSTRING_WIN32;
|
OPTSTRING_INIT OPTSTRING_EXTRA;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get credential information for later use, and drop privileges
|
* Get credential information for later use, and drop privileges
|
||||||
|
@ -2393,9 +2393,9 @@ main(int argc, char *argv[])
|
||||||
case 'S': /* "Sync" mode: used for following file ala tail -f */
|
case 'S': /* "Sync" mode: used for following file ala tail -f */
|
||||||
case 'w': /* Write to capture file xxx */
|
case 'w': /* Write to capture file xxx */
|
||||||
case 'y': /* Set the pcap data link type */
|
case 'y': /* Set the pcap data link type */
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
case 'B': /* Buffer size */
|
case 'B': /* Buffer size */
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
|
status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
|
||||||
&start_capture);
|
&start_capture);
|
||||||
|
|
18
tshark.c
18
tshark.c
|
@ -232,7 +232,7 @@ print_usage(gboolean print_ver)
|
||||||
fprintf(output, " -f <capture filter> packet filter in libpcap filter syntax\n");
|
fprintf(output, " -f <capture filter> packet filter in libpcap filter syntax\n");
|
||||||
fprintf(output, " -s <snaplen> packet snapshot length (def: 65535)\n");
|
fprintf(output, " -s <snaplen> packet snapshot length (def: 65535)\n");
|
||||||
fprintf(output, " -p don't capture in promiscuous mode\n");
|
fprintf(output, " -p don't capture in promiscuous mode\n");
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
fprintf(output, " -B <buffer size> size of kernel buffer (def: 1MB)\n");
|
fprintf(output, " -B <buffer size> size of kernel buffer (def: 1MB)\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
|
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
|
||||||
|
@ -769,16 +769,16 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
#define OPTSTRING_INIT "a:b:c:C:d:De:E:f:F:G:hi:K:lLnN:o:pPqr:R:s:St:T:u:vVw:xX:y:z:"
|
#define OPTSTRING_INIT "a:b:c:C:d:De:E:f:F:G:hi:K:lLnN:o:pPqr:R:s:St:T:u:vVw:xX:y:z:"
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
#define OPTSTRING_WIN32 "B:"
|
#define OPTSTRING_EXTRA "B:"
|
||||||
#else
|
#else
|
||||||
#define OPTSTRING_WIN32 ""
|
#define OPTSTRING_EXTRA ""
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
|
||||||
#else
|
#else
|
||||||
#define OPTSTRING_WIN32 ""
|
#define OPTSTRING_EXTRA ""
|
||||||
#endif /* HAVE_LIBPCAP */
|
#endif /* HAVE_LIBPCAP */
|
||||||
|
|
||||||
static const char optstring[] = OPTSTRING_INIT OPTSTRING_WIN32;
|
static const char optstring[] = OPTSTRING_INIT OPTSTRING_EXTRA;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get credential information for later use.
|
* Get credential information for later use.
|
||||||
|
@ -1003,9 +1003,9 @@ main(int argc, char *argv[])
|
||||||
case 's': /* Set the snapshot (capture) length */
|
case 's': /* Set the snapshot (capture) length */
|
||||||
case 'w': /* Write to capture file x */
|
case 'w': /* Write to capture file x */
|
||||||
case 'y': /* Set the pcap data link type */
|
case 'y': /* Set the pcap data link type */
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
|
||||||
case 'B': /* Buffer size */
|
case 'B': /* Buffer size */
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
|
status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
|
||||||
if(status != 0) {
|
if(status != 0) {
|
||||||
|
|
Loading…
Reference in New Issue