THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

what is the best way to clean up in extcap?

Hi, I am learning extcap and need cleanup when stop capture. I debug the code a little bit, and seems Wireshark call TerminateProcess to force terminating the child extcap process. As a result, the extcap process has no chance to end (cleanup) gracefully.

I also read https://www.wireshark.org/docs/wsdg_h..., but it didn't mention how extcap process cleanup gracefully when stop capture.

Is there a recommended mechanism to archive this? Any help is appreciated, thanks.

wiresharkyyh's avatar
7
wiresharkyyh
asked 2021-01-05 02:50:29 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

This issue came up last year on the Wireshark dev mailing list, see here, but there was apparently no conclusion found.

There doesn't seem to be an issue for this in the Issue Tracker.

grahamb's avatar
23.8k
grahamb
answered 2021-01-05 08:38:40 +0000
edit flag offensive 0 remove flag delete link

Comments

Before I asked this question, I tried the same signal(). Unfortunately as what is described in the thread, the extcap child process doesn't get any signal when stop capture.

wiresharkyyh's avatar wiresharkyyh (2021-01-05 22:03:38 +0000) edit

Issue 17131 is filed, please continue the discussion over there. I will close this question. Thanks

wiresharkyyh's avatar wiresharkyyh (2021-01-06 00:54:16 +0000) edit
add a comment see more comments
0

I assume the idea behind extcap was to make it possible to have a relatively simple extcap program, without, for example, a pipe from dumpcap or Wireshark to the extcap program to send it messages such as a "stop capturing" message. It supports a control pipe to, for example, support changing capture parameters in the middle of the capture, but it doesn't require one.

On UN*X, you can send a signal that the program captures and treats as a "stop capturing" indication. I guess the idea was that TerminateProcess() is the Windows equivalent of kill() - but it isn't, because UN*X signals other than SIGKILL can be caught, but TerminateProcess() just kills the process, SIGKILL-style, rather than SIGTERM-style.

This needs some cleanup work. Please file an issue on this on the Wireshark issue tracker.

Guy Harris's avatar
19.9k
Guy Harris
answered 2021-01-05 05:19:29 +0000
edit flag offensive 0 remove flag delete link

Comments

Sure, I will file an issue

wiresharkyyh's avatar wiresharkyyh (2021-01-05 22:04:32 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer