nltrace icon indicating copy to clipboard operation
nltrace copied to clipboard

Support for multi-threaded process?

Open DenizThatMenace opened this issue 10 years ago • 8 comments

Hi there, I just wanted to know if this project is still maintained and if it is planned to add support for multi-threaded processes?

Thanks, Deniz

DenizThatMenace avatar Aug 07 '14 09:08 DenizThatMenace

Sorry, this project is not maintained anymore. Tracing unfortunatelly is impossible because there is no way to parse unknown netlink messages. To write complete parser I should write library like wireshark or strace, that know everything about (constantly changing!) protocols in netlink. It's too hard for me, especially when no documentation really exists (like ipset protocol).

It seems we should use libnl3 to parse messages, but I have no time to complete this. SORRY... :(

socketpair avatar Aug 07 '14 10:08 socketpair

Also, cross-platform tracing is hard. Tracing file descriptors (to get known which descriptor is netlink socket actually) is hard task.

socketpair avatar Aug 07 '14 10:08 socketpair

That's sad to hear. But thanks for the fast answer. And thanks for the current version, which helps me a lot (even though I have problems nl-tracing my multi-threaded applications).

DenizThatMenace avatar Aug 07 '14 11:08 DenizThatMenace

OOOPS! I forgot that I already implement dumping via libnl3 :) shame on me. Will figure out how to trace multi-thread programs. It seems I should implement tracing clone() syscall as well as fork() and vfork(). (implement strace -f). It will be nice if you could help me :)

socketpair avatar Aug 07 '14 12:08 socketpair

Maybe this will work for you:

$ LD_PRELOAD=<full_path_to>/preload.so ipset list

socketpair avatar Aug 07 '14 12:08 socketpair

http://lwn.net/Articles/556183 + https://www.google.com/search?q=wireshark+netlink+dissector

socketpair avatar Aug 07 '14 12:08 socketpair

The following both commands seem to work:

$LD_PRELOAD=<full_path_to>/preload.so ipset list

<full_path_to>/nltrace ipset list

They print some netlink-messages. However, I do neither know if this are all netlink messages sent by that command nor if this command is a multi-threaded program.

I just realized that in my (C++-)program nltrace works as long the netlink-communication takes place in the main-thread. If I start an additional thread, netlink-communication occuring in that thread is not visible via nltrace.

You meant, I could help you. How exactly could I help?

DenizThatMenace avatar Aug 07 '14 14:08 DenizThatMenace

LD_PRELOAD-version can easily be patched to report thread-id in each message. But simultaneous access to netlink in different threads will garble output.

How you can help? make some pull-request!

socketpair avatar Aug 07 '14 17:08 socketpair