From 584e8d0604a55fcda68848bef82a2954d8af71f5 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sun, 24 Jan 2010 15:49:16 +0100 Subject: New version 4.2 released: 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. --- ipset_ipportnethash.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'ipset_ipportnethash.c') diff --git a/ipset_ipportnethash.c b/ipset_ipportnethash.c index 3485711..3a60bf1 100644 --- a/ipset_ipportnethash.c +++ b/ipset_ipportnethash.c @@ -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); } } -- cgit v1.2.3