aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2009-02-23 19:00:30 +0000
committerGuy Harris <guy@alum.mit.edu>2009-02-23 19:00:30 +0000
commit1514fcff5f94bc02e1c4ee117bdacb459ebd184c (patch)
tree8e89acab04fdc2ccc4c0fc40bf2a876fa466d4fb /capture_opts.c
parentb93465327798583bbc7ee89f26eae8f6273ec130 (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.c8
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;