Problem with libiptc ( Rules modification)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi
    I am writing a GUI for FW rule-sets.Instead of
using iptables directly i am using functions provided
by libiptc library.

    Viewing rules using libiptc functions is Ok
but when i am trying to modify firewall rules
its giving segmentation faults with every functions
which modifies rules.even i am also not able to
flush the rules.

   Plz help me out of it.

MY CODE :

#include<stdio.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/errno.h>
#include<iptables.h>
#include<libiptc/libiptc.h>

int main(void)

{ iptc_handle_t handle;
  const char *chain=NULL;
  int res;

handle=iptc_init("filter");

if(!handle)
     { printf("Error1: %s \n", iptc_strerror(errno));
       exit(errno);
     }

for(chain=iptc_first_chain(&handle);chain;chain=iptc_next_chain(&handle))
      { printf(" Flushing %s chain",chain);
        res=iptc_flush_entries(chain,&handle);  /* Culprit Line */
      }

if(!res)
     { printf("Error2: %s \n", iptc_strerror(errno));
       exit(errno);
     }
}

 With Regards

     Biswajit Paul




[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux