summaryrefslogtreecommitdiffstats
path: root/kernel/ip_set.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>2008-11-15 20:20:09 +0000
committer/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>2008-11-15 20:20:09 +0000
commit6a5878a3748d84d95e15b9a8b018e1bfc54fc894 (patch)
tree1c5131e29dd469a07090277c82ebb582fb3aa9fa /kernel/ip_set.c
parent4eec8b3824d49c1c0503ebbf7844a4e312bc29e1 (diff)
2.4.5origin
- setlist type does not work properly together with swapping sets, bug reported by Thomas Jacob. - Include linux/capability.h explicitly in ip_set.c (Jan Engelhardt)
Diffstat (limited to 'kernel/ip_set.c')
-rw-r--r--kernel/ip_set.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/kernel/ip_set.c b/kernel/ip_set.c
index c4fcc69..f60a63e 100644
--- a/kernel/ip_set.c
+++ b/kernel/ip_set.c
@@ -21,6 +21,7 @@
#include <linux/random.h>
#include <linux/jhash.h>
#include <linux/errno.h>
+#include <linux/capability.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
@@ -378,7 +379,7 @@ __ip_set_get_byname(const char *name, struct ip_set **set)
return index;
}
-void __ip_set_put_byid(ip_set_id_t index)
+void __ip_set_put_byindex(ip_set_id_t index)
{
if (ip_set_list[index])
__ip_set_put(index);
@@ -434,11 +435,25 @@ ip_set_get_byindex(ip_set_id_t index)
}
/*
+ * Find the set id belonging to the index.
+ * We are protected by the mutex, so we do not need to use
+ * ip_set_lock. There is no need to reference the sets either.
+ */
+ip_set_id_t
+ip_set_id(ip_set_id_t index)
+{
+ if (index >= ip_set_max || !ip_set_list[index])
+ return IP_SET_INVALID_ID;
+
+ return ip_set_list[index]->id;
+}
+
+/*
* If the given set pointer points to a valid set, decrement
* reference count by 1. The caller shall not assume the index
* to be valid, after calling this function.
*/
-void ip_set_put(ip_set_id_t index)
+void ip_set_put_byindex(ip_set_id_t index)
{
down(&ip_set_app_mutex);
if (ip_set_list[index])
@@ -2037,9 +2052,10 @@ EXPORT_SYMBOL(ip_set_unregister_set_type);
EXPORT_SYMBOL(ip_set_get_byname);
EXPORT_SYMBOL(ip_set_get_byindex);
-EXPORT_SYMBOL(ip_set_put);
+EXPORT_SYMBOL(ip_set_put_byindex);
+EXPORT_SYMBOL(ip_set_id);
EXPORT_SYMBOL(__ip_set_get_byname);
-EXPORT_SYMBOL(__ip_set_put_byid);
+EXPORT_SYMBOL(__ip_set_put_byindex);
EXPORT_SYMBOL(ip_set_addip_kernel);
EXPORT_SYMBOL(ip_set_delip_kernel);