]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
New version 4.2 released: v4.2
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sun, 24 Jan 2010 14:49:16 +0000 (15:49 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sun, 24 Jan 2010 14:49:16 +0000 (15:49 +0100)
kernel:
  - nethash and ipportnethash types counted every entry twice
    which could produce bogus entries when listing/saving these types
    of sets (bug reported by Husnu Demir)

userspace:
  - Checking null entries when listing/saving hash types of sets
    deleted because it's unnecessary and can mask possible errors.

ChangeLog
Makefile
ipset_iphash.c
ipset_ipporthash.c
ipset_ipportiphash.c
ipset_ipportnethash.c
ipset_nethash.c
kernel/ChangeLog
kernel/ip_set_ipportnethash.c
kernel/ip_set_nethash.c

index 13707ed2546f7f7bc2c16c1fdaf68aa139cfca49..354df0b8703fdf6eadb6f80cf9f437a799081acb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+4.2
+  - Checking null entries when listing/saving hash types of sets
+    deleted because it's unnecessary and can mask possible errors.
+
 4.1
   - Manpage fixes and corrections (Jan Engelhardt)
 
index b0f337efa3036b749bc2e8736daa88a162b7e7a2..bbec4493878e8c3708d9ec7b268f05cc84ea5b1c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ ifndef V
 V=0
 endif
 
-IPSET_VERSION:=4.1
+IPSET_VERSION:=4.2
 
 PREFIX:=/usr/local
 LIBDIR:=$(PREFIX)/lib
index b352df452284f8d0cb7a6b6d5559f651da23045e..0bc5bd186d5dc42e5304a7e9383b6c9146be8d31 100644 (file)
@@ -200,8 +200,7 @@ iphash_printips(struct set *set UNUSED, void *data, u_int32_t len,
 
        while (offset < len) {
                ip = data + offset;
-               if (*ip)
-                       printf("%s\n", ip_tostring(*ip, options));
+               printf("%s\n", ip_tostring(*ip, options));
                offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align);
        }
 }
@@ -230,9 +229,7 @@ iphash_saveips(struct set *set UNUSED, void *data, u_int32_t len,
 
        while (offset < len) {
                ip = data + offset;
-               if (*ip)
-                       printf("-A %s %s\n", set->name, 
-                              ip_tostring(*ip, options));
+               printf("-A %s %s\n", set->name, ip_tostring(*ip, options));
                offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align);
        }
 }
index ce783ee2bf9435cdb835da90a095daed340b5027..9249b2a925f79f1e81061a0f6f421b3a26abc5af 100644 (file)
@@ -259,13 +259,11 @@ ipporthash_printips(struct set *set, void *data, u_int32_t len,
 
        while (offset < len) {
                ipptr = data + offset;
-               if (*ipptr) {
-                       ip = (*ipptr>>16) + mysetdata->first_ip;
-                       port = (uint16_t) *ipptr;
-                       printf("%s,%s\n", 
-                              ip_tostring(ip, options),
-                              port_tostring(port, options));
-               }
+               ip = (*ipptr>>16) + mysetdata->first_ip;
+               port = (uint16_t) *ipptr;
+               printf("%s,%s\n", 
+                      ip_tostring(ip, options),
+                      port_tostring(port, options));
                offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align);
        }
 }
@@ -296,13 +294,11 @@ ipporthash_saveips(struct set *set, void *data, u_int32_t len,
 
        while (offset < len) {
                ipptr = data + offset;
-               if (*ipptr) {
-                       ip = (*ipptr>>16) + mysetdata->first_ip;
-                       port = (uint16_t) *ipptr;
-                       printf("-A %s %s,%s\n", set->name, 
-                              ip_tostring(ip, options),
-                              port_tostring(port, options));
-               }
+               ip = (*ipptr>>16) + mysetdata->first_ip;
+               port = (uint16_t) *ipptr;
+               printf("-A %s %s,%s\n", set->name, 
+                      ip_tostring(ip, options),
+                      port_tostring(port, options));
                offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align);
        }
 }
index 95cbcfd6286b3deddea5a79d6ba2110cfb26ac41..49861bfbc4ccc0f8ca63cd573d8cd94ff1108475 100644 (file)
@@ -265,15 +265,13 @@ ipportiphash_printips(struct set *set, void *data, u_int32_t len,
 
        while (offset < len) {
                ipptr = data + offset;
-               if (ipptr->ip && ipptr->ip1) {
-                       ip = (ipptr->ip>>16) + mysetdata->first_ip;
-                       port = (uint16_t) ipptr->ip;
-                       printf("%s,%s,", 
-                              ip_tostring(ip, options),
-                              port_tostring(port, options));
-                       printf("%s\n", 
-                              ip_tostring(ipptr->ip1, options));
-               }
+               ip = (ipptr->ip>>16) + mysetdata->first_ip;
+               port = (uint16_t) ipptr->ip;
+               printf("%s,%s,", 
+                      ip_tostring(ip, options),
+                      port_tostring(port, options));
+               printf("%s\n", 
+                      ip_tostring(ipptr->ip1, options));
                offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align);
        }
 }
@@ -305,15 +303,13 @@ ipportiphash_saveips(struct set *set, void *data, u_int32_t len,
 
        while (offset < len) {
                ipptr = data + offset;
-               if (ipptr->ip && ipptr->ip1) {
-                       ip = (ipptr->ip>>16) + mysetdata->first_ip;
-                       port = (uint16_t) ipptr->ip;
-                       printf("-A %s %s,%s,", set->name, 
-                              ip_tostring(ip, options),
-                              port_tostring(port, options));
-                       printf("%s\n",
-                              ip_tostring(ipptr->ip1, options));
-               }
+               ip = (ipptr->ip>>16) + mysetdata->first_ip;
+               port = (uint16_t) ipptr->ip;
+               printf("-A %s %s,%s,", set->name, 
+                      ip_tostring(ip, options),
+                      port_tostring(port, options));
+               printf("%s\n",
+                      ip_tostring(ipptr->ip1, options));
                offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align);
        }
 }
index 3485711429c98cbd4658912e8fe129b0f6593998..3a60bf1a9b50484ef1f9e329650cf6be72171376 100644 (file)
@@ -330,15 +330,13 @@ ipportnethash_printips(struct set *set, void *data, u_int32_t len,
 
        while (offset < len) {
                ipptr = data + offset;
-               if (ipptr->ip || ipptr->ip1) {
-                       ip = (ipptr->ip>>16) + mysetdata->first_ip;
-                       port = (uint16_t) ipptr->ip;
-                       printf("%s,%s,", 
-                              ip_tostring(ip, options),
-                              port_tostring(port, options));
-                       printf("%s\n", 
-                              unpack_ip_tostring(ipptr->ip1, options));
-               }
+               ip = (ipptr->ip>>16) + mysetdata->first_ip;
+               port = (uint16_t) ipptr->ip;
+               printf("%s,%s,", 
+                      ip_tostring(ip, options),
+                      port_tostring(port, options));
+               printf("%s\n", 
+                      unpack_ip_tostring(ipptr->ip1, options));
                offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align);
        }
 }
@@ -370,15 +368,13 @@ ipportnethash_saveips(struct set *set, void *data, u_int32_t len,
 
        while (offset < len) {
                ipptr = data + offset;
-               if (ipptr) {
-                       ip = (ipptr->ip>>16) + mysetdata->first_ip;
-                       port = (uint16_t) ipptr->ip;
-                       printf("-A %s %s,%s,", set->name, 
-                              ip_tostring(ip, options),
-                              port_tostring(port, options));
-                       printf("%s\n",
-                              unpack_ip_tostring(ipptr->ip, options));
-               }
+               ip = (ipptr->ip>>16) + mysetdata->first_ip;
+               port = (uint16_t) ipptr->ip;
+               printf("-A %s %s,%s,", set->name, 
+                      ip_tostring(ip, options),
+                      port_tostring(port, options));
+               printf("%s\n",
+                      unpack_ip_tostring(ipptr->ip, options));
                offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align);
        }
 }
index 50ca1bda933c457c4734e656ac251ccbba38a84c..c7891cf645e88bb877c176dc36db17c7bfc17fa9 100644 (file)
@@ -232,8 +232,7 @@ nethash_printips(struct set *set UNUSED, void *data, u_int32_t len,
 
        while (offset < len) {
                ip = data + offset;
-               if (*ip)
-                       printf("%s\n", unpack_ip_tostring(*ip, options));
+               printf("%s\n", unpack_ip_tostring(*ip, options));
                offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align);
        }
 }
@@ -258,9 +257,8 @@ nethash_saveips(struct set *set UNUSED, void *data, u_int32_t len,
 
        while (offset < len) {
                ip = data + offset;
-               if (*ip)
-                       printf("-A %s %s\n", set->name, 
-                              unpack_ip_tostring(*ip, options));
+               printf("-A %s %s\n", set->name,
+                      unpack_ip_tostring(*ip, options));
                offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align);
        }
 }
index f613c947a5a4fcf7302b0961963cf967dd18dad0..1ad54cdca6e0bd7d6f1337e8aa3203fa87e9be0c 100644 (file)
@@ -1,3 +1,8 @@
+4.2
+  - nethash and ipportnethash types counted every entry twice
+    which could produce bogus entries when listing/saving these types
+    of sets (bug reported by Husnu Demir)
+
 4.1
   - Do not use init_MUTEX either (Jan Engelhardt)
   - Improve listing/saving hash type of sets by not copying empty
index f32897275e379261701da5e6dd11eed67510ffcd..e0bb352942ad36bec2603294be6b5443b7c5096a 100644 (file)
@@ -185,7 +185,6 @@ ipportnethash_add(struct ip_set *set,
        if (ret == 0) {
                if (!map->nets[cidr-1]++)
                        add_cidr_size(map->cidr, cidr);
-               map->elements++;
        }
        return ret;
 }
index bf87f5c2c8351c640e3256448f284d32a060b8e9..e3b09e0cc52c37ed953faaa6271f0c30431e700c 100644 (file)
@@ -136,7 +136,6 @@ nethash_add(struct ip_set *set, ip_set_ip_t ip, uint8_t cidr)
        if (ret == 0) {
                if (!map->nets[cidr-1]++)
                        add_cidr_size(map->cidr, cidr);
-               map->elements++;
        }
        
        return ret;