diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-02-23 19:00:30 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-02-23 19:00:30 +0000 |
commit | 1514fcff5f94bc02e1c4ee117bdacb459ebd184c (patch) | |
tree | 8e89acab04fdc2ccc4c0fc40bf2a876fa466d4fb /capture_opts.c | |
parent | b93465327798583bbc7ee89f26eae8f6273ec130 (diff) |
Have the minimum snapshot length be 1 byte, and have a snapshot length
of 0 mean 65535, similar to what tcpdump does.
Fixes bug 2731.
svn path=/trunk/; revision=27526
Diffstat (limited to 'capture_opts.c')
-rw-r--r-- | capture_opts.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/capture_opts.c b/capture_opts.c index debccc9128..ae94e8dd3e 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -514,7 +514,13 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, #endif case 's': /* Set the snapshot (capture) length */ capture_opts->has_snaplen = TRUE; - capture_opts->snaplen = get_positive_int(optarg, "snapshot length"); + capture_opts->snaplen = get_natural_int(optarg, "snapshot length"); + /* + * Make a snapshot length of 0 equivalent to the maximum packet + * length, mirroring what tcpdump does. + */ + if (capture_opts->snaplen == 0) + capture_opts->snaplen = WTAP_MAX_PACKET_SIZE; break; case 'S': /* "Real-Time" mode: used for following file ala tail -f */ capture_opts->real_time_mode = TRUE; |