Search code examples
linuxgnuiptables

How to programmatically access iptables?


Is there a way we can query iptables programmatically without making use of shell script? I don't have liberty of using shell script to run iptables command and grep output. Is there a native (API) level access to iptables using GNU C? At the bare minimum I would like to query default policy of iptables.

I was hoping to use /proc file system but I don't think its implemented yet.


Solution

  • So it looks like there isn't any way and it's been acknowledged by Netfilter group.

    See SO question, How can I programmatically manage iptables rules on the fly?