ip(6)_tables.h: return type difference in ip(6)t_get_target

Pablo Neira pablo at eurodev.net
Fri Sep 9 00:54:03 CEST 2005


Henning Peters wrote:
> This software is being written in c++. I want to avoid using the
> command-line to talk to iptables for efficiency. Including iptables
> headers and linking to libiptables seemed reasonable for me. But compiling
> with g++ (gcc version 3.3.4 (pre 3.3.5 20040809)) and linking to the
> c-libs (extern "C" stuff) gave me a compile error:

Two comments:

a) The internal library used by iptables (libiptc) is undocumented and
its use is discouraged.
b) iptables is entirely written in C, linking libiptc to C++ code isn't
a good a idea.

So, you should call iptables via system(). It isn't great but you'll
have less problems.

--
Pablo



More information about the netfilter-devel mailing list