On Mon, Nov 5, 2012 at 2:46 PM, Doug Burks <[email protected]> wrote:
> On Mon, Nov 5, 2012 at 8:36 AM, Daniel Borkmann <[email protected]>
> 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 \
> 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
>
>
> --
> Doug Burks
> http://securityonion.blogspot.com
>
> --
>
>
--