logo
Getting libdnet to compile under Fedora

You're probably here because you want to run lsrscan, or lsrtunnel, or perhaps stegtunnel, and you're having problems compiling libdnet.

You're getting an error like the following:

In file included from fw-ipchains.c:15:
/usr/include/linux/ip.h:95: syntax error before "__u8"
/usr/include/linux/ip.h:102: syntax error before "tot_len"
/usr/include/linux/ip.h:103: syntax error before "id"
/usr/include/linux/ip.h:104: syntax error before "frag_off"
/usr/include/linux/ip.h:105: syntax error before "ttl"
/usr/include/linux/ip.h:106: syntax error before "protocol"
/usr/include/linux/ip.h:107: syntax error before "check"
/usr/include/linux/ip.h:108: syntax error before "saddr"
/usr/include/linux/ip.h:109: syntax error before "daddr"
In file included from /usr/include/linux/tcp.h:21,
                 from fw-ipchains.c:16:
/usr/include/asm/byteorder.h:6:2: warning: #warning using private kernel header;
 include  instead!
In file included from fw-ipchains.c:16:
/usr/include/linux/tcp.h:105: braced-group within expression allowed only inside
 a function
/usr/include/linux/tcp.h:105: enumerator value for `TCP_FLAG_CWR' not integer co
nstant
/usr/include/linux/tcp.h:106: syntax error before "__u32"
/usr/include/linux/tcp.h:107: syntax error before "__u32"
/usr/include/linux/tcp.h:108: syntax error before "__u32"
/usr/include/linux/tcp.h:109: syntax error before "__u32"
/usr/include/linux/tcp.h:110: syntax error before "__u32"
/usr/include/linux/tcp.h:111: syntax error before "__u32"
/usr/include/linux/tcp.h:112: syntax error before "__u32"
/usr/include/linux/tcp.h:113: syntax error before "__u32"
/usr/include/linux/tcp.h:114: syntax error before "__u32"
In file included from fw-ipchains.c:25:
/usr/include/linux/netfilter_ipv4/ipchains_core.h:114: field `fwp_iph' has incom
plete type
/usr/include/linux/netfilter_ipv4/ipchains_core.h:122: confused by earlier error
s, bailing out


It's ugly, and I apologize. You're not the only one. Fedora borked their kernel header files, and libdnet hasn't yet incorporated the patches to fix it. (Or Fedora hasn't fixed it yet. Basically, you and me are the people that care about this).

So, what to do? In a few days, I'll post some modified tarballs that include a libdnet-possiblymodified, a la nmap including its own libpcap.

In the short run, well, I have a patch for you to use. If you're not familiar with patch syntax, follow the below instructions:

  • Download the libdnet tarball and the patch into the same directory.

  • Extract the libdnet tarball:
    tar xzvf libdnet-1.7.tar.gz

  • Patch the libdnet source:
    patch -p0 <libdnet-patch.fedora

  • Change directory into the libdnet directory, and configure, make, make install as you normally would, and then make lsrscan, or whichever tool you were trying to make.

That's it! I apologize for the inconvenience, I'll get cleaner tarballs up shortly.

-Todd