From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fallucchi Antonio Subject: create c programm for insert rules in netfilters Date: Tue, 22 Jun 2004 11:45:08 +0200 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <40D7FFA4.3070002@cisbic.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: To: netfilter-devel Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org 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