patch-2.4.27 linux-2.4.27/net/ipv4/netfilter/ip_tables.c
Next file: linux-2.4.27/net/ipv4/netfilter/ipt_MASQUERADE.c
Previous file: linux-2.4.27/net/ipv4/netfilter/ip_nat_rule.c
Back to the patch index
Back to the overall index
- Lines: 117
- Date:
2004-08-07 16:26:06.992442846 -0700
- Orig file:
linux-2.4.26/net/ipv4/netfilter/ip_tables.c
- Orig date:
2004-02-18 05:36:32.000000000 -0800
diff -urN linux-2.4.26/net/ipv4/netfilter/ip_tables.c linux-2.4.27/net/ipv4/netfilter/ip_tables.c
@@ -53,9 +53,6 @@
#endif
#define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1))
-/* Mutex protects lists (only traversed in user context). */
-static DECLARE_MUTEX(ipt_mutex);
-
/* Must have mutex */
#define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0)
#define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0)
@@ -418,7 +415,7 @@
{
void *ret;
-#if 0
+#if 0
duprintf("find_inlist: searching for `%s' in %s.\n",
name, head == &ipt_target ? "ipt_target"
: head == &ipt_match ? "ipt_match"
@@ -464,7 +461,7 @@
#endif
static inline struct ipt_table *
-find_table_lock(const char *name, int *error, struct semaphore *mutex)
+ipt_find_table_lock(const char *name, int *error, struct semaphore *mutex)
{
return find_inlist_lock(&ipt_tables, name, "iptable_", error, mutex);
}
@@ -475,8 +472,8 @@
return find_inlist_lock(&ipt_match, name, "ipt_", error, mutex);
}
-static inline struct ipt_target *
-find_target_lock(const char *name, int *error, struct semaphore *mutex)
+struct ipt_target *
+ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex)
{
return find_inlist_lock(&ipt_target, name, "ipt_", error, mutex);
}
@@ -693,7 +690,7 @@
goto cleanup_matches;
t = ipt_get_target(e);
- target = find_target_lock(t->u.user.name, &ret, &ipt_mutex);
+ target = ipt_find_target_lock(t->u.user.name, &ret, &ipt_mutex);
if (!target) {
duprintf("check_entry: `%s' not found\n", t->u.user.name);
goto cleanup_matches;
@@ -1030,7 +1027,7 @@
int ret;
struct ipt_table *t;
- t = find_table_lock(entries->name, &ret, &ipt_mutex);
+ t = ipt_find_table_lock(entries->name, &ret, &ipt_mutex);
if (t) {
duprintf("t->private->number = %u\n",
t->private->number);
@@ -1097,7 +1094,7 @@
duprintf("ip_tables: Translated table\n");
- t = find_table_lock(tmp.name, &ret, &ipt_mutex);
+ t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex);
if (!t)
goto free_newinfo_counters_untrans;
@@ -1191,7 +1188,7 @@
goto free;
}
- t = find_table_lock(tmp.name, &ret, &ipt_mutex);
+ t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex);
if (!t)
goto free;
@@ -1266,7 +1263,7 @@
break;
}
name[IPT_TABLE_MAXNAMELEN-1] = '\0';
- t = find_table_lock(name, &ret, &ipt_mutex);
+ t = ipt_find_table_lock(name, &ret, &ipt_mutex);
if (t) {
struct ipt_getinfo info;
@@ -1717,6 +1714,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;
@@ -1743,7 +1749,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);
@@ -1838,6 +1844,7 @@
EXPORT_SYMBOL(ipt_do_table);
EXPORT_SYMBOL(ipt_register_target);
EXPORT_SYMBOL(ipt_unregister_target);
+EXPORT_SYMBOL(ipt_find_target_lock);
module_init(init);
module_exit(fini);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)