diff options
author | David Perry <boolean263@protonmail.com> | 2021-06-16 15:23:40 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-07-14 04:34:52 +0000 |
commit | 67b54e8b66add38e30f057d5b9421c521d95d4ca (patch) | |
tree | 04106c7c92104c5f6866e923535457b14479399b /capture | |
parent | ff60fcf92dfc33f001e990268d060af4e97bfb7a (diff) |
tshark: allow --capture-comment when reading a file
Allows adding one or more capture comments to a new pcapng file when
tshark is reading from a file. Currently, tshark only allows setting one
capture comment, and that only when doing a live capture.
The use case for this feature is given in bug #15005.
I decided to allow multiple capture comments to match the same ability
in `editcap`.
To allow this change, I changed the function signature of
`process_cap_file()` so it takes a `capture_options` struct instead of
individual parameters that affect the capture.
Diffstat (limited to 'capture')
-rw-r--r-- | capture/capture_sync.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/capture/capture_sync.c b/capture/capture_sync.c index e8bb67f44f..ad7fbca89f 100644 --- a/capture/capture_sync.c +++ b/capture/capture_sync.c @@ -258,8 +258,10 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, inf argv = sync_pipe_add_arg(argv, &argc, "-P"); if (capture_opts->capture_comment) { - argv = sync_pipe_add_arg(argv, &argc, "--capture-comment"); - argv = sync_pipe_add_arg(argv, &argc, capture_opts->capture_comment); + for (j = 0; j < capture_opts->capture_comment->len; j++) { + argv = sync_pipe_add_arg(argv, &argc, "--capture-comment"); + argv = sync_pipe_add_arg(argv, &argc, (char*)g_ptr_array_index(capture_opts->capture_comment, j)); + } } if (capture_opts->multi_files_on) { |