libnl3 on Ubuntu 12.04

2,073 views
Skip to first unread message

Doug Burks

unread,
Oct 31, 2012, 9:57:30 AM10/31/12
to netsn...@googlegroups.com
Hello all,

I'm having issues with libnl3 trying to build the latest git version
on Ubuntu 12.04. I did see this thread:
https://groups.google.com/d/topic/netsniff-ng/RyR4Zw-IiBY/discussion

Based on that thread, I have libnl1 and the libnl-3-dev packages installed:
dpkg -l |grep libnl
ii libnl-3-200 3.2.3-2ubuntu2
library for dealing with netlink sockets
ii libnl-3-dev 3.2.3-2ubuntu2
development library and headers for libnl-3
ii libnl-genl-3-200 3.2.3-2ubuntu2
library for dealing with netlink sockets - generic netlink
ii libnl-genl-3-dev 3.2.3-2ubuntu2
development library and headers for libnl-genl-3
ii libnl-route-3-200 3.2.3-2ubuntu2
library for dealing with netlink sockets - route interface
ii libnl1 1.1-7
library for dealing with netlink sockets
ii libnl2 2.0-1
library for dealing with netlink sockets

"cmake .." finds Libnl (full output below), but then make says:
/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
netlink/netlink.h: No such file or directory
(full make output is also copied below)

Any ideas?

Thanks,
--
Doug Burks
http://securityonion.blogspot.com


========================================
Output of cmake ..
========================================
-- The C compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Performing Test BPFATTACH_RUN_RESULT
-- Performing Test BPFATTACH_RUN_RESULT - Success
-- System has SO_ATTACH_FILTER/SO_DETACH_FILTER support
-- Performing Test PFPACKET_RUN_RESULT
-- Performing Test PFPACKET_RUN_RESULT - Success
-- System has PF_PACKET sockets
-- Performing Test STRICT_ALIGN_RUN_RESULT
-- Performing Test STRICT_ALIGN_RUN_RESULT - Success
-- System has strict alignment
-- Performing Test TX_RING_RUN_RESULT
-- Performing Test TX_RING_RUN_RESULT - Success
-- System has TX_RING support
-- Performing Test eth0
-- Performing Test eth0 - Failed
-- System has no SOF_TIMESTAMPING_RAW_HARDWARE support
-- Performing Test GEOIPV6_RUN_RESULT
-- Performing Test GEOIPV6_RUN_RESULT - Success
-- System has GeoIPv6 support
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Libnl: /lib/libnl-genl-3.so
-- Found FLEX: /usr/bin/flex
-- Found BISON: /usr/bin/bison
-- Could NOT find libcli (missing: LIBCLI_LIBRARY LIBCLI_INCLUDE_DIR)
libcli is missing on target. Skipping mausezahn build.
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
libncurses is missing on target. Skipping ifpps build.
-- Found LibGeoIP: /usr/lib/libGeoIP.so
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
-- Could NOT find libnetfilter_conntrack (missing:
LIBNETFILTER_CONNTRACK_LIBRARY LIBNETFILTER_CONNTRACK_INCLUDE_DIR)
-- Could NOT find liburcu (missing: LIBURCU_LIBRARY LIBURCU_INCLUDE_DIR)
libncurses is missing on target. Skipping flowtop build.
libnetfilter_conntrack is missing on target. Skipping flowtop build.
liburcu is missing on target. Skipping flowtop build.
-- Could NOT find NaCl (missing: NACL_LIBRARY NACL_INCLUDE_DIR)
NaCl was not found. Check if NACL_INCLUDE_DIR and NACL_LIB_DIR are
properly set in nacl_path.cmake. Skipping curvetun build.
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/doug/bdr/securityonion-netsniff-ng/git_failed/test/src/build


========================================
Output of make
========================================
Scanning dependencies of target netsniff-ng
[ 1%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/hash.c.o
[ 2%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/dissector.c.o
[ 3%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/dissector_eth.c.o
[ 5%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/dissector_80211.c.o
[ 6%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_arp.c.o
[ 7%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ethernet.c.o
[ 9%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_icmpv4.c.o
[ 10%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_icmpv6.c.o
[ 11%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_igmp.c.o
[ 13%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ip_authentication_hdr.c.o
[ 14%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ip_esp.c.o
[ 15%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv4.c.o
[ 17%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6.c.o
[ 18%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_dest_opts.c.o
[ 19%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_fragm.c.o
[ 21%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_hop_by_hop.c.o
[ 22%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_in_ipv4.c.o
[ 23%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_mobility_hdr.c.o
[ 25%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_no_nxt_hdr.c.o
[ 26%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_ipv6_routing.c.o
[ 27%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_none.c.o
[ 28%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_tcp.c.o
[ 30%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_udp.c.o
[ 31%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_vlan.c.o
[ 32%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_vlan_q_in_q.c.o
[ 34%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_mpls_unicast.c.o
[ 35%] Building C object
netsniff-ng/CMakeFiles/netsniff-ng.dir/__/proto_80211_mac_hdr.c.o
[ 36%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/xmalloc.c.o
[ 38%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/oui.c.o
[ 39%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/xio.c.o
[ 40%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/xutils.c.o
/home/doug/bdr/securityonion-netsniff-ng/git_failed/test/src/xutils.c:
In function ‘set_system_socket_mem’:
/home/doug/bdr/securityonion-netsniff-ng/git_failed/test/src/xutils.c:274:10:
warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
[ 42%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/bpf.c.o
[ 43%] Building C object netsniff-ng/CMakeFiles/netsniff-ng.dir/__/mac80211.c.o
In file included from
/home/doug/bdr/securityonion-netsniff-ng/git_failed/test/src/mac80211.c:20:0:
/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
netlink/netlink.h: No such file or directory
compilation terminated.
make[2]: *** [netsniff-ng/CMakeFiles/netsniff-ng.dir/__/mac80211.c.o] Error 1
make[1]: *** [netsniff-ng/CMakeFiles/netsniff-ng.dir/all] Error 2
make: *** [all] Error 2

Daniel Borkmann

unread,
Oct 31, 2012, 10:05:56 AM10/31/12
to netsn...@googlegroups.com
Hmm ... it should have been installed ... according to the libnl3-dev
file: http://packages.ubuntu.com/precise/amd64/libnl-3-dev/filelist

Does the file "/usr/include/libnl3/netlink/netlink.h" exist on your system?

Would it help if you hard-code "/usr/include/libnl3" as a path suffix
in src/cmake/modules/FindLibnl.cmake, remove the build folder and try
again?
> --
>
>

Doug Burks

unread,
Oct 31, 2012, 10:14:51 AM10/31/12
to netsn...@googlegroups.com
On Wed, Oct 31, 2012 at 10:05 AM, Daniel Borkmann
<bork...@iogearbox.net> wrote:
> Hmm ... it should have been installed ... according to the libnl3-dev
> file: http://packages.ubuntu.com/precise/amd64/libnl-3-dev/filelist
>
> Does the file "/usr/include/libnl3/netlink/netlink.h" exist on your system?

Yep:
ls -alh /usr/include/libnl3/netlink/netlink.h
-rw-r--r-- 1 root root 2.6K Apr 2 2012 /usr/include/libnl3/netlink/netlink.h

> Would it help if you hard-code "/usr/include/libnl3" as a path suffix
> in src/cmake/modules/FindLibnl.cmake, remove the build folder and try
> again?

Like this?
PATH_SUFFIXES /usr/include/libnl3

With a fresh build folder, running "cmake .." results in:
-- Could NOT find Libnl (missing: LIBNL_INCLUDE_DIR)
libnl is missing on target. Skipping netsniff-ng build.

Daniel Borkmann

unread,
Oct 31, 2012, 11:04:05 AM10/31/12
to netsn...@googlegroups.com, Markus Amend, doug....@gmail.com
How I hate cmake ... and without the first slash?

@Markus: btw. did you fix this issue in the mean-time, since you also
wrote on the list a while ago regarding this?

I have to catch a flight back to Europe, so you'll hear from me some
time tomorrow evening.

Doug Burks

unread,
Oct 31, 2012, 11:06:35 AM10/31/12
to Daniel Borkmann, netsn...@googlegroups.com, Markus Amend
On Wed, Oct 31, 2012 at 11:04 AM, Daniel Borkmann
<bork...@iogearbox.net> wrote:
> How I hate cmake ... and without the first slash?

Like this?
PATH_SUFFIXES usr/include/libnl3

Same result:
-- Could NOT find Libnl (missing: LIBNL_INCLUDE_DIR)
libnl is missing on target. Skipping netsniff-ng build.

Daniel Borkmann

unread,
Oct 31, 2012, 2:32:57 PM10/31/12
to netsn...@googlegroups.com, Markus Amend
On Wed, Oct 31, 2012 at 4:06 PM, Doug Burks <doug....@gmail.com> wrote:
> On Wed, Oct 31, 2012 at 11:04 AM, Daniel Borkmann
> <bork...@iogearbox.net> wrote:
>> How I hate cmake ... and without the first slash?
>
> Like this?
> PATH_SUFFIXES usr/include/libnl3
>
> Same result:
> -- Could NOT find Libnl (missing: LIBNL_INCLUDE_DIR)
> libnl is missing on target. Skipping netsniff-ng build.

Hmm... this sucks. What I did on Debian stable was that I compiled the
tarball from scratch. With configure prefix "usr".

Then, it worked. But I just noticed there is also an issue that came
up during libnl3 port where netsniff-ng with --rfraw exits with
"Waiting for netlink ack failed!". I'll look into that when I'm back
home after my flight.

Doug Burks

unread,
Nov 1, 2012, 9:05:16 AM11/1/12
to netsn...@googlegroups.com, Markus Amend
I spent some time playing with this but didn't have any luck.

In googling around, I found that Wireshark uses (used) cmake and libnl3:
http://anonsvn.wireshark.org/wireshark/trunk/cmake/modules/FindNL.cmake

I tried modifying that file to try to fit what netsniff-ng needs, but
couldn't get it to work. I also noticed that the current Wireshark
tarball no longer contains this file, so maybe they had issues with
libnl3 and moved on to something else?

Jon Schipp

unread,
Nov 1, 2012, 10:29:57 AM11/1/12
to netsn...@googlegroups.com
FWIW: I'm having trouble with this too. I tried this on Ubuntu 10.04
last night.
I downloaded the latest libnl3 from the author's website and compiled it.
cmake then found all the libraries. However, when I issue the "make"
I get a bunch of similar errors about being unable to find the header files:

"/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
netlink/netlink.h: No such file or directory
...."

I tried all the suggestions mentioned above.
> --
>
>

Daniel Borkmann

unread,
Nov 1, 2012, 1:43:05 PM11/1/12
to netsn...@googlegroups.com
On Thu, Nov 1, 2012 at 3:29 PM, Jon Schipp <jons...@gmail.com> wrote:
> FWIW: I'm having trouble with this too. I tried this on Ubuntu 10.04
> last night.
> I downloaded the latest libnl3 from the author's website and compiled it.
> cmake then found all the libraries. However, when I issue the "make"
> I get a bunch of similar errors about being unable to find the header files:
>
> "/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
> netlink/netlink.h: No such file or directory
> ...."
>
> I tried all the suggestions mentioned above.

Ok, seems I have to install an Ubuntu in KVM to reproduce all that.

Another try could be to copy
http://anonsvn.wireshark.org/wireshark/trunk/cmake/modules/FindNL.cmake
into "netsniff-ng/src/cmake/modules/FindLibnl.cmake" and replace all
...

* NL_FOUND into LIBNL_FOUND
* NL_LIBRARIES into LIBNL_LIBRARIES
* NL_INCLUDE_DIRS into LIBNL_INCLUDE_DIR
> --
>
>

Doug Burks

unread,
Nov 1, 2012, 1:48:28 PM11/1/12
to netsn...@googlegroups.com
On Thu, Nov 1, 2012 at 1:43 PM, Daniel Borkmann <bork...@iogearbox.net> wrote:
> On Thu, Nov 1, 2012 at 3:29 PM, Jon Schipp <jons...@gmail.com> wrote:
>> FWIW: I'm having trouble with this too. I tried this on Ubuntu 10.04
>> last night.
>> I downloaded the latest libnl3 from the author's website and compiled it.
>> cmake then found all the libraries. However, when I issue the "make"
>> I get a bunch of similar errors about being unable to find the header files:
>>
>> "/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
>> netlink/netlink.h: No such file or directory
>> ...."
>>
>> I tried all the suggestions mentioned above.
>
> Ok, seems I have to install an Ubuntu in KVM to reproduce all that.
>
> Another try could be to copy
> http://anonsvn.wireshark.org/wireshark/trunk/cmake/modules/FindNL.cmake
> into "netsniff-ng/src/cmake/modules/FindLibnl.cmake" and replace all
> ...
>
> * NL_FOUND into LIBNL_FOUND
> * NL_LIBRARIES into LIBNL_LIBRARIES
> * NL_INCLUDE_DIRS into LIBNL_INCLUDE_DIR

I tried that this morning, but couldn't get it to work.

Daniel Borkmann

unread,
Nov 1, 2012, 1:52:54 PM11/1/12
to netsn...@googlegroups.com
Thanks for the fast reply.

I hope to get this done as soon as possible via KVM.

High likely in the next release, we will just remove this cmake
brain-damage and switch back to the classical make system. It's more
predictable, well-known, has no bad surprises and one can customize it
quite easily (also for cross-compiling). Personally, I don't think
cmake has *any* benefit over the normal make in our case, it just
obfuscates stuff for users and developers and hides important
information.

Thanks again,
Daniel

Markus Amend

unread,
Nov 1, 2012, 2:04:47 PM11/1/12
to netsn...@googlegroups.com
Am 01.11.2012 um 18:52 schrieb Daniel Borkmann <bork...@iogearbox.net>:

> On Thu, Nov 1, 2012 at 6:48 PM, Doug Burks <doug....@gmail.com> wrote:
>> On Thu, Nov 1, 2012 at 1:43 PM, Daniel Borkmann <bork...@iogearbox.net> wrote:
>>> On Thu, Nov 1, 2012 at 3:29 PM, Jon Schipp <jons...@gmail.com> wrote:
>>>> FWIW: I'm having trouble with this too. I tried this on Ubuntu 10.04
>>>> last night.
>>>> I downloaded the latest libnl3 from the author's website and compiled it.
>>>> cmake then found all the libraries. However, when I issue the "make"
>>>> I get a bunch of similar errors about being unable to find the header files:
>>>>
>>>> "/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
>>>> netlink/netlink.h: No such file or directory
>>>> ...."
>>>>
>>>> I tried all the suggestions mentioned above.
>>>
>>> Ok, seems I have to install an Ubuntu in KVM to reproduce all that.
>>>
>>> Another try could be to copy
>>> http://anonsvn.wireshark.org/wireshark/trunk/cmake/modules/FindNL.cmake
>>> into "netsniff-ng/src/cmake/modules/FindLibnl.cmake" and replace all
>>> ...
>>>
>>> * NL_FOUND into LIBNL_FOUND
>>> * NL_LIBRARIES into LIBNL_LIBRARIES
>>> * NL_INCLUDE_DIRS into LIBNL_INCLUDE_DIR
>>
>> I tried that this morning, but couldn't get it to work.
>
> Thanks for the fast reply.
>
> I hope to get this done as soon as possible via KVM.
plz try also Ubuntu 10.04
>
> High likely in the next release, we will just remove this cmake
> brain-damage and switch back to the classical make system. It's more
> predictable, well-known, has no bad surprises and one can customize it
> quite easily (also for cross-compiling). Personally, I don't think
> cmake has *any* benefit over the normal make in our case, it just
> obfuscates stuff for users and developers and hides important
> information.
>
> Thanks again,
> Daniel
>
> --
>
>

Daniel Borkmann

unread,
Nov 2, 2012, 5:15:26 AM11/2/12
to netsn...@googlegroups.com
I will ping you back regarding this issue (and the libncurses from
Jon) on Sunday at latest. Thus, I'll try to get things working on
Ubuntu on the weekend.

Markus Amend

unread,
Nov 2, 2012, 7:45:23 AM11/2/12
to netsn...@googlegroups.com
Hmmm,

at weekend I could spent time in further developing 80211 mac header. But
that's not possible without compiling. Any idea as workaround?

Greetings

-----Ursprüngliche Nachricht-----
Von: netsn...@googlegroups.com [mailto:netsn...@googlegroups.com] Im
Auftrag von Daniel Borkmann
Gesendet: Freitag, 2. November 2012 10:15
An: netsn...@googlegroups.com
Betreff: Re: [netsniff-ng] libnl3 on Ubuntu 12.04

I will ping you back regarding this issue (and the libncurses from
Jon) on Sunday at latest. Thus, I'll try to get things working on Ubuntu on
the weekend.

--



Daniel Borkmann

unread,
Nov 2, 2012, 9:10:34 AM11/2/12
to netsn...@googlegroups.com
On Fri, Nov 2, 2012 at 12:45 PM, Markus Amend <mar...@netsniff-ng.org> wrote:
> Hmmm,
>
> at weekend I could spent time in further developing 80211 mac header. But
> that's not possible without compiling. Any idea as workaround?

Ok, I try to get something done tonight.

> -----Ursprüngliche Nachricht-----
> Von: netsn...@googlegroups.com [mailto:netsn...@googlegroups.com] Im
> Auftrag von Daniel Borkmann
> Gesendet: Freitag, 2. November 2012 10:15
> An: netsn...@googlegroups.com
> Betreff: Re: [netsniff-ng] libnl3 on Ubuntu 12.04
>
> I will ping you back regarding this issue (and the libncurses from
> Jon) on Sunday at latest. Thus, I'll try to get things working on Ubuntu on
> the weekend.
>
> --
>
>
>
> --
>
>

Daniel Borkmann

unread,
Nov 4, 2012, 6:29:26 PM11/4/12
to netsn...@googlegroups.com
The new build system is not yet finished, but you can give it already
a try. It still needs two or three evenings of hacking in order to
remove the whole cmake system, but what you can try is:

1) update to the latest Git
2) cd src/
3) make netsniff-ng
4) run ./netsniff-ng/netsniff-ng

That should work.

Doug Burks

unread,
Nov 5, 2012, 6:05:17 AM11/5/12
to netsn...@googlegroups.com
On Sun, Nov 4, 2012 at 6:29 PM, Daniel Borkmann <bork...@iogearbox.net> wrote:
> The new build system is not yet finished, but you can give it already
> a try. It still needs two or three evenings of hacking in order to
> remove the whole cmake system, but what you can try is:
>
> 1) update to the latest Git
> 2) cd src/
> 3) make netsniff-ng
> 4) run ./netsniff-ng/netsniff-ng
>
> That should work.

Good morning Daniel,

I tried the steps above in a clean directory and got the following:

make netsniff-ng
Building netsniff-ng:
-e CC hash.c
-e CC mac80211.c
In file included from mac80211.c:20:0:
/usr/include/libnl3/netlink/genl/genl.h:15:29: fatal error:
netlink/netlink.h: No such file or directory
compilation terminated.
make: *** [mac80211.o] Error 1

Of course, I still have netlink/netlink.h installed:
ls -alh /usr/include/libnl3/netlink/netlink.h
-rw-r--r-- 1 root root 2.6K Apr 2 2012 /usr/include/libnl3/netlink/netlink.h

dpkg -l |grep libnl
ii libnl-3-200 3.2.3-2ubuntu2
library for dealing with netlink sockets
ii libnl-3-dev 3.2.3-2ubuntu2
development library and headers for libnl-3
ii libnl-genl-3-200 3.2.3-2ubuntu2
library for dealing with netlink sockets - generic netlink
ii libnl-genl-3-dev 3.2.3-2ubuntu2
development library and headers for libnl-genl-3
ii libnl-route-3-200 3.2.3-2ubuntu2
library for dealing with netlink sockets - route interface
ii libnl1 1.1-7
library for dealing with netlink sockets
ii libnl2 2.0-1
library for dealing with netlink sockets

Any ideas?

Markus Amend

unread,
Nov 5, 2012, 6:18:51 AM11/5/12
to netsn...@googlegroups.com
I also get an error @Ubuntu10.04 with the same issue of cmake:

In file included from mac80211.c:20:
/usr/include/libnl3/netlink/genl/genl.h:15:29: error: netlink/netlink.h: No
such file or directory
/usr/include/libnl3/netlink/genl/genl.h:16:25: error: netlink/msg.h: No such
file or directory
/usr/include/libnl3/netlink/genl/genl.h:17:26: error: netlink/attr.h: No
such file or directory
...

/usr/include/libnl3/ exists with all needed files in it.

Greetings

Markus

Daniel Borkmann

unread,
Nov 5, 2012, 7:03:39 AM11/5/12
to netsn...@googlegroups.com
Can you please try again?

I just committed this:
https://github.com/gnumaniacs/netsniff-ng/commit/52471d34caeb9bdb96ac87249fdc9c340851ed13

The problem is that in one include file from the libnl3 headers, it
tries to include another header and simply cannot find it (because the
libnl3 path prefix is missing).
> --
>
>

Markus Amend

unread,
Nov 5, 2012, 7:25:54 AM11/5/12
to netsn...@googlegroups.com
It works :-)

-----Ursprüngliche Nachricht-----
Von: netsn...@googlegroups.com [mailto:netsn...@googlegroups.com] Im
Auftrag von Daniel Borkmann
Gesendet: Montag, 5. November 2012 13:04
An: netsn...@googlegroups.com
Betreff: Re: [netsniff-ng] libnl3 on Ubuntu 12.04

--



Daniel Borkmann

unread,
Nov 5, 2012, 7:29:04 AM11/5/12
to netsn...@googlegroups.com
Okay, great.

So the next couple of evenings, I'll try to complete the new build
architecture thus we can remove cmake.

I will write another announcement when it's fully deployed.
> --
>
>

Doug Burks

unread,
Nov 5, 2012, 8:22:59 AM11/5/12
to netsn...@googlegroups.com
On Mon, Nov 5, 2012 at 7:03 AM, Daniel Borkmann <bork...@iogearbox.net> wrote:
> Can you please try again?
>
> I just committed this:
> https://github.com/gnumaniacs/netsniff-ng/commit/52471d34caeb9bdb96ac87249fdc9c340851ed13
>
> The problem is that in one include file from the libnl3 headers, it
> tries to include another header and simply cannot find it (because the
> libnl3 path prefix is missing).

I got this:
make netsniff-ng
Building netsniff-ng:
-e CC hash.c
-e CC mac80211.c
-e CC dissector.c
-e CC dissector_eth.c
-e CC dissector_80211.c
-e CC proto_arp.c
-e CC proto_ethernet.c
-e CC proto_icmpv4.c
-e CC proto_icmpv6.c
-e CC proto_igmp.c
-e CC proto_ip_authentication_hdr.c
-e CC proto_ip_esp.c
-e CC proto_ipv4.c
-e CC proto_ipv6.c
-e CC proto_ipv6_dest_opts.c
-e CC proto_ipv6_fragm.c
-e CC proto_ipv6_hop_by_hop.c
-e CC proto_ipv6_in_ipv4.c
-e CC proto_ipv6_mobility_hdr.c
-e CC proto_ipv6_no_nxt_hdr.c
-e CC proto_ipv6_routing.c
-e CC proto_none.c
-e CC proto_tcp.c
-e CC proto_udp.c
-e CC proto_vlan.c
-e CC proto_vlan_q_in_q.c
-e CC proto_mpls_unicast.c
-e CC proto_80211_mac_hdr.c
-e CC xio.c
-e CC xutils.c
xutils.c: In function ‘set_system_socket_mem’:
xutils.c:274:10: warning: variable ‘ret’ set but not used
[-Wunused-but-set-variable]
-e CC xmalloc.c
-e CC bpf.c
-e CC oui.c
-e CC pcap.c
-e CC pcap_rw.c
-e CC pcap_sg.c
-e CC pcap_mmap.c
-e CC ring_rx.c
-e CC ring_tx.c
-e CC mtrand.c
-e CC tprintf.c
-e CC netsniff-ng.c
-e LD netsniff-ng
/usr/bin/ld: netsniff-ng/mac80211.o: undefined reference to symbol 'nlmsg_alloc'
/usr/bin/ld: note: 'nlmsg_alloc' is defined in DSO /lib/libnl-3.so.200
so try adding it to the linker command line
/lib/libnl-3.so.200: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [netsniff-ng] Error 1

What am I missing?

Daniel Borkmann

unread,
Nov 5, 2012, 8:36:55 AM11/5/12
to netsn...@googlegroups.com
Fixed.

> -e CC xmalloc.c
> -e CC bpf.c
> -e CC oui.c
> -e CC pcap.c
> -e CC pcap_rw.c
> -e CC pcap_sg.c
> -e CC pcap_mmap.c
> -e CC ring_rx.c
> -e CC ring_tx.c
> -e CC mtrand.c
> -e CC tprintf.c
> -e CC netsniff-ng.c
> -e LD netsniff-ng
> /usr/bin/ld: netsniff-ng/mac80211.o: undefined reference to symbol 'nlmsg_alloc'
> /usr/bin/ld: note: 'nlmsg_alloc' is defined in DSO /lib/libnl-3.so.200
> so try adding it to the linker command line
> /lib/libnl-3.so.200: could not read symbols: Invalid operation
> collect2: ld returned 1 exit status
> make: *** [netsniff-ng] Error 1
>
> What am I missing?

On my Debian machine, it is installed under /usr/lib/ . The symlink
/usr/lib/libnl-3.so.200 points to /usr/lib/libnl-3.so.200.10.1, so
does the symlink /usr/lib/libnl-3.so . The same counts for
libnl-genl-3.so et al. Is that maybe not the case on your machine
since ld cannot read the symbols?! (Wrong symlink?)

Daniel Borkmann

unread,
Nov 5, 2012, 8:38:38 AM11/5/12
to netsn...@googlegroups.com
# file /usr/lib/libnl-3.so.200.10.1
/usr/lib/libnl-3.so.200.10.1: ELF 64-bit LSB shared object, x86-64,
version 1 (SYSV), dynamically linked, not stripped

Or, is yours for 32-bit by accident?

Doug Burks

unread,
Nov 5, 2012, 8:46:01 AM11/5/12
to netsn...@googlegroups.com
On Mon, Nov 5, 2012 at 8:36 AM, Daniel Borkmann <bork...@iogearbox.net> wrote:
>> /usr/bin/ld: netsniff-ng/mac80211.o: undefined reference to symbol 'nlmsg_alloc'
>> /usr/bin/ld: note: 'nlmsg_alloc' is defined in DSO /lib/libnl-3.so.200
>> so try adding it to the linker command line
>> /lib/libnl-3.so.200: could not read symbols: Invalid operation
>> collect2: ld returned 1 exit status
>> make: *** [netsniff-ng] Error 1
>>
>> What am I missing?
>
> On my Debian machine, it is installed under /usr/lib/ . The symlink
> /usr/lib/libnl-3.so.200 points to /usr/lib/libnl-3.so.200.10.1, so
> does the symlink /usr/lib/libnl-3.so . The same counts for
> libnl-genl-3.so et al. Is that maybe not the case on your machine
> since ld cannot read the symbols?! (Wrong symlink?)


ls -alh /usr/lib/libnl*
lrwxrwxrwx 1 root root 18 May 2 2011 /usr/lib/libnl-cli.so.2 ->
libnl-cli.so.2.0.0
-rw-r--r-- 1 root root 31K May 2 2011 /usr/lib/libnl-cli.so.2.0.0
lrwxrwxrwx 1 root root 19 May 2 2011 /usr/lib/libnl-genl.so.2 ->
libnl-genl.so.2.0.0
-rw-r--r-- 1 root root 20K May 2 2011 /usr/lib/libnl-genl.so.2.0.0
lrwxrwxrwx 1 root root 17 May 2 2011 /usr/lib/libnl-nf.so.2 ->
libnl-nf.so.2.0.0
-rw-r--r-- 1 root root 66K May 2 2011 /usr/lib/libnl-nf.so.2.0.0
lrwxrwxrwx 1 root root 24 May 26 06:14 /usr/lib/libnl-route-3.so.200
-> libnl-route-3.so.200.3.0
-rw-r--r-- 1 root root 267K Apr 2 2012 /usr/lib/libnl-route-3.so.200.3.0
lrwxrwxrwx 1 root root 20 May 2 2011 /usr/lib/libnl-route.so.2 ->
libnl-route.so.2.0.0
-rw-r--r-- 1 root root 193K May 2 2011 /usr/lib/libnl-route.so.2.0.0
lrwxrwxrwx 1 root root 14 May 2 2011 /usr/lib/libnl.so.2 -> libnl.so.2.0.0
-rw-r--r-- 1 root root 90K May 2 2011 /usr/lib/libnl.so.2.0.0

ls -alh /lib/libnl*
lrwxrwxrwx 1 root root 18 Apr 2 2012 /lib/libnl-3.so -> libnl-3.so.200.3.0
lrwxrwxrwx 1 root root 18 May 26 06:13 /lib/libnl-3.so.200 ->
libnl-3.so.200.3.0
-rw-r--r-- 1 root root 95K Apr 2 2012 /lib/libnl-3.so.200.3.0
lrwxrwxrwx 1 root root 23 Apr 2 2012 /lib/libnl-genl-3.so ->
libnl-genl-3.so.200.3.0
lrwxrwxrwx 1 root root 23 May 26 06:13 /lib/libnl-genl-3.so.200 ->
libnl-genl-3.so.200.3.0
-rw-r--r-- 1 root root 20K Apr 2 2012 /lib/libnl-genl-3.so.200.3.0

file /lib/libnl-3.so.200.3.0
/lib/libnl-3.so.200.3.0: ELF 64-bit LSB shared object, x86-64, version
1 (SYSV), dynamically linked,
BuildID[sha1]=0xc1ca736f91d70ed352730384631a33100ff6a7d0, stripped

Daniel Borkmann

unread,
Nov 5, 2012, 8:58:40 AM11/5/12
to netsn...@googlegroups.com
On Mon, Nov 5, 2012 at 2:46 PM, Doug Burks <doug....@gmail.com> wrote:
> On Mon, Nov 5, 2012 at 8:36 AM, Daniel Borkmann <bork...@iogearbox.net> wrote:
>>> /usr/bin/ld: netsniff-ng/mac80211.o: undefined reference to symbol 'nlmsg_alloc'
>>> /usr/bin/ld: note: 'nlmsg_alloc' is defined in DSO /lib/libnl-3.so.200
>>> so try adding it to the linker command line
>>> /lib/libnl-3.so.200: could not read symbols: Invalid operation
>>> collect2: ld returned 1 exit status
>>> make: *** [netsniff-ng] Error 1
>>>
>>> What am I missing?
>>
>> On my Debian machine, it is installed under /usr/lib/ . The symlink
>> /usr/lib/libnl-3.so.200 points to /usr/lib/libnl-3.so.200.10.1, so
>> does the symlink /usr/lib/libnl-3.so . The same counts for
>> libnl-genl-3.so et al. Is that maybe not the case on your machine
>> since ld cannot read the symbols?! (Wrong symlink?)

Would this work? ... if you simply change the order of libs that are
used by the linker, I have read somewhere that this could cause such
an error. You could also try to remove -lpthread and leave -lnl-genl-3
as the only one - it will still be pulled later on:

# ldd netsniff-ng/netsniff-ng
linux-vdso.so.1 => (0x00007fff8d5ff000)
libnl-genl-3.so.200 => /usr/lib/libnl-genl-3.so.200 (0x00007fd1809e6000)
libc.so.6 => /lib/libc.so.6 (0x00007fd180684000)
libnl-3.so.200 => /usr/lib/libnl-3.so.200 (0x00007fd18046a000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007fd18024e000)
libm.so.6 => /lib/libm.so.6 (0x00007fd17ffcc000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd180c00000)

Here's the change:

diff --git a/src/netsniff-ng/Makefile b/src/netsniff-ng/Makefile
index a533702..035eb52 100644
--- a/src/netsniff-ng/Makefile
+++ b/src/netsniff-ng/Makefile
@@ -1,5 +1,5 @@
-netsniff-ng-libs = -lpthread \
- -lnl-genl-3
+netsniff-ng-libs = -lnl-genl-3 \
+ -lpthread

netsniff-ng-objs = hash.o \
mac80211.o \
> --
>
>

Doug Burks

unread,
Nov 5, 2012, 9:12:46 AM11/5/12
to netsn...@googlegroups.com
On Mon, Nov 5, 2012 at 8:58 AM, Daniel Borkmann <bork...@iogearbox.net> wrote:
> Would this work? ... if you simply change the order of libs that are
> used by the linker, I have read somewhere that this could cause such
> an error.

Tried this and got the same error.

> You could also try to remove -lpthread and leave -lnl-genl-3
> as the only one - it will still be pulled later on:

Tried this and got the same error.

netsniff-ng/Makefile:
netsniff-ng-libs = -lnl-genl-3
netsniff-ng-objs = hash.o \
<snip>
-e CC xmalloc.c
-e CC bpf.c
-e CC oui.c
-e CC pcap.c
-e CC pcap_rw.c
-e CC pcap_sg.c
-e CC pcap_mmap.c
-e CC ring_rx.c
-e CC ring_tx.c
-e CC mtrand.c
-e CC tprintf.c
-e CC netsniff-ng.c
-e LD netsniff-ng
/usr/bin/ld: netsniff-ng/mac80211.o: undefined reference to symbol 'nlmsg_alloc'
/usr/bin/ld: note: 'nlmsg_alloc' is defined in DSO /lib/libnl-3.so.200
so try adding it to the linker command line
/lib/libnl-3.so.200: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [netsniff-ng] Error 1

Thanks,

Daniel Borkmann

unread,
Nov 5, 2012, 10:25:17 AM11/5/12
to netsn...@googlegroups.com
Please pull. I've added -lnl-3 . Sometimes reading error messages helps.

Should work now. ^{tm} ;-)

Doug Burks

unread,
Nov 5, 2012, 10:41:53 AM11/5/12
to netsn...@googlegroups.com
Nice!
-e CC xmalloc.c
-e CC bpf.c
-e CC oui.c
-e CC pcap.c
-e CC pcap_rw.c
-e CC pcap_sg.c
-e CC pcap_mmap.c
-e CC ring_rx.c
-e CC ring_tx.c
-e CC mtrand.c
-e CC tprintf.c
-e CC netsniff-ng.c
-e LD netsniff-ng
-e STRIP netsniff-ng

Thanks!
Reply all
Reply to author
Forward
0 new messages