diff --git a/capture_opts.c b/capture_opts.c index 74b1a7992a..6cb03a7a29 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -301,6 +301,11 @@ capture_opts_add_opt(capture_options *capture_opts, const char *appname, int opt exit(1); } break; +#ifdef _WIN32 + case 'B': /* Buffer size */ + capture_opts->buffer_size = get_positive_int(appname, optarg, "buffer size"); + break; +#endif case 'c': /* Capture xxx packets */ capture_opts->has_autostop_packets = TRUE; capture_opts->autostop_packets = get_positive_int(appname, optarg, "packet count"); diff --git a/capture_sync.c b/capture_sync.c index ebc38b216d..9c177afe67 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -333,6 +333,7 @@ sync_pipe_start(capture_options *capture_opts) { char sautostop_filesize[ARGV_NUMBER_LEN]; char sautostop_duration[ARGV_NUMBER_LEN]; #ifdef _WIN32 + char buffer_size[ARGV_NUMBER_LEN]; char sync_pipe_fd[ARGV_NUMBER_LEN]; char signal_pipe_fd[ARGV_NUMBER_LEN]; char *fontstring; @@ -459,6 +460,10 @@ sync_pipe_start(capture_options *capture_opts) { capture_opts->signal_pipe_fd = signal_pipe[PIPE_WRITE]; + argv = sync_pipe_add_arg(argv, &argc, "-B"); + sprintf(buffer_size,"%d",capture_opts->buffer_size); + argv = sync_pipe_add_arg(argv, &argc, buffer_size); + /* Convert font name to a quote-encapsulated string and pass to child */ argv = sync_pipe_add_arg(argv, &argc, "-m"); fontstring = sync_pipe_quote_encapsulate(prefs.PREFS_GUI_FONT_NAME); diff --git a/doc/ethereal.pod b/doc/ethereal.pod index 2e62a40bfe..17c30546a3 100644 --- a/doc/ethereal.pod +++ b/doc/ethereal.pod @@ -8,6 +8,7 @@ ethereal - Interactively browse network traffic B S<[ B<-a> capture autostop condition ] ...> S<[ B<-b> ring buffer options] ...> +S<[ B<-B> capture buffer size (Win32 only) ] ...> S<[ B<-c> count ]> S<[ B<-f> capture filter expression ]> S<[ B<-h> ]> @@ -207,6 +208,12 @@ I kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). B:I begin again with the first file after I number of files were written (form a ring buffer). +=item -B + +Win32 only: set capture buffer size (in MB, default is 1MB). This is used by the +the capture driver to buffer packet data until that data can be written to +disk. If you encounter packet drops while capturing, try to increase this size. + =item -c Set the default number of packets to read when capturing live diff --git a/gtk/main.c b/gtk/main.c index 8c81ecbe69..a923e876fe 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1610,15 +1610,18 @@ main(int argc, char *argv[]) #ifdef HAVE_LIBPCAP #ifdef _WIN32 #define OPTSTRING_CHILD "W:Z:" +#define OPTSTRING_WIN32 "B:" #else #define OPTSTRING_CHILD "W:" +#define OPTSTRING_WIN32 "" #endif /* _WIN32 */ #else #define OPTSTRING_CHILD "" +#define OPTSTRING_WIN32 "" #endif /* HAVE_LIBPCAP */ - char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_CHILD) - 1] = - OPTSTRING_INIT; + char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_CHILD) + sizeof(OPTSTRING_WIN32) - 2] = + OPTSTRING_INIT OPTSTRING_WIN32; /* Set the current locale according to the program environment. @@ -1946,6 +1949,7 @@ main(int argc, char *argv[]) case 'w': /* Write to capture file xxx */ case 'y': /* Set the pcap data link type */ #ifdef _WIN32 + case 'B': /* Buffer size */ /* Hidden option supporting Sync mode */ case 'Z': /* Write to pipe FD XXX */ #endif /* _WIN32 */