Iptables programming
Johnny Choque
jchoque at tlmat.unican.es
Tue Nov 22 13:04:00 UTC 2005
Hi all,
I am trying to do a program to query the internal structure of the
firewalling code. To start, I am following the examples of Querying libiptc
HOWTO but when I compile my program, showed below, I get some compile errors
because I can find the libiptc.h, ipt_kernel_headers.h and iptables.h files.
I have installed the iptables-devel rpm file but the problem is the same.
Anyone have any idea to find a solution for problem?
Regards,
Johnny
#include <getopt.h>
#include <sys/errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <time.h>
#include "libiptc/libiptc.h"
#include "iptables.h"
int main(void)
{
iptc_handle_t h;
const char *chain = NULL;
const char *tablename = "filter";
program_name = "p1";
program_version = NETFILTER_VERSION;
h = iptc_init(tablename);
if ( !h ) {
printf("Error initializing: %s\n", iptc_strerror(errno));
exit(errno);
}
for (chain = iptc_first_chain(&h); chain; chain = iptc_next_chain(&h)) {
printf("%s\n", chain);
}
exit(0);
} /* main */
More information about the fedora-list
mailing list