I announce a new tool: Netlink tracer

Марк Коренберг socketpair at gmail.com
Mon Apr 29 02:24:07 EDT 2013


Hello, developers!

I'm glad to announce new tracing tool: nltrace.

First of all, why it needed? Suppose I want to debug some netlink
application that do not use libnl (so, I can not set NLDBG=9 or
NLCB=DEBUG).

Trying to use strace will show only binary data that cannot be parsed.

So, I decide to intercept sending/receiving of netlink messages and
pass them to libnl message dumper !

There are two possibilities for that:

1. First, using ptrace() technique:
- will work even for static binaries
- guaranteed to be non-invasive to the process
- slower
- much harder to implement (threads, multiarch-issues...)

2. Second, using LD_PRELOAD technique
- will not work for static binaries
- invasive to the process
- relatively fast
- much easier to implement

I implement both methods using common base.
Usage:
$ nltrace ipset list # run "ipset list" and ptrace them(), debug all
messages to stderr
$ LD_PRELOAD=./preload.so ipset list  # do the same, but using
LD_PRELOAD technique

Where to get it:
https://github.com/socketpair/nltrace
or
$ git clone git://github.com/socketpair/nltrace.git

P.S.
ptrace() version works only on AMD64 (I will fix that later), does not
work when child process is not AMD64, does not work with threads. Does
not compile in clang (uses gcc's closure)

Also, it is pre-pre-pre-alpha version, but works now. Please review
and send your opinion!

--
Segmentation fault



More information about the libnl mailing list