aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2015-05-20 11:28:04 -0400
committerJeff Morriss <jeff.morriss.ws@gmail.com>2015-05-28 11:22:04 +0000
commit187e8f61dcea08b2db8f7cf78102b4c0eaa8e3a0 (patch)
treebc02fa66321e6489396595bb9d751fcc97f0c7c4
parent2772a11bd58770fe2eaef308c9db430ba9772f0c (diff)
Windows: don't attempt to set the capture buffer size on remote (rpcap) devices.
Also move the code for setting the buffer size on Windows near the code for setting it when we have pcap_create(): into open_capture_device(). Bug: 9067 Change-Id: Ica45f74b98094958d8bb0a38de23248aaa251d4b Reviewed-on: https://code.wireshark.org/review/8551 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
-rw-r--r--dumpcap.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 2a59a87d5e..5e2c69be92 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -787,6 +787,25 @@ open_capture_device(capture_options *capture_opts
*open_err_str);
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"pcap_open_live() returned %p.", (void *)pcap_h);
+
+/* Windows doesn't have pcap_create() yet */
+#ifdef _WIN32
+ /* try to set the capture buffer size -- but not for remote devices */
+ if (interface_opts->buffer_size > 1 &&
+ pcap_setbuff(pcap_h, interface_opts->buffer_size * 1024 * 1024) != 0) {
+ gchar *sync_secondary_msg_str;
+
+ sync_secondary_msg_str = g_strdup_printf(
+ "The capture buffer size of %d MiB seems to be too high for your machine,\n"
+ "the default of %d MiB will be used.\n"
+ "\n"
+ "Nonetheless, the capture is started.\n",
+ interface_opts->buffer_size, DEFAULT_CAPTURE_BUFFER_SIZE);
+ report_capture_error("Couldn't set the capture buffer size.",
+ sync_secondary_msg_str);
+ g_free(sync_secondary_msg_str);
+ }
+#endif
#endif
}
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "open_capture_device %s : %s", pcap_h ? "SUCCESS" : "FAILURE", interface_opts->name);
@@ -2635,7 +2654,6 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
guint i;
#ifdef _WIN32
int err;
- gchar *sync_secondary_msg_str;
WORD wVersionRequested;
WSADATA wsaData;
#endif
@@ -2755,22 +2773,6 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
pcap_opts->ts_nsec = have_high_resolution_timestamp(pcap_opts->pcap_h);
#endif
-#ifdef _WIN32
- /* try to set the capture buffer size */
- if (interface_opts.buffer_size > 1 &&
- pcap_setbuff(pcap_opts->pcap_h, interface_opts.buffer_size * 1024 * 1024) != 0) {
- sync_secondary_msg_str = g_strdup_printf(
- "The capture buffer size of %d MiB seems to be too high for your machine,\n"
- "the default of %d MiB will be used.\n"
- "\n"
- "Nonetheless, the capture is started.\n",
- interface_opts.buffer_size, DEFAULT_CAPTURE_BUFFER_SIZE);
- report_capture_error("Couldn't set the capture buffer size.",
- sync_secondary_msg_str);
- g_free(sync_secondary_msg_str);
- }
-#endif
-
#if defined(HAVE_PCAP_SETSAMPLING)
if (interface_opts.sampling_method != CAPTURE_SAMP_NONE) {
struct pcap_samp *samp;