create c programm for insert rules in netfilters
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