: skip internal targets in iptables proc listing
Subsystems (2)
PATCH 4/14 : skip internal targets in iptables proc listing
This patch for 2.6 changes iptables to skip the standard and error target in /proc/net/ip_tables_targets. Before they would show up as an empty line, followed by "ERROR".
Author: Patrick McHardy <[email protected]>
--
- Harald Welte <[email protected]> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/20 22:31:11+02:00 [email protected]
# [NETFILTER]: skip internal targets in iptables proc listing
#
# net/ipv6/netfilter/ip6_tables.c # 2004/06/20 22:31:01+02:00 [email protected] +10 -1 # [NETFILTER]: skip internal targets in iptables proc listing # # net/ipv4/netfilter/ip_tables.c # 2004/06/20 22:31:01+02:00 [email protected] +10 -1 # [NETFILTER]: skip internal targets in iptables proc listing # diff -Nru a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c --- a/net/ipv4/netfilter/ip_tables.c 2004-06-20 22:59:51 +02:00 +++ b/net/ipv4/netfilter/ip_tables.c 2004-06-20 22:59:51 +02:00 @@ -1731,6 +1731,15 @@ return 0; }
+static inline int print_target(const struct ipt_target *t,
+ off_t start_offset, char *buffer, int length,
+ off_t *pos, unsigned int *count)
+{
+ if (t == &ipt_standard_target || t == &ipt_error_target)
+ return 0;
+ return print_name((char *)t, start_offset, buffer, length, pos, count);
+}
+
static int ipt_get_tables(char *buffer, char **start, off_t offset, int length) {
off_t pos = 0;
@@ -1757,7 +1766,7 @@
if (down_interruptible(&ipt_mutex) != 0)
return 0;
- LIST_FIND(&ipt_target, print_name, void *,
+ LIST_FIND(&ipt_target, print_target, struct ipt_target *,
offset, buffer, length, &pos, &count);
up(&ipt_mutex);
net/ipv6/netfilter/ip6_tables.c +10 -1
@@ -1845,6 +1845,15 @@return 0 ; } +static inline int print_target (const struct ip6t_target *t, +off_t start_offset,char *buffer,int length, +off_t *pos,unsigned int *count) +{ +if (t == &ip6t_standard_target || t == &ip6t_error_target) +return 0 ; +return print_name ((char *)t, start_offset, buffer, length, pos, count); +} +static int ip6t_get_tables (char *buffer,char **start,off_t offset,int length) {off_t pos =0 ;
@@ -1871,7 +1880,7 @@if (down_interruptible (&ip6t_mutex) !=0 )return 0 ; - LIST_FIND(&ip6t_target, print_name, char *, + LIST_FIND(&ip6t_target, print_target, struct ip6t_target *, offset, buffer, length, &pos, &count);up (&ip6t_mutex);