Re: [SOLVED] Re: Native support of counting rules?

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

 



On 04.01.2013 06:02, Eliezer Croitoru wrote:
Since iptables are kind of static I think a simple script should be good
enough.

A one liner should do the trick:
tables="filter nat raw mangle";counter="0"; for i in $tables; do
add=`iptables -t $i -L -n --line-numbers |egrep "^[0-9]+\ " |wc -l`;
counter=`expr $counter + $add`;done ;echo $counter

You dont need to read the proc file system to know that there are only
four tables exits in iptables.

That is not true.
There also is the security table.
And if you have xtables-addons installed, there might also be the rawpost table.
But any of those might not be loaded, if compiled in as loadable module.
So you might need to read /proc/net/ip_tables_names to work only on existing tables, without loading unwanted/needed ones.

[...]
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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