Skip to contentSkip to conversation

create c programm for insert rules in netfilters

DISCUSSION Fallucchi Antonio 1 participant 1 message Jun 22, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

hi,

I must create a c programm for inserting rules in iptables..

I have used "do_command" function:

char *tablename = "filter";
iptc_handle_t h = NULL;
char *vettarg[] = {"iptable", "-t", "nat", "-A", "OUTPUT", "-d", "!", "127.0.0.1", "-p", "tcp", "--tcp-flags", "syn", "syn", "-j", "QUEUE"}; int numarg=15;
do_command(numarg, vettarg, &tablename, &h);

but, the program crashes with segmentation fault doing;

for (protocol = argv[optind-1]; *protocol; protocol++)

               *protocol = tolower(*protocol);

please help me!
Antonio