Wireshark-dev: Re: [Wireshark-dev] How to troubleshoot extcap applications?

From: Dario Lombardo <lomato@xxxxxxxxx>
Date: Wed, 1 Dec 2021 14:34:57 +0100
I'm ok with this change. I can give you direct support for the extcaps I wrote (sshdump/ciscodump, udpdump, randpktdump), and do my best with the others.

On Wed, Dec 1, 2021 at 2:18 PM Jirka Novak <j.novak@xxxxxxxxxxxx> wrote:
Hi,

  I noticed issue below and I propose a solution for it. Can I ask for
comments?

  Every extcap tool has --debug and --debug-file options, but when they
are used, it do "nothing". File is created, but it is empty.
  Later I found that it must be used with --log-level=debug to really
log messages.
  The issue is that when you increase --log-level, it logs to console
(STDERR). So when extcap is started from Wireshark, it mixes log output
with packet data and wireshark gets confused and I found no way how to
make it operational.
  In other words you can't use debug of extcap from Wireshark.

  In code I found that the reason is that wsutils/wscode.c writes every
message to STDERR. If application registers additional file, it is
copied to it too, but output to STDERR is made in every case.
  Applications can replace default writer to STDERR, but no extcap do it.

  My proposal is to modify extcap/extcap-base.c:
1) When --debug is used, set log level to debug so you don't have to add
--log-level
2) If --log-file used, register custom log writer with
ws_log_init_with_writer() which will discard all messages so just write
to file will be made.
3) Update log init in every extcap

  Change is quite simple, but involves all extcaps. I already tested it
and it works. I'm just not sure every extcap.
  I'm ready to prepare patch.

                                        Best regards,

                                                Jirka
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe


--
Naima is online.