SOURCES (LINUX_2_6): kernel-pom-ng-set.patch - updated to svn snapshot 2008...
zbyniu
zbyniu at pld-linux.org
Tue Jul 8 18:23:34 CEST 2008
Author: zbyniu Date: Tue Jul 8 16:23:34 2008 GMT
Module: SOURCES Tag: LINUX_2_6
---- Log message:
- updated to svn snapshot 20080708
---- Files affected:
SOURCES:
kernel-pom-ng-set.patch (1.1.2.10 -> 1.1.2.11)
---- Diffs:
================================================================
Index: SOURCES/kernel-pom-ng-set.patch
diff -u SOURCES/kernel-pom-ng-set.patch:1.1.2.10 SOURCES/kernel-pom-ng-set.patch:1.1.2.11
--- SOURCES/kernel-pom-ng-set.patch:1.1.2.10 Fri Jan 18 23:17:45 2008
+++ SOURCES/kernel-pom-ng-set.patch Tue Jul 8 18:23:29 2008
@@ -1,6 +1,6 @@
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set.h linux-2.6/include/linux/netfilter_ipv4/ip_set.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set.h 2005-10-13 10:53:58.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set.h linux-2.6/include/linux/netfilter_ipv4/ip_set.h
+--- a/include/linux/netfilter_ipv4/ip_set.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,498 @@
+#ifndef _IP_SET_H
+#define _IP_SET_H
@@ -500,9 +500,9 @@
+#endif /* __KERNEL__ */
+
+#endif /*_IP_SET_H*/
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_iphash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iphash.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_iphash.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iphash.h 2006-05-08 11:52:48.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_iphash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iphash.h
+--- a/include/linux/netfilter_ipv4/ip_set_iphash.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iphash.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,30 @@
+#ifndef __IP_SET_IPHASH_H
+#define __IP_SET_IPHASH_H
@@ -534,9 +534,9 @@
+};
+
+#endif /* __IP_SET_IPHASH_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_ipmap.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_ipmap.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_ipmap.h 2005-09-30 18:44:08.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_ipmap.h
+--- a/include/linux/netfilter_ipv4/ip_set_ipmap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_ipmap.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,56 @@
+#ifndef __IP_SET_IPMAP_H
+#define __IP_SET_IPMAP_H
@@ -594,9 +594,9 @@
+}
+
+#endif /* __IP_SET_IPMAP_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_ipporthash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_ipporthash.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_ipporthash.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_ipporthash.h 2006-05-08 11:52:48.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_ipporthash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_ipporthash.h
+--- a/include/linux/netfilter_ipv4/ip_set_ipporthash.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_ipporthash.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,34 @@
+#ifndef __IP_SET_IPPORTHASH_H
+#define __IP_SET_IPPORTHASH_H
@@ -632,9 +632,9 @@
+};
+
+#endif /* __IP_SET_IPPORTHASH_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_iptree.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iptree.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_iptree.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iptree.h 2006-05-08 11:52:48.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_iptree.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iptree.h
+--- a/include/linux/netfilter_ipv4/ip_set_iptree.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iptree.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,40 @@
+#ifndef __IP_SET_IPTREE_H
+#define __IP_SET_IPTREE_H
@@ -676,9 +676,9 @@
+};
+
+#endif /* __IP_SET_IPTREE_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_iptreemap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iptreemap.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_iptreemap.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iptreemap.h 2007-08-28 13:29:12.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_iptreemap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iptreemap.h
+--- a/include/linux/netfilter_ipv4/ip_set_iptreemap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iptreemap.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,40 @@
+#ifndef __IP_SET_IPTREEMAP_H
+#define __IP_SET_IPTREEMAP_H
@@ -720,9 +720,9 @@
+};
+
+#endif /* __IP_SET_IPTREEMAP_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_jhash.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_jhash.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_jhash.h 2004-12-01 10:49:36.000000000 +0100
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_jhash.h
+--- a/include/linux/netfilter_ipv4/ip_set_jhash.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_jhash.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,148 @@
+#ifndef _LINUX_IPSET_JHASH_H
+#define _LINUX_IPSET_JHASH_H
@@ -872,9 +872,9 @@
+}
+
+#endif /* _LINUX_IPSET_JHASH_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_macipmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_macipmap.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_macipmap.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_macipmap.h 2004-12-01 10:49:36.000000000 +0100
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_macipmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_macipmap.h
+--- a/include/linux/netfilter_ipv4/ip_set_macipmap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_macipmap.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,38 @@
+#ifndef __IP_SET_MACIPMAP_H
+#define __IP_SET_MACIPMAP_H
@@ -914,39 +914,34 @@
+};
+
+#endif /* __IP_SET_MACIPMAP_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_malloc.h linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_malloc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h 2005-10-13 10:53:58.000000000 +0200
-@@ -0,0 +1,116 @@
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_malloc.h linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h
+--- a/include/linux/netfilter_ipv4/ip_set_malloc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h 2008-07-08 16:52:53.465235839 +0200
+@@ -0,0 +1,143 @@
+#ifndef _IP_SET_MALLOC_H
+#define _IP_SET_MALLOC_H
+
+#ifdef __KERNEL__
+
-+/* Memory allocation and deallocation */
-+static size_t max_malloc_size = 0;
++static size_t max_malloc_size = 0, max_page_size = 0;
+
-+static inline void init_max_malloc_size(void)
++static inline bool init_max_page_size(void)
+{
-+#define CACHE(x) max_malloc_size = x;
++ size_t page_size = 0;
++
++#define CACHE(x) if (max_page_size == 0 || x < max_page_size) \
++ page_size = x;
+#include <linux/kmalloc_sizes.h>
+#undef CACHE
-+}
++ if (page_size) {
++ if (max_malloc_size == 0)
++ max_malloc_size = page_size;
+
-+static inline void * ip_set_malloc(size_t bytes)
-+{
-+ if (bytes > max_malloc_size)
-+ return vmalloc(bytes);
-+ else
-+ return kmalloc(bytes, GFP_KERNEL);
-+}
++ max_page_size = page_size;
+
-+static inline void ip_set_free(void * data, size_t bytes)
-+{
-+ if (bytes > max_malloc_size)
-+ vfree(data);
-+ else
-+ kfree(data);
++ return 1;
++ }
++ return 0;
+}
+
+struct harray {
@@ -955,18 +950,17 @@
+};
+
+static inline void *
-+harray_malloc(size_t hashsize, size_t typesize, int flags)
++__harray_malloc(size_t hashsize, size_t typesize, int flags)
+{
+ struct harray *harray;
+ size_t max_elements, size, i, j;
+
-+ if (!max_malloc_size)
-+ init_max_malloc_size();
++ BUG_ON(max_page_size == 0);
+
-+ if (typesize > max_malloc_size)
++ if (typesize > max_page_size)
+ return NULL;
+
-+ max_elements = max_malloc_size/typesize;
++ max_elements = max_page_size/typesize;
+ size = hashsize/max_elements;
+ if (hashsize % max_elements)
+ size++;
@@ -1003,6 +997,18 @@
+ return NULL;
+}
+
++static inline void *
++harray_malloc(size_t hashsize, size_t typesize, int flags)
++{
++ void *harray;
++
++ do {
++ harray = __harray_malloc(hashsize, typesize, flags|__GFP_NOWARN);
++ } while (harray == NULL && init_max_page_size());
++
++ return harray;
++}
++
+static inline void harray_free(void *h)
+{
+ struct harray *harray = (struct harray *) h;
@@ -1031,12 +1037,33 @@
+ + (which)%(__h)->max_elements); \
+})
+
++/* General memory allocation and deallocation */
++static inline void * ip_set_malloc(size_t bytes)
++{
++ BUG_ON(max_malloc_size == 0);
++
++ if (bytes > max_malloc_size)
++ return vmalloc(bytes);
++ else
++ return kmalloc(bytes, GFP_KERNEL | __GFP_NOWARN);
++}
++
++static inline void ip_set_free(void * data, size_t bytes)
++{
++ BUG_ON(max_malloc_size == 0);
++
++ if (bytes > max_malloc_size)
++ vfree(data);
++ else
++ kfree(data);
++}
++
+#endif /* __KERNEL__ */
+
+#endif /*_IP_SET_MALLOC_H*/
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_nethash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_nethash.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_nethash.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_nethash.h 2006-05-08 11:52:48.000000000 +0200
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_nethash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_nethash.h
+--- a/include/linux/netfilter_ipv4/ip_set_nethash.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_nethash.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,55 @@
+#ifndef __IP_SET_NETHASH_H
+#define __IP_SET_NETHASH_H
@@ -1093,9 +1120,9 @@
+}
+
+#endif /* __IP_SET_NETHASH_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_portmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_portmap.h
---- linux-2.6./include/linux/netfilter_ipv4/ip_set_portmap.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ip_set_portmap.h 2004-12-01 10:49:36.000000000 +0100
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ip_set_portmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_portmap.h
+--- a/include/linux/netfilter_ipv4/ip_set_portmap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_portmap.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,25 @@
+#ifndef __IP_SET_PORTMAP_H
+#define __IP_SET_PORTMAP_H
@@ -1122,9 +1149,9 @@
+};
+
+#endif /* __IP_SET_PORTMAP_H */
-diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ipt_set.h linux-2.6/include/linux/netfilter_ipv4/ipt_set.h
---- linux-2.6./include/linux/netfilter_ipv4/ipt_set.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/include/linux/netfilter_ipv4/ipt_set.h 2004-12-06 10:32:59.000000000 +0100
+diff -uNrp --exclude=.svn a/include/linux/netfilter_ipv4/ipt_set.h linux-2.6/include/linux/netfilter_ipv4/ipt_set.h
+--- a/include/linux/netfilter_ipv4/ipt_set.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ipt_set.h 2008-07-08 16:52:53.465235839 +0200
@@ -0,0 +1,21 @@
+#ifndef _IPT_SET_H
+#define _IPT_SET_H
@@ -1147,17 +1174,17 @@
+};
+
+#endif /*_IPT_SET_H*/
-diff -uNrp linux-2.6./net/ipv4/netfilter/ip_set.c linux-2.6/net/ipv4/netfilter/ip_set.c
---- linux-2.6./net/ipv4/netfilter/ip_set.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6/net/ipv4/netfilter/ip_set.c 2007-08-28 13:29:12.000000000 +0200
-@@ -0,0 +1,2001 @@
+diff -uNrp --exclude=.svn a/net/ipv4/netfilter/ip_set.c linux-2.6/net/ipv4/netfilter/ip_set.c
+--- a/net/ipv4/netfilter/ip_set.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/net/ipv4/netfilter/ip_set.c 2008-07-08 16:52:53.965201208 +0200
+@@ -0,0 +1,1981 @@
+/* Copyright (C) 2000-2002 Joakim Axelsson <gozem at linux.nu>
+ * Patrick Schaaf <bof at bof.de>
+ * Copyright (C) 2003-2004 Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
++ * published by the Free Software Foundation.
+ */
+
+/* Kernel module for IP set management */
@@ -1194,14 +1221,16 @@
+static struct list_head *ip_set_hash; /* hash of bindings */
+static unsigned int ip_set_hash_random; /* random seed */
+
++#define SETNAME_EQ(a,b) (strncmp(a,b,IP_SET_MAXNAMELEN) == 0)
++
+/*
+ * Sets are identified either by the index in ip_set_list or by id.
-+ * The id never changes and is used to find a key in the hash.
-+ * The index may change by swapping and used at all other places
++ * The id never changes and is used to find a key in the hash.
++ * The index may change by swapping and used at all other places
+ * (set/SET netfilter modules, binding value, etc.)
+ *
+ * Userspace requests are serialized by ip_set_mutex and sets can
-+ * be deleted only from userspace. Therefore ip_set_list locking
++ * be deleted only from userspace. Therefore ip_set_list locking
+ * must obey the following rules:
+ *
+ * - kernel requests: read and write locking mandatory
@@ -1239,7 +1268,7 @@
+static ip_set_id_t
+ip_set_find_in_hash(ip_set_id_t id, ip_set_ip_t ip)
+{
-+ u_int32_t key = jhash_2words(id, ip, ip_set_hash_random)
++ u_int32_t key = jhash_2words(id, ip, ip_set_hash_random)
+ % ip_set_bindings_hash_size;
+ struct ip_set_hash *set_hash;
+
@@ -1249,14 +1278,14 @@
+
+ set_hash = __ip_set_find(key, id, ip);
+
-+ DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
++ DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
+ HIPQUAD(ip),
+ set_hash != NULL ? ip_set_list[set_hash->binding]->name : "");
+
+ return (set_hash != NULL ? set_hash->binding : IP_SET_INVALID_ID);
+}
+
-+static inline void
++static inline void
+__set_hash_del(struct ip_set_hash *set_hash)
+{
+ ASSERT_WRITE_LOCK(&ip_set_lock);
@@ -1288,7 +1317,7 @@
+ return 0;
+}
+
-+static int
++static int
+ip_set_hash_add(ip_set_id_t id, ip_set_ip_t ip, ip_set_id_t binding)
+{
+ u_int32_t key = jhash_2words(id, ip, ip_set_hash_random)
@@ -1298,7 +1327,7 @@
+
+ IP_SET_ASSERT(ip_set_list[id]);
+ IP_SET_ASSERT(ip_set_list[binding]);
-+ DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
++ DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
+ HIPQUAD(ip), ip_set_list[binding]->name);
+ write_lock_bh(&ip_set_lock);
+ set_hash = __ip_set_find(key, id, ip);
@@ -1377,8 +1406,8 @@
+ res = set->type->testip_kernel(set, skb, &ip, flags, i++);
+ read_unlock_bh(&set->lock);
+ i += !!(set->type->features & IPSET_DATA_DOUBLE);
-+ } while (res > 0
-+ && flags[i]
++ } while (res > 0
++ && flags[i]
+ && follow_bindings(index, set, ip));
+ read_unlock_bh(&ip_set_lock);
+
@@ -1407,7 +1436,7 @@
+ write_unlock_bh(&set->lock);
+ i += !!(set->type->features & IPSET_DATA_DOUBLE);
+ } while ((res == 0 || res == -EEXIST)
-+ && flags[i]
++ && flags[i]
+ && follow_bindings(index, set, ip));
+ read_unlock_bh(&ip_set_lock);
+
@@ -1438,7 +1467,7 @@
+ write_unlock_bh(&set->lock);
+ i += !!(set->type->features & IPSET_DATA_DOUBLE);
+ } while ((res == 0 || res == -EEXIST)
-+ && flags[i]
++ && flags[i]
+ && follow_bindings(index, set, ip));
+ read_unlock_bh(&ip_set_lock);
+}
@@ -1456,7 +1485,7 @@
+ return NULL;
+}
+
-+int
++int
+ip_set_register_set_type(struct ip_set_type *set_type)
+{
+ int ret = 0;
@@ -1472,7 +1501,7 @@
+ write_lock_bh(&ip_set_lock);
+ if (find_set_type(set_type->typename)) {
+ /* Duplicate! */
-+ ip_set_printk("'%s' already registered!",
++ ip_set_printk("'%s' already registered!",
+ set_type->typename);
+ ret = -EINVAL;
+ goto unlock;
@@ -1522,7 +1551,7 @@
+ down(&ip_set_app_mutex);
+ for (i = 0; i < ip_set_max; i++) {
+ if (ip_set_list[i] != NULL
-+ && strcmp(ip_set_list[i]->name, name) == 0) {
++ && SETNAME_EQ(ip_set_list[i]->name, name)) {
+ __ip_set_get(i);
+ index = i;
+ break;
@@ -1575,7 +1604,7 @@
+
+ for (i = 0; i < ip_set_max; i++) {
+ if (ip_set_list[i] != NULL
-+ && strcmp(ip_set_list[i]->name, name) == 0) {
++ && SETNAME_EQ(ip_set_list[i]->name, name)) {
+ index = i;
+ break;
+ }
@@ -1687,7 +1716,7 @@
+ size_t size)
+{
+ struct ip_set *set = ip_set_list[index];
-+ struct ip_set_req_bind *req_bind;
++ const struct ip_set_req_bind *req_bind;
+ ip_set_id_t binding;
+ ip_set_ip_t ip;
+ int res;
@@ -1696,18 +1725,16 @@
+ if (size < sizeof(struct ip_set_req_bind))
+ return -EINVAL;
+
-+ req_bind = (struct ip_set_req_bind *) data;
-+ req_bind->binding[IP_SET_MAXNAMELEN - 1] = '\0';
++ req_bind = data;
+
-+ if (strcmp(req_bind->binding, IPSET_TOKEN_DEFAULT) == 0) {
++ if (SETNAME_EQ(req_bind->binding, IPSET_TOKEN_DEFAULT)) {
+ /* Default binding of a set */
-+ char *binding_name;
++ const char *binding_name;
+
+ if (size != sizeof(struct ip_set_req_bind) + IP_SET_MAXNAMELEN)
+ return -EINVAL;
+
-+ binding_name = (char *)(data + sizeof(struct ip_set_req_bind));
-+ binding_name[IP_SET_MAXNAMELEN - 1] = '\0';
++ binding_name = data + sizeof(struct ip_set_req_bind);
+
+ binding = ip_set_find_byname(binding_name);
+ if (binding == IP_SET_INVALID_ID)
@@ -1775,7 +1802,7 @@
+ size_t size)
+{
+ struct ip_set *set;
-+ struct ip_set_req_bind *req_bind;
++ const struct ip_set_req_bind *req_bind;
+ ip_set_ip_t ip;
+ int res;
+
@@ -1783,19 +1810,18 @@
+ if (size < sizeof(struct ip_set_req_bind))
+ return -EINVAL;
+
-+ req_bind = (struct ip_set_req_bind *) data;
-+ req_bind->binding[IP_SET_MAXNAMELEN - 1] = '\0';
++ req_bind = data;
+
+ DP("%u %s", index, req_bind->binding);
+ if (index == IP_SET_INVALID_ID) {
+ /* unbind :all: */
-+ if (strcmp(req_bind->binding, IPSET_TOKEN_DEFAULT) == 0) {
++ if (SETNAME_EQ(req_bind->binding, IPSET_TOKEN_DEFAULT)) {
+ /* Default binding of sets */
+ write_lock_bh(&ip_set_lock);
+ FOREACH_SET_DO(__unbind_default);
+ write_unlock_bh(&ip_set_lock);
+ return 0;
-+ } else if (strcmp(req_bind->binding, IPSET_TOKEN_ALL) == 0) {
++ } else if (SETNAME_EQ(req_bind->binding, IPSET_TOKEN_ALL)) {
+ /* Flush all bindings of all sets*/
+ write_lock_bh(&ip_set_lock);
+ FOREACH_HASH_RW_DO(__set_hash_del);
@@ -1808,7 +1834,7 @@
+
+ set = ip_set_list[index];
+ IP_SET_ASSERT(set);
-+ if (strcmp(req_bind->binding, IPSET_TOKEN_DEFAULT) == 0) {
++ if (SETNAME_EQ(req_bind->binding, IPSET_TOKEN_DEFAULT)) {
+ /* Default binding of set */
+ ip_set_id_t binding = ip_set_find_byindex(set->binding);
+
@@ -1822,7 +1848,7 @@
+ write_unlock_bh(&ip_set_lock);
+
+ return 0;
-+ } else if (strcmp(req_bind->binding, IPSET_TOKEN_ALL) == 0) {
++ } else if (SETNAME_EQ(req_bind->binding, IPSET_TOKEN_ALL)) {
+ /* Flush all bindings */
+
+ write_lock_bh(&ip_set_lock);
@@ -1849,7 +1875,7 @@
+ size_t size)
+{
+ struct ip_set *set = ip_set_list[index];
-+ struct ip_set_req_bind *req_bind;
++ const struct ip_set_req_bind *req_bind;
+ ip_set_id_t binding;
+ ip_set_ip_t ip;
+ int res;
@@ -1858,18 +1884,16 @@
+ if (size < sizeof(struct ip_set_req_bind))
+ return -EINVAL;
+
-+ req_bind = (struct ip_set_req_bind *) data;
-+ req_bind->binding[IP_SET_MAXNAMELEN - 1] = '\0';
++ req_bind = data;
+
-+ if (strcmp(req_bind->binding, IPSET_TOKEN_DEFAULT) == 0) {
++ if (SETNAME_EQ(req_bind->binding, IPSET_TOKEN_DEFAULT)) {
+ /* Default binding of set */
-+ char *binding_name;
++ const char *binding_name;
+
+ if (size != sizeof(struct ip_set_req_bind) + IP_SET_MAXNAMELEN)
+ return -EINVAL;
+
-+ binding_name = (char *)(data + sizeof(struct ip_set_req_bind));
-+ binding_name[IP_SET_MAXNAMELEN - 1] = '\0';
++ binding_name = data + sizeof(struct ip_set_req_bind);
+
+ binding = ip_set_find_byname(binding_name);
+ if (binding == IP_SET_INVALID_ID)
@@ -1890,7 +1914,7 @@
+ &ip);
+ DP("set %s, ip: %u.%u.%u.%u, binding %s",
+ set->name, HIPQUAD(ip), ip_set_list[binding]->name);
-+
++
+ if (res >= 0)
+ res = (ip_set_find_in_hash(set->id, ip) == binding)
+ ? -EEXIST : 0;
@@ -1923,7 +1947,7 @@
+ if (ip_set_list[i] == NULL) {
+ if (*id == IP_SET_INVALID_ID)
+ *id = *index = i;
-+ } else if (strcmp(name, ip_set_list[i]->name) == 0)
++ } else if (SETNAME_EQ(name, ip_set_list[i]->name))
+ /* Name clash */
+ return -EEXIST;
+ }
@@ -2011,7 +2035,7 @@
+
+ /*
+ * Here, we have a valid, constructed set. &ip_set_lock again,
-+ * find free id/index and check that it is not already in
++ * find free id/index and check that it is not already in
+ * ip_set_list.
+ */
+ write_lock_bh(&ip_set_lock);
@@ -2026,7 +2050,7 @@
+ res = -ERANGE;
+ goto cleanup;
+ }
-+
++
+ /*
+ * Finally! Add our shiny new set to the list, and be done.
+ */
@@ -2085,7 +2109,7 @@
+ ip_set_destroy_set(index);
+ } else {
+ for (i = 0; i < ip_set_max; i++) {
-+ if (ip_set_list[i] != NULL
++ if (ip_set_list[i] != NULL
+ && (atomic_read(&ip_set_list[i]->ref)))
+ return -EBUSY;
+ }
@@ -2108,7 +2132,7 @@
+ write_unlock_bh(&set->lock);
+}
+
-+/*
++/*
+ * Flush data in a set - or in all sets
+ */
+static int
@@ -2135,9 +2159,7 @@
+ write_lock_bh(&ip_set_lock);
+ for (i = 0; i < ip_set_max; i++) {
+ if (ip_set_list[i] != NULL
-+ && strncmp(ip_set_list[i]->name,
-+ name,
-+ IP_SET_MAXNAMELEN - 1) == 0) {
++ && SETNAME_EQ(ip_set_list[i]->name, name)) {
+ res = -EEXIST;
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/kernel-pom-ng-set.patch?r1=1.1.2.10&r2=1.1.2.11&f=u
More information about the pld-cvs-commit
mailing list