diff --git a/acinclude.m4 b/acinclude.m4 index dedbe25ff4..5eb2359a07 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -513,9 +513,6 @@ and did you also install that package?]])) AC_MSG_RESULT(no) fi 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 # in the pcap.h header file. If it's not declared in the header diff --git a/capture_opts.c b/capture_opts.c index 48d1f37335..d060810234 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -97,7 +97,7 @@ capture_opts_init(capture_options *capture_opts, void *cf) capture_opts->sampling_param = 0; #endif #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) capture_opts->buffer_size = 1; /* 1 MB */ #endif 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 local : %u", capture_opts->nocap_local); #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) g_log(log_domain, log_level, "BufferSize : %u (MB)", capture_opts->buffer_size); #endif 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; } break; -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) case 'B': /* Buffer size */ capture_opts->buffer_size = get_positive_int(optarg_str_p, "buffer size"); break; diff --git a/capture_opts.h b/capture_opts.h index 507ced2926..fa9bf6d641 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -105,7 +105,7 @@ typedef struct capture_options_tag { int sampling_param; /**< PCAP packet sampling parameter */ #endif #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) int buffer_size; /**< the capture buffer size (MB) */ #endif gboolean has_snaplen; /**< TRUE if maximum capture packet length diff --git a/capture_sync.c b/capture_sync.c index 55ff2bd121..ab14c98558 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -257,7 +257,7 @@ sync_pipe_start(capture_options *capture_opts) { #ifdef HAVE_PCAP_SETSAMPLING char ssampling[ARGV_NUMBER_LEN]; #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) char buffer_size[ARGV_NUMBER_LEN]; #endif #ifdef _WIN32 @@ -398,7 +398,7 @@ sync_pipe_start(capture_options *capture_opts) { #endif #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) argv = sync_pipe_add_arg(argv, &argc, "-B"); #ifdef HAVE_PCAP_REMOTE if (capture_opts->src_type == CAPTURE_IFREMOTE) diff --git a/dumpcap.c b/dumpcap.c index a314483144..aff5cbc556 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -322,7 +322,7 @@ print_usage(gboolean print_ver) { fprintf(output, " -f packet filter in libpcap filter syntax\n"); fprintf(output, " -s packet snapshot length (def: 65535)\n"); fprintf(output, " -p don't capture in promiscuous mode\n"); -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) fprintf(output, " -B size of kernel buffer (def: 1MB)\n"); #endif fprintf(output, " -y link layer type (def: first appropriate)\n"); @@ -1483,11 +1483,9 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld, pcap_set_promisc(ld->pcap_h, capture_opts->promisc_mode); pcap_set_timeout(ld->pcap_h, CAP_READ_TIMEOUT); -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) if (capture_opts->buffer_size > 1) { pcap_set_buffer_size(ld->pcap_h, capture_opts->buffer_size * 1024 * 1024); } -#endif if (pcap_activate(ld->pcap_h) != 0) { /* Failed to activate, set to NULL */ pcap_close(ld->pcap_h); @@ -2705,11 +2703,11 @@ main(int argc, char *argv[]) #define OPTSTRING_INIT "a:b:c:Df:hi:LMnpSs:vw:y:Z:" #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) #define OPTSTRING_EXTRA "B:" #else #define OPTSTRING_EXTRA "" -#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */ +#endif /* _WIN32 or HAVE_PCAP_CREATE */ char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_EXTRA) - 1] = OPTSTRING_INIT OPTSTRING_EXTRA; @@ -2979,9 +2977,9 @@ main(int argc, char *argv[]) #ifdef HAVE_PCAP_SETSAMPLING case 'm': /* Sampling */ #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) case 'B': /* Buffer size */ -#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */ +#endif /* _WIN32 or HAVE_PCAP_CREATE */ status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture); if(status != 0) { exit_main(status); diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c index d9b4e3bc22..a6831a88df 100644 --- a/gtk/capture_dlg.c +++ b/gtk/capture_dlg.c @@ -85,7 +85,7 @@ #define E_CAP_SNAP_CB_KEY "cap_snap_cb" #define E_CAP_LT_OM_KEY "cap_lt_om" #define E_CAP_LT_OM_LABEL_KEY "cap_lt_om_label" -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) #define E_CAP_BUFFER_SIZE_SB_KEY "cap_buffer_size_sb" #endif #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 err; gchar *err_str; -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) GtkAdjustment *buffer_size_adj; GtkWidget *buffer_size_lb, *buffer_size_sb, *buffer_size_hb; #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_box_pack_start(GTK_BOX(main_hb), left_vb, TRUE, TRUE, 0); -#if defined (HAVE_AIRPCAP) || defined (HAVE_PCAP_REMOTE) || defined (HAVE_PCAP_SET_BUFFER_SIZE) +#if defined (HAVE_AIRPCAP) || defined (HAVE_PCAP_REMOTE) || defined (HAVE_PCAP_CREATE) /* Avoid adding the right vbox if not needed, because it steals 3 pixels */ right_vb = gtk_vbox_new(FALSE, 3); 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); #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) buffer_size_hb = gtk_hbox_new(FALSE, 3); buffer_size_lb = gtk_label_new("Buffer size:"); 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_SB_KEY, snap_sb); g_object_set_data(G_OBJECT(cap_open_w), E_CAP_LT_OM_KEY, linktype_om); -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) g_object_set_data(G_OBJECT(cap_open_w), E_CAP_BUFFER_SIZE_SB_KEY, buffer_size_sb); #endif 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 GtkWidget *iftype_cbx; #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) GtkWidget *buffer_size_sb; #endif 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_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); -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) buffer_size_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_BUFFER_SIZE_SB_KEY); #endif 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; #endif -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) global_capture_opts.buffer_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_sb)); #endif diff --git a/gtk/main.c b/gtk/main.c index c72163750f..89123ea937 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1161,7 +1161,7 @@ print_usage(gboolean print_ver) { fprintf(output, " -Q quit Wireshark after capturing\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"); -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) fprintf(output, " -B size of kernel buffer (def: 1MB)\n"); #endif fprintf(output, " -y link layer type (def: first appropriate)\n"); @@ -2021,7 +2021,7 @@ 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:" -#if defined HAVE_LIBPCAP && defined HAVE_PCAP_SET_BUFFER_SIZE +#if defined HAVE_LIBPCAP && defined HAVE_PCAP_CREATE #define OPTSTRING_EXTRA "B:" #else #define OPTSTRING_EXTRA "" @@ -2393,9 +2393,9 @@ main(int argc, char *argv[]) case 'S': /* "Sync" mode: used for following file ala tail -f */ case 'w': /* Write to capture file xxx */ case 'y': /* Set the pcap data link type */ -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) case 'B': /* Buffer size */ -#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */ +#endif /* _WIN32 or HAVE_PCAP_CREATE */ #ifdef HAVE_LIBPCAP status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture); diff --git a/tshark.c b/tshark.c index 6015f9c55f..bc5cc54325 100644 --- a/tshark.c +++ b/tshark.c @@ -232,7 +232,7 @@ print_usage(gboolean print_ver) fprintf(output, " -f packet filter in libpcap filter syntax\n"); fprintf(output, " -s packet snapshot length (def: 65535)\n"); fprintf(output, " -p don't capture in promiscuous mode\n"); -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) fprintf(output, " -B size of kernel buffer (def: 1MB)\n"); #endif fprintf(output, " -y link layer type (def: first appropriate)\n"); @@ -769,11 +769,11 @@ 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:" #ifdef HAVE_LIBPCAP -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) #define OPTSTRING_EXTRA "B:" #else #define OPTSTRING_EXTRA "" -#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */ +#endif /* _WIN32 or HAVE_PCAP_CREATE */ #else #define OPTSTRING_EXTRA "" #endif /* HAVE_LIBPCAP */ @@ -1003,9 +1003,9 @@ main(int argc, char *argv[]) case 's': /* Set the snapshot (capture) length */ case 'w': /* Write to capture file x */ case 'y': /* Set the pcap data link type */ -#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE) +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) case 'B': /* Buffer size */ -#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */ +#endif /* _WIN32 or HAVE_PCAP_CREATE */ #ifdef HAVE_LIBPCAP status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture); if(status != 0) {